From fddc64799ee06e684e50e6b140ec0ba8e1dcc903 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 19 Mar 2024 07:41:53 -0400 Subject: [PATCH] refactor: put some account endpoints under account instead of auth --- api/account/account.go | 23 ++++++++++++----------- api/account/swagger.yaml | 10 +++++----- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/api/account/account.go b/api/account/account.go index 56ec3a4..6bdc211 100644 --- a/api/account/account.go +++ b/api/account/account.go @@ -387,17 +387,18 @@ func (a *AccountAPI) Routes() (*httprouter.Router, error) { }) routes := map[string]jape.Handler{ - "POST /api/auth/ping": middleware.ApplyMiddlewares(a.ping, corsMw.Handler, pingAuthMw, middleware.ProxyMiddleware), - "POST /api/auth/login": middleware.ApplyMiddlewares(a.login, corsMw.Handler, loginAuthMw2fa, middleware.ProxyMiddleware), - "POST /api/auth/register": middleware.ApplyMiddlewares(a.register, corsMw.Handler, middleware.ProxyMiddleware), - "POST /api/auth/verify-email": middleware.ApplyMiddlewares(a.verifyEmail, corsMw.Handler, middleware.ProxyMiddleware), - "POST /api/auth/otp/verify": middleware.ApplyMiddlewares(a.otpVerify, corsMw.Handler, authMw, middleware.ProxyMiddleware), - "POST /api/auth/otp/validate": middleware.ApplyMiddlewares(a.otpValidate, corsMw.Handler, authMw, middleware.ProxyMiddleware), - "POST /api/auth/otp/disable": middleware.ApplyMiddlewares(a.otpDisable, corsMw.Handler, authMw, middleware.ProxyMiddleware), - "POST /api/auth/password-reset/request": middleware.ApplyMiddlewares(a.passwordResetRequest, corsMw.Handler, middleware.ProxyMiddleware), - "POST /api/auth/password-reset/confirm": middleware.ApplyMiddlewares(a.passwordResetConfirm, corsMw.Handler, middleware.ProxyMiddleware), - "POST /api/auth/logout": middleware.ApplyMiddlewares(a.logout, corsMw.Handler, authMw, middleware.ProxyMiddleware), - "GET /*path": middleware.ApplyMiddlewares(getHandler, corsMw.Handler), + "POST /api/auth/ping": middleware.ApplyMiddlewares(a.ping, corsMw.Handler, pingAuthMw, middleware.ProxyMiddleware), + "POST /api/auth/login": middleware.ApplyMiddlewares(a.login, corsMw.Handler, loginAuthMw2fa, middleware.ProxyMiddleware), + "POST /api/auth/register": middleware.ApplyMiddlewares(a.register, corsMw.Handler, middleware.ProxyMiddleware), + "POST /api/auth/otp/validate": middleware.ApplyMiddlewares(a.otpValidate, corsMw.Handler, authMw, middleware.ProxyMiddleware), + "POST /api/auth/logout": middleware.ApplyMiddlewares(a.logout, corsMw.Handler, authMw, middleware.ProxyMiddleware), + + "POST /api/account/verify-email": middleware.ApplyMiddlewares(a.verifyEmail, corsMw.Handler, middleware.ProxyMiddleware), + "POST /api/account/otp/verify": middleware.ApplyMiddlewares(a.otpVerify, corsMw.Handler, authMw, middleware.ProxyMiddleware), + "POST /api/account/otp/disable": middleware.ApplyMiddlewares(a.otpDisable, corsMw.Handler, authMw, middleware.ProxyMiddleware), + "POST /api/account/password-reset/request": middleware.ApplyMiddlewares(a.passwordResetRequest, corsMw.Handler, middleware.ProxyMiddleware), + "POST /api/account/password-reset/confirm": middleware.ApplyMiddlewares(a.passwordResetConfirm, corsMw.Handler, middleware.ProxyMiddleware), + "GET /*path": middleware.ApplyMiddlewares(getHandler, corsMw.Handler), } return jape.Mux(routes), nil diff --git a/api/account/swagger.yaml b/api/account/swagger.yaml index 7f8dd21..c9d85ef 100644 --- a/api/account/swagger.yaml +++ b/api/account/swagger.yaml @@ -42,7 +42,7 @@ paths: description: Successfully registered '400': description: Bad Request - /api/auth/verify-email: + /api/account/verify-email: post: summary: Verify email address requestBody: @@ -64,7 +64,7 @@ paths: application/json: schema: $ref: '#/components/schemas/OTPGenerateResponse' - /api/auth/otp/verify: + /api/account/otp/verify: post: summary: Verify OTP for enabling two-factor authentication requestBody: @@ -76,7 +76,7 @@ paths: responses: '200': description: OTP verified successfully - /api/auth/otp/validate: + /api/account/otp/validate: post: summary: Validate OTP for two-factor authentication login requestBody: @@ -100,7 +100,7 @@ paths: responses: '200': description: OTP disabled successfully - /api/auth/password-reset/request: + /api/password-rese/password-reset/request: post: summary: Request a password reset requestBody: @@ -112,7 +112,7 @@ paths: responses: '200': description: Password reset requested successfully - /api/auth/password-reset/confirm: + /api/password-rese/password-reset/confirm: post: summary: Confirm a password reset requestBody: