UPDATE: Fix bug auth
All checks were successful
Build and Release / release (push) Successful in 53s

This commit is contained in:
2026-03-30 16:49:37 +07:00
parent a1496c5cd8
commit 44d0d0c973
5 changed files with 5 additions and 16 deletions

View File

@@ -114,9 +114,7 @@ func StartServer() {
// @license.name Apache 2.0 // @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html // @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host history-api.kain.id.vn
// @BasePath / // @BasePath /
// @schemes https http
// @securityDefinitions.apikey BearerAuth // @securityDefinitions.apikey BearerAuth
// @in header // @in header

View File

@@ -1119,9 +1119,9 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it // SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{ var SwaggerInfo = &swag.Spec{
Version: "1.0", Version: "1.0",
Host: "history-api.kain.id.vn", Host: "",
BasePath: "/", BasePath: "/",
Schemes: []string{"https", "http"}, Schemes: []string{},
Title: "History API", Title: "History API",
Description: "This is a sample server for History API.", Description: "This is a sample server for History API.",
InfoInstanceName: "swagger", InfoInstanceName: "swagger",

View File

@@ -1,8 +1,4 @@
{ {
"schemes": [
"https",
"http"
],
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "This is a sample server for History API.", "description": "This is a sample server for History API.",
@@ -19,7 +15,6 @@
}, },
"version": "1.0" "version": "1.0"
}, },
"host": "history-api.kain.id.vn",
"basePath": "/", "basePath": "/",
"paths": { "paths": {
"/auth/forgot-password": { "/auth/forgot-password": {

View File

@@ -163,7 +163,6 @@ definitions:
- TokenEmailVerify - TokenEmailVerify
- TokenMagicLink - TokenMagicLink
- TokenRefreshToken - TokenRefreshToken
host: history-api.kain.id.vn
info: info:
contact: contact:
email: support@swagger.io email: support@swagger.io
@@ -730,9 +729,6 @@ paths:
summary: Get current user profile summary: Get current user profile
tags: tags:
- Users - Users
schemes:
- https
- http
securityDefinitions: securityDefinitions:
BearerAuth: BearerAuth:
description: Type "Bearer " followed by a space and JWT token. description: Type "Bearer " followed by a space and JWT token.

View File

@@ -227,7 +227,7 @@ func (a *authService) Signup(ctx context.Context, dto *request.SignUpDto) (*resp
} }
user, err := a.userRepo.GetByEmail(ctx, dto.Email) user, err := a.userRepo.GetByEmail(ctx, dto.Email)
if err != nil { if err != nil && !errors.Is(err, sql.ErrNoRows) {
return nil, fiber.NewError(fiber.StatusInternalServerError, err.Error()) return nil, fiber.NewError(fiber.StatusInternalServerError, err.Error())
} }
if user != nil { if user != nil {
@@ -478,7 +478,7 @@ func (a *authService) CreateToken(ctx context.Context, dto *request.CreateTokenD
} }
user, err := a.userRepo.GetByEmail(ctx, dto.Email) user, err := a.userRepo.GetByEmail(ctx, dto.Email)
if err != nil { if err != nil && !errors.Is(err, sql.ErrNoRows) {
return fiber.NewError(fiber.StatusInternalServerError, "Internal Server Error") return fiber.NewError(fiber.StatusInternalServerError, "Internal Server Error")
} }
@@ -533,7 +533,7 @@ func (a *authService) VerifyToken(ctx context.Context, dto *request.VerifyTokenD
} }
user, err := a.userRepo.GetByEmail(ctx, dto.Email) user, err := a.userRepo.GetByEmail(ctx, dto.Email)
if err != nil { if err != nil && !errors.Is(err, sql.ErrNoRows) {
return nil, fiber.NewError(fiber.StatusInternalServerError, "Internal Server Error") return nil, fiber.NewError(fiber.StatusInternalServerError, "Internal Server Error")
} }