From 9aecbd04a2454dc7cad693b2da2548b78746c8fb Mon Sep 17 00:00:00 2001 From: Robert Choi Date: Fri, 3 May 2024 15:25:47 +0900 Subject: [PATCH] bugfix: return availableRollback value by GetTasks API --- internal/delivery/http/app-serve-app.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/delivery/http/app-serve-app.go b/internal/delivery/http/app-serve-app.go index aa29a745..ab127e72 100644 --- a/internal/delivery/http/app-serve-app.go +++ b/internal/delivery/http/app-serve-app.go @@ -481,6 +481,12 @@ func (h *AppServeAppHandler) GetAppServeAppTasksByAppId(w http.ResponseWriter, r var out domain.GetAppServeAppTasksResponse out.AppServeAppTasks = make([]domain.AppServeAppTaskResponse, len(tasks)) for i, task := range tasks { + // Rollbacking to latest task should be blocked. + if i > 0 && strings.Contains(task.Status, "SUCCESS") && task.Status != "ABORT_SUCCESS" && + task.Status != "ROLLBACK_SUCCESS" { + task.AvailableRollback = true + } + if err := serializer.Map(r.Context(), task, &out.AppServeAppTasks[i]); err != nil { log.Info(r.Context(), err) continue