Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(field validation): added conditional check for member roles #1999

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/web-api/src/members/members.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class MembersService {
@Inject(CACHE_MANAGER) private cacheService: Cache

) { }
) { }

/**
* Creates a new member in the database within a transaction.
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -1121,8 +1124,8 @@ export class MembersService {
* @param userEmail logged in member email
* @returns result
*/
async verifyMembers(memberIds: string[], userEmail: any): Promise<any> {
return await this.prisma.$transaction(async (tx) => {
async verifyMembers(memberIds: string[], userEmail:string): Promise<any> {
return await this.prisma.$transaction(async (tx) => {
const result = await tx.member.updateMany({
where: { uid: { in: memberIds } },
data: {
Expand Down
Loading