From c9442fc0cb0ac6a3fcfe2db3ffa11cb4ab20fda1 Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Tue, 30 May 2023 14:30:20 +0900 Subject: [PATCH] app-serving: remove unnecessary fields from updateRequest obj --- internal/delivery/http/app-serve-app.go | 10 +--------- pkg/domain/app-serve-app.go | 25 ------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/internal/delivery/http/app-serve-app.go b/internal/delivery/http/app-serve-app.go index 37b9d9fb..acb8021d 100644 --- a/internal/delivery/http/app-serve-app.go +++ b/internal/delivery/http/app-serve-app.go @@ -509,6 +509,7 @@ func (h *AppServeAppHandler) UpdateAppServeApp(w http.ResponseWriter, r *http.Re ErrorJSON(w, r, err) } + // unmarshal request that only contains task-specific params appReq := domain.UpdateAppServeAppRequest{} err = UnmarshalRequestInput(r, &appReq) if err != nil { @@ -520,15 +521,6 @@ func (h *AppServeAppHandler) UpdateAppServeApp(w http.ResponseWriter, r *http.Re // from existing app config. //appReq.SetDefaultValue() - appReq.Type = app.Type - appReq.AppType = app.AppType - appReq.Namespace = app.Namespace - - if err = domain.Map(appReq, app); err != nil { - //ErrorJSON(w, r, httpErrors.NewBadRequestError(err, "", "")) - return - } - var task domain.AppServeAppTask //tasks := app.AppServeAppTasks //sort.Slice(tasks, func(i, j int) bool { diff --git a/pkg/domain/app-serve-app.go b/pkg/domain/app-serve-app.go index 67057b02..480dafe1 100644 --- a/pkg/domain/app-serve-app.go +++ b/pkg/domain/app-serve-app.go @@ -135,10 +135,6 @@ type UpdateAppServeAppEndpointRequest struct { } type UpdateAppServeAppRequest struct { - // App - Type string `json:"type"` - AppType string `json:"appType"` - // Task Strategy string `json:"strategy"` ArtifactUrl string `json:"artifactUrl"` @@ -156,27 +152,6 @@ type UpdateAppServeAppRequest struct { Abort bool `json:"abort"` } -func (u *UpdateAppServeAppRequest) SetDefaultValue() { - if u.Type == "" { - u.Type = "all" - } - if u.AppType == "" { - u.AppType = "springboot" - } - if u.Strategy == "" { - u.Strategy = "rolling-update" - } - if u.ResourceSpec == "" { - u.ResourceSpec = "medium" - } - if u.Profile == "" { - u.Profile = "default" - } - if u.Port == "" { - u.Port = "8080" - } -} - type RollbackAppServeAppRequest struct { TaskId string `json:"taskId"` }