Skip to content

Commit

Permalink
Merge pull request #441 from openinfradev/minor_fix
Browse files Browse the repository at this point in the history
trivial. add default systemNotificationTemplate when organization cre…
  • Loading branch information
cho4036 authored Apr 29, 2024
2 parents e6a6f03 + 6b2e6ee commit 3ce4f20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/usecase/system-notification-rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/usecase/system-notification-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3ce4f20

Please sign in to comment.