services

package
v0.0.0-...-c48e8af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(config lib.Config, userService UserService, authMail mails.AuthMail, db lib.Database) AuthService

func (AuthService) Authenticate

func (s AuthService) Authenticate(ctx *gin.Context) (*models.User, error)

func (AuthService) GenerateToken

func (s AuthService) GenerateToken(user *models.User) (*dto.JWTResponse, error)

func (AuthService) Login

func (s AuthService) Login(login *dto.LoginRequest) (*dto.LoginResponse, error)

func (AuthService) ParseToken

func (s AuthService) ParseToken(tokenString string) (*dto.JWTClaims, error)

func (AuthService) Register

func (s AuthService) Register(register *dto.RegisterRequest) (*dto.RegisterResponse, error)

type PostService

type PostService struct {
	// contains filtered or unexported fields
}

func NewPostService

func NewPostService(postRepository repositories.PostRepository, postMail mails.PostMail) PostService

func (PostService) Create

func (s PostService) Create(params *dto.PostRequest, user *models.User) (*dto.PostResponse, error)

func (PostService) Delete

func (s PostService) Delete(post *models.Post) error

func (PostService) Get

func (s PostService) Get(id string) (*models.Post, error)

func (PostService) Query

func (PostService) Update

func (s PostService) Update(post *models.Post, params *dto.PostUpdateRequest) (*dto.PostResponse, error)

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func NewUserService

func NewUserService(db lib.Database, userRepository repositories.UserRepository, profileRepository repositories.ProfileRepository, authMail mails.AuthMail) UserService

func (UserService) Delete

func (s UserService) Delete(user *models.User) error

func (UserService) GetByUsername

func (s UserService) GetByUsername(username string) (*models.User, error)

func (UserService) Query

func (UserService) Register

func (s UserService) Register(params *dto.RegisterRequest) (*models.User, error)

func (UserService) Verify

func (s UserService) Verify(username, password string) (*models.User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL