user

package
v0.0.0-...-38b1c69 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadBody = errors.New("bad body avatar")
View Source
var ErrUserAuthentication = errors.New("user authentication")

Functions

func New

func New(log *logger.Logger, imgCase image.Usecase, repo repo.Repository) *userCase

Types

type ProfileUpdateData

type ProfileUpdateData struct {
	Username *string `json:"username"`
	Email    *string `json:"email"`
	Name     *string `json:"name"`
	Surname  *string `json:"surname"`
	AboutMe  *string `json:"about_me"`
	Password *string `json:"password"`
}

func (ProfileUpdateData) MarshalEasyJSON

func (v ProfileUpdateData) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProfileUpdateData) MarshalJSON

func (v ProfileUpdateData) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProfileUpdateData) UnmarshalEasyJSON

func (v *ProfileUpdateData) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProfileUpdateData) UnmarshalJSON

func (v *ProfileUpdateData) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Usecase

type Usecase interface {
	Register(ctx context.Context, user *entity.User) error
	Authentication(ctx context.Context, credentials UserCredentials) (*entity.User, error)
	FindOutUsernameAndAvatar(ctx context.Context, userID int) (username string, avatar string, err error)
	UpdateUserAvatar(ctx context.Context, userID int, mimeTypeAvatar string, sizeAvatar int64, avatar io.Reader) error
	GetAllProfileInfo(ctx context.Context, userID int) (*entity.User, error)
	GetUserInfo(ctx context.Context, userID int) (user *entity.User, isSubscribed bool, subsCount int, err error)
	GetProfileInfo(ctx context.Context) (user *entity.User, subsCount int, err error)
	EditProfileInfo(ctx context.Context, userID int, updateData *ProfileUpdateData) error
}

type UserCredentials

type UserCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (UserCredentials) MarshalEasyJSON

func (v UserCredentials) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserCredentials) MarshalJSON

func (v UserCredentials) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserCredentials) UnmarshalEasyJSON

func (v *UserCredentials) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserCredentials) UnmarshalJSON

func (v *UserCredentials) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Directories

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

Jump to

Keyboard shortcuts

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