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.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host history-api.kain.id.vn
// @BasePath /
// @schemes https http
// @securityDefinitions.apikey BearerAuth
// @in header

View File

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

View File

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

View File

@@ -163,7 +163,6 @@ definitions:
- TokenEmailVerify
- TokenMagicLink
- TokenRefreshToken
host: history-api.kain.id.vn
info:
contact:
email: support@swagger.io
@@ -730,9 +729,6 @@ paths:
summary: Get current user profile
tags:
- Users
schemes:
- https
- http
securityDefinitions:
BearerAuth:
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)
if err != nil {
if err != nil && !errors.Is(err, sql.ErrNoRows) {
return nil, fiber.NewError(fiber.StatusInternalServerError, err.Error())
}
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)
if err != nil {
if err != nil && !errors.Is(err, sql.ErrNoRows) {
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)
if err != nil {
if err != nil && !errors.Is(err, sql.ErrNoRows) {
return nil, fiber.NewError(fiber.StatusInternalServerError, "Internal Server Error")
}