service

package
v0.0.0-...-85337ad Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account interface {
	ExistsAccount(id int) (models.Account, error)
	GetAccount(id, userId int) (models.Account, error)
	GetAllAccounts(userId int) ([]models.Account, error)
	CreateAccount(userId int, name string, balance float64) (int, error)
	UpdateAccount(id, userId int, name string, balance float64) (models.Account, error)
	DeleteAccount(id, userId int) error
	RestoreAccount(id, userId int) error
	ChangePictureAccount(id, userId int, filepath string) (models.Account, error)
	UploadAccountPicture(id, userId int, filepath string) (models.Account, error)
}

type AccountService

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

func NewAccountService

func NewAccountService(repo repository.Account) *AccountService

func (*AccountService) ChangePictureAccount

func (s *AccountService) ChangePictureAccount(id, userId int, filepath string) (models.Account, error)

func (*AccountService) CreateAccount

func (s *AccountService) CreateAccount(userId int, name string, balance float64) (int, error)

func (*AccountService) DeleteAccount

func (s *AccountService) DeleteAccount(id, userId int) error

func (*AccountService) ExistsAccount

func (s *AccountService) ExistsAccount(id int) (models.Account, error)

func (*AccountService) GetAccount

func (s *AccountService) GetAccount(id, userId int) (models.Account, error)

func (*AccountService) GetAllAccounts

func (s *AccountService) GetAllAccounts(userId int) ([]models.Account, error)

func (*AccountService) RestoreAccount

func (s *AccountService) RestoreAccount(id, userId int) error

func (*AccountService) UpdateAccount

func (s *AccountService) UpdateAccount(id, userId int, name string, balance float64) (models.Account, error)

func (*AccountService) UploadAccountPicture

func (s *AccountService) UploadAccountPicture(id, userId int, filepath string) (models.Account, error)

type AuthService

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

func NewAuthService

func NewAuthService(repo repository.Authorization) *AuthService

func (*AuthService) CreateUser

func (s *AuthService) CreateUser(firstname, lastname, username, email, password string) (int, error)

func (*AuthService) GenerateToken

func (s *AuthService) GenerateToken(email, username, password string) (string, error)

func (*AuthService) ParseToken

func (s *AuthService) ParseToken(token string) (int, error)

type Authorization

type Authorization interface {
	CreateUser(fistname, lastname, username, email, password string) (int, error)
	GenerateToken(email, username, password string) (string, error)
	ParseToken(token string) (int, error)
}

type Category

type Category interface {
	CreateCategory(name, description string, price float64) (models.Category, error)
	GetCategories() ([]models.Category, error)
	GetCategory(id int) (models.Category, error)
	UpdateCategory(id int, name, description string, price float64) (models.Category, error)
	UploadPictureCategory(id int, filepath string) (models.Category, error)
	ChangePictureCategory(id int, filepath string) (models.Category, error)
	DeleteCategory(id int) error
	RestoreCategory(id int) error
}

type CategoryService

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

func NewCategoryService

func NewCategoryService(repo repository.Category) *CategoryService

func (*CategoryService) ChangePictureCategory

func (c *CategoryService) ChangePictureCategory(id int, filepath string) (models.Category, error)

func (*CategoryService) CreateCategory

func (c *CategoryService) CreateCategory(name, description string, price float64) (models.Category, error)

func (*CategoryService) DeleteCategory

func (c *CategoryService) DeleteCategory(id int) error

func (*CategoryService) GetCategories

func (c *CategoryService) GetCategories() ([]models.Category, error)

func (*CategoryService) GetCategory

func (c *CategoryService) GetCategory(id int) (models.Category, error)

func (*CategoryService) RestoreCategory

func (c *CategoryService) RestoreCategory(id int) error

func (*CategoryService) UpdateCategory

func (c *CategoryService) UpdateCategory(id int, name, description string, price float64) (models.Category, error)

func (*CategoryService) UploadPictureCategory

func (c *CategoryService) UploadPictureCategory(id int, filepath string) (models.Category, error)

type Report

type Report interface {
	GetCSVReport(
		userFrom, userTo models.User,
		accountFrom, accountTo models.Account,
		tr []models.Transaction,
	) (*os.File, error)
	GetExcelReport(
		userFrom, userTo models.User,
		accountFrom, accountTo models.Account,
		tr []models.Transaction,
	) (*excelize.File, error)
	GetReport(
		FromID, ToID int, ToType string,
		Limit, Page int, Type string,
		From, To time.Time,
	) ([]models.Transaction, error)
}

type ReportService

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

func NewReportService

func NewReportService(repo repository.Report) *ReportService

func (*ReportService) GetCSVReport

func (s *ReportService) GetCSVReport(
	userFrom, userTo models.User,
	accountFrom, accountTo models.Account,
	tr []models.Transaction,
) (*os.File, error)

func (*ReportService) GetExcelReport

func (s *ReportService) GetExcelReport(
	userFrom, userTo models.User,
	accountFrom, accountTo models.Account,
	tr []models.Transaction,
) (*excelize.File, error)

func (*ReportService) GetReport

func (s *ReportService) GetReport(
	FromID, ToID int, ToType string,
	Limit, Page int, Type string,
	From, To time.Time,
) ([]models.Transaction, error)

type Service

func NewService

func NewService(repository *repository.Repository) *Service

type Transaction

type Transaction interface {
	CreateTransaction(tr models.Transaction) (models.Transaction, error)
	GetTransaction(id, userId int) (models.Transaction, error)
	UpdateTransaction(id, userId int, comment string) (models.Transaction, error)
	GetTransactions(userId int) ([]models.Transaction, error)
}

type TransactionService

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

func NewTransactionService

func NewTransactionService(repo repository.Transaction) *TransactionService

func (*TransactionService) CreateTransaction

func (t *TransactionService) CreateTransaction(tr models.Transaction) (models.Transaction, error)

func (*TransactionService) GetTransaction

func (t *TransactionService) GetTransaction(id, userId int) (models.Transaction, error)

func (*TransactionService) GetTransactions

func (t *TransactionService) GetTransactions(userId int) ([]models.Transaction, error)

func (*TransactionService) UpdateTransaction

func (t *TransactionService) UpdateTransaction(id, userId int, comment string) (models.Transaction, error)

type User

type User interface {
	GetUserById(id int) (models.User, error)
	UpdateUser(id int, firstname, lastname, email, username, password string) (models.User, error)
	DeleteUserById(id int) error
	RestoreUserById(id int) error
	UpdatePictureUser(id int, filepath string) (models.User, error)
	UploadUserPicture(id int, filepath string) (models.User, error)
}

type UserService

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

func NewUserService

func NewUserService(repo repository.User) *UserService

func (*UserService) DeleteUserById

func (u *UserService) DeleteUserById(id int) error

func (*UserService) GetUserById

func (u *UserService) GetUserById(id int) (models.User, error)

func (*UserService) RestoreUserById

func (u *UserService) RestoreUserById(id int) error

func (*UserService) UpdatePictureUser

func (u *UserService) UpdatePictureUser(id int, filepath string) (models.User, error)

func (*UserService) UpdateUser

func (u *UserService) UpdateUser(
	id int,
	firstname, lastname, email, username, password string,
) (models.User, error)

func (*UserService) UploadUserPicture

func (u *UserService) UploadUserPicture(id int, filepath string) (models.User, error)

Jump to

Keyboard shortcuts

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