biz

package
v0.0.0-...-393e050 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 11 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type CampaignRepo

type CampaignRepo interface {
	Tx
	CreateCampaign(ctx context.Context, request *CreateCampaignRequest) (int64, error)
	GetCampaignNotFull(ctx context.Context) (*ent.Campaign, error)
	IncreaseCampaignSlot(ctx context.Context, req *IncreaseCampaignSlotRequest) error
}

type CampaignUseCase

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

func NewCampaignUseCase

func NewCampaignUseCase(voucherRepo VoucherRepo, voucherCampaignRepo VoucherCampaignRepo, campaignRepo CampaignRepo) *CampaignUseCase

func (*CampaignUseCase) CreateCampaign

func (uc *CampaignUseCase) CreateCampaign(ctx context.Context, req *server.CreateCampaignRequest) (int64, error)

type CreateCampaignRequest

type CreateCampaignRequest struct {
	Name      string
	StartDay  int64
	EndDay    int64
	TotalSlot int64
}

type CreateUserRequest

type CreateUserRequest struct {
	FullName    string
	UserName    string
	PhoneNumber string
	Email       string
	Password    string // encrypted password
	BirthDay    time.Time
	Account     string
}

type CreateUserVoucherRequest

type CreateUserVoucherRequest struct {
	VoucherCampaignID int64
	UserID            string
}

type CreateVoucherCampaignRequest

type CreateVoucherCampaignRequest struct {
	CampaignID int64
	VoucherID  int64
	StartDay   int64
	ValidTo    int64
}

type CreateVoucherRequest

type CreateVoucherRequest struct {
	Name  string
	Type  string
	Value float32
}

type GetUserRequest

type GetUserRequest struct {
	Account string
}

type IncreaseCampaignSlotRequest

type IncreaseCampaignSlotRequest struct {
	CampaignID  int64
	IsFull      bool
	CurrentSlot int64
}

type Tx

type Tx interface {
	WithTx(ctx context.Context, fn func(ctx context.Context) error) error
}

type UserRepo

type UserRepo interface {
	Tx
	CreateUser(ctx context.Context, req *CreateUserRequest) (string, error)
	GetUser(ctx context.Context, req *GetUserRequest) (*ent.User, error)
	UpdateLoginTime(ctx context.Context, account string) error
}

type UserUseCase

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

func NewUserUserCase

func NewUserUserCase(repo UserRepo, natsCli nats.JetStreamContext, topic string) *UserUseCase

func (*UserUseCase) Login

func (uc *UserUseCase) Login(ctx context.Context, req *server.LoginRequest) error

func (*UserUseCase) Register

type UserVoucherRepo

type UserVoucherRepo interface {
	Tx
	CreateUserVoucher(ctx context.Context, req *CreateUserVoucherRequest) error
}

type VoucherCampaignRepo

type VoucherCampaignRepo interface {
	Tx
	CreateVoucherCampaign(ctx context.Context, req *CreateVoucherCampaignRequest) error
	GetVoucherCampaign(ctx context.Context, campaignID int64) ([]*ent.VoucherCampaign, error)
}

type VoucherRepo

type VoucherRepo interface {
	Tx
	CreateVoucher(ctx context.Context, req *server.CreateVoucherRequest) error
	GetVoucherByIDs(ctx context.Context, ids []int) ([]*ent.Voucher, error)
}

type VoucherUseCase

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

func NewVoucherUseCase

func NewVoucherUseCase(repo VoucherRepo) *VoucherUseCase

func (*VoucherUseCase) CreateVoucher

func (uc *VoucherUseCase) CreateVoucher(ctx context.Context, req *server.CreateVoucherRequest) error

Jump to

Keyboard shortcuts

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