biz

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 12 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type AuthRepo

type AuthRepo interface {
	FindUserByPhone(ctx context.Context, phone string) (*User, error)
	FindUserByEmail(ctx context.Context, email string) (*User, error)
	CreateUserWithPhone(ctx context.Context, phone string) (*User, error)
	CreateUserWithEmail(ctx context.Context, email, password string) (*User, error)
	CreateUserProfile(ctx context.Context, account, uuid string) error
	CreateUserProfileUpdate(ctx context.Context, account, uuid string) error
	CreateUserSearch(ctx context.Context, account, uuid string) error
	SetUserPhone(ctx context.Context, uuid, phone string) error
	SetUserEmail(ctx context.Context, uuid, email string) error
	SetUserPassword(ctx context.Context, uuid, password string) error
	SendPhoneCode(ctx context.Context, template, phone string) error
	SendEmailCode(ctx context.Context, template, phone string) error
	VerifyPhoneCode(ctx context.Context, phone, code string) error
	VerifyEmailCode(ctx context.Context, email, code string) error
	VerifyPassword(ctx context.Context, account, password, mode string) (*User, error)
	PasswordResetByPhone(ctx context.Context, phone, password string) error
	PasswordResetByEmail(ctx context.Context, email, password string) error
	GetCosSessionKey(ctx context.Context, uuid string) (*Credentials, error)
	UnbindUserPhone(ctx context.Context, uuid string) error
	UnbindUserEmail(ctx context.Context, uuid string) error
}

type AuthUseCase

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

func NewAuthUseCase

func NewAuthUseCase(conf *conf.Auth, repo AuthRepo, re Recovery, userRepo UserRepo, tm Transaction, logger log.Logger) *AuthUseCase

func (*AuthUseCase) ChangeUserPassword

func (r *AuthUseCase) ChangeUserPassword(ctx context.Context, uuid, oldpassword, password string) error

func (*AuthUseCase) GetCosSessionKey

func (r *AuthUseCase) GetCosSessionKey(ctx context.Context, uuid string) (*Credentials, error)

func (*AuthUseCase) LoginByCode

func (r *AuthUseCase) LoginByCode(ctx context.Context, phone, code string) (string, error)

func (*AuthUseCase) LoginByPassword

func (r *AuthUseCase) LoginByPassword(ctx context.Context, account, password, mode string) (string, error)

func (*AuthUseCase) LoginPasswordReset

func (r *AuthUseCase) LoginPasswordReset(ctx context.Context, account, password, code, mode string) error

func (*AuthUseCase) SendEmailCode

func (r *AuthUseCase) SendEmailCode(ctx context.Context, template, email string) error

func (*AuthUseCase) SendPhoneCode

func (r *AuthUseCase) SendPhoneCode(ctx context.Context, template, phone string) error

func (*AuthUseCase) SetUserEmail

func (r *AuthUseCase) SetUserEmail(ctx context.Context, uuid, email, code string) error

func (*AuthUseCase) SetUserPassword

func (r *AuthUseCase) SetUserPassword(ctx context.Context, uuid, password string) error

func (*AuthUseCase) SetUserPhone

func (r *AuthUseCase) SetUserPhone(ctx context.Context, uuid, phone, code string) error

func (*AuthUseCase) UnbindUserEmail

func (r *AuthUseCase) UnbindUserEmail(ctx context.Context, uuid, email, code string) error

func (*AuthUseCase) UnbindUserPhone

func (r *AuthUseCase) UnbindUserPhone(ctx context.Context, uuid, phone, code string) error

func (*AuthUseCase) UserRegister

func (r *AuthUseCase) UserRegister(ctx context.Context, email, password, code string) error

type Credentials

type Credentials struct {
	TmpSecretID  string
	TmpSecretKey string
	SessionToken string
	StartTime    int64
	ExpiredTime  int64
}

type Follow

type Follow struct {
	Id       int32
	Update   time.Time
	Follow   string
	Followed string
	Status   int32
}

type Follows

type Follows struct {
	Uuid   string
	Follow int32
}

type ImageReview

type ImageReview struct {
	Id       int32
	CreateAt string
	Uuid     string
	JobId    string
	Url      string
	Label    string
	Result   int32
	Category string
	SubLabel string
	Mode     string
	Score    int32
}

type Profile

type Profile struct {
	Created   string
	Updated   string
	Uuid      string
	Username  string
	Avatar    string
	School    string
	Company   string
	Job       string
	Homepage  string
	Introduce string
}

type ProfileUpdate

type ProfileUpdate struct {
	Profile
	Status int32
}

type Recovery

type Recovery interface {
	GroupRecover(context.Context, func(ctx context.Context) error) func() error
}

type Transaction

type Transaction interface {
	ExecTx(context.Context, func(ctx context.Context) error) error
}

type User

type User struct {
	Uuid     string
	Phone    string
	Email    string
	Qq       string
	Wechat   string
	Weibo    string
	Github   string
	Password string
}

type UserRepo

type UserRepo interface {
	GetAccount(ctx context.Context, uuid string) (*User, error)
	GetProfile(ctx context.Context, uuid string) (*Profile, error)
	GetProfileList(ctx context.Context, uuids []string) ([]*Profile, error)
	GetUserFollow(ctx context.Context, uuid, userUuid string) (bool, error)
	GetUserFollows(ctx context.Context, uuid string) ([]string, error)
	GetProfileUpdate(ctx context.Context, uuid string) (*ProfileUpdate, error)
	GetFollowList(ctx context.Context, page int32, uuid string) ([]*Follow, error)
	GetFollowListCount(ctx context.Context, uuid string) (int32, error)
	GetFollowedList(ctx context.Context, page int32, uuid string) ([]*Follow, error)
	GetFollowedListCount(ctx context.Context, uuid string) (int32, error)
	GetUserSearch(ctx context.Context, page int32, search string) ([]*UserSearch, int32, error)
	GetAvatarReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)
	GetCoverReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)
	EditUserSearch(ctx context.Context, uuid string, profile *ProfileUpdate) error
	SetAvatarIrregular(ctx context.Context, review *ImageReview) (*ImageReview, error)
	SetAvatarIrregularToCache(ctx context.Context, review *ImageReview) error
	SetCoverIrregular(ctx context.Context, review *ImageReview) (*ImageReview, error)
	SetCoverIrregularToCache(ctx context.Context, review *ImageReview) error
	SetProfile(ctx context.Context, profile *ProfileUpdate) error
	SetProfileUpdate(ctx context.Context, profile *ProfileUpdate, status int32) (*ProfileUpdate, error)
	SetUserFollow(ctx context.Context, uuid, userId string) error
	SetUserFollowToCache(ctx context.Context, uuid, userId string) error
	SetFollowToMq(ctx context.Context, follow *Follow, mode string) error
	CancelUserFollow(ctx context.Context, uuid, userId string) error
	CancelUserFollowFromCache(ctx context.Context, uuid, userId string) error
	SendImageIrregularToMq(ctx context.Context, review *ImageReview) error
	SendProfileToMq(ctx context.Context, profile *ProfileUpdate) error
	SendUserStatisticToMq(ctx context.Context, uuid, userUuid, mode string) error
	ModifyProfileUpdateStatus(ctx context.Context, uuid, update string) error
}

type UserSearch

type UserSearch struct {
	Uuid      string
	Username  string
	Introduce string
}

type UserUseCase

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

func NewUserUseCase

func NewUserUseCase(repo UserRepo, re Recovery, tm Transaction, logger log.Logger) *UserUseCase

func (*UserUseCase) AddAvatarReviewDbAndCache

func (r *UserUseCase) AddAvatarReviewDbAndCache(ctx context.Context, review *ImageReview) error

func (*UserUseCase) AddCoverReviewDbAndCache

func (r *UserUseCase) AddCoverReviewDbAndCache(ctx context.Context, review *ImageReview) error

func (*UserUseCase) AvatarIrregular

func (r *UserUseCase) AvatarIrregular(ctx context.Context, review *ImageReview) error

func (*UserUseCase) CancelFollowDbAndCache

func (r *UserUseCase) CancelFollowDbAndCache(ctx context.Context, uuid, userId string) error

func (*UserUseCase) CancelUserFollow

func (r *UserUseCase) CancelUserFollow(ctx context.Context, uuid, userId string) error

func (*UserUseCase) CoverIrregular

func (r *UserUseCase) CoverIrregular(ctx context.Context, review *ImageReview) error

func (*UserUseCase) GetAccount

func (r *UserUseCase) GetAccount(ctx context.Context, uuid string) (*User, error)

func (*UserUseCase) GetAvatarReview

func (r *UserUseCase) GetAvatarReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)

func (*UserUseCase) GetCoverReview

func (r *UserUseCase) GetCoverReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)

func (*UserUseCase) GetFollowList

func (r *UserUseCase) GetFollowList(ctx context.Context, page int32, uuid string) ([]*Follow, error)

func (*UserUseCase) GetFollowListCount

func (r *UserUseCase) GetFollowListCount(ctx context.Context, uuid string) (int32, error)

func (*UserUseCase) GetFollowedList

func (r *UserUseCase) GetFollowedList(ctx context.Context, page int32, uuid string) ([]*Follow, error)

func (*UserUseCase) GetFollowedListCount

func (r *UserUseCase) GetFollowedListCount(ctx context.Context, uuid string) (int32, error)

func (*UserUseCase) GetProfile

func (r *UserUseCase) GetProfile(ctx context.Context, uuid string) (*Profile, error)

func (*UserUseCase) GetProfileList

func (r *UserUseCase) GetProfileList(ctx context.Context, uuids []string) ([]*Profile, error)

func (*UserUseCase) GetProfileUpdate

func (r *UserUseCase) GetProfileUpdate(ctx context.Context, uuid string) (*ProfileUpdate, error)

func (*UserUseCase) GetUserFollow

func (r *UserUseCase) GetUserFollow(ctx context.Context, uuid, userUuid string) (bool, error)

func (*UserUseCase) GetUserFollows

func (r *UserUseCase) GetUserFollows(ctx context.Context, uuid string) (map[string]bool, error)

func (*UserUseCase) GetUserSearch

func (r *UserUseCase) GetUserSearch(ctx context.Context, page int32, search string) ([]*UserSearch, int32, error)

func (*UserUseCase) ProfileReviewNotPass

func (r *UserUseCase) ProfileReviewNotPass(ctx context.Context, uuid string) error

func (*UserUseCase) ProfileReviewPass

func (r *UserUseCase) ProfileReviewPass(ctx context.Context, uuid, update string) error

func (*UserUseCase) SetFollowDbAndCache

func (r *UserUseCase) SetFollowDbAndCache(ctx context.Context, uuid, userId string) error

func (*UserUseCase) SetProfileUpdate

func (r *UserUseCase) SetProfileUpdate(ctx context.Context, profile *ProfileUpdate) error

func (*UserUseCase) SetUserFollow

func (r *UserUseCase) SetUserFollow(ctx context.Context, uuid, userId string) error

Jump to

Keyboard shortcuts

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