Merge branch 'activity-logs' of https://github.com/Infisical/infisical into activity-logs

This commit is contained in:
Tuan Dang
2023-01-03 08:19:43 +07:00
7 changed files with 286 additions and 100 deletions
@@ -41,10 +41,11 @@ export const getWorkspaceLogs = async (req: Request, res: Response) => {
let logs
try {
const { workspaceId } = req.params;
const { userId, actionNames } = req.query;
const offset: number = parseInt(req.query.offset as string);
const limit: number = parseInt(req.query.limit as string);
const userId: string = req.query.userId as string;
const actionNames: string = req.query.actionNames as string;
logs = await Log.find({
workspace: workspaceId,
@@ -53,11 +54,12 @@ export const getWorkspaceLogs = async (req: Request, res: Response) => {
actionNames
? {
actionNames: {
$in: actionNames
$in: actionNames.split(',')
}
} : {}
)
})
.sort({ createdAt: -1 })
.skip(offset)
.limit(limit)
.populate('actions')