Files
kra-new/internal/biz/business/direct_promote.go
T

37 lines
1.0 KiB
Go

package business
import "context"
type BusinessPromote struct {
ID uint64
Account, SourceDB string
BusierID uint64
}
type BusinessPromoteFilter struct {
UserID uint
SourceDB string
BusierID uint64
}
type BusinessPromotePage struct {
Rows []*BusinessPromote
Total int64
Available bool
}
type BusinessPromoteRepo interface {
ListDirect(context.Context, BusinessPromoteFilter, ...ListOption) (*BusinessPromotePage, error)
}
type BusinessPromoteUsecase struct {
repo BusinessPromoteRepo
accounts *AccountUsecase
}
func NewBusinessPromoteUsecase(repo BusinessPromoteRepo, accounts *AccountUsecase) *BusinessPromoteUsecase {
return &BusinessPromoteUsecase{repo: repo, accounts: accounts}
}
func (uc *BusinessPromoteUsecase) List(ctx context.Context, filter BusinessPromoteFilter, options ...ListOption) (*BusinessPromotePage, error) {
if _, err := uc.accounts.Find(ctx, filter.UserID); err != nil {
return nil, err
}
return uc.repo.ListDirect(ctx, filter, options...)
}