Documentation ¶
Index ¶
- type AuthService
- type Authorization
- type Service
- type TodoItem
- type TodoItemService
- func (s *TodoItemService) Create(userId, listId int, item todo.TodoItem) (int, error)
- func (s *TodoItemService) Delete(userId, itemId int) error
- func (s *TodoItemService) GetAll(userId, listId int) ([]todo.TodoItem, error)
- func (s *TodoItemService) GetById(userId, itemId int) (todo.TodoItem, error)
- func (s *TodoItemService) Update(userId, itemId int, input todo.UpdateItemInput) error
- type TodoList
- type TodoListService
- func (s TodoListService) Create(userId int, list todo.TodoList) (int, error)
- func (s TodoListService) Delete(userId, id int) error
- func (s TodoListService) FindById(userId, id int) (todo.TodoList, error)
- func (s TodoListService) GetAll(userId int) ([]todo.TodoList, error)
- func (s TodoListService) Update(userId, id int, updateListRequest todo.UpdateTodoListRequest) error
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.Authorization) *AuthService
NewAuthService creates a new instance of AuthService
func (AuthService) CreateUser ¶
func (a AuthService) CreateUser(user todo.User) (int, error)
CreateUser generates a hashed password and creates a new user
func (AuthService) GenerateToken ¶
func (a AuthService) GenerateToken(username string, password string) (string, error)
GenerateToken generates a new JWT token if a user found for specified username and password
func (AuthService) ParseToken ¶
func (a AuthService) ParseToken(accessToken string) (int, error)
ParseToken parses provided JWT access token and returns userID
type Authorization ¶
type Service ¶
type Service struct { Authorization TodoList TodoItem }
func NewService ¶
func NewService(repos *repository.Repository) *Service
NewService creates a new instance of Service
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, 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, itemId int, input todo.UpdateItemInput) error
type TodoListService ¶
type TodoListService struct {
// contains filtered or unexported fields
}
func NewTodoListService ¶
func NewTodoListService(repo repository.TodoList) *TodoListService
NewTodoListService creates a new instance of TodoListService
func (TodoListService) Create ¶
func (s TodoListService) Create(userId int, list todo.TodoList) (int, error)
Create creates a new TodoList for specified userId
func (TodoListService) Delete ¶
func (s TodoListService) Delete(userId, id int) error
Delete deletes the list for specified user
func (TodoListService) FindById ¶
func (s TodoListService) FindById(userId, id int) (todo.TodoList, error)
FindById return all Todolists for specified userId
func (TodoListService) GetAll ¶
func (s TodoListService) GetAll(userId int) ([]todo.TodoList, error)
GetAll return all Todolists for specified userId
func (TodoListService) Update ¶
func (s TodoListService) Update(userId, id int, updateListRequest todo.UpdateTodoListRequest) error
Update updates the specified TodoList
Click to show internal directories.
Click to hide internal directories.