From c70e430eca2f64e3d27c6c36377ee281bce440f9 Mon Sep 17 00:00:00 2001 From: fsy2001 Date: Sun, 4 Aug 2024 16:06:05 +0800 Subject: [PATCH] change: PUT routes suffix --- danke/api/review.go | 4 ++-- danke/api/routes.go | 4 ++-- danke/docs/docs.go | 6 ++++-- danke/docs/swagger.json | 6 ++++-- danke/docs/swagger.yaml | 7 ++++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/danke/api/review.go b/danke/api/review.go index d53527f..601aba7 100644 --- a/danke/api/review.go +++ b/danke/api/review.go @@ -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 @@ -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 diff --git a/danke/api/routes.go b/danke/api/routes.go index 8571e91..a9f5df7 100644 --- a/danke/api/routes.go +++ b/danke/api/routes.go @@ -40,7 +40,7 @@ func registerRoutes(r fiber.Router) { r.Get("/courses/:id/reviews", ListReviewsV1) r.Post("/courses/:id/reviews", CreateReviewV1) r.Put("/reviews/:id", ModifyReviewV1) - r.Patch("/reviews/:id/_modify", ModifyReviewV1) + r.Patch("/reviews/:id/_webvpn", ModifyReviewV1) r.Patch("/reviews/:id", VoteForReviewV1) r.Get("/reviews/me", ListMyReviewsV1) r.Get("/reviews/random", GetRandomReviewV1) @@ -58,5 +58,5 @@ func registerRoutes(r fiber.Router) { r.Get("/v3/reviews/_sensitive", ListSensitiveReviews) r.Put("/v3/reviews/:id/_sensitive", ModifyReviewSensitive) - r.Patch("/v3/reviews/:id/_sensitive", ModifyReviewSensitive) + r.Patch("/v3/reviews/:id/_sensitive/_webvpn", ModifyReviewSensitive) } diff --git a/danke/docs/docs.go b/danke/docs/docs.go index 6966afa..262727d 100644 --- a/danke/docs/docs.go +++ b/danke/docs/docs.go @@ -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": [ @@ -895,7 +895,9 @@ const docTemplate = `{ } } } - }, + } + }, + "/v3/reviews/{id}/_sensitive/_webvpn": { "patch": { "produces": [ "application/json" diff --git a/danke/docs/swagger.json b/danke/docs/swagger.json index 728b725..5439c2a 100644 --- a/danke/docs/swagger.json +++ b/danke/docs/swagger.json @@ -627,7 +627,7 @@ } } }, - "/reviews/{review_id}/_modify": { + "/reviews/{review_id}/_webvpn": { "patch": { "description": "modify a review, admin or owner can modify", "consumes": [ @@ -888,7 +888,9 @@ } } } - }, + } + }, + "/v3/reviews/{id}/_sensitive/_webvpn": { "patch": { "produces": [ "application/json" diff --git a/danke/docs/swagger.yaml b/danke/docs/swagger.yaml index e57920f..c1a27d5 100644 --- a/danke/docs/swagger.yaml +++ b/danke/docs/swagger.yaml @@ -840,7 +840,7 @@ paths: summary: modify a review tags: - Review - /reviews/{review_id}/_modify: + /reviews/{review_id}/_webvpn: patch: consumes: - application/json @@ -1035,7 +1035,7 @@ paths: tags: - Review /v3/reviews/{id}/_sensitive: - patch: + put: parameters: - description: id in: path @@ -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