Skip to content

Commit

Permalink
docs: return id along with json response for changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hayzamjs committed Nov 27, 2024
1 parent fa2b516 commit 16c237e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions handlers/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func CreateDocumentation(services *services.ServiceRegistry, w http.ResponseWrit
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "documentation_created"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "documentation_created", "id": fmt.Sprint(documentation.ID)})
}

func EditDocumentation(services *services.ServiceRegistry, w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -191,7 +191,7 @@ func EditDocumentation(services *services.ServiceRegistry, w http.ResponseWriter
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "documentation_updated"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "documentation_updated", "id": fmt.Sprint(req.ID)})
}

func DeleteDocumentation(service *services.DocService, w http.ResponseWriter, r *http.Request) {
Expand All @@ -212,7 +212,7 @@ func DeleteDocumentation(service *services.DocService, w http.ResponseWriter, r
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "documentation_deleted"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "documentation_deleted", "id": fmt.Sprint(req.ID)})
}

func CreateDocumentationVersion(service *services.DocService, w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -325,7 +325,7 @@ func CreatePage(services *services.ServiceRegistry, w http.ResponseWriter, r *ht
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_created"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_created", "id": fmt.Sprint(page.ID)})
}

func EditPage(services *services.ServiceRegistry, w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -361,7 +361,7 @@ func EditPage(services *services.ServiceRegistry, w http.ResponseWriter, r *http
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_updated"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_updated", "id": fmt.Sprint(req.ID)})
}

func DeletePage(service *services.DocService, w http.ResponseWriter, r *http.Request) {
Expand All @@ -386,7 +386,7 @@ func DeletePage(service *services.DocService, w http.ResponseWriter, r *http.Req
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_deleted"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_deleted", "id": fmt.Sprint(req.ID)})
}

func GetPageGroups(service *services.DocService, w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -477,7 +477,7 @@ func CreatePageGroup(services *services.ServiceRegistry, w http.ResponseWriter,
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_group_created"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_group_created", "id": fmt.Sprint(pageGroup.ID)})
}

func EditPageGroup(services *services.ServiceRegistry, w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -512,7 +512,7 @@ func EditPageGroup(services *services.ServiceRegistry, w http.ResponseWriter, r
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_group_updated"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_group_updated", "id": fmt.Sprint(req.ID)})
}

func DeletePageGroup(service *services.DocService, w http.ResponseWriter, r *http.Request) {
Expand All @@ -531,7 +531,7 @@ func DeletePageGroup(service *services.DocService, w http.ResponseWriter, r *htt
return
}

SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_group_deleted"})
SendJSONResponse(http.StatusOK, w, map[string]string{"status": "success", "message": "page_group_deleted", "id": fmt.Sprint(req.ID)})
}

func GetRsPress(service *services.DocService, w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 16c237e

Please sign in to comment.