From c645c0cbf7376fc434c12ec69309e3aa13168af7 Mon Sep 17 00:00:00 2001 From: Pranavvv Date: Mon, 8 Jun 2026 15:16:19 +0530 Subject: [PATCH] fix: move null check before metadata parse in setDefaultConferencingApp (#29457) (#29466) teamMetadataSchema.parse(team?.metadata) was called before checking if team exists, causing a Zod validation error on undefined instead of the intended NotFoundException. Also corrected the misleading error message from 'user not found' to 'team not found'. Co-authored-by: Pranav Gawande Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com> --- apps/api/v2/src/modules/teams/teams/teams.repository.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/api/v2/src/modules/teams/teams/teams.repository.ts b/apps/api/v2/src/modules/teams/teams/teams.repository.ts index ad6a0b01d9..21752bce4c 100644 --- a/apps/api/v2/src/modules/teams/teams/teams.repository.ts +++ b/apps/api/v2/src/modules/teams/teams/teams.repository.ts @@ -89,12 +89,13 @@ export class TeamsRepository { async setDefaultConferencingApp(teamId: number, appSlug?: string, appLink?: string) { const team = await this.getById(teamId); - const teamMetadata = teamMetadataSchema.parse(team?.metadata); if (!team) { - throw new NotFoundException("user not found"); + throw new NotFoundException("team not found"); } + const teamMetadata = teamMetadataSchema.parse(team.metadata); + return await this.dbWrite.prisma.team.update({ data: { metadata: