Skip to content

Commit c645c0c

Browse files
fix: move null check before metadata parse in setDefaultConferencingApp (calcom#29457) (calcom#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 <pranavv00@users.noreply.github.com> Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
1 parent 07a288b commit c645c0c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

apps/api/v2/src/modules/teams/teams/teams.repository.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ export class TeamsRepository {
8989

9090
async setDefaultConferencingApp(teamId: number, appSlug?: string, appLink?: string) {
9191
const team = await this.getById(teamId);
92-
const teamMetadata = teamMetadataSchema.parse(team?.metadata);
9392

9493
if (!team) {
95-
throw new NotFoundException("user not found");
94+
throw new NotFoundException("team not found");
9695
}
9796

97+
const teamMetadata = teamMetadataSchema.parse(team.metadata);
98+
9899
return await this.dbWrite.prisma.team.update({
99100
data: {
100101
metadata:

0 commit comments

Comments
 (0)