diff --git a/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts b/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts index 24c72cb3..72ccaf1b 100644 --- a/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts +++ b/packages/ui/certd-server/src/modules/pipeline/service/notification-service.ts @@ -45,6 +45,23 @@ export class NotificationService extends BaseService { return notificationRegistry.getDefine(type); } + async add(bean: NotificationEntity) { + const res = await super.add(bean); + if(bean.isDefault){ + await this.setDefault(res.id, bean.userId); + } + return res + } + + async update(bean: NotificationEntity) { + const res = await super.update(bean); + if(bean.isDefault){ + const old = await this.info(bean.id); + await this.setDefault(bean.id, old.userId); + } + return res + } + async getById(id: number, userId: number): Promise { if (!id) { throw new ValidateException('id不能为空');