From dd542e95f24876e2a66508fae0f1d237a32816b1 Mon Sep 17 00:00:00 2001 From: navneethkrish Date: Wed, 4 Dec 2024 10:27:36 +0530 Subject: [PATCH] fix(field validation): added conditional check for member roles --- apps/web-api/src/members/members.service.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web-api/src/members/members.service.ts b/apps/web-api/src/members/members.service.ts index 5a6000e07..bcdae87c3 100644 --- a/apps/web-api/src/members/members.service.ts +++ b/apps/web-api/src/members/members.service.ts @@ -44,6 +44,7 @@ export class MembersService { @Inject(CACHE_MANAGER) private cacheService: Cache ) { } + ) { } /** * Creates a new member in the database within a transaction. @@ -719,7 +720,9 @@ export class MembersService { : type === 'Update' ? { disconnect: true } : undefined; member['skills'] = buildMultiRelationMapping('skills', memberData, type); if (type === 'Create') { - member['teamMemberRoles'] = this.buildTeamMemberRoles(memberData); + if (Array.isArray(memberData.teamMemberRoles)) { + member['teamMemberRoles'] = this.buildTeamMemberRoles(memberData); + } if (Array.isArray(memberData.projectContributions)) { member['projectContributions'] = { createMany: { data: memberData.projectContributions }, @@ -1121,8 +1124,8 @@ export class MembersService { * @param userEmail logged in member email * @returns result */ - async verifyMembers(memberIds: string[], userEmail: any): Promise { - return await this.prisma.$transaction(async (tx) => { + async verifyMembers(memberIds: string[], userEmail:string): Promise { + return await this.prisma.$transaction(async (tx) => { const result = await tx.member.updateMany({ where: { uid: { in: memberIds } }, data: {