Skip to content

Commit 0a31a33

Browse files
committed
fix(backend:swagger): updated invalid path on swag comment
1 parent 041c5e1 commit 0a31a33

8 files changed

Lines changed: 160 additions & 157 deletions

File tree

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ build:transcoder:
311311
# For free tier, use Trivy
312312
container_scanning:backend:
313313
stage: container-scan
314-
image: docker:24-stable
314+
image: docker:24
315315
services:
316316
- docker:24-dind
317317
variables:
@@ -345,7 +345,7 @@ container_scanning:backend:
345345

346346
container_scanning:transcoder:
347347
stage: container-scan
348-
image: docker:24-stable
348+
image: docker:24
349349
services:
350350
- docker:24-dind
351351
variables:

backend/server/auth_handler.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ type (
3434
// @Tags auth
3535
// @Accept x-www-form-urlencoded
3636
// @Produce json
37-
// @Param name formData string true "User name"
38-
// @Param email formData string true "User email"
39-
// @Param password formData string true "User password"
37+
// @Param name formData string true "Name"
38+
// @Param email formData string true "Email"
39+
// @Param password formData string true "Password"
4040
// @Success 200 {object} AuthResponse
4141
// @Failure 400 {object} AuthResponse
4242
// @Failure 500 {object} AuthResponse
43-
// @Router /auth/signup [post]
43+
// @Router /auth/users [post]
4444
func (s *Server) SignupHandler(c echo.Context) error {
4545
name := c.FormValue("name")
4646
email := c.FormValue("email")
@@ -81,6 +81,7 @@ func (s *Server) SignupHandler(c echo.Context) error {
8181
s.store.CreateUser(c.Request().Context(), db.CreateUserParams{
8282
ID: uuid.MustParse(userSub),
8383
Email: email,
84+
Name: name,
8485
})
8586

8687
return c.JSON(http.StatusOK, AuthResponse{
@@ -100,7 +101,7 @@ func (s *Server) SignupHandler(c echo.Context) error {
100101
// @Success 200 {object} AuthResponse
101102
// @Failure 400 {object} AuthResponse
102103
// @Failure 401 {object} AuthResponse
103-
// @Router /auth/login [post]
104+
// @Router /auth/sessions [post]
104105
func (s *Server) LoginHandler(c echo.Context) error {
105106
email := c.FormValue("email")
106107
password := c.FormValue("password")
@@ -136,7 +137,7 @@ func (s *Server) LoginHandler(c echo.Context) error {
136137
// @Success 200 {object} AuthResponse
137138
// @Failure 400 {object} AuthResponse
138139
// @Failure 500 {object} AuthResponse
139-
// @Router /auth/resend-otp [post]
140+
// @Router /auth/verifications [post]
140141
func (s *Server) ResentOTP(c echo.Context) error {
141142
email := c.FormValue("email")
142143
err := validator.Var(email, "required,email")
@@ -163,7 +164,7 @@ func (s *Server) ResentOTP(c echo.Context) error {
163164
// @Success 200 {object} AuthResponse
164165
// @Failure 400 {object} AuthResponse
165166
// @Failure 500 {object} AuthResponse
166-
// @Router /auth/confirm-signup [post]
167+
// @Router /auth/verifications/confirm [post]
167168
func (s *Server) ConfirmSignupHandler(c echo.Context) error {
168169
email := c.FormValue("email")
169170
otp := c.FormValue("otp")
@@ -192,7 +193,7 @@ func (s *Server) ConfirmSignupHandler(c echo.Context) error {
192193
// @Success 200 {object} AuthResponse
193194
// @Failure 400 {object} AuthResponse
194195
// @Failure 500 {object} AuthResponse
195-
// @Router /auth/refresh [post]
196+
// @Router /auth/tokens [post]
196197
func (s *Server) RefreshTokenHandler(c echo.Context) error {
197198
refreshCookie, err := c.Cookie("refresh_token")
198199
if err != nil {

backend/server/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (s *Server) registerRoutes(e *echo.Echo) {
148148

149149
// Auth routes
150150
authRoutes := e.Group("/auth")
151-
authRoutes.GET("/me", s.ProfileHandler)
151+
authRoutes.GET("/profile", s.ProfileHandler)
152152
authRoutes.POST("/users", s.SignupHandler)
153153
authRoutes.POST("/sessions", s.LoginHandler)
154154
authRoutes.POST("/tokens", s.RefreshTokenHandler)

backend/swagger/docs.go

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,19 @@ const docTemplate = `{
2222
"host": "{{.Host}}",
2323
"basePath": "{{.BasePath}}",
2424
"paths": {
25-
"/auth/confirm-signup": {
25+
"/auth/profile": {
2626
"post": {
27-
"description": "Confirm a user's signup using OTP",
27+
"description": "Get Profile Detail",
2828
"consumes": [
29-
"application/x-www-form-urlencoded"
29+
"application/json"
3030
],
3131
"produces": [
3232
"application/json"
3333
],
3434
"tags": [
3535
"auth"
3636
],
37-
"summary": "Confirm signup",
38-
"parameters": [
39-
{
40-
"type": "string",
41-
"description": "User email",
42-
"name": "email",
43-
"in": "formData",
44-
"required": true
45-
},
46-
{
47-
"type": "string",
48-
"description": "OTP code",
49-
"name": "otp",
50-
"in": "formData",
51-
"required": true
52-
}
53-
],
37+
"summary": "Profile",
5438
"responses": {
5539
"200": {
5640
"description": "OK",
@@ -73,7 +57,7 @@ const docTemplate = `{
7357
}
7458
}
7559
},
76-
"/auth/login": {
60+
"/auth/sessions": {
7761
"post": {
7862
"description": "Authenticate a user and set access/refresh cookies",
7963
"consumes": [
@@ -124,9 +108,9 @@ const docTemplate = `{
124108
}
125109
}
126110
},
127-
"/auth/profile": {
111+
"/auth/tokens": {
128112
"post": {
129-
"description": "Get Profile Detail",
113+
"description": "Refresh access token using refresh token cookie",
130114
"consumes": [
131115
"application/json"
132116
],
@@ -136,7 +120,7 @@ const docTemplate = `{
136120
"tags": [
137121
"auth"
138122
],
139-
"summary": "Profile",
123+
"summary": "Refresh access token",
140124
"responses": {
141125
"200": {
142126
"description": "OK",
@@ -159,19 +143,42 @@ const docTemplate = `{
159143
}
160144
}
161145
},
162-
"/auth/refresh": {
146+
"/auth/users": {
163147
"post": {
164-
"description": "Refresh access token using refresh token cookie",
148+
"description": "Create a new user account",
165149
"consumes": [
166-
"application/json"
150+
"application/x-www-form-urlencoded"
167151
],
168152
"produces": [
169153
"application/json"
170154
],
171155
"tags": [
172156
"auth"
173157
],
174-
"summary": "Refresh access token",
158+
"summary": "Sign up a new user",
159+
"parameters": [
160+
{
161+
"type": "string",
162+
"description": "Name",
163+
"name": "name",
164+
"in": "formData",
165+
"required": true
166+
},
167+
{
168+
"type": "string",
169+
"description": "Email",
170+
"name": "email",
171+
"in": "formData",
172+
"required": true
173+
},
174+
{
175+
"type": "string",
176+
"description": "Password",
177+
"name": "password",
178+
"in": "formData",
179+
"required": true
180+
}
181+
],
175182
"responses": {
176183
"200": {
177184
"description": "OK",
@@ -194,7 +201,7 @@ const docTemplate = `{
194201
}
195202
}
196203
},
197-
"/auth/resend-otp": {
204+
"/auth/verifications": {
198205
"post": {
199206
"description": "Resend confirmation code (OTP) to user's email",
200207
"consumes": [
@@ -238,9 +245,9 @@ const docTemplate = `{
238245
}
239246
}
240247
},
241-
"/auth/signup": {
248+
"/auth/verifications/confirm": {
242249
"post": {
243-
"description": "Create a new user account",
250+
"description": "Confirm a user's signup using OTP",
244251
"consumes": [
245252
"application/x-www-form-urlencoded"
246253
],
@@ -250,15 +257,8 @@ const docTemplate = `{
250257
"tags": [
251258
"auth"
252259
],
253-
"summary": "Sign up a new user",
260+
"summary": "Confirm signup",
254261
"parameters": [
255-
{
256-
"type": "string",
257-
"description": "User name",
258-
"name": "name",
259-
"in": "formData",
260-
"required": true
261-
},
262262
{
263263
"type": "string",
264264
"description": "User email",
@@ -268,8 +268,8 @@ const docTemplate = `{
268268
},
269269
{
270270
"type": "string",
271-
"description": "User password",
272-
"name": "password",
271+
"description": "OTP code",
272+
"name": "otp",
273273
"in": "formData",
274274
"required": true
275275
}

0 commit comments

Comments
 (0)