service

package
v0.0.0-...-88a34c4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCESS_TOKEN  = iota
	REFRESH_TOKEN = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

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(user models.User) (int, error)

func (*AuthService) GenerateTokens

func (s *AuthService) GenerateTokens(signInDto dto.SignIn) (dto.Tokens, error)

func (*AuthService) ParseToken

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

func (*AuthService) RefreshTokens

func (s *AuthService) RefreshTokens(refreshToken string) (dto.Tokens, error)

type Authorization

type Authorization interface {
	CreateUser(user models.User) (int, error)
	ParseToken(token string, tokenType int) (int, error)
	GenerateTokens(signInDTO dto.SignIn) (dto.Tokens, error)
	RefreshTokens(refreshToken string) (dto.Tokens, error)
}

type Service

type Service struct {
	Authorization
	TodoList
	TodoItem
}

func NewService

func NewService(repos *repository.Repository) *Service

type TodoItem

type TodoItem interface {
	Create(userId, listId int, item models.TodoItem) (int, error)
	GetAll(userId, listId int) ([]models.TodoItem, error)
	GetById(userId, itemId int) (models.TodoItem, error)
	Delete(userId, itemId int) error
	Update(userId, itemId int, input dto.UpdateItem) error
}

type TodoItemService

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

func NewTodoItemService

func NewTodoItemService(
	repo repository.TodoItem, todoListRepository repository.TodoList,
) *TodoItemService

func (*TodoItemService) Create

func (s *TodoItemService) Create(userId, listId int, item models.TodoItem) (int, error)

func (*TodoItemService) Delete

func (s *TodoItemService) Delete(userId, itemId int) error

func (*TodoItemService) GetAll

func (s *TodoItemService) GetAll(userId, listId int) ([]models.TodoItem, error)

func (*TodoItemService) GetById

func (s *TodoItemService) GetById(userId, itemId int) (models.TodoItem, error)

func (*TodoItemService) Update

func (s *TodoItemService) Update(userId, itemId int, input dto.UpdateItem) error

type TodoList

type TodoList interface {
	Create(userId int, list models.TodoList) (int, error)
	GetAll(userId int) ([]models.TodoList, error)
	GetById(userId, listId int) (models.TodoList, error)
	Delete(userId, listId int) error
	Update(userId, listId int, input dto.UpdateList) error
}

type TodoListService

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

func NewTodoListService

func NewTodoListService(repo repository.TodoList) *TodoListService

func (*TodoListService) Create

func (s *TodoListService) Create(userId int, list models.TodoList) (int, error)

func (*TodoListService) Delete

func (s *TodoListService) Delete(userId, listId int) error

func (*TodoListService) GetAll

func (s *TodoListService) GetAll(userId int) ([]models.TodoList, error)

func (*TodoListService) GetById

func (s *TodoListService) GetById(userId, listId int) (models.TodoList, error)

func (*TodoListService) Update

func (s *TodoListService) Update(userId, listId int, input dto.UpdateList) error

Jump to

Keyboard shortcuts

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