chore: fix duplicate notification
This commit is contained in:
@@ -420,8 +420,10 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
})
|
})
|
||||||
// get user ids from centerMentorIds
|
// get user ids from centerMentorIds
|
||||||
const userIds = [center.centerOwnerId, ...mentorIds]
|
const userIds = [center.centerOwnerId, ...mentorIds]
|
||||||
|
// remove duplicate user ids
|
||||||
|
const uniqueUserIds = [...new Set(userIds)]
|
||||||
// send notification to user using context
|
// send notification to user using context
|
||||||
userIds.forEach(async (id) => {
|
uniqueUserIds.forEach(async (id) => {
|
||||||
// add message to database
|
// add message to database
|
||||||
const message = await this.prisma.message.create({
|
const message = await this.prisma.message.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -447,7 +449,9 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
// send notification to user using context
|
// send notification to user using context
|
||||||
// get user ids from mentorIds
|
// get user ids from mentorIds
|
||||||
const userIds = [center.centerOwnerId, ...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
|
// add message to database
|
||||||
const message = await this.prisma.message.create({
|
const message = await this.prisma.message.create({
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
Reference in New Issue
Block a user