Documentation ¶
Index ¶
- Variables
- type Auth
- type AuthCreateUserInput
- type AuthGenerateTokenInput
- type AuthService
- type Services
- type ServicesDependencies
- type Slug
- type SlugService
- func (s *SlugService) AddUserToSlug(ctx context.Context, slugsToAdd []string, slugsToDelete []string, userId int) error
- func (s *SlugService) CreateSlug(ctx context.Context, slugName string) (int, error)
- func (s *SlugService) DeleteSlug(ctx context.Context, slugName string) error
- func (s *SlugService) GetActiveSlugs(ctx context.Context, userId int) ([]entities.Slug, error)
- type TokenClaims
- type User
- type UserService
- func (s *UserService) GetUserById(ctx context.Context, id int) (entities.User, error)
- func (s *UserService) GetUserByUsername(ctx context.Context, username string) (entities.User, error)
- func (s *UserService) GetUserByUsernameAndPassword(ctx context.Context, username, password string) (entities.User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserAlreadyExists = fmt.Errorf("user already exist") ErrCannotCreateUser = fmt.Errorf("cannot create user") ErrUserNotFound = fmt.Errorf("user not found") ErrCannotGetUser = fmt.Errorf("cannot get user") ErrSlugAlreadyExists = fmt.Errorf("slug already exist") ErrCannotCreateSlug = fmt.Errorf("cannot create slug") ErrSlugNotFound = fmt.Errorf("slug not found") ErrCannotDeleteSlug = fmt.Errorf("cannot delete slug") ErrCannotGetSlug = fmt.Errorf("cannot get slug") ErrCannotSignToken = fmt.Errorf("cannot sign token") ErrCannotParseToken = fmt.Errorf("cannot parse tocken") )
Functions ¶
This section is empty.
Types ¶
type AuthCreateUserInput ¶
type AuthGenerateTokenInput ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService( userRepo repo.User, passwordHasher hasher.PasswordHasher, signKey string, tokenTTL time.Duration, ) *AuthService
func (*AuthService) CreateUser ¶
func (s *AuthService) CreateUser(ctx context.Context, input AuthCreateUserInput) (int, error)
func (*AuthService) GenerateToken ¶
func (s *AuthService) GenerateToken(ctx context.Context, input AuthGenerateTokenInput) (string, error)
func (*AuthService) ParseToken ¶
func (s *AuthService) ParseToken(accessToken string) (int, error)
type Services ¶
func NewServices ¶
func NewServices(deps *ServicesDependencies) *Services
type ServicesDependencies ¶
type ServicesDependencies struct { Repos *repo.Repositories Hasher hasher.PasswordHasher SignKey string TokenTTL time.Duration }
type Slug ¶
type Slug interface { CreateSlug(ctx context.Context, slugName string) (int, error) DeleteSlug(ctx context.Context, slugName string) error AddUserToSlug(ctx context.Context, slugsToAdd []string, slugsToDelete []string, userId int) error GetActiveSlugs(ctx context.Context, userId int) ([]entities.Slug, error) }
type SlugService ¶
type SlugService struct {
// contains filtered or unexported fields
}
func NewSlugService ¶
func NewSlugService(userRepo repo.User, slugRepo repo.Slug, membershipRepo repo.Membership) *SlugService
func (*SlugService) AddUserToSlug ¶
func (*SlugService) CreateSlug ¶
func (*SlugService) DeleteSlug ¶
func (s *SlugService) DeleteSlug(ctx context.Context, slugName string) error
func (*SlugService) GetActiveSlugs ¶
type TokenClaims ¶
type TokenClaims struct { jwt.StandardClaims UserId int }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(userRepo repo.User) *UserService
func (*UserService) GetUserById ¶
func (*UserService) GetUserByUsername ¶
func (*UserService) GetUserByUsernameAndPassword ¶
Click to show internal directories.
Click to hide internal directories.