From 3e76c095e0a10f7f9a62052470a998ed4f84d89d Mon Sep 17 00:00:00 2001 From: Joshua Date: Sat, 3 Feb 2024 15:08:59 +0800 Subject: [PATCH 1/2] refactor: return newly created service request object --- backend/src/api/handlers/handlers.go | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/api/handlers/handlers.go b/backend/src/api/handlers/handlers.go index 2472e2a7..94e83fe2 100644 --- a/backend/src/api/handlers/handlers.go +++ b/backend/src/api/handlers/handlers.go @@ -91,6 +91,7 @@ func CreateServiceRequest(w http.ResponseWriter, r *http.Request) { srm.Id = insertedId event.FireAsync(events.NewNewServiceRequestEvent(srm)) w.WriteHeader(http.StatusCreated) + json.NewEncoder(w).Encode(srm) } func CreatePipeline(w http.ResponseWriter, r *http.Request) { From 66c23c314069c6c1f64146ac48849a7f99eaea67 Mon Sep 17 00:00:00 2001 From: Joshua Date: Sat, 3 Feb 2024 15:10:58 +0800 Subject: [PATCH 2/2] refactor: update service request routes --- backend/src/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/main.go b/backend/src/main.go index e2c0bf7f..87d70777 100644 --- a/backend/src/main.go +++ b/backend/src/main.go @@ -17,10 +17,10 @@ func main() { r := mux.NewRouter() r.HandleFunc("/api/healthcheck", handlers.HealthCheck).Methods("GET") - r.HandleFunc("/api/servicerequest/new", handlers.CreateServiceRequest).Methods("POST").Headers("Content-Type", "application/json") - r.HandleFunc("/api/servicerequest/{requestId}", handlers.GetServiceRequest).Methods("GET") - r.HandleFunc("/api/servicerequest", handlers.GetAllServiceRequest).Methods("GET") - r.HandleFunc("/api/servicerequest/{requestId}/approve", handlers.ApproveServiceRequest).Methods("POST").Headers("Content-Type", "application/json") + r.HandleFunc("/api/service_request", handlers.CreateServiceRequest).Methods("POST").Headers("Content-Type", "application/json") + r.HandleFunc("/api/service_request/{requestId}", handlers.GetServiceRequest).Methods("GET") + r.HandleFunc("/api/service_request", handlers.GetAllServiceRequest).Methods("GET") + r.HandleFunc("/api/service_request/{requestId}/approve", handlers.ApproveServiceRequest).Methods("POST").Headers("Content-Type", "application/json") r.HandleFunc("/api/pipeline", handlers.CreatePipeline).Methods("POST").Headers("Content-Type", "application/json") r.HandleFunc("/api/pipeline", handlers.GetAllPipelines).Methods("GET") r.HandleFunc("/api/pipeline/{pipelineId}", handlers.GetPipeline).Methods("GET")