Skip to content

Commit 409cfe4

Browse files
authored
feat(SPV-680): standarize delete endpoints returns (#768)
1 parent 87ae633 commit 409cfe4

6 files changed

Lines changed: 3535 additions & 105 deletions

File tree

actions/access_keys/revoke.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func oldRevoke(c *gin.Context, userContext *reqctx.UserContext) {
3939
// @Tags Access-key
4040
// @Produce json
4141
// @Param id path string true "id of the access key"
42-
// @Success 200 {object} response.AccessKey "Revoked AccessKey"
42+
// @Success 200
4343
// @Failure 400 "Bad request - Missing required field: id"
4444
// @Failure 500 "Internal server error - Error while revoking access key"
4545
// @Router /api/v1/users/current/keys/{id} [delete]
@@ -78,6 +78,5 @@ func revokeHelper(c *gin.Context, id string, snakeCase bool, xpub string) {
7878
return
7979
}
8080

81-
contract := mappings.MapToAccessKeyContract(accessKey)
82-
c.JSON(http.StatusCreated, contract)
81+
c.Status(http.StatusOK)
8382
}

actions/admin/contact.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func contactsDelete(c *gin.Context, _ *reqctx.AdminContext) {
154154
// @Tags Admin
155155
// @Produce json
156156
// @Param id path string false "Contact id"
157-
// @Success 200 {object} response.Contact "Rejected contact"
157+
// @Success 200
158158
// @Failure 400 "Bad request - Error while getting id from path"
159159
// @Failure 404 "Not found - Error while getting contact by id"
160160
// @Failure 422 "Unprocessable entity - Incorrect status of contact"
@@ -165,7 +165,7 @@ func contactsDelete(c *gin.Context, _ *reqctx.AdminContext) {
165165
func contactsReject(c *gin.Context, _ *reqctx.AdminContext) {
166166
id := c.Param("id")
167167

168-
contact, err := reqctx.Engine(c).AdminChangeContactStatus(
168+
_, err := reqctx.Engine(c).AdminChangeContactStatus(
169169
c.Request.Context(),
170170
id,
171171
engine.ContactRejected,
@@ -175,9 +175,7 @@ func contactsReject(c *gin.Context, _ *reqctx.AdminContext) {
175175
return
176176
}
177177

178-
contract := mappings.MapToContactContract(contact)
179-
180-
c.JSON(http.StatusOK, contract)
178+
c.Status(http.StatusOK)
181179
}
182180

183181
// contactsAccept will perform Accept action on contact with the given id

actions/admin/webhooks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func subscribeWebhook(c *gin.Context, _ *reqctx.AdminContext) {
4242
// @Tags Admin
4343
// @Produce json
4444
// @Param UnsubscribeRequestBody body models.UnsubscribeRequestBody false "URL to unsubscribe from"
45-
// @Success 200 {boolean} bool "Success response"
45+
// @Success 200
4646
// @Failure 500 "Internal server error - Error while unsubscribing to the webhook"
4747
// @Router /api/v1/admin/webhooks/subscriptions [delete]
4848
// @Security x-auth-xpub
@@ -59,5 +59,5 @@ func unsubscribeWebhook(c *gin.Context, _ *reqctx.AdminContext) {
5959
return
6060
}
6161

62-
c.JSON(http.StatusOK, true)
62+
c.Status(http.StatusOK)
6363
}

0 commit comments

Comments
 (0)