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:
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:
|
||||
|
||||
Reference in new issue
Block a user