users

package
v0.44.25 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Users routes and controllers logic package for the backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUserRepository added in v0.44.22

func NewUserRepository(cache db.Cacher) models.UserRepositoryInterface

func NewUserRouter added in v0.44.23

func NewUserRouter(userController *UserController) chi.Router

func NewUserService added in v0.44.23

func NewUserService(
	postRepository models.PostRepositoryInterface,
	userRepository models.UserRepositoryInterface,
	tokenRepository models.TokenRepositoryInterface,
) models.UserServiceInterface

Types

type UserController added in v0.44.23

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

func NewUserController added in v0.44.23

func NewUserController(userService models.UserServiceInterface) *UserController

func (*UserController) Activate added in v0.44.23

func (c *UserController) Activate(w http.ResponseWriter, r *http.Request)

func (*UserController) Create added in v0.44.23

func (c *UserController) Create(w http.ResponseWriter, r *http.Request)

Create is the users handler that processes input and creates a new user.

@Summary Add new user @Description add new user @Tags users @Accept json @Produce json @Param request body models.User true "new user's request body" @Success 200 {object} common.APIResponse @Failure 400 {object} common.APIResponse @Failure 403 {object} common.APIResponse @Failure 409 {object} common.APIResponse @Failure 500 {object} common.APIResponse @Router /users [post]

func (*UserController) Delete added in v0.44.23

func (c *UserController) Delete(w http.ResponseWriter, r *http.Request)

func (*UserController) GetAll added in v0.44.23

func (c *UserController) GetAll(w http.ResponseWriter, r *http.Request)

func (*UserController) GetByID added in v0.44.23

func (c *UserController) GetByID(w http.ResponseWriter, r *http.Request)

func (*UserController) GetPosts added in v0.44.23

func (c *UserController) GetPosts(w http.ResponseWriter, r *http.Request)

func (*UserController) PassphraseResetRequest added in v0.44.23

func (c *UserController) PassphraseResetRequest(w http.ResponseWriter, r *http.Request)

func (*UserController) ResetPassphrase added in v0.44.23

func (c *UserController) ResetPassphrase(w http.ResponseWriter, r *http.Request)

func (*UserController) Update added in v0.44.23

func (c *UserController) Update(w http.ResponseWriter, r *http.Request)

Update is the users handler that allows the user to change their lists/options/passphrase.

@Summary Update user's data @Description update user's data @Tags users @Produce json @Param request body users.UserUpdateRequest true "data to update" @Param userID path string true "ID of the user to update" @Success 200 {object} common.APIResponse @Failure 400 {object} common.APIResponse @Failure 403 {object} common.APIResponse @Failure 404 {object} common.APIResponse @Failure 409 {object} common.APIResponse @Failure 500 {object} common.APIResponse @Router /users/{userID}/{updateType} [patch]

func (*UserController) UploadAvatar added in v0.44.23

func (c *UserController) UploadAvatar(w http.ResponseWriter, r *http.Request)

type UserRepository added in v0.44.22

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

The implementation of pkg/models.UserRepositoryInterface.

func (*UserRepository) Delete added in v0.44.22

func (r *UserRepository) Delete(userID string) error

func (*UserRepository) GetAll added in v0.44.22

func (r *UserRepository) GetAll() (*map[string]models.User, error)

func (*UserRepository) GetByID added in v0.44.22

func (r *UserRepository) GetByID(userID string) (*models.User, error)

func (*UserRepository) GetPage added in v0.44.24

func (r *UserRepository) GetPage(pageOpts interface{}) (*map[string]models.User, error)

func (*UserRepository) Save added in v0.44.22

func (r *UserRepository) Save(user *models.User) error

type UserService added in v0.44.23

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

func (*UserService) Create added in v0.44.23

func (s *UserService) Create(ctx context.Context, user *models.User) error

func (*UserService) Delete added in v0.44.23

func (s *UserService) Delete(ctx context.Context, userID string) error

func (*UserService) FindAll added in v0.44.23

func (s *UserService) FindAll(ctx context.Context) (*map[string]models.User, error)

func (*UserService) FindByID added in v0.44.23

func (s *UserService) FindByID(ctx context.Context, userID string) (*models.User, error)

func (*UserService) Update added in v0.44.23

func (s *UserService) Update(ctx context.Context, userRequest interface{}) error

type UserUpdateRequest added in v0.44.23

type UserUpdateRequest struct {
	NewPassphraseHex     string `json:"new_passphrase_hex"`
	CurrentPassphraseHex string `json:"current_passphrase_hex"`
}

Jump to

Keyboard shortcuts

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