Skip to content

Commit 93533b1

Browse files
Arta AsadiArta Asadi
Arta Asadi
authored and
Arta Asadi
committed
fix: update get task details outputs
1 parent 86bcd9f commit 93533b1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

services/tasks/api/tasks.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type TaskDetailsResponse struct {
2424
ImageUrl string `json:"image_url"`
2525
RunSchedules []RunScheduleObject `json:"run_schedules"`
2626
Credentials []string `json:"credentials"`
27-
EnvVars []string `json:"env_vars"`
27+
EnvVars map[string]string `json:"env_vars"`
2828
ScaleConfig ScaleConfig `json:"scale_config"`
2929
}
3030

services/tasks/http.go

+16
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,29 @@ func (r *httpRoutes) GetTask(ctx echo.Context) error {
173173
}
174174
}
175175

176+
var envVars map[string]string
177+
if task.EnvVars.Status == pgtype.Present {
178+
if err := json.Unmarshal(task.EnvVars.Bytes, &envVars); err != nil {
179+
return err
180+
}
181+
}
182+
183+
var scaleConfig api.ScaleConfig
184+
if task.ScaleConfig.Status == pgtype.Present {
185+
if err = json.Unmarshal(task.ScaleConfig.Bytes, &scaleConfig); err != nil {
186+
return err
187+
}
188+
}
189+
176190
taskResponse := api.TaskDetailsResponse{
177191
ID: task.ID,
178192
Name: task.Name,
179193
Description: task.Description,
180194
ImageUrl: task.ImageUrl,
181195
RunSchedules: runSchedulesObjects,
182196
Credentials: credentials,
197+
EnvVars: envVars,
198+
ScaleConfig: scaleConfig,
183199
}
184200

185201
return ctx.JSON(http.StatusOK, taskResponse)

0 commit comments

Comments
 (0)