fix: regen oapi for auth
All checks were successful
Build and Deploy Go App / build (push) Successful in 5m51s
Build and Deploy Go App / deploy (push) Successful in 25s

This commit is contained in:
nihonium 2025-12-04 07:20:10 +03:00
parent e316617175
commit b03f9c9704
Signed by: nihonium
GPG key ID: 0251623741027CFC
2 changed files with 60 additions and 60 deletions

View file

@ -78,7 +78,7 @@ func (s Server) generateTokens(userID string) (accessToken string, refreshToken
return accessToken, refreshToken, csrfToken, nil
}
func (s Server) PostAuthSignUp(ctx context.Context, req auth.PostAuthSignUpRequestObject) (auth.PostAuthSignUpResponseObject, error) {
func (s Server) PostSignUp(ctx context.Context, req auth.PostSignUpRequestObject) (auth.PostSignUpResponseObject, error) {
passhash, err := HashPassword(req.Body.Pass)
if err != nil {
log.Errorf("failed to hash password: %v", err)
@ -94,17 +94,17 @@ func (s Server) PostAuthSignUp(ctx context.Context, req auth.PostAuthSignUpReque
// TODO: check err and retyrn 400/500
}
return auth.PostAuthSignUp200JSONResponse{
return auth.PostSignUp200JSONResponse{
UserId: user_id,
}, nil
}
func (s Server) PostAuthSignIn(ctx context.Context, req auth.PostAuthSignInRequestObject) (auth.PostAuthSignInResponseObject, error) {
func (s Server) PostSignIn(ctx context.Context, req auth.PostSignInRequestObject) (auth.PostSignInResponseObject, error) {
ginCtx, ok := ctx.Value(gin.ContextKey).(*gin.Context)
if !ok {
log.Print("failed to get gin context")
// TODO: change to 500
return auth.PostAuthSignIn200JSONResponse{}, fmt.Errorf("failed to get gin.Context from context.Context")
return auth.PostSignIn200JSONResponse{}, fmt.Errorf("failed to get gin.Context from context.Context")
}
user, err := s.db.GetUserByNickname(context.Background(), req.Body.Nickname)
@ -120,7 +120,7 @@ func (s Server) PostAuthSignIn(ctx context.Context, req auth.PostAuthSignInReque
}
if !ok {
err_msg := "invalid credentials"
return auth.PostAuthSignIn401JSONResponse{
return auth.PostSignIn401JSONResponse{
Error: &err_msg,
}, nil
}
@ -137,7 +137,7 @@ func (s Server) PostAuthSignIn(ctx context.Context, req auth.PostAuthSignInReque
ginCtx.SetCookie("refresh_token", refreshToken, 1209600, "/auth", "", false, true)
ginCtx.SetCookie("xsrf_token", csrfToken, 1209600, "/api", "", false, false)
result := auth.PostAuthSignIn200JSONResponse{
result := auth.PostSignIn200JSONResponse{
UserId: user.ID,
UserName: user.Nickname,
}