Skip to content

Commit

Permalink
feature. change resource name alert to event
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Mar 18, 2024
1 parent 33ae071 commit c7dd9db
Show file tree
Hide file tree
Showing 22 changed files with 2,101 additions and 2,181 deletions.
794 changes: 374 additions & 420 deletions api/swagger/docs.go

Large diffs are not rendered by default.

794 changes: 374 additions & 420 deletions api/swagger/swagger.json

Large diffs are not rendered by default.

496 changes: 233 additions & 263 deletions api/swagger/swagger.yaml

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package database
import (
"context"
"fmt"
"github.com/openinfradev/tks-api/internal/pagination"
"os"
"strings"

"github.com/openinfradev/tks-api/internal/pagination"

"github.com/openinfradev/tks-api/internal/delivery/api"

internal_gorm "github.com/openinfradev/tks-api/internal/gorm"
Expand Down Expand Up @@ -109,11 +110,11 @@ func migrateSchema(db *gorm.DB) error {
return err
}

// Alert
if err := db.AutoMigrate(&model.Alert{}); err != nil {
// Event
if err := db.AutoMigrate(&model.SystemNotification{}); err != nil {
return err
}
if err := db.AutoMigrate(&model.AlertAction{}); err != nil {
if err := db.AutoMigrate(&model.SystemNotificationAction{}); err != nil {
return err
}

Expand Down Expand Up @@ -162,19 +163,19 @@ func migrateSchema(db *gorm.DB) error {
func EnsureDefaultRows(db *gorm.DB) error {
// Create default rows
repoFactory := repository.Repository{
Auth: repository.NewAuthRepository(db),
User: repository.NewUserRepository(db),
Cluster: repository.NewClusterRepository(db),
Organization: repository.NewOrganizationRepository(db),
AppGroup: repository.NewAppGroupRepository(db),
AppServeApp: repository.NewAppServeAppRepository(db),
CloudAccount: repository.NewCloudAccountRepository(db),
StackTemplate: repository.NewStackTemplateRepository(db),
Alert: repository.NewAlertRepository(db),
Role: repository.NewRoleRepository(db),
Permission: repository.NewPermissionRepository(db),
Endpoint: repository.NewEndpointRepository(db),
Project: repository.NewProjectRepository(db),
Auth: repository.NewAuthRepository(db),
User: repository.NewUserRepository(db),
Cluster: repository.NewClusterRepository(db),
Organization: repository.NewOrganizationRepository(db),
AppGroup: repository.NewAppGroupRepository(db),
AppServeApp: repository.NewAppServeAppRepository(db),
CloudAccount: repository.NewCloudAccountRepository(db),
StackTemplate: repository.NewStackTemplateRepository(db),
SystemNotification: repository.NewSystemNotificationRepository(db),
Role: repository.NewRoleRepository(db),
Permission: repository.NewPermissionRepository(db),
Endpoint: repository.NewEndpointRepository(db),
Project: repository.NewProjectRepository(db),
}

//
Expand Down
27 changes: 20 additions & 7 deletions internal/delivery/api/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,26 @@ const (
GetStacksDashboard // 대시보드/대시보드/조회
GetResourcesDashboard // 대시보드/대시보드/조회

// Alert
CreateAlert
GetAlerts
GetAlert
DeleteAlert
UpdateAlert
CreateAlertAction
// AlertTemplate
Admin_CreateAlertTemplate
Admin_UpdateAlertTemplate
Admin_GetAlertTemplates
Admin_GetAlertTemplate

// SystemAlert
// CreateSystemAlert
// GetSystemAlerts
// GetSystemAlert
// DeleteSystemAlert
// UpdateSystemAlert

// SystemNotification
CreateSystemNotification
GetSystemNotifications
GetSystemNotification
DeleteSystemNotification
UpdateSystemNotification
CreateSystemNotificationAction

// Stack
GetStacks // 스택관리/조회
Expand Down
116 changes: 74 additions & 42 deletions internal/delivery/api/generated_endpoints.go.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,29 +331,45 @@ var ApiMap = map[Endpoint]EndpointInfo{
Name: "GetResourcesDashboard",
Group: "Dashboard",
},
CreateAlert: {
Name: "CreateAlert",
Group: "Alert",
Admin_CreateAlertTemplate: {
Name: "Admin_CreateAlertTemplate",
Group: "AlertTemplate",
},
GetAlerts: {
Name: "GetAlerts",
Group: "Alert",
Admin_UpdateAlertTemplate: {
Name: "Admin_UpdateAlertTemplate",
Group: "AlertTemplate",
},
GetAlert: {
Name: "GetAlert",
Group: "Alert",
Admin_GetAlertTemplates: {
Name: "Admin_GetAlertTemplates",
Group: "AlertTemplate",
},
DeleteAlert: {
Name: "DeleteAlert",
Group: "Alert",
Admin_GetAlertTemplate: {
Name: "Admin_GetAlertTemplate",
Group: "AlertTemplate",
},
UpdateAlert: {
Name: "UpdateAlert",
Group: "Alert",
CreateSystemNotification: {
Name: "CreateSystemNotification",
Group: "SystemNotification",
},
CreateAlertAction: {
Name: "CreateAlertAction",
Group: "Alert",
GetSystemNotifications: {
Name: "GetSystemNotifications",
Group: "SystemNotification",
},
GetSystemNotification: {
Name: "GetSystemNotification",
Group: "SystemNotification",
},
DeleteSystemNotification: {
Name: "DeleteSystemNotification",
Group: "SystemNotification",
},
UpdateSystemNotification: {
Name: "UpdateSystemNotification",
Group: "SystemNotification",
},
CreateSystemNotificationAction: {
Name: "CreateSystemNotificationAction",
Group: "SystemNotification",
},
GetStacks: {
Name: "GetStacks",
Expand Down Expand Up @@ -906,18 +922,26 @@ func (e Endpoint) String() string {
return "GetStacksDashboard"
case GetResourcesDashboard:
return "GetResourcesDashboard"
case CreateAlert:
return "CreateAlert"
case GetAlerts:
return "GetAlerts"
case GetAlert:
return "GetAlert"
case DeleteAlert:
return "DeleteAlert"
case UpdateAlert:
return "UpdateAlert"
case CreateAlertAction:
return "CreateAlertAction"
case Admin_CreateAlertTemplate:
return "Admin_CreateAlertTemplate"
case Admin_UpdateAlertTemplate:
return "Admin_UpdateAlertTemplate"
case Admin_GetAlertTemplates:
return "Admin_GetAlertTemplates"
case Admin_GetAlertTemplate:
return "Admin_GetAlertTemplate"
case CreateSystemNotification:
return "CreateSystemNotification"
case GetSystemNotifications:
return "GetSystemNotifications"
case GetSystemNotification:
return "GetSystemNotification"
case DeleteSystemNotification:
return "DeleteSystemNotification"
case UpdateSystemNotification:
return "UpdateSystemNotification"
case CreateSystemNotificationAction:
return "CreateSystemNotificationAction"
case GetStacks:
return "GetStacks"
case CreateStack:
Expand Down Expand Up @@ -1280,18 +1304,26 @@ func GetEndpoint(name string) Endpoint {
return GetStacksDashboard
case "GetResourcesDashboard":
return GetResourcesDashboard
case "CreateAlert":
return CreateAlert
case "GetAlerts":
return GetAlerts
case "GetAlert":
return GetAlert
case "DeleteAlert":
return DeleteAlert
case "UpdateAlert":
return UpdateAlert
case "CreateAlertAction":
return CreateAlertAction
case "Admin_CreateAlertTemplate":
return Admin_CreateAlertTemplate
case "Admin_UpdateAlertTemplate":
return Admin_UpdateAlertTemplate
case "Admin_GetAlertTemplates":
return Admin_GetAlertTemplates
case "Admin_GetAlertTemplate":
return Admin_GetAlertTemplate
case "CreateSystemNotification":
return CreateSystemNotification
case "GetSystemNotifications":
return GetSystemNotifications
case "GetSystemNotification":
return GetSystemNotification
case "DeleteSystemNotification":
return DeleteSystemNotification
case "UpdateSystemNotification":
return UpdateSystemNotification
case "CreateSystemNotificationAction":
return CreateSystemNotificationAction
case "GetStacks":
return GetStacks
case "CreateStack":
Expand Down
Loading

0 comments on commit c7dd9db

Please sign in to comment.