From a9671eedf8d0fb5d0e30c10bc1c5cb89eb8dd1b6 Mon Sep 17 00:00:00 2001 From: Kishore <42832651+kishore03109@users.noreply.github.com> Date: Tue, 2 Jan 2024 18:09:46 +0800 Subject: [PATCH] feat(logging): adding logging (#1089) * feat(logging): adding logging * fix(collaborator): typo --- src/routes/v2/authenticated/collaborators.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/routes/v2/authenticated/collaborators.ts b/src/routes/v2/authenticated/collaborators.ts index 4d278ea33..bbecaf268 100644 --- a/src/routes/v2/authenticated/collaborators.ts +++ b/src/routes/v2/authenticated/collaborators.ts @@ -8,6 +8,7 @@ import { attachReadRouteHandlerWrapper } from "@middleware/routeHandler" import UserWithSiteSessionData from "@classes/UserWithSiteSessionData" import { BaseIsomerError } from "@root/errors/BaseError" +import logger from "@root/logger/logger" import { attachSiteHandler } from "@root/middleware" import { RequestHandler } from "@root/types" import { UserDto } from "@root/types/dto/review" @@ -42,6 +43,10 @@ export class CollaboratorsRouter { > = async (req, res) => { const { email, acknowledge = false } = req.body const { siteName } = req.params + const { userWithSiteSessionData } = res.locals + logger.info( + `Editing site members table by creating collaborator ${email} for site ${siteName} by user ${userWithSiteSessionData.isomerUserId}` + ) const resp = await this.collaboratorsService.create( siteName, email, @@ -63,6 +68,11 @@ export class CollaboratorsRouter { { userWithSiteSessionData: UserWithSiteSessionData } > = async (req, res) => { const { siteName, userId } = req.params + const { userWithSiteSessionData } = res.locals + logger.info( + `Editing site members table by deleting collaborator ${userId} for site ${siteName} by user ${userWithSiteSessionData.isomerUserId}` + ) + const resp = await this.collaboratorsService.delete(siteName, userId) // Check for error and throw