-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Update SendNotification function to handle old and new sett…
…ings triggers
- Loading branch information
Showing
9 changed files
with
96 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,33 @@ | ||
package models | ||
|
||
import "go.mongodb.org/mongo-driver/bson/primitive" | ||
|
||
type NotificationSettingV2 struct { | ||
any `collection:"notification_settings"` | ||
BaseModelV2[NotificationSettingV2] `bson:",inline"` | ||
Type string `json:"type" bson:"type"` | ||
Name string `json:"name" bson:"name"` | ||
Description string `json:"description" bson:"description"` | ||
Enabled bool `json:"enabled" bson:"enabled"` | ||
Global bool `json:"global" bson:"global"` | ||
Title string `json:"title,omitempty" bson:"title,omitempty"` | ||
Template string `json:"template" bson:"template"` | ||
TemplateMode string `json:"template_mode" bson:"template_mode"` | ||
TemplateMarkdown string `json:"template_markdown,omitempty" bson:"template_markdown,omitempty"` | ||
TemplateRichText string `json:"template_rich_text,omitempty" bson:"template_rich_text,omitempty"` | ||
TemplateRichTextJson string `json:"template_rich_text_json,omitempty" bson:"template_rich_text_json,omitempty"` | ||
TemplateTheme string `json:"template_theme,omitempty" bson:"template_theme,omitempty"` | ||
TaskTrigger string `json:"task_trigger" bson:"task_trigger"` | ||
TriggerTarget string `json:"trigger_target" bson:"trigger_target"` | ||
Trigger string `json:"trigger" bson:"trigger"` | ||
Mail NotificationSettingMail `json:"mail,omitempty" bson:"mail,omitempty"` | ||
Mobile NotificationSettingMobile `json:"mobile,omitempty" bson:"mobile,omitempty"` | ||
} | ||
Name string `json:"name" bson:"name"` | ||
Description string `json:"description" bson:"description"` | ||
Enabled bool `json:"enabled" bson:"enabled"` | ||
|
||
type NotificationSettingMail struct { | ||
Server string `json:"server" bson:"server"` | ||
Port string `json:"port,omitempty" bson:"port,omitempty"` | ||
User string `json:"user,omitempty" bson:"user,omitempty"` | ||
Password string `json:"password,omitempty" bson:"password,omitempty"` | ||
SenderEmail string `json:"sender_email,omitempty" bson:"sender_email,omitempty"` | ||
SenderIdentity string `json:"sender_identity,omitempty" bson:"sender_identity,omitempty"` | ||
To string `json:"to,omitempty" bson:"to,omitempty"` | ||
Cc string `json:"cc,omitempty" bson:"cc,omitempty"` | ||
} | ||
Title string `json:"title,omitempty" bson:"title,omitempty"` | ||
Template string `json:"template" bson:"template"` | ||
TemplateMode string `json:"template_mode" bson:"template_mode"` | ||
TemplateMarkdown string `json:"template_markdown,omitempty" bson:"template_markdown,omitempty"` | ||
TemplateRichText string `json:"template_rich_text,omitempty" bson:"template_rich_text,omitempty"` | ||
TemplateRichTextJson string `json:"template_rich_text_json,omitempty" bson:"template_rich_text_json,omitempty"` | ||
TemplateTheme string `json:"template_theme,omitempty" bson:"template_theme,omitempty"` | ||
|
||
TaskTrigger string `json:"task_trigger" bson:"task_trigger"` | ||
TriggerTarget string `json:"trigger_target" bson:"trigger_target"` | ||
Trigger string `json:"trigger" bson:"trigger"` | ||
|
||
HasMail bool `json:"has_mail" bson:"has_mail"` | ||
SenderEmail string `json:"sender_email" bson:"sender_email"` | ||
SenderName string `json:"sender_name" bson:"sender_name"` | ||
MailTo string `json:"mail_to" bson:"mail_to"` | ||
MailCc string `json:"mail_cc" bson:"mail_cc"` | ||
MailBcc string `json:"mail_bcc" bson:"mail_bcc"` | ||
|
||
type NotificationSettingMobile struct { | ||
Webhook string `json:"webhook" bson:"webhook"` | ||
ChannelIds []primitive.ObjectID `json:"channel_ids,omitempty" bson:"channel_ids,omitempty"` | ||
Channels []NotificationChannelV2 `json:"channels,omitempty" bson:"-"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package notification | ||
|
||
const ( | ||
TypeMail = "mail" | ||
TypeMobile = "mobile" | ||
TypeMail = "mail" | ||
TypeIM = "im" | ||
) | ||
|
||
const ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.