usecase

package
v0.0.0-...-833fa1d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package usecase account implementation

Index

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) Count

func (a *AccountUsecase) Count(ctx context.Context, filter *account.Filter) (int64, error)

Count of accounts by filter

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) Get

func (a *AccountUsecase) Get(ctx context.Context, id uint64) (*model.Account, error)

Get returns the group by ID if have access

func (*AccountUsecase) GetByTitle

func (a *AccountUsecase) GetByTitle(ctx context.Context, title string) (*model.Account, error)

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) Store

func (a *AccountUsecase) Store(ctx context.Context, accountObj *model.Account) (uint64, error)

Store new object into database

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

Jump to

Keyboard shortcuts

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