todos

package module
v0.0.0-...-ded953e Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAgregator

func NewAgregator(repo Repository, logger log.Logger) agregator

NewAgregator creates a new album agregator.

func RegisterHandlers

func RegisterHandlers(router *fiber.App, agregator Agregator, logger log.Logger)

RegisterHandlers sets up the routing of the HTTP handlers.

Types

type Agregator

type Agregator interface {
	GetUsersWithLimitOffset(ctx context.Context, limit, offset int64) ([]entity.User, error)
	GetUserById(ctx context.Context, id int64) (entity.User, error)
	GetUserByTodoId(ctx context.Context, aid int64) (entity.User, error)
	GetUserByEmail(ctx context.Context, email string) (entity.User, error)
	GetTodoById(ctx context.Context, id int64) (entity.Todo, error)
	GetTodoDisplayByUserId(ctx context.Context, uid int64) ([]dto.TodoDisplay, error)
	GetTodoByUserId(ctx context.Context, uid int64) ([]entity.Todo, error)
	UpdateTodoStatus(ctx context.Context, fdata *TodoStatusForm, uid int64) error
	UpdateTodo(ctx context.Context, fdata *TodoForm) error
	DeleteTodoData(ctx context.Context, aid int64) error
	UpdateUser(ctx context.Context, fdata *ProfileForm, uid int64) error
	CreateTodo(ctx context.Context, f *TodoForm) (int64, error)
}

Agregator encapsulates usecase logic for albums

type DeleteTodoForm

type DeleteTodoForm struct {
	TodoId int64 `json:"todo_id" form:"todo_id"`
}

type LoginForm

type LoginForm struct {
	Username        string `json:"username"        form:"username"`
	CurrentPassword string `json:"current-password" form:"current-password"`
}

LoginForm represents an album update request.

func (LoginForm) Validate

func (m LoginForm) Validate() error

Validate validates the LoginForm fields

type ProfileForm

type ProfileForm struct {
	Tel               string `json:"tel"          form:"tel"`
	GivenName         string `json:"given-name"   form:"given-name"`
	NewPassword       string `json:"new-password" form:"new-password"`
	NewPasswordRepeat string `json:"new-password-repeat" form:"new-password-repeat"`
}

ProfileForm represents an album update request.

func (ProfileForm) Validate

func (m ProfileForm) Validate() error

Validate validates the ProfileForm fields

type Repository

type Repository interface {
	// Get returns the users with follow by specified limit-offset params.
	GetUsersWithLimitOffset(ctx context.Context, limit, offset int64) ([]entity.User, error)
	// Get returns the Todo with the specified Todo ID.
	GetTodoById(ctx context.Context, id int64) (entity.Todo, error)
	// Get returns the Todo with the specified Todo ID.
	GetTodoLast(ctx context.Context) ([]entity.Todo, error)
	// Get returns the Todo by word filtered like function.
	GetTodoSearch(ctx context.Context, word string) ([]entity.Todo, error)
	// Get returns the Todo by user_id.
	GetTodoByUserId(ctx context.Context, uid int64) ([]entity.Todo, error)
	// Get returns the user with the specified user_id.
	GetUserById(ctx context.Context, id int64) (entity.User, error)
	// Get returns the user with the specified Todo_id.
	GetUserByTodoId(ctx context.Context, aid int64) (entity.User, error)
	// Get returns the Todo with the specified email.
	GetUserByEmail(ctx context.Context, email string) (entity.User, error)
	// Count returns the number of Todo.
	Count(ctx context.Context) (int, error)
	// Query returns the list of Todo with the given offset and limit.
	QueryTodo(ctx context.Context, offset, limit int) ([]entity.Todo, error)
	// Create saves a new user in the storage.
	CreateUser(ctx context.Context, user entity.User) (int64, error)
	// Update user in the storage.
	UpdateTodo(ctx context.Context, td entity.Todo) error
	// Update user in the storage.
	UpdateTodoStatus(ctx context.Context, td entity.Todo) error
	// Update user in the storage.
	UpdateUser(ctx context.Context, user entity.User, uid int64) error
	// Create saves a new Todo in the storage.
	CreateTodo(ctx context.Context, Todo entity.Todo) (int64, error)
	// Getting Todo by user_id.
	GetTodoDisplayByUserId(ctx context.Context, id int64) ([]dto.TodoDisplay, error)
	// Update updates the Todo with given ID in the storage.
	Update(ctx context.Context, Todo entity.Todo) error
	// Delete removes the Todo with given ID from the storage.
	DeleteTodoById(ctx context.Context, id int64) error
}

Repository encapsulates the logic to access Todo from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

NewRepository creates a new Todo repository

type TodoForm

type TodoForm struct {
	TodoId     int64  `json:"todo_id" form:"todo_id"`
	AuthorId   int64  `json:"author_id" form:"author_id"`
	PerfomerId int64  `json:"perfomer_id" form:"perfomer_id"`
	Name       string `json:"name" form:"name"`
	Status     int    `json:"status" form:"status"`
}

func (TodoForm) Validate

func (m TodoForm) Validate() error

Validate validates the TodoForm fields

type TodoStatusForm

type TodoStatusForm struct {
	TodoId int64 `json:"todoid" form:"todoit"`
	Status int   `json:"status" form:"status"`
}

pdateTodoForm represents an album update request.

func (TodoStatusForm) Validate

func (f TodoStatusForm) Validate() error

Validate validates the LoginForm fields

Jump to

Keyboard shortcuts

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