From d7b9c3f6829014ed76f87afd78ed698995ee8b2a Mon Sep 17 00:00:00 2001 From: fsy2001 Date: Sun, 4 Aug 2024 15:59:00 +0800 Subject: [PATCH] change: PUT route suffix --- apis/division/routes.go | 2 +- apis/favourite/routes.go | 4 ++-- apis/floor/apis.go | 4 ++-- apis/floor/routes.go | 4 ++-- apis/hole/apis.go | 2 +- apis/hole/routes.go | 2 +- apis/message/apis.go | 2 +- apis/message/routes.go | 2 +- apis/tag/apis.go | 2 +- apis/tag/routes.go | 2 +- apis/user/apis.go | 8 ++++---- docs/docs.go | 32 +++++++++++++++++--------------- docs/swagger.json | 32 +++++++++++++++++--------------- docs/swagger.yaml | 31 ++++++++++++++++--------------- 14 files changed, 67 insertions(+), 62 deletions(-) diff --git a/apis/division/routes.go b/apis/division/routes.go index 1df14e8..67b5dfe 100644 --- a/apis/division/routes.go +++ b/apis/division/routes.go @@ -7,6 +7,6 @@ func RegisterRoutes(app fiber.Router) { app.Get("/divisions", ListDivisions) app.Get("/divisions/:id", GetDivision) app.Put("/divisions/:id", ModifyDivision) - app.Patch("/divisions/:id/_modify", ModifyDivision) + app.Patch("/divisions/:id/_webvpn", ModifyDivision) app.Delete("/divisions/:id", DeleteDivision) } diff --git a/apis/favourite/routes.go b/apis/favourite/routes.go index 09314d5..889f7b2 100644 --- a/apis/favourite/routes.go +++ b/apis/favourite/routes.go @@ -6,12 +6,12 @@ func RegisterRoutes(app fiber.Router) { app.Get("/user/favorites", ListFavorites) app.Post("/user/favorites", AddFavorite) app.Put("/user/favorites", ModifyFavorite) - app.Patch("/user/favorites/_modify", ModifyFavorite) + app.Patch("/user/favorites/_webvpn", ModifyFavorite) app.Delete("/user/favorites", DeleteFavorite) app.Get("/user/favorite_groups", ListFavoriteGroups) app.Post("/user/favorite_groups", AddFavoriteGroup) app.Put("/user/favorite_groups", ModifyFavoriteGroup) - app.Patch("/user/favorite_groups/_modify", ModifyFavoriteGroup) + app.Patch("/user/favorite_groups/_webvpn", ModifyFavoriteGroup) app.Delete("/user/favorite_groups", DeleteFavoriteGroup) app.Put("/user/favorites/move", MoveFavorite) } diff --git a/apis/floor/apis.go b/apis/floor/apis.go index 75c32a9..1e3c162 100644 --- a/apis/floor/apis.go +++ b/apis/floor/apis.go @@ -300,7 +300,7 @@ func CreateFloorOld(c *fiber.Ctx) error { // @Tags Floor // @Produce application/json // @Router /floors/{id} [put] -// @Router /floors/{id}/_modify [patch] +// @Router /floors/{id}/_webvpn [patch] // @Param id path int true "id" // @Param json body ModifyModel true "json" // @Success 200 {object} Floor @@ -958,7 +958,7 @@ func ListSensitiveFloors(c *fiber.Ctx) (err error) { // @Tags Floor // @Produce application/json // @Router /floors/{id}/_sensitive [put] -// @Router /floors/{id}/_sensitive [patch] +// @Router /floors/{id}/_sensitive/_webvpn [patch] // @Param id path int true "id" // @Param json body ModifySensitiveFloorRequest true "json" // @Success 200 {object} Floor diff --git a/apis/floor/routes.go b/apis/floor/routes.go index 3f8ff76..2647e3f 100644 --- a/apis/floor/routes.go +++ b/apis/floor/routes.go @@ -16,7 +16,7 @@ func RegisterRoutes(app fiber.Router) { app.Post("/holes/:id/floors", utils.MiddlewareHasAnsweredQuestions, CreateFloor) app.Post("/floors", utils.MiddlewareHasAnsweredQuestions, CreateFloorOld) app.Put("/floors/:id", ModifyFloor) - app.Patch("/floors/:id/_modify", ModifyFloor) + app.Patch("/floors/:id/_webvpn", ModifyFloor) app.Post("/floors/:id/like/:like", ModifyFloorLike) app.Delete("/floors/:id", DeleteFloor) @@ -31,5 +31,5 @@ func RegisterRoutes(app fiber.Router) { app.Get("/floors/_sensitive", ListSensitiveFloors) app.Put("/floors/:id/_sensitive", ModifyFloorSensitive) - app.Patch("/floors/:id/_sensitive", ModifyFloorSensitive) + app.Patch("/floors/:id/_sensitive/_webvpn", ModifyFloorSensitive) } diff --git a/apis/hole/apis.go b/apis/hole/apis.go index aaf60b2..2af1afe 100644 --- a/apis/hole/apis.go +++ b/apis/hole/apis.go @@ -396,7 +396,7 @@ func CreateHoleOld(c *fiber.Ctx) error { // @Tags Hole // @Produce application/json // @Router /holes/{id} [put] -// @Router /holes/{id}/_modify [patch] +// @Router /holes/{id}/_webvpn [patch] // @Param id path int true "id" // @Param json body ModifyModel true "json" // @Success 200 {object} Hole diff --git a/apis/hole/routes.go b/apis/hole/routes.go index 2d97c05..777e522 100644 --- a/apis/hole/routes.go +++ b/apis/hole/routes.go @@ -15,7 +15,7 @@ func RegisterRoutes(app fiber.Router) { app.Get("/holes/_good", ListGoodHoles) app.Post("/divisions/:id/holes", utils.MiddlewareHasAnsweredQuestions, CreateHole) app.Post("/holes", utils.MiddlewareHasAnsweredQuestions, CreateHoleOld) - app.Patch("/holes/:id/_modify", ModifyHole) + app.Patch("/holes/:id/_webvpn", ModifyHole) app.Patch("/holes/:id", PatchHole) app.Put("/holes/:id", ModifyHole) app.Delete("/holes/:id", HideHole) diff --git a/apis/message/apis.go b/apis/message/apis.go index 3066270..4c736e2 100644 --- a/apis/message/apis.go +++ b/apis/message/apis.go @@ -125,7 +125,7 @@ func ClearMessages(c *fiber.Ctx) error { // @Tags Message // @Produce application/json // @Router /messages [put] -// @Router /messages/_clear [patch] +// @Router /messages/_webvpn [patch] // @Success 204 func ClearMessagesDeprecated(c *fiber.Ctx) error { return ClearMessages(c) diff --git a/apis/message/routes.go b/apis/message/routes.go index 5c9a012..4eae0f2 100644 --- a/apis/message/routes.go +++ b/apis/message/routes.go @@ -7,6 +7,6 @@ func RegisterRoutes(app fiber.Router) { app.Get("/messages", ListMessages) app.Post("/messages/clear", ClearMessages) app.Put("/messages", ClearMessagesDeprecated) - app.Patch("/messages/_clear", ClearMessagesDeprecated) + app.Patch("/messages/_webvpn", ClearMessagesDeprecated) app.Delete("/messages/:id", DeleteMessage) } diff --git a/apis/tag/apis.go b/apis/tag/apis.go index 4ae6364..1bbbf69 100644 --- a/apis/tag/apis.go +++ b/apis/tag/apis.go @@ -138,7 +138,7 @@ func CreateTag(c *fiber.Ctx) error { // @Tags Tag // @Produce application/json // @Router /tags/{id} [put] -// @Router /tags/{id}/_modify [patch] +// @Router /tags/{id}/_webvpn [patch] // @Param id path int true "id" // @Param json body ModifyModel true "json" // @Success 200 {object} Tag diff --git a/apis/tag/routes.go b/apis/tag/routes.go index 6751be5..075b2b3 100644 --- a/apis/tag/routes.go +++ b/apis/tag/routes.go @@ -7,6 +7,6 @@ func RegisterRoutes(app fiber.Router) { app.Get("/tags/:id", GetTag) app.Post("/tags", CreateTag) app.Put("/tags/:id", ModifyTag) - app.Patch("/tags/:id/_modify", ModifyTag) + app.Patch("/tags/:id/_webvpn", ModifyTag) app.Delete("/tags/:id", DeleteTag) } diff --git a/apis/user/apis.go b/apis/user/apis.go index a45b805..4d7b79a 100644 --- a/apis/user/apis.go +++ b/apis/user/apis.go @@ -12,9 +12,9 @@ func RegisterRoutes(app fiber.Router) { app.Get("/users/me", GetCurrentUser) app.Get("/users/:id", GetUserByID) app.Put("/users/:id", ModifyUser) - app.Patch("/users/:id/_modify", ModifyUser) + app.Patch("/users/:id/_webvpn", ModifyUser) app.Put("/users/me", ModifyCurrentUser) - app.Patch("/users/me/_modify", ModifyCurrentUser) + app.Patch("/users/me/_webvpn", ModifyCurrentUser) } // GetCurrentUser @@ -70,7 +70,7 @@ func GetUserByID(c *fiber.Ctx) error { // @Tags User // @Produce json // @Router /users/{user_id} [put] -// @Router /users/{user_id}/_modify [patch] +// @Router /users/{user_id}/_webvpn [patch] // @Param user_id path int true "user id" // @Param json body ModifyModel true "modify user" // @Success 200 {object} User @@ -115,7 +115,7 @@ func ModifyUser(c *fiber.Ctx) error { // @Tags User // @Produce json // @Router /users/me [put] -// @Router /users/me/_modify [patch] +// @Router /users/me/_webvpn [patch] // @Param user_id path int true "user id" // @Param json body ModifyModel true "modify user" // @Success 200 {object} User diff --git a/docs/docs.go b/docs/docs.go index ffccd1f..3416a7b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -733,16 +733,15 @@ const docTemplate = `{ } } }, - "/floors/{id}/_modify": { - "patch": { - "description": "when both \"fold_v2\" and \"fold\" are empty, reset fold; else, \"fold_v2\" has the priority", + "/floors/{id}/_sensitive": { + "put": { "produces": [ "application/json" ], "tags": [ "Floor" ], - "summary": "Modify A Floor", + "summary": "Modify A Floor's actual_sensitive, admin only", "parameters": [ { "type": "integer", @@ -757,7 +756,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/floor.ModifyModel" + "$ref": "#/definitions/floor.ModifySensitiveFloorRequest" } } ], @@ -777,8 +776,8 @@ const docTemplate = `{ } } }, - "/floors/{id}/_sensitive": { - "put": { + "/floors/{id}/_sensitive/_webvpn": { + "patch": { "produces": [ "application/json" ], @@ -818,15 +817,18 @@ const docTemplate = `{ } } } - }, + } + }, + "/floors/{id}/_webvpn": { "patch": { + "description": "when both \"fold_v2\" and \"fold\" are empty, reset fold; else, \"fold_v2\" has the priority", "produces": [ "application/json" ], "tags": [ "Floor" ], - "summary": "Modify A Floor's actual_sensitive, admin only", + "summary": "Modify A Floor", "parameters": [ { "type": "integer", @@ -841,7 +843,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/floor.ModifySensitiveFloorRequest" + "$ref": "#/definitions/floor.ModifyModel" } } ], @@ -1466,7 +1468,7 @@ const docTemplate = `{ } } }, - "/holes/{id}/_modify": { + "/holes/{id}/_webvpn": { "patch": { "description": "Modify a hole, modify tags and set the name mapping\nOnly admin can modify division, tags, hidden, lock\n` + "`" + `unhidden` + "`" + ` take effect only when hole is hidden and set to true", "produces": [ @@ -1583,7 +1585,7 @@ const docTemplate = `{ } } }, - "/messages/_clear": { + "/messages/_webvpn": { "patch": { "produces": [ "application/json" @@ -2068,7 +2070,7 @@ const docTemplate = `{ } } }, - "/tags/{id}/_modify": { + "/tags/{id}/_webvpn": { "patch": { "produces": [ "application/json" @@ -2622,7 +2624,7 @@ const docTemplate = `{ } } }, - "/users/me/_modify": { + "/users/me/_webvpn": { "patch": { "produces": [ "application/json" @@ -2967,7 +2969,7 @@ const docTemplate = `{ } } }, - "/users/{user_id}/_modify": { + "/users/{user_id}/_webvpn": { "patch": { "produces": [ "application/json" diff --git a/docs/swagger.json b/docs/swagger.json index 8f6518b..bfe6f02 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -726,16 +726,15 @@ } } }, - "/floors/{id}/_modify": { - "patch": { - "description": "when both \"fold_v2\" and \"fold\" are empty, reset fold; else, \"fold_v2\" has the priority", + "/floors/{id}/_sensitive": { + "put": { "produces": [ "application/json" ], "tags": [ "Floor" ], - "summary": "Modify A Floor", + "summary": "Modify A Floor's actual_sensitive, admin only", "parameters": [ { "type": "integer", @@ -750,7 +749,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/floor.ModifyModel" + "$ref": "#/definitions/floor.ModifySensitiveFloorRequest" } } ], @@ -770,8 +769,8 @@ } } }, - "/floors/{id}/_sensitive": { - "put": { + "/floors/{id}/_sensitive/_webvpn": { + "patch": { "produces": [ "application/json" ], @@ -811,15 +810,18 @@ } } } - }, + } + }, + "/floors/{id}/_webvpn": { "patch": { + "description": "when both \"fold_v2\" and \"fold\" are empty, reset fold; else, \"fold_v2\" has the priority", "produces": [ "application/json" ], "tags": [ "Floor" ], - "summary": "Modify A Floor's actual_sensitive, admin only", + "summary": "Modify A Floor", "parameters": [ { "type": "integer", @@ -834,7 +836,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/floor.ModifySensitiveFloorRequest" + "$ref": "#/definitions/floor.ModifyModel" } } ], @@ -1459,7 +1461,7 @@ } } }, - "/holes/{id}/_modify": { + "/holes/{id}/_webvpn": { "patch": { "description": "Modify a hole, modify tags and set the name mapping\nOnly admin can modify division, tags, hidden, lock\n`unhidden` take effect only when hole is hidden and set to true", "produces": [ @@ -1576,7 +1578,7 @@ } } }, - "/messages/_clear": { + "/messages/_webvpn": { "patch": { "produces": [ "application/json" @@ -2061,7 +2063,7 @@ } } }, - "/tags/{id}/_modify": { + "/tags/{id}/_webvpn": { "patch": { "produces": [ "application/json" @@ -2615,7 +2617,7 @@ } } }, - "/users/me/_modify": { + "/users/me/_webvpn": { "patch": { "produces": [ "application/json" @@ -2960,7 +2962,7 @@ } } }, - "/users/{user_id}/_modify": { + "/users/{user_id}/_webvpn": { "patch": { "produces": [ "application/json" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 4323293..874a545 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1241,10 +1241,8 @@ paths: summary: Modify A Floor tags: - Floor - /floors/{id}/_modify: - patch: - description: when both "fold_v2" and "fold" are empty, reset fold; else, "fold_v2" - has the priority + /floors/{id}/_sensitive: + put: parameters: - description: id in: path @@ -1256,7 +1254,7 @@ paths: name: json required: true schema: - $ref: '#/definitions/floor.ModifyModel' + $ref: '#/definitions/floor.ModifySensitiveFloorRequest' produces: - application/json responses: @@ -1268,10 +1266,10 @@ paths: description: Not Found schema: $ref: '#/definitions/models.MessageModel' - summary: Modify A Floor + summary: Modify A Floor's actual_sensitive, admin only tags: - Floor - /floors/{id}/_sensitive: + /floors/{id}/_sensitive/_webvpn: patch: parameters: - description: id @@ -1299,7 +1297,10 @@ paths: summary: Modify A Floor's actual_sensitive, admin only tags: - Floor - put: + /floors/{id}/_webvpn: + patch: + description: when both "fold_v2" and "fold" are empty, reset fold; else, "fold_v2" + has the priority parameters: - description: id in: path @@ -1311,7 +1312,7 @@ paths: name: json required: true schema: - $ref: '#/definitions/floor.ModifySensitiveFloorRequest' + $ref: '#/definitions/floor.ModifyModel' produces: - application/json responses: @@ -1323,7 +1324,7 @@ paths: description: Not Found schema: $ref: '#/definitions/models.MessageModel' - summary: Modify A Floor's actual_sensitive, admin only + summary: Modify A Floor tags: - Floor /floors/{id}/history: @@ -1794,7 +1795,7 @@ paths: summary: Delete A Hole tags: - Hole - /holes/{id}/_modify: + /holes/{id}/_webvpn: patch: description: |- Modify a hole, modify tags and set the name mapping @@ -1873,7 +1874,7 @@ paths: summary: Clear Messages Deprecated tags: - Message - /messages/_clear: + /messages/_webvpn: patch: produces: - application/json @@ -2191,7 +2192,7 @@ paths: summary: Modify A Tag, admin only tags: - Tag - /tags/{id}/_modify: + /tags/{id}/_webvpn: patch: parameters: - description: id @@ -2574,7 +2575,7 @@ paths: summary: modify user profiles tags: - User - /users/{user_id}/_modify: + /users/{user_id}/_webvpn: patch: parameters: - description: user id @@ -2629,7 +2630,7 @@ paths: summary: modify current user profiles tags: - User - /users/me/_modify: + /users/me/_webvpn: patch: parameters: - description: modify user