service

package
v0.0.0-...-21ca630 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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.Autorization) *AuthService

func (*AuthService) CreateUser

func (s *AuthService) CreateUser(user todo.User) (int, error)

func (*AuthService) GeneratePasswordHash

func (s *AuthService) GeneratePasswordHash(password string) string

func (*AuthService) GenerateToken

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

func (*AuthService) ParseToken

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

type Autorization

type Autorization interface {
	CreateUser(user todo.User) (int, error)
	GenerateToken(username, password string) (string, error)
	ParseToken(token string) (int, error)
}

type Service

type Service struct {
	Autorization
	TodoList
	TodoItem
}

func NewService

func NewService(repos *repository.Repository) *Service

type TodoItem

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

type TodoItemService

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

func NewTodoItemService

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

func (*TodoItemService) Create

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

func (*TodoItemService) Delete

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

func (*TodoItemService) GetAll

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

func (*TodoItemService) GetById

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

func (*TodoItemService) Update

func (s *TodoItemService) Update(userId int, listId int, input todo.UpdateItemInput) error

type TodoList

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

type TodoListService

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

func NewTodoListSerevice

func NewTodoListSerevice(repo repository.TodoList) *TodoListService

func (*TodoListService) Create

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

func (*TodoListService) Delete

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

func (*TodoListService) GetAll

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

func (*TodoListService) GetById

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

func (*TodoListService) Update

func (s *TodoListService) Update(userId int, listId int, input todo.UpdateListInput) error

Directories

Path Synopsis
Package mock_service is a generated GoMock package.
Package mock_service is a generated GoMock package.

Jump to

Keyboard shortcuts

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