usecase

package
v0.0.0-...-2dc66f2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package usecase implements application business logic. Each logic group in own file.

Index

Constants

View Source
const DEBUG = true

Variables

This section is empty.

Functions

func AuthenticateCtx

func AuthenticateCtx(ctx *context.Context, c *ent.Client, user *model.Customer)

func EmbedUser

func EmbedUser(ctx context.Context, u *model.Customer) context.Context

func EncodeToString

func EncodeToString(max int) string

func GenerateConfirmTxcToken

func GenerateConfirmTxcToken(
	ctx context.Context,
	token,
	signingKey string,
	isFeePaidByMe bool,
	secondsDuration time.Duration,
) (string, error)

func GenerateForgetPwdToken

func GenerateForgetPwdToken(
	ctx context.Context,
	token,
	email,
	signingKey string,
	secondsDuration time.Duration,
) (string, error)

func GenerateFulfillToken

func GenerateFulfillToken(
	ctx context.Context,
	token,
	signingKey string,
	secondsDuration time.Duration,
) (string, error)

func GenerateHashInfo

func GenerateHashInfo(
	v string,
) (string, error)

func GenerateOTP

func GenerateOTP(max int) string

func GetUserAsAdmin

func GetUserAsAdmin(ctx context.Context) *model.Admin

func GetUserAsCustomer

func GetUserAsCustomer(ctx context.Context) *model.Customer

func GetUserAsEmployee

func GetUserAsEmployee(ctx context.Context) *model.Employee

func GetUserAsPartner

func GetUserAsPartner(ctx context.Context) *model.Partner

func MakeOTPValue

func MakeOTPValue(ctx context.Context, otp string, extra ...string) string

func MakeValue

func MakeValue(ctx context.Context) string

func ParseToken

func ParseToken(
	ctx context.Context,
	token string,
	signingKey string,
) (map[string]any, error)

func ValidateHashInfo

func ValidateHashInfo(
	raw,
	hash string,
) error

func ValidationError

func ValidationError(err error) error

func WrapError

func WrapError(err error) error

Types

type IAdminAuthUseCase

type IAdminAuthUseCase interface {
	// contains filtered or unexported methods
}

type IAdminConfigUseCase

type IAdminConfigUseCase interface {
	IGetConfigUseCase
}

type IAdminEmployeeCreateUseCase

type IAdminEmployeeCreateUseCase interface {
	// contains filtered or unexported methods
}

type IAdminEmployeeDeleteUseCase

type IAdminEmployeeDeleteUseCase interface {
	// contains filtered or unexported methods
}

type IAdminEmployeeGetFirstUseCase

type IAdminEmployeeGetFirstUseCase interface {
	GetFirst(context.Context, *model.EmployeeOrderInput, *model.EmployeeWhereInput) (*model.Employee, error)
}

type IAdminEmployeeListUseCase

type IAdminEmployeeListUseCase interface {
	// contains filtered or unexported methods
}

type IAdminEmployeeUpdateUseCase

type IAdminEmployeeUpdateUseCase interface {
	// contains filtered or unexported methods
}

type IAdminEmployeeValidateCreateUseCase

type IAdminEmployeeValidateCreateUseCase interface {
	// contains filtered or unexported methods
}

type IAdminEmployeeValidateUpdateUseCase

type IAdminEmployeeValidateUpdateUseCase interface {
	// contains filtered or unexported methods
}

type IAdminGetFirstUseCase

type IAdminGetFirstUseCase interface {
	GetFirst(context.Context, *model.AdminOrderInput, *model.AdminWhereInput) (*model.Admin, error)
}

type IAdminGetUserFromCtxUseCase

type IAdminGetUserFromCtxUseCase interface {
	GetUserFromCtx(context.Context) (*model.Admin, error)
}

type IAdminGetUserUseCase

type IAdminGetUserUseCase interface {
	IGetUserUseCase
}

type IAdminListUseCase

type IAdminListUseCase interface {
	// contains filtered or unexported methods
}

type IAdminTransactionGetFirstUseCase

type IAdminTransactionGetFirstUseCase interface {
	GetFirst(context.Context, *model.TransactionOrderInput, *model.TransactionWhereInput) (*model.Transaction, error)
}

type IAdminTransactionListUseCase

type IAdminTransactionListUseCase interface {
	// contains filtered or unexported methods
}

type IAdminUpdateUseCase

type IAdminUpdateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerBankAccountDeleteUseCase

type ICustomerBankAccountDeleteUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerBankAccountGetFirstMineUseCase

type ICustomerBankAccountGetFirstMineUseCase interface {
	GetFirstMine(context.Context, *model.BankAccountOrderInput, *model.BankAccountWhereInput) (*model.BankAccount, error)
}

type ICustomerBankAccountGetFirstUseCase

type ICustomerBankAccountGetFirstUseCase interface {
	GetFirst(context.Context, *model.BankAccountOrderInput, *model.BankAccountWhereInput) (*model.BankAccount, error)
}

type ICustomerBankAccountListMineUseCase

type ICustomerBankAccountListMineUseCase interface {
	ListMine(context.Context, *int, *int, *model.BankAccountOrderInput, *model.BankAccountWhereInput) ([]*model.BankAccount, error)
}

type ICustomerBankAccountListUseCase

type ICustomerBankAccountListUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerBankAccountUpdateUseCase

type ICustomerBankAccountUpdateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerBankAccountValidateUpdateInputUseCase

type ICustomerBankAccountValidateUpdateInputUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerChangePasswordUseCase

type ICustomerChangePasswordUseCase interface {
	ChangePassword(context.Context, *model.CustomerChangePasswordInput) (*model.Customer, error)
}

type ICustomerChangePasswordWithTokenUseCase

type ICustomerChangePasswordWithTokenUseCase interface {
	ChangePasswordWithToken(context.Context, *model.CustomerChangePasswordWithTokenInput) error
}

type ICustomerConfigUseCase

type ICustomerConfigUseCase interface {
	IGetConfigUseCase
	GetFeeAmount() *float64
	GetFeeDesc() *string
}

type ICustomerContactCreateUseCase

type ICustomerContactCreateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerContactDeleteUseCase

type ICustomerContactDeleteUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerContactGetFirstMineUseCase

type ICustomerContactGetFirstMineUseCase interface {
	GetFirstMine(context.Context, *model.ContactOrderInput, *model.ContactWhereInput) (*model.Contact, error)
}

type ICustomerContactListMineUseCase

type ICustomerContactListMineUseCase interface {
	ListMine(context.Context, *int, *int, *model.ContactOrderInput, *model.ContactWhereInput) ([]*model.Contact, error)
}

type ICustomerContactListUseCase

type ICustomerContactListUseCase interface {
	// contains filtered or unexported methods
}

contact

type ICustomerContactUpdateUseCase

type ICustomerContactUpdateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerContactValidateCreateInputUseCase

type ICustomerContactValidateCreateInputUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerContactValidateUpdateInputUseCase

type ICustomerContactValidateUpdateInputUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerDebtCancelUseCase

type ICustomerDebtCancelUseCase interface {
	Cancel(context.Context, *model.Debt, *model.DebtUpdateInput) (*model.Debt, error)
}

type ICustomerDebtCreateUseCase

type ICustomerDebtCreateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerDebtFulfillUseCase

type ICustomerDebtFulfillUseCase interface {
	Fulfill(context.Context, *model.Debt) (*model.DebtFulfillResp, error)
}

type ICustomerDebtFulfillWithTokenUseCase

type ICustomerDebtFulfillWithTokenUseCase interface {
	FulfillWithToken(context.Context, *model.Debt, *model.DebtFulfillWithTokenInput) (*model.Debt, error)
}

type ICustomerDebtGetFirstMineUseCase

type ICustomerDebtGetFirstMineUseCase interface {
	GetFirstMine(context.Context, *model.DebtOrderInput, *model.DebtWhereInput) (*model.Debt, error)
}

type ICustomerDebtListMineUseCase

type ICustomerDebtListMineUseCase interface {
	ListMine(context.Context, *int, *int, *model.DebtOrderInput, *model.DebtWhereInput) ([]*model.Debt, error)
}

type ICustomerDebtListUseCase

type ICustomerDebtListUseCase interface {
	// contains filtered or unexported methods
}

debt

type ICustomerDebtUpdateUseCase

type ICustomerDebtUpdateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerDebtValidateCancelUseCase

type ICustomerDebtValidateCancelUseCase interface {
	ValidateCancel(context.Context, *model.Debt, *model.DebtUpdateInput) (*model.DebtUpdateInput, error)
}

type ICustomerDebtValidateCreateInputUseCase

type ICustomerDebtValidateCreateInputUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerDebtValidateFulfillUseCase

type ICustomerDebtValidateFulfillUseCase interface {
	ValidateFulfill(context.Context, *model.Debt) error
}

type ICustomerDebtValidateFulfillWithTokenUseCase

type ICustomerDebtValidateFulfillWithTokenUseCase interface {
	ValidateFulfillWithToken(context.Context, *model.Debt, *model.DebtFulfillWithTokenInput) (*model.DebtFulfillWithTokenInput, error)
}

type ICustomerForgetPasswordUseCase

type ICustomerForgetPasswordUseCase interface {
	ForgetPassword(context.Context, *model.CustomerForgetPasswordInput) (*model.CustomerForgetPasswordResp, error)
}

type ICustomerGetFirstUseCase

type ICustomerGetFirstUseCase interface {
	GetFirst(context.Context, *model.CustomerOrderInput, *model.CustomerWhereInput) (*model.Customer, error)
}

type ICustomerGetUserFromCtxUseCase

type ICustomerGetUserFromCtxUseCase interface {
	GetUserFromCtx(context.Context) (*model.Customer, error)
}

type ICustomerGetUserUseCase

type ICustomerGetUserUseCase interface {
	IGetUserUseCase
}

type ICustomerListUseCase

type ICustomerListUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerStreamUseCase

type ICustomerStreamUseCase interface {
	ICustomerGetUserUseCase
	ICustomerConfigUseCase
}

stream

type ICustomerTPBankBankAccountGetUseCase

type ICustomerTPBankBankAccountGetUseCase interface {
	Get(context.Context, *model.BankAccountWhereInput) (*model.BankAccountPartner, error)
}

type ICustomerTransactionConfirmSuccessUseCase

type ICustomerTransactionConfirmSuccessUseCase interface {
	ConfirmSuccess(context.Context, *model.Transaction, *string) (*model.Transaction, error)
}

type ICustomerTransactionCreateUseCase

type ICustomerTransactionCreateUseCase interface {
	Create(context.Context, *model.TransactionCreateUseCaseInput) (*model.TransactionCreateResp, error)
}

type ICustomerTransactionGetFirstMineUseCase

type ICustomerTransactionGetFirstMineUseCase interface {
	GetFirstMine(context.Context, *model.TransactionOrderInput, *model.TransactionWhereInput) (*model.Transaction, error)
}

type ICustomerTransactionListMineUseCase

type ICustomerTransactionListMineUseCase interface {
	ListMine(context.Context, *int, *int, *model.TransactionOrderInput, *model.TransactionWhereInput) ([]*model.Transaction, error)
}

type ICustomerTransactionListUseCase

type ICustomerTransactionListUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerTransactionUpdateUseCase

type ICustomerTransactionUpdateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerTransactionValidateConfirmInputUseCase

type ICustomerTransactionValidateConfirmInputUseCase interface {
	ValidateConfirmInput(context.Context, *model.Transaction, *model.TransactionConfirmUseCaseInput) error
}

type ICustomerTransactionValidateCreateInputUseCase

type ICustomerTransactionValidateCreateInputUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerUpdateUseCase

type ICustomerUpdateUseCase interface {
	// contains filtered or unexported methods
}

type ICustomerValidateChangePasswordUseCase

type ICustomerValidateChangePasswordUseCase interface {
	ValidateChangePassword(context.Context, *model.CustomerChangePasswordInput) (*model.CustomerChangePasswordInput, error)
}

change password

type ICustomerValidateChangePasswordWithTokenUseCase

type ICustomerValidateChangePasswordWithTokenUseCase interface {
	ValidateChangePasswordWithToken(context.Context, *model.CustomerChangePasswordWithTokenInput) (*model.CustomerChangePasswordWithTokenInput, error)
}

type ICustomerValidateForgetPasswordUsecase

type ICustomerValidateForgetPasswordUsecase interface {
	ValidateForgetPassword(context.Context, *model.CustomerForgetPasswordInput) (*model.CustomerForgetPasswordInput, error)
}

type IEmployeeAuthUseCase

type IEmployeeAuthUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeBankAccountDeleteUseCase

type IEmployeeBankAccountDeleteUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeBankAccountGetFirstUseCase

type IEmployeeBankAccountGetFirstUseCase interface {
	GetFirst(context.Context, *model.BankAccountOrderInput, *model.BankAccountWhereInput) (*model.BankAccount, error)
}

type IEmployeeBankAccountListUseCase

type IEmployeeBankAccountListUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeBankAccountUpdateUseCase

type IEmployeeBankAccountUpdateUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeBankAccountValidateUpdateInputUseCase

type IEmployeeBankAccountValidateUpdateInputUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeConfigUseCase

type IEmployeeConfigUseCase interface {
	IGetConfigUseCase
}

type IEmployeeCustomerCreateUseCase

type IEmployeeCustomerCreateUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeCustomerGetFirstUseCase

type IEmployeeCustomerGetFirstUseCase interface {
	ICustomerGetFirstUseCase
}

type IEmployeeCustomerListUseCase

type IEmployeeCustomerListUseCase interface {
	ICustomerListUseCase
}

type IEmployeeCustomerValidateCreateUseCase

type IEmployeeCustomerValidateCreateUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeGetFirstUseCase

type IEmployeeGetFirstUseCase interface {
	GetFirst(context.Context, *model.EmployeeOrderInput, *model.EmployeeWhereInput) (*model.Employee, error)
}

type IEmployeeGetUserFromCtxUseCase

type IEmployeeGetUserFromCtxUseCase interface {
	GetUserFromCtx(context.Context) (*model.Employee, error)
}

type IEmployeeGetUserUseCase

type IEmployeeGetUserUseCase interface {
	IGetUserUseCase
}

type IEmployeeListUseCase

type IEmployeeListUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeTransactionGetFirstUseCase

type IEmployeeTransactionGetFirstUseCase interface {
	GetFirst(context.Context, *model.TransactionOrderInput, *model.TransactionWhereInput) (*model.Transaction, error)
}

type IEmployeeTransactionListUseCase

type IEmployeeTransactionListUseCase interface {
	// contains filtered or unexported methods
}

type IEmployeeUpdateUseCase

type IEmployeeUpdateUseCase interface {
	// contains filtered or unexported methods
}

type IGetConfigUseCase

type IGetConfigUseCase interface {
	GetProductOwnerName() *string
	GetSecret() *string
}

type IGetUserUseCase

type IGetUserUseCase interface {
	GetUser(context.Context, map[string]any) (any, error)
}

type IIsNextUseCase

type IIsNextUseCase[ModelType, ModelOrderInput, ModelWhereInput any] interface {
	IsNext(context.Context, int, int, ModelOrderInput, ModelWhereInput) (bool, error)
}

type IOptionsUseCase

type IOptionsUseCase interface {
	IGetConfigUseCase
	GetDebtStatus(context.Context) []string
	GetTransactionStatus(context.Context) []string
	GetEvents(context.Context) []string
	GetPartners(context.Context) []string
}

type IPartnerAuthUseCase

type IPartnerAuthUseCase interface {
	Login(context.Context, *model.PartnerLoginInput) (any, error)
	ValidateLoginInput(context.Context, *model.PartnerLoginInput) (*model.PartnerLoginInput, error)
}

type IPartnerBankAccountGetFirstUseCase

type IPartnerBankAccountGetFirstUseCase interface {
	GetFirst(context.Context, *model.BankAccountOrderInput, *model.BankAccountWhereInput) (*model.BankAccount, error)
}

type IPartnerBankAccountListUseCase

type IPartnerBankAccountListUseCase interface {
	// contains filtered or unexported methods
}

type IPartnerBankAccountRespGetFirstUseCase

type IPartnerBankAccountRespGetFirstUseCase interface {
	GetFirst(context.Context, *model.BankAccountOrderInput, *model.BankAccountWhereInput) (*model.PartnerBankAccountResp, error)
}

type IPartnerConfigUseCase

type IPartnerConfigUseCase interface {
	IGetConfigUseCase
	GetFeeAmount() *float64
	GetFeeDesc() *string
}

type IPartnerGetFirstUseCase

type IPartnerGetFirstUseCase interface {
	GetFirst(context.Context, *model.PartnerOrderInput, *model.PartnerWhereInput) (*model.Partner, error)
}

type IPartnerGetUserUseCase

type IPartnerGetUserUseCase interface {
	IGetUserUseCase
}

type IPartnerListUseCase

type IPartnerListUseCase interface {
	// contains filtered or unexported methods
}

type IPartnerOptionUseCase

type IPartnerOptionUseCase interface {
	GetActorType(context.Context) []string
}

type IPartnerTransactionCreateUseCase

type IPartnerTransactionCreateUseCase interface {
	// contains filtered or unexported methods
}

type IPartnerTransactionValidateCreateUseCase

type IPartnerTransactionValidateCreateUseCase interface {
	// contains filtered or unexported methods
}

type UserCtxType

type UserCtxType string
const (
	UserCtxKey UserCtxType = "user"
	UserCtxVal UserCtxType = "user-value"
)

Directories

Path Synopsis
logic
me

Jump to

Keyboard shortcuts

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