Skip to content

Commit

Permalink
Merge pull request #261 from seungkyua/20240304_refactoring_dto
Browse files Browse the repository at this point in the history
Refactoring domain object
  • Loading branch information
ktkfree authored Mar 6, 2024
2 parents 2c2b4cc + 09a0d71 commit c6055e9
Show file tree
Hide file tree
Showing 25 changed files with 1,634 additions and 1,591 deletions.
6 changes: 3 additions & 3 deletions api/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7734,7 +7734,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"projectRole": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRole"
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse"
}
}
},
Expand All @@ -7744,7 +7744,7 @@ const docTemplate = `{
"projectRoles": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRole"
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse"
}
}
}
Expand Down Expand Up @@ -8474,7 +8474,7 @@ const docTemplate = `{
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.ProjectRole": {
"github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse": {
"type": "object",
"properties": {
"createdAt": {
Expand Down
6 changes: 3 additions & 3 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7728,7 +7728,7 @@
"type": "object",
"properties": {
"projectRole": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRole"
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse"
}
}
},
Expand All @@ -7738,7 +7738,7 @@
"projectRoles": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRole"
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse"
}
}
}
Expand Down Expand Up @@ -8468,7 +8468,7 @@
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.ProjectRole": {
"github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse": {
"type": "object",
"properties": {
"createdAt": {
Expand Down
6 changes: 3 additions & 3 deletions api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1421,13 +1421,13 @@ definitions:
github_com_openinfradev_tks-api_pkg_domain.GetProjectRoleResponse:
properties:
projectRole:
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRole'
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse'
type: object
github_com_openinfradev_tks-api_pkg_domain.GetProjectRolesResponse:
properties:
projectRoles:
items:
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRole'
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse'
type: array
type: object
github_com_openinfradev_tks-api_pkg_domain.GetProjectsResponse:
Expand Down Expand Up @@ -1913,7 +1913,7 @@ definitions:
projectRoleName:
type: string
type: object
github_com_openinfradev_tks-api_pkg_domain.ProjectRole:
github_com_openinfradev_tks-api_pkg_domain.ProjectRoleResponse:
properties:
createdAt:
type: string
Expand Down
26 changes: 13 additions & 13 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ func init() {
swagger.SwaggerInfo.Host = address
}

// @title tks-api service
// @version 1.0
// @description This is backend api service for tks platform
// @title tks-api service
// @version 1.0
// @description This is backend api service for tks platform

// @contact.name [email protected]
// @contact.url
// @contact.email [email protected]
// @contact.name [email protected]
// @contact.url
// @contact.email [email protected]

// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html

// @securitydefinitions.apikey JWT
// @in header
// @name Authorization
// @securitydefinitions.apikey JWT
// @in header
// @name Authorization

// @host tks-api-dev.taco-cat.xyz
// @BasePath /
// @host tks-api-dev.taco-cat.xyz
// @BasePath /
func main() {
log.Info("*** Arguments *** ")
for i, s := range viper.AllSettings() {
Expand Down
9 changes: 5 additions & 4 deletions internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"gorm.io/gorm"
"gorm.io/gorm/logger"

indomain "github.com/openinfradev/tks-api/internal/domain"
"github.com/openinfradev/tks-api/internal/repository"
"github.com/openinfradev/tks-api/pkg/domain"
)
Expand Down Expand Up @@ -124,16 +125,16 @@ func migrateSchema(db *gorm.DB) error {
}

// Project
if err := db.AutoMigrate(&domain.Project{}); err != nil {
if err := db.AutoMigrate(&indomain.Project{}); err != nil {
return err
}
if err := db.AutoMigrate(&domain.ProjectMember{}); err != nil {
if err := db.AutoMigrate(&indomain.ProjectMember{}); err != nil {
return err
}
if err := db.AutoMigrate(&domain.ProjectNamespace{}); err != nil {
if err := db.AutoMigrate(&indomain.ProjectNamespace{}); err != nil {
return err
}
if err := db.AutoMigrate(&domain.ProjectRole{}); err != nil {
if err := db.AutoMigrate(&indomain.ProjectRole{}); err != nil {
return err
}

Expand Down
124 changes: 62 additions & 62 deletions internal/delivery/http/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ func NewAlertHandler(h usecase.Usecase) *AlertHandler {
}

// CreateAlert godoc
// @Tags Alerts
// @Summary Create alert. ADMIN ONLY
// @Description Create alert. ADMIN ONLY
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Success 200 {object} nil
// @Router /system-api/organizations/{organizationId}/alerts [post]
// @Security JWT
// @Tags Alerts
// @Summary Create alert. ADMIN ONLY
// @Description Create alert. ADMIN ONLY
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Success 200 {object} nil
// @Router /system-api/organizations/{organizationId}/alerts [post]
// @Security JWT
func (h *AlertHandler) CreateAlert(w http.ResponseWriter, r *http.Request) {

/*
Expand Down Expand Up @@ -72,20 +72,20 @@ func (h *AlertHandler) CreateAlert(w http.ResponseWriter, r *http.Request) {
}

// GetAlert godoc
// @Tags Alerts
// @Summary Get Alerts
// @Description Get Alerts
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param limit query string false "pageSize"
// @Param page query string false "pageNumber"
// @Param soertColumn query string false "sortColumn"
// @Param sortOrder query string false "sortOrder"
// @Param filters query []string false "filters"
// @Success 200 {object} domain.GetAlertsResponse
// @Router /api/1.0/organizations/{organizationId}/alerts [get]
// @Security JWT
// @Tags Alerts
// @Summary Get Alerts
// @Description Get Alerts
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param limit query string false "pageSize"
// @Param page query string false "pageNumber"
// @Param soertColumn query string false "sortColumn"
// @Param sortOrder query string false "sortOrder"
// @Param filters query []string false "filters"
// @Success 200 {object} domain.GetAlertsResponse
// @Router /api/1.0/organizations/{organizationId}/alerts [get]
// @Security JWT
func (h *AlertHandler) GetAlerts(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
organizationId, ok := vars["organizationId"]
Expand Down Expand Up @@ -147,16 +147,16 @@ func (h *AlertHandler) GetAlerts(w http.ResponseWriter, r *http.Request) {
}

// GetAlert godoc
// @Tags Alerts
// @Summary Get Alert
// @Description Get Alert
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param alertId path string true "alertId"
// @Success 200 {object} domain.GetAlertResponse
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId} [get]
// @Security JWT
// @Tags Alerts
// @Summary Get Alert
// @Description Get Alert
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param alertId path string true "alertId"
// @Success 200 {object} domain.GetAlertResponse
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId} [get]
// @Security JWT
func (h *AlertHandler) GetAlert(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
strId, ok := vars["alertId"]
Expand Down Expand Up @@ -194,31 +194,31 @@ func (h *AlertHandler) GetAlert(w http.ResponseWriter, r *http.Request) {
}

// UpdateAlert godoc
// @Tags Alerts
// @Summary Update Alert
// @Description Update Alert
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param body body domain.UpdateAlertRequest true "Update cloud setting request"
// @Success 200 {object} nil
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId} [put]
// @Security JWT
// @Tags Alerts
// @Summary Update Alert
// @Description Update Alert
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param body body domain.UpdateAlertRequest true "Update cloud setting request"
// @Success 200 {object} nil
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId} [put]
// @Security JWT
func (h *AlertHandler) UpdateAlert(w http.ResponseWriter, r *http.Request) {
ErrorJSON(w, r, fmt.Errorf("Need implementation"))
}

// DeleteAlert godoc
// @Tags Alerts
// @Summary Delete Alert
// @Description Delete Alert
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param alertId path string true "alertId"
// @Success 200 {object} nil
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId} [delete]
// @Security JWT
// @Tags Alerts
// @Summary Delete Alert
// @Description Delete Alert
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param alertId path string true "alertId"
// @Success 200 {object} nil
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId} [delete]
// @Security JWT
func (h *AlertHandler) DeleteAlert(w http.ResponseWriter, r *http.Request) {
ErrorJSON(w, r, fmt.Errorf("Need implementation"))
}
Expand All @@ -234,15 +234,15 @@ func (h *AlertHandler) AlertTest(w http.ResponseWriter, r *http.Request) {
}

// CreateAlertAction godoc
// @Tags Alerts
// @Summary Create alert action
// @Description Create alert action
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Success 200 {object} nil
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId}/actions [post]
// @Security JWT
// @Tags Alerts
// @Summary Create alert action
// @Description Create alert action
// @Accept json
// @Produce json
// @Param organizationId path string true "organizationId"
// @Success 200 {object} nil
// @Router /api/1.0/organizations/{organizationId}/alerts/{alertId}/actions [post]
// @Security JWT
func (h *AlertHandler) CreateAlertAction(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
strId, ok := vars["alertId"]
Expand Down
Loading

0 comments on commit c6055e9

Please sign in to comment.