bjarneo 0c86efd56c
refactor: use fastify vite for the dev server (#284)
* refactor: use fastify vite for the server

by doing this we do not need to have local hacks for the routes. No local proxy needed. Everything just works.

* fix: update the dockerfile build path

* fix: update package.json

* fix: fonts path
2024-03-11 13:43:20 +01:00

19 lines
601 B
JavaScript

import prisma from '../services/prisma.js';
async function statistics(fastify) {
fastify.get('/', async (_, reply) => {
const [totalSecretsCreated, activeSecrets, isPublicSecrets] = await Promise.all([
prisma.statistic.findMany(),
prisma.secret.count(),
prisma.secret.count({ where: { isPublic: true } }),
]);
const [total = { value: 0 }] = totalSecretsCreated;
const { value } = total;
return reply.code(200).send({ totalSecretsCreated: value, activeSecrets, isPublicSecrets });
});
}
export default statistics;