adjust dashboard

This commit is contained in:
Emily
2024-11-13 15:44:20 +01:00
parent 2929b229c4
commit 9de299d841
19 changed files with 254 additions and 65 deletions

View File

@@ -8,9 +8,16 @@ export default defineEventHandler(async event => {
if (!userData?.logged) return;
if (!userData.user.roles.includes('ADMIN')) return;
const { from } = getQuery(event);
const projectsCount = await ProjectModel.countDocuments({});
const usersCount = await UserModel.countDocuments({});
const date = new Date(parseInt(from as any));
const projectsCount = await ProjectModel.countDocuments({
created_at: { $gte: date }
});
const usersCount = await UserModel.countDocuments({
created_at: { $gte: date }
});
return { users: usersCount, projects: projectsCount }