service

package
v0.0.0-...-d9efa11 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSalt

func GenerateSalt() (string, error)

func HashPassword

func HashPassword(password, salt string) string

Types

type AuthService

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

func NewAuthService

func NewAuthService(repo repository.Authorization, secretKey []byte) *AuthService

func (*AuthService) CreateSession

func (a *AuthService) CreateSession(session *models.Session) (*models.Session, error)

func (*AuthService) CreateToken

func (a *AuthService) CreateToken(id int64, email string, isAdmin bool, duration time.Duration) (string, *models.UserClaims, error)

func (*AuthService) CreateUser

func (a *AuthService) CreateUser(userReq models.UserRegisterReq) (models.UserRegisterRes, error)

func (*AuthService) DeleteSession

func (a *AuthService) DeleteSession(id string) error

func (*AuthService) DeleteUser

func (a *AuthService) DeleteUser(id int64) error

func (*AuthService) GetSession

func (a *AuthService) GetSession(id string) (*models.Session, error)

func (*AuthService) GetUser

func (a *AuthService) GetUser(email, password string) (models.UserLogin, error)

func (*AuthService) RevokeSession

func (a *AuthService) RevokeSession(id string) error

func (*AuthService) UpdateUser

func (a *AuthService) UpdateUser(user *models.User) (*models.User, error)

func (*AuthService) VerifyAccessToken

func (a *AuthService) VerifyAccessToken(tokenStr string) (*models.UserClaims, error)

func (*AuthService) VerifyRefreshToken

func (a *AuthService) VerifyRefreshToken(refreshTokenUUID string) (*models.UserClaims, error)

type Authorization

type Authorization interface {
	CreateUser(input models.UserRegisterReq) (models.UserRegisterRes, error)
	GetUser(email, password string) (models.UserLogin, error)
	UpdateUser(user *models.User) (*models.User, error)
	CreateToken(id int64, email string, isAdmin bool, duration time.Duration) (string, *models.UserClaims, error)
	VerifyAccessToken(tokenStr string) (*models.UserClaims, error)
	VerifyRefreshToken(refreshTokenUUID string) (*models.UserClaims, error)
	CreateSession(session *models.Session) (*models.Session, error)
	GetSession(id string) (*models.Session, error)
	RevokeSession(id string) error
	DeleteSession(id string) error
}

type Chat

type Chat interface {
	SendMessage(message *models.Message) error
	GetChatHistory(groupID string, limit, offset int) ([]models.Message, error)
	GetUserData(userID int64) (models.Message, error)
	IsUserInGroup(userID int64, groupID string) (bool, error)
}

type ChatService

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

func NewChatService

func NewChatService(repo repository.Chat) *ChatService

func (*ChatService) GetChatHistory

func (s *ChatService) GetChatHistory(groupID string, limit, offset int) ([]models.Message, error)

func (*ChatService) GetUserData

func (s *ChatService) GetUserData(userID int64) (models.Message, error)

func (*ChatService) IsUserInGroup

func (s *ChatService) IsUserInGroup(userID int64, groupID string) (bool, error)

func (*ChatService) SendMessage

func (s *ChatService) SendMessage(message *models.Message) error

type Group

type Group interface {
	CreateGroup(group *models.CreateGroupReq) error
}

type GroupService

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

func NewGroupService

func NewGroupService(repo repository.Group) *GroupService

func (*GroupService) CreateGroup

func (g *GroupService) CreateGroup(group *models.CreateGroupReq) error

type Notification

type Notification interface {
}

type NotificationService

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

func NewNotificationService

func NewNotificationService(repo repository.Notification) *NotificationService

type Service

func NewService

func NewService(repo *repository.Repository, secretKey []byte) *Service

type Statistics

type Statistics interface {
}

type StatisticsService

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

func NewStatisticsService

func NewStatisticsService(repo repository.Statistics) *StatisticsService

type Task

type Task interface {
}

type TaskService

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

func NewTaskService

func NewTaskService(repo repository.Task) *TaskService

Jump to

Keyboard shortcuts

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