service

package
v0.0.0-...-521d95a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT 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.Repository) *AuthService

func (*AuthService) Create

func (s *AuthService) Create(ctx context.Context, user model.User) (string, error)

func (*AuthService) SignIn

func (s *AuthService) SignIn(ctx context.Context, user model.User) (string, error)

type Authorization

type Authorization interface {
	Create(ctx context.Context, user model.User) (string, error)
	SignIn(ctx context.Context, user model.User) (string, error)
}

type Service

type Service struct {
	Authorization
	User
	Todo
}

func New

func New(repo *repository.Repository) *Service

type Todo

type Todo interface {
	Create(ctx context.Context, todo model.Todo) error
	GetAll(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
	Update(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID, options model.TodoUpdateOptions) error
	Delete(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID) error
	GetCompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
	GetImportantTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
	GetUncompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
}

type TodoService

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

func NewTodoService

func NewTodoService(repo *repository.Repository) *TodoService

func (*TodoService) Create

func (s *TodoService) Create(ctx context.Context, todo model.Todo) error

func (*TodoService) Delete

func (s *TodoService) Delete(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID) error

func (*TodoService) GetAll

func (s *TodoService) GetAll(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoService) GetCompletedTodos

func (s *TodoService) GetCompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoService) GetImportantTodos

func (s *TodoService) GetImportantTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoService) GetUncompletedTodos

func (s *TodoService) GetUncompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoService) Update

func (s *TodoService) Update(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID, options model.TodoUpdateOptions) error

type User

type User interface {
	GetById(ctx context.Context, userID primitive.ObjectID) (*model.User, error)
	UpdateUsername(ctx context.Context, userID primitive.ObjectID, newUsername string) error
}

type UserService

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

func NewUserService

func NewUserService(repo *repository.Repository) *UserService

func (*UserService) GetById

func (s *UserService) GetById(ctx context.Context, userID primitive.ObjectID) (*model.User, error)

func (*UserService) UpdateUsername

func (s *UserService) UpdateUsername(ctx context.Context, userID primitive.ObjectID, newUsername string) error

Jump to

Keyboard shortcuts

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