endpoints returning languages, countries and currencies
This commit is contained in:
@@ -27,8 +27,8 @@ type JWTClaims struct {
|
||||
Email string `json:"email"`
|
||||
Username string `json:"username"`
|
||||
Role model.CustomerRole `json:"customer_role"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
CartsIDs []uint `json:"carts_ids"`
|
||||
CountryID uint `json:"country_id"`
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
@@ -476,8 +476,8 @@ func (s *AuthService) generateAccessToken(user *model.Customer) (string, error)
|
||||
Email: user.Email,
|
||||
Username: user.Email,
|
||||
Role: user.Role,
|
||||
FirstName: user.FirstName,
|
||||
LastName: user.LastName,
|
||||
CartsIDs: []uint{},
|
||||
CountryID: 1,
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Duration(s.config.JWTExpiration) * time.Second)),
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
|
||||
28
app/service/jwtService/jwtService.go
Normal file
28
app/service/jwtService/jwtService.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package jwtService
|
||||
|
||||
import (
|
||||
"git.ma-al.com/goc_daniel/b2b/app/model"
|
||||
"git.ma-al.com/goc_daniel/b2b/repository/jwtFieldsRepo"
|
||||
)
|
||||
|
||||
// jwtService handles updating JWT cookies
|
||||
type JWTService struct {
|
||||
repo jwtFieldsRepo.JWTFieldsRepo
|
||||
}
|
||||
|
||||
// NewJWTService creates a new JWT service
|
||||
func New() *JWTService {
|
||||
return &JWTService{}
|
||||
}
|
||||
|
||||
func (s *JWTService) GetLanguages() ([]model.Language, error) {
|
||||
return s.repo.GetLanguages()
|
||||
}
|
||||
|
||||
func (s *JWTService) GetCountriesAndCurrencies() ([]model.Country, error) {
|
||||
return s.repo.GetCountriesAndCurrencies()
|
||||
}
|
||||
|
||||
func (s *JWTService) UpdateChoice() error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user