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 <pranavv00@users.noreply.github.com>
Co-authored-by: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-06-08 09:46:19 +00:00
1 parent 07a288bbd8
commit c645c0cbf7
1 file changed
+3 -2
@@ -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: