From 6b2e6eed9496e558d7267016e211d6d687ec1b07 Mon Sep 17 00:00:00 2001 From: "taekyu.kang" Date: Fri, 26 Apr 2024 18:23:34 +0900 Subject: [PATCH] trivial. add default systemNotificationTemplate when organization created --- internal/usecase/system-notification-rule.go | 5 +++++ internal/usecase/system-notification-template.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/usecase/system-notification-rule.go b/internal/usecase/system-notification-rule.go index d777e432..ad04ee57 100644 --- a/internal/usecase/system-notification-rule.go +++ b/internal/usecase/system-notification-rule.go @@ -191,6 +191,11 @@ func (u *SystemNotificationRuleUsecase) MakeDefaultSystemNotificationRules(ctx c return err } + err = u.organizationRepo.AddSystemNotificationTemplates(ctx, organizationId, templates) + if err != nil { + return httpErrors.NewBadRequestError(err, "ST_FAILED_ADD_ORGANIZATION_SYSTEM_NOTIFICATION_TEMPLATE", "") + } + rules := make([]model.SystemNotificationRule, 0) for _, template := range templates { if template.Name == domain.SN_TYPE_NODE_CPU_HIGH_LOAD { diff --git a/internal/usecase/system-notification-template.go b/internal/usecase/system-notification-template.go index f0c7743f..99240baf 100644 --- a/internal/usecase/system-notification-template.go +++ b/internal/usecase/system-notification-template.go @@ -188,7 +188,7 @@ func (u *SystemNotificationTemplateUsecase) UpdateOrganizations(ctx context.Cont func (u *SystemNotificationTemplateUsecase) AddOrganizationSystemNotificationTemplates(ctx context.Context, organizationId string, systemNotificationTemplateIds []string) error { _, err := u.organizationRepo.Get(ctx, organizationId) if err != nil { - return httpErrors.NewBadRequestError(err, "O_NOT_EXISTED_NAME", "") + return httpErrors.NewBadRequestError(err, "ST_NOT_EXISTED_NAME", "") } systemNotificationTemplates := make([]model.SystemNotificationTemplate, 0)