Skip to content

Commit

Permalink
change: PUT routes suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
fsy2001 committed Aug 4, 2024
1 parent 78277e6 commit c70e430
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions danke/api/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func CreateReviewV1(c *fiber.Ctx) (err error) {
// @Param json body schema.ModifyReviewV1Request true "json"
// @Param review_id path int true "review id"
// @Router /reviews/{review_id} [put]
// @Router /reviews/{review_id}/_modify [patch]
// @Router /reviews/{review_id}/_webvpn [patch]
// @Success 200 {object} schema.ReviewV1Response
// @Failure 400 {object} common.HttpError
// @Failure 404 {object} common.HttpBaseError
Expand Down Expand Up @@ -509,7 +509,7 @@ func ListSensitiveReviews(c *fiber.Ctx) (err error) {
// @Tags Review
// @Produce application/json
// @Router /v3/reviews/{id}/_sensitive [put]
// @Router /v3/reviews/{id}/_sensitive [patch]
// @Router /v3/reviews/{id}/_sensitive/_webvpn [patch]
// @Param id path int true "id"
// @Param json body schema.ModifySensitiveReviewRequest true "json"
// @Success 200 {object} schema.SensitiveReviewResponse
Expand Down
4 changes: 2 additions & 2 deletions danke/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func registerRoutes(r fiber.Router) {
r.Get("/courses/:id<int>/reviews", ListReviewsV1)
r.Post("/courses/:id<int>/reviews", CreateReviewV1)
r.Put("/reviews/:id<int>", ModifyReviewV1)
r.Patch("/reviews/:id<int>/_modify", ModifyReviewV1)
r.Patch("/reviews/:id<int>/_webvpn", ModifyReviewV1)
r.Patch("/reviews/:id<int>", VoteForReviewV1)
r.Get("/reviews/me", ListMyReviewsV1)
r.Get("/reviews/random", GetRandomReviewV1)
Expand All @@ -58,5 +58,5 @@ func registerRoutes(r fiber.Router) {

r.Get("/v3/reviews/_sensitive", ListSensitiveReviews)
r.Put("/v3/reviews/:id<int>/_sensitive", ModifyReviewSensitive)
r.Patch("/v3/reviews/:id<int>/_sensitive", ModifyReviewSensitive)
r.Patch("/v3/reviews/:id<int>/_sensitive/_webvpn", ModifyReviewSensitive)
}
6 changes: 4 additions & 2 deletions danke/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ const docTemplate = `{
}
}
},
"/reviews/{review_id}/_modify": {
"/reviews/{review_id}/_webvpn": {
"patch": {
"description": "modify a review, admin or owner can modify",
"consumes": [
Expand Down Expand Up @@ -895,7 +895,9 @@ const docTemplate = `{
}
}
}
},
}
},
"/v3/reviews/{id}/_sensitive/_webvpn": {
"patch": {
"produces": [
"application/json"
Expand Down
6 changes: 4 additions & 2 deletions danke/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@
}
}
},
"/reviews/{review_id}/_modify": {
"/reviews/{review_id}/_webvpn": {
"patch": {
"description": "modify a review, admin or owner can modify",
"consumes": [
Expand Down Expand Up @@ -888,7 +888,9 @@
}
}
}
},
}
},
"/v3/reviews/{id}/_sensitive/_webvpn": {
"patch": {
"produces": [
"application/json"
Expand Down
7 changes: 4 additions & 3 deletions danke/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ paths:
summary: modify a review
tags:
- Review
/reviews/{review_id}/_modify:
/reviews/{review_id}/_webvpn:
patch:
consumes:
- application/json
Expand Down Expand Up @@ -1035,7 +1035,7 @@ paths:
tags:
- Review
/v3/reviews/{id}/_sensitive:
patch:
put:
parameters:
- description: id
in: path
Expand All @@ -1062,7 +1062,8 @@ paths:
summary: Modify A Review's actual_sensitive, admin only
tags:
- Review
put:
/v3/reviews/{id}/_sensitive/_webvpn:
patch:
parameters:
- description: id
in: path
Expand Down

0 comments on commit c70e430

Please sign in to comment.