From 493d539cd45650cdfbc960b18a96d6ed80adb1ad Mon Sep 17 00:00:00 2001 From: Joshua Date: Tue, 19 Mar 2024 00:02:33 +0800 Subject: [PATCH] feat: add ApprovedBy field --- backend/src/server/handlers.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/server/handlers.go b/backend/src/server/handlers.go index 2d0b8a72..92a73169 100644 --- a/backend/src/server/handlers.go +++ b/backend/src/server/handlers.go @@ -52,9 +52,10 @@ func handleGetAllServiceRequest(client *mongo.Client) http.Handler { func handleGetServiceRequest(mongoClient *mongo.Client, psqlClient *sql.DB) http.Handler { type ResponseBodySteps struct { - Name string `json:"name"` - Status models.EventType `json:"status"` - UpdatedAt time.Time `json:"updated_at"` + Name string `json:"name"` + Status models.EventType `json:"status"` + UpdatedAt time.Time `json:"updated_at"` + ApprovedBy string `json:"approved_by"` } type ResponseBody struct { ServiceRequest *models.ServiceRequestModel `json:"service_request"` @@ -78,9 +79,10 @@ func handleGetServiceRequest(mongoClient *mongo.Client, psqlClient *sql.DB) http steps := make([]ResponseBodySteps, 0, len(sre)) for _, event := range sre { steps = append(steps, ResponseBodySteps{ - Name: event.StepName, - Status: event.EventType, - UpdatedAt: event.CreatedAt, + Name: event.StepName, + Status: event.EventType, + UpdatedAt: event.CreatedAt, + ApprovedBy: event.ApprovedBy, }) } response := ResponseBody{