Skip to content

Commit fb010e5

Browse files
authored
Merge pull request #28 from fsy2001/put
change: PUT route path suffix
2 parents b8fa7bc + 8111025 commit fb010e5

7 files changed

Lines changed: 38 additions & 28 deletions

File tree

apis/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func register(c *fiber.Ctx, email, password string, batch bool) error {
337337
// @Accept json
338338
// @Produce json
339339
// @Router /register [put]
340-
// @Router /register [patch]
340+
// @Router /register/_webvpn [patch]
341341
// @Param json body RegisterRequest true "json"
342342
// @Success 200 {object} TokenResponse
343343
// @Failure 400 {object} common.MessageResponse "验证码错误"

apis/routes.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func RegisterRoutes(app *fiber.App) {
3232
routes.Get("/verify/apikey", VerifyWithApikey)
3333
routes.Post("/register", Register)
3434
routes.Put("/register", ChangePassword)
35-
routes.Patch("/register", ChangePassword)
35+
routes.Patch("/register/_webvpn", ChangePassword)
3636
routes.Delete("/users/me", DeleteUser)
3737
routes.Delete("/users/:id", DeleteUserByID)
3838

@@ -53,7 +53,7 @@ func RegisterRoutes(app *fiber.App) {
5353
routes.Get("/users/:id", GetUserByID)
5454
routes.Get("/users", ListUsers)
5555
routes.Put("/users/:id", ModifyUser)
56-
routes.Patch("/users/:id<int>/_modify", ModifyUser)
56+
routes.Patch("/users/:id<int>/_webvpn", ModifyUser)
5757

5858
// shamir
5959
routes.Get("/shamir/status", GetShamirStatus)
@@ -63,7 +63,7 @@ func RegisterRoutes(app *fiber.App) {
6363
routes.Post("/shamir/key", UploadPublicKey)
6464
routes.Post("/shamir/update", UpdateShamir)
6565
routes.Put("/shamir/refresh", RefreshShamir)
66-
routes.Patch("/shamir/refresh", RefreshShamir)
66+
routes.Patch("/shamir/refresh/_webvpn", RefreshShamir)
6767
routes.Post("/shamir/decrypt", UploadUserShares)
6868
routes.Get("/shamir/decrypt/:id", GetDecryptedUserEmail)
6969
routes.Get("/shamir/decrypt/status/:id", GetDecryptStatusbyUserID)

apis/shamir.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func UpdateShamir(c *fiber.Ctx) error {
333333
// @Summary trigger for refresh uploaded shares
334334
// @Tags shamir
335335
// @Router /shamir/refresh [put]
336-
// @Router /shamir/refresh [patch]
336+
// @Router /shamir/refresh/_webvpn [patch]
337337
// @Success 204
338338
// @Failure 403 {object} common.MessageResponse "非管理员"
339339
// @failure 500 {object} common.MessageResponse

apis/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func ListAdmin(c *fiber.Ctx) error {
9595
// @Tags user
9696
// @Produce json
9797
// @Router /users/{user_id} [put]
98-
// @Router /users/{user_id}/_modify [patch]
98+
// @Router /users/{user_id}/_webvpn [patch]
9999
// @Param user_id path int true "UserID"
100100
// @Success 201 {object} User
101101
// @Failure 403 {object} common.MessageResponse "不是管理员"

docs/docs.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ const docTemplate = `{
320320
}
321321
}
322322
}
323-
},
323+
}
324+
},
325+
"/register/_webvpn": {
324326
"patch": {
325327
"description": "reset password, reset jwt credential",
326328
"consumes": [
@@ -753,7 +755,9 @@ const docTemplate = `{
753755
}
754756
}
755757
}
756-
},
758+
}
759+
},
760+
"/shamir/refresh/_webvpn": {
757761
"patch": {
758762
"tags": [
759763
"shamir"
@@ -1239,7 +1243,7 @@ const docTemplate = `{
12391243
}
12401244
}
12411245
},
1242-
"/users/{user_id}/_modify": {
1246+
"/users/{user_id}/_webvpn": {
12431247
"patch": {
12441248
"description": "modify user, owner or admin",
12451249
"produces": [

docs/swagger.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@
314314
}
315315
}
316316
}
317-
},
317+
}
318+
},
319+
"/register/_webvpn": {
318320
"patch": {
319321
"description": "reset password, reset jwt credential",
320322
"consumes": [
@@ -747,7 +749,9 @@
747749
}
748750
}
749751
}
750-
},
752+
}
753+
},
754+
"/shamir/refresh/_webvpn": {
751755
"patch": {
752756
"tags": [
753757
"shamir"
@@ -1233,7 +1237,7 @@
12331237
}
12341238
}
12351239
},
1236-
"/users/{user_id}/_modify": {
1240+
"/users/{user_id}/_webvpn": {
12371241
"patch": {
12381242
"description": "modify user, owner or admin",
12391243
"produces": [

docs/swagger.yaml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,10 @@ paths:
538538
tags:
539539
- token
540540
/register:
541-
patch:
541+
post:
542542
consumes:
543543
- application/json
544-
description: reset password, reset jwt credential
544+
description: register with email, password and verification code
545545
parameters:
546546
- description: json
547547
in: body
@@ -552,25 +552,25 @@ paths:
552552
produces:
553553
- application/json
554554
responses:
555-
"200":
556-
description: OK
555+
"201":
556+
description: Created
557557
schema:
558558
$ref: '#/definitions/apis.TokenResponse'
559559
"400":
560-
description: 验证码错误
560+
description: 验证码错误、用户已注册
561561
schema:
562562
$ref: '#/definitions/common.MessageResponse'
563563
"500":
564564
description: Internal Server Error
565565
schema:
566566
$ref: '#/definitions/common.MessageResponse'
567-
summary: reset password
567+
summary: register
568568
tags:
569569
- account
570-
post:
570+
put:
571571
consumes:
572572
- application/json
573-
description: register with email, password and verification code
573+
description: reset password, reset jwt credential
574574
parameters:
575575
- description: json
576576
in: body
@@ -581,22 +581,23 @@ paths:
581581
produces:
582582
- application/json
583583
responses:
584-
"201":
585-
description: Created
584+
"200":
585+
description: OK
586586
schema:
587587
$ref: '#/definitions/apis.TokenResponse'
588588
"400":
589-
description: 验证码错误、用户已注册
589+
description: 验证码错误
590590
schema:
591591
$ref: '#/definitions/common.MessageResponse'
592592
"500":
593593
description: Internal Server Error
594594
schema:
595595
$ref: '#/definitions/common.MessageResponse'
596-
summary: register
596+
summary: reset password
597597
tags:
598598
- account
599-
put:
599+
/register/_webvpn:
600+
patch:
600601
consumes:
601602
- application/json
602603
description: reset password, reset jwt credential
@@ -891,7 +892,7 @@ paths:
891892
tags:
892893
- shamir
893894
/shamir/refresh:
894-
patch:
895+
put:
895896
responses:
896897
"204":
897898
description: No Content
@@ -906,7 +907,8 @@ paths:
906907
summary: trigger for refresh uploaded shares
907908
tags:
908909
- shamir
909-
put:
910+
/shamir/refresh/_webvpn:
911+
patch:
910912
responses:
911913
"204":
912914
description: No Content
@@ -1117,7 +1119,7 @@ paths:
11171119
summary: modify user
11181120
tags:
11191121
- user
1120-
/users/{user_id}/_modify:
1122+
/users/{user_id}/_webvpn:
11211123
patch:
11221124
description: modify user, owner or admin
11231125
parameters:

0 commit comments

Comments
 (0)