Documentation ¶
Overview ¶
Package usecase implements application business logic. Each logic group in own file.
Index ¶
- type GophKeeper
- type GophKeeperRepo
- type GophKeeperUseCase
- func (uc *GophKeeperUseCase) AddBinary(ctx context.Context, binary *entity.Binary, file *multipart.FileHeader, ...) error
- func (uc *GophKeeperUseCase) AddBinaryMeta(ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID, ...) (*entity.Binary, error)
- func (uc *GophKeeperUseCase) AddCard(ctx context.Context, card *entity.Card, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) AddLogin(ctx context.Context, login *entity.Login, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) AddNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) CheckAccessToken(ctx context.Context, accessToken string) (entity.User, error)
- func (uc *GophKeeperUseCase) DelCard(ctx context.Context, cardUUID, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) DelLogin(ctx context.Context, loginID, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) DelNote(ctx context.Context, noteID, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) DelUserBinary(ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID) error
- func (uc *GophKeeperUseCase) GetBinaries(ctx context.Context, user entity.User) ([]entity.Binary, error)
- func (uc *GophKeeperUseCase) GetCards(ctx context.Context, user entity.User) ([]entity.Card, error)
- func (uc *GophKeeperUseCase) GetDomainName() string
- func (uc *GophKeeperUseCase) GetLogins(ctx context.Context, user entity.User) ([]entity.Login, error)
- func (uc *GophKeeperUseCase) GetNotes(ctx context.Context, user entity.User) ([]entity.SecretNote, error)
- func (uc *GophKeeperUseCase) GetUserBinary(ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID) (string, error)
- func (uc *GophKeeperUseCase) HealthCheck() error
- func (uc *GophKeeperUseCase) RefreshAccessToken(ctx context.Context, refreshToken string) (token entity.JWT, err error)
- func (uc *GophKeeperUseCase) SignInUser(ctx context.Context, email, password string) (token entity.JWT, err error)
- func (uc *GophKeeperUseCase) SignUpUser(ctx context.Context, email, password string) (user entity.User, err error)
- func (uc *GophKeeperUseCase) UpdateCard(ctx context.Context, card *entity.Card, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) UpdateLogin(ctx context.Context, login *entity.Login, userID uuid.UUID) error
- func (uc *GophKeeperUseCase) UpdateNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GophKeeper ¶
type GophKeeper interface { HealthCheck() error SignUpUser(ctx context.Context, email, password string) (entity.User, error) SignInUser(ctx context.Context, email, password string) (entity.JWT, error) RefreshAccessToken(ctx context.Context, refreshToken string) (entity.JWT, error) GetDomainName() string CheckAccessToken(ctx context.Context, accessToken string) (entity.User, error) GetLogins(ctx context.Context, user entity.User) ([]entity.Login, error) AddLogin(ctx context.Context, login *entity.Login, userID uuid.UUID) error DelLogin(ctx context.Context, loginID, userID uuid.UUID) error UpdateLogin(ctx context.Context, login *entity.Login, userID uuid.UUID) error GetCards(ctx context.Context, user entity.User) ([]entity.Card, error) AddCard(ctx context.Context, card *entity.Card, userID uuid.UUID) error DelCard(ctx context.Context, cardUUID, userID uuid.UUID) error UpdateCard(ctx context.Context, card *entity.Card, userID uuid.UUID) error GetNotes(ctx context.Context, user entity.User) ([]entity.SecretNote, error) AddNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error DelNote(ctx context.Context, noteID, userID uuid.UUID) error UpdateNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error GetBinaries(ctx context.Context, user entity.User) ([]entity.Binary, error) AddBinary(ctx context.Context, binary *entity.Binary, file *multipart.FileHeader, userID uuid.UUID) error GetUserBinary(ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID) (string, error) DelUserBinary(ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID) error AddBinaryMeta( ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID, meta []entity.Meta) (*entity.Binary, error) }
GophKeeper - use cases.
type GophKeeperRepo ¶
type GophKeeperRepo interface { DBHealthCheck() error AddUser(ctx context.Context, email, hashedPassword string) (entity.User, error) GetUserByEmail(ctx context.Context, email, hashedPassword string) (entity.User, error) GetUserByID(ctx context.Context, id string) (entity.User, error) GetLogins(ctx context.Context, user entity.User) ([]entity.Login, error) AddLogin(ctx context.Context, login *entity.Login, userID uuid.UUID) error DelLogin(ctx context.Context, loginID, userID uuid.UUID) error UpdateLogin(ctx context.Context, login *entity.Login, userID uuid.UUID) error IsLoginOwner(ctx context.Context, loginID, userID uuid.UUID) bool GetCards(ctx context.Context, user entity.User) ([]entity.Card, error) AddCard(ctx context.Context, card *entity.Card, userID uuid.UUID) error DelCard(ctx context.Context, cardUUID, userID uuid.UUID) error UpdateCard(ctx context.Context, card *entity.Card, userID uuid.UUID) error IsCardOwner(ctx context.Context, cardUUID, userID uuid.UUID) bool GetNotes(ctx context.Context, user entity.User) ([]entity.SecretNote, error) AddNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error DelNote(ctx context.Context, noteID, userID uuid.UUID) error UpdateNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error IsNoteOwner(ctx context.Context, noteID, userID uuid.UUID) bool GetBinaries(ctx context.Context, user entity.User) ([]entity.Binary, error) AddBinary(ctx context.Context, binary *entity.Binary, userID uuid.UUID) error GetBinary(ctx context.Context, binaryID, userID uuid.UUID) (*entity.Binary, error) DelUserBinary(ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID) error AddBinaryMeta( ctx context.Context, currentUser *entity.User, binaryUUID uuid.UUID, meta []entity.Meta) (*entity.Binary, error) }
GophKeeperRepo - db logic.
type GophKeeperUseCase ¶
type GophKeeperUseCase struct {
// contains filtered or unexported fields
}
GophKeeperUseCase -.
func New ¶
func New(r GophKeeperRepo, cfg *config.Config, cache c.Cacher, l *logger.Logger) *GophKeeperUseCase
func (*GophKeeperUseCase) AddBinary ¶
func (uc *GophKeeperUseCase) AddBinary( ctx context.Context, binary *entity.Binary, file *multipart.FileHeader, userID uuid.UUID, ) error
func (*GophKeeperUseCase) AddBinaryMeta ¶
func (*GophKeeperUseCase) AddNote ¶
func (uc *GophKeeperUseCase) AddNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error
func (*GophKeeperUseCase) CheckAccessToken ¶
func (*GophKeeperUseCase) DelUserBinary ¶
func (*GophKeeperUseCase) GetBinaries ¶
func (*GophKeeperUseCase) GetDomainName ¶
func (uc *GophKeeperUseCase) GetDomainName() string
func (*GophKeeperUseCase) GetNotes ¶
func (uc *GophKeeperUseCase) GetNotes(ctx context.Context, user entity.User) ([]entity.SecretNote, error)
func (*GophKeeperUseCase) GetUserBinary ¶
func (*GophKeeperUseCase) HealthCheck ¶
func (uc *GophKeeperUseCase) HealthCheck() error
func (*GophKeeperUseCase) RefreshAccessToken ¶
func (*GophKeeperUseCase) SignInUser ¶
func (*GophKeeperUseCase) SignUpUser ¶
func (*GophKeeperUseCase) UpdateCard ¶
func (*GophKeeperUseCase) UpdateLogin ¶
func (*GophKeeperUseCase) UpdateNote ¶
func (uc *GophKeeperUseCase) UpdateNote(ctx context.Context, note *entity.SecretNote, userID uuid.UUID) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.