Documentation ¶
Overview ¶
Package usecase account implementation
Index ¶
- Variables
- type AccountUsecase
- func (a *AccountUsecase) Count(ctx context.Context, filter *account.Filter) (int64, error)
- func (a *AccountUsecase) CountMembers(ctx context.Context, filter *account.MemberFilter) (_ int64, err error)
- func (a *AccountUsecase) Delete(ctx context.Context, id uint64) error
- func (a *AccountUsecase) FetchList(ctx context.Context, filter *account.Filter, order *account.ListOrder, ...) ([]*model.Account, error)
- func (a *AccountUsecase) FetchListMembers(ctx context.Context, filter *account.MemberFilter, ...) (_ []*model.AccountMember, err error)
- func (a *AccountUsecase) Get(ctx context.Context, id uint64) (*model.Account, error)
- func (a *AccountUsecase) GetByTitle(ctx context.Context, title string) (*model.Account, error)
- func (a *AccountUsecase) InviteMember(ctx context.Context, accountID uint64, email string, roles ...string) (*model.AccountMember, error)
- func (a *AccountUsecase) LinkMember(ctx context.Context, accountObj *model.Account, isAdmin bool, ...) error
- func (a *AccountUsecase) Register(ctx context.Context, ownerObj *model.User, accountObj *model.Account, ...) (uint64, error)
- func (a *AccountUsecase) SetAccountMemeberRoles(ctx context.Context, accountID, userID uint64, roles ...string) (*model.AccountMember, error)
- func (a *AccountUsecase) SetMemberRoles(ctx context.Context, memberID uint64, roles ...string) (*model.AccountMember, error)
- func (a *AccountUsecase) Store(ctx context.Context, accountObj *model.Account) (uint64, error)
- func (a *AccountUsecase) UnlinkAccountMember(ctx context.Context, memberID uint64) error
- func (a *AccountUsecase) UnlinkMember(ctx context.Context, accountObj *model.Account, members ...*model.User) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOwnerRequired = errors.New("owner is required")
Functions ¶
This section is empty.
Types ¶
type AccountUsecase ¶
type AccountUsecase struct {
// contains filtered or unexported fields
}
AccountUsecase provides bussiness logic for account access
func NewAccountUsecase ¶
func NewAccountUsecase(userRepo user.Repository, accountRepo account.Repository) *AccountUsecase
NewAccountUsecase object controller
func (*AccountUsecase) CountMembers ¶
func (a *AccountUsecase) CountMembers(ctx context.Context, filter *account.MemberFilter) (_ int64, err error)
CountMembers returns the count of members from account
func (*AccountUsecase) Delete ¶
func (a *AccountUsecase) Delete(ctx context.Context, id uint64) error
Delete delites record by ID
func (*AccountUsecase) FetchList ¶
func (a *AccountUsecase) FetchList(ctx context.Context, filter *account.Filter, order *account.ListOrder, pagination *repository.Pagination) ([]*model.Account, error)
FetchList of accounts by filter
func (*AccountUsecase) FetchListMembers ¶
func (a *AccountUsecase) FetchListMembers(ctx context.Context, filter *account.MemberFilter, order *account.MemberListOrder, pagination *repository.Pagination) (_ []*model.AccountMember, err error)
FetchListMembers returns the list of members from account
func (*AccountUsecase) GetByTitle ¶
GetByTitle returns the account by title if have access
func (*AccountUsecase) InviteMember ¶
func (a *AccountUsecase) InviteMember(ctx context.Context, accountID uint64, email string, roles ...string) (*model.AccountMember, error)
InviteMember into account by email
func (*AccountUsecase) LinkMember ¶
func (a *AccountUsecase) LinkMember(ctx context.Context, accountObj *model.Account, isAdmin bool, members ...*model.User) error
LinkMember into account
func (*AccountUsecase) Register ¶
func (a *AccountUsecase) Register(ctx context.Context, ownerObj *model.User, accountObj *model.Account, password string) (uint64, error)
Register new account with owner if not exists
func (*AccountUsecase) SetAccountMemeberRoles ¶
func (a *AccountUsecase) SetAccountMemeberRoles(ctx context.Context, accountID, userID uint64, roles ...string) (*model.AccountMember, error)
SetAccountMemeberRoles into account
func (*AccountUsecase) SetMemberRoles ¶
func (a *AccountUsecase) SetMemberRoles(ctx context.Context, memberID uint64, roles ...string) (*model.AccountMember, error)
SetMemberRoles into account
func (*AccountUsecase) UnlinkAccountMember ¶
func (a *AccountUsecase) UnlinkAccountMember(ctx context.Context, memberID uint64) error
UnlinkAccountMember from the account
func (*AccountUsecase) UnlinkMember ¶
func (a *AccountUsecase) UnlinkMember(ctx context.Context, accountObj *model.Account, members ...*model.User) error
UnlinkMember from the account
Click to show internal directories.
Click to hide internal directories.