mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
adjust dashboard
This commit is contained in:
@@ -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 }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user