Skip to content

Commit

Permalink
feat(SPV-680): standarize delete endpoints returns (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzolt-4chain authored Nov 13, 2024
1 parent 87ae633 commit 409cfe4
Show file tree
Hide file tree
Showing 6 changed files with 3,535 additions and 105 deletions.
5 changes: 2 additions & 3 deletions actions/access_keys/revoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func oldRevoke(c *gin.Context, userContext *reqctx.UserContext) {
// @Tags Access-key
// @Produce json
// @Param id path string true "id of the access key"
// @Success 200 {object} response.AccessKey "Revoked AccessKey"
// @Success 200
// @Failure 400 "Bad request - Missing required field: id"
// @Failure 500 "Internal server error - Error while revoking access key"
// @Router /api/v1/users/current/keys/{id} [delete]
Expand Down Expand Up @@ -78,6 +78,5 @@ func revokeHelper(c *gin.Context, id string, snakeCase bool, xpub string) {
return
}

contract := mappings.MapToAccessKeyContract(accessKey)
c.JSON(http.StatusCreated, contract)
c.Status(http.StatusOK)
}
8 changes: 3 additions & 5 deletions actions/admin/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func contactsDelete(c *gin.Context, _ *reqctx.AdminContext) {
// @Tags Admin
// @Produce json
// @Param id path string false "Contact id"
// @Success 200 {object} response.Contact "Rejected contact"
// @Success 200
// @Failure 400 "Bad request - Error while getting id from path"
// @Failure 404 "Not found - Error while getting contact by id"
// @Failure 422 "Unprocessable entity - Incorrect status of contact"
Expand All @@ -165,7 +165,7 @@ func contactsDelete(c *gin.Context, _ *reqctx.AdminContext) {
func contactsReject(c *gin.Context, _ *reqctx.AdminContext) {
id := c.Param("id")

contact, err := reqctx.Engine(c).AdminChangeContactStatus(
_, err := reqctx.Engine(c).AdminChangeContactStatus(
c.Request.Context(),
id,
engine.ContactRejected,
Expand All @@ -175,9 +175,7 @@ func contactsReject(c *gin.Context, _ *reqctx.AdminContext) {
return
}

contract := mappings.MapToContactContract(contact)

c.JSON(http.StatusOK, contract)
c.Status(http.StatusOK)
}

// contactsAccept will perform Accept action on contact with the given id
Expand Down
4 changes: 2 additions & 2 deletions actions/admin/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func subscribeWebhook(c *gin.Context, _ *reqctx.AdminContext) {
// @Tags Admin
// @Produce json
// @Param UnsubscribeRequestBody body models.UnsubscribeRequestBody false "URL to unsubscribe from"
// @Success 200 {boolean} bool "Success response"
// @Success 200
// @Failure 500 "Internal server error - Error while unsubscribing to the webhook"
// @Router /api/v1/admin/webhooks/subscriptions [delete]
// @Security x-auth-xpub
Expand All @@ -59,5 +59,5 @@ func unsubscribeWebhook(c *gin.Context, _ *reqctx.AdminContext) {
return
}

c.JSON(http.StatusOK, true)
c.Status(http.StatusOK)
}
Loading

0 comments on commit 409cfe4

Please # to comment.