diff --git a/src/Service/service.schema.ts b/src/Service/service.schema.ts index d91242b..3558ceb 100644 --- a/src/Service/service.schema.ts +++ b/src/Service/service.schema.ts @@ -420,8 +420,10 @@ export class ServiceSchema extends PothosSchema { }) // get user ids from centerMentorIds const userIds = [center.centerOwnerId, ...mentorIds] + // remove duplicate user ids + const uniqueUserIds = [...new Set(userIds)] // send notification to user using context - userIds.forEach(async (id) => { + uniqueUserIds.forEach(async (id) => { // add message to database const message = await this.prisma.message.create({ data: { @@ -447,7 +449,9 @@ export class ServiceSchema extends PothosSchema { // send notification to user using context // get user ids from mentorIds const userIds = [center.centerOwnerId, ...mentorIds] - userIds.forEach(async (id) => { + // remove duplicate user ids + const uniqueUserIds = [...new Set(userIds)] + uniqueUserIds.forEach(async (id) => { // add message to database const message = await this.prisma.message.create({ data: {