Skip to content

Commit

Permalink
Merge pull request #53 from joshtyf/refactor/update-api
Browse files Browse the repository at this point in the history
Update service request API
  • Loading branch information
Ziyang-98 authored Feb 3, 2024
2 parents ac627b5 + 66c23c3 commit f56faeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions backend/src/api/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions backend/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f56faeb

Please sign in to comment.