From 107fa8fe3b4a13d88d6b6c7424d354e12eea7c8a Mon Sep 17 00:00:00 2001 From: RXRD Date: Wed, 15 Nov 2023 12:43:47 +0700 Subject: [PATCH] Update user-experience.service.ts --- src/services/user-experience.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/user-experience.service.ts b/src/services/user-experience.service.ts index 10df3223e..60e71ca50 100644 --- a/src/services/user-experience.service.ts +++ b/src/services/user-experience.service.ts @@ -255,7 +255,11 @@ export class UserExperienceService { jobs.push(this.userExperienceRepository.deleteAll(where)); } - if (editors && !editors.includes(userId)) { + if (editors) { + if (editors.includes(userId)) { + jobs.push(this.experienceRepository.editors(id).unlinkAll()) + } + else { await this.experienceRepository.editors(id).unlinkAll(); editors.map(editor => { const link = this.experienceRepository @@ -269,7 +273,7 @@ export class UserExperienceService { jobs.push(creation); return editor; }); - +} } Promise.all(jobs) as Promise;