add service
Some checks failed
Deploy Smart Search Backend / deploy (push) Failing after 1m54s

This commit is contained in:
vallyenfail
2026-01-17 20:41:37 +03:00
parent 635acd13ac
commit e2968722ed
70 changed files with 7542 additions and 463 deletions

View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/golang-jwt/jwt/v5"
"github.com/google/uuid"
)
type Claims struct {
@@ -21,6 +22,7 @@ func GenerateAccessToken(userID int, secret string) (string, error) {
Sub: strconv.Itoa(userID),
Type: "access",
RegisteredClaims: jwt.RegisteredClaims{
ID: uuid.New().String(),
IssuedAt: jwt.NewNumericDate(now),
ExpiresAt: jwt.NewNumericDate(now.Add(15 * time.Minute)),
},
@@ -36,6 +38,7 @@ func GenerateRefreshToken(userID int, secret string) (string, error) {
Sub: strconv.Itoa(userID),
Type: "refresh",
RegisteredClaims: jwt.RegisteredClaims{
ID: uuid.New().String(),
IssuedAt: jwt.NewNumericDate(now),
ExpiresAt: jwt.NewNumericDate(now.Add(30 * 24 * time.Hour)),
},