* 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
19 lines
601 B
JavaScript
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;
|