Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/controllers/admin/adminController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const getAllWorkspacesWithSpaces = async (req: CustomRequest, res: Respon
throw new CustomError("Unauthorized access", 401);
}

const { page = 1, limit = 10 } = req.query;
const { page = 1, limit = 12 } = req.query;

const skip = (Number(page) - 1) * Number(limit);

Expand All @@ -79,14 +79,13 @@ export const getAllWorkspacesWithSpaces = async (req: CustomRequest, res: Respon
},
]);

const total = workspacesWithSpaces[0]?.totalCount[0]?.count || 0;
const total = await Workspace.countDocuments();

res.status(200).json(
new StandardResponse("Workspaces with spaces retrieved successfully", {
data: workspacesWithSpaces[0]?.data || [],
total,
page: Number(page),
limit: Number(limit),
}),
);
};
Expand Down