From 4fc0aad7a04537478c5d103bfe11f2c2a404b60a Mon Sep 17 00:00:00 2001 From: naiba Date: Sun, 20 Oct 2024 00:32:55 +0800 Subject: [PATCH] model redesign --- model/notification_group.go | 6 ++++++ model/notification_group_notification.go | 7 +++++++ model/server.go | 3 ++- model/server_group.go | 6 ++++++ model/server_group_server.go | 7 +++++++ model/user_group.go | 6 ++++++ model/user_group_user.go | 7 +++++++ 7 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 model/notification_group.go create mode 100644 model/notification_group_notification.go create mode 100644 model/server_group.go create mode 100644 model/server_group_server.go create mode 100644 model/user_group.go create mode 100644 model/user_group_user.go diff --git a/model/notification_group.go b/model/notification_group.go new file mode 100644 index 0000000..5244a01 --- /dev/null +++ b/model/notification_group.go @@ -0,0 +1,6 @@ +package model + +type NotificationGroup struct { + Common + Name string `json:"name"` +} diff --git a/model/notification_group_notification.go b/model/notification_group_notification.go new file mode 100644 index 0000000..63e20c2 --- /dev/null +++ b/model/notification_group_notification.go @@ -0,0 +1,7 @@ +package model + +type NotificationGroupNotification struct { + Common + NotificationGroupID uint64 `json:"notification_group_id"` + NotificationID uint64 `json:"notification_id"` +} diff --git a/model/server.go b/model/server.go index e0a923b..2427ae3 100644 --- a/model/server.go +++ b/model/server.go @@ -7,9 +7,10 @@ import ( "sync" "time" + "gorm.io/gorm" + "github.com/naiba/nezha/pkg/utils" pb "github.com/naiba/nezha/proto" - "gorm.io/gorm" ) type Server struct { diff --git a/model/server_group.go b/model/server_group.go new file mode 100644 index 0000000..db558e9 --- /dev/null +++ b/model/server_group.go @@ -0,0 +1,6 @@ +package model + +type ServerGroup struct { + Common + Name string `json:"name"` +} diff --git a/model/server_group_server.go b/model/server_group_server.go new file mode 100644 index 0000000..2786431 --- /dev/null +++ b/model/server_group_server.go @@ -0,0 +1,7 @@ +package model + +type ServerGroupServer struct { + Common + ServerGroupId uint64 `json:"server_group_id"` + ServerId uint64 `json:"server_id"` +} diff --git a/model/user_group.go b/model/user_group.go new file mode 100644 index 0000000..45b0ecf --- /dev/null +++ b/model/user_group.go @@ -0,0 +1,6 @@ +package model + +type UserGroup struct { + Common + Name string `json:"name"` +} diff --git a/model/user_group_user.go b/model/user_group_user.go new file mode 100644 index 0000000..080f35e --- /dev/null +++ b/model/user_group_user.go @@ -0,0 +1,7 @@ +package model + +type UserGroupUser struct { + Common + UserGroupId uint64 `json:"user_group_id"` + UserId uint64 `json:"user_id"` +}