Documentation ¶
Index ¶
- Constants
- Variables
- type CreatedInput
- type DeletedInput
- type DetailGotInput
- type IService
- type ListGotInput
- type Output
- type OutputList
- type ServiceImpl
- func (u *ServiceImpl) CreateGroup(ctx context.Context, groupInfo *CreatedInput) (*Output, error)
- func (u *ServiceImpl) DeleteGroup(ctx context.Context, groupInfo *DeletedInput) (*Output, error)
- func (u *ServiceImpl) GetGroupDetail(ctx context.Context, groupInfo *DetailGotInput) (*Output, error)
- func (u *ServiceImpl) GetGroupList(ctx context.Context, groupInfo *ListGotInput) (*OutputList, error)
- func (u *ServiceImpl) UpdateGroup(ctx context.Context, groupInfo *UpdatedInput) (*Output, error)
- type UpdatedInput
Constants ¶
View Source
const ( ErrorCodeRepository = domainerrors.ErrorCodeApplication + domainerrors.ErrorCodeApplicationGroup + iota ErrorCodeValidateInput ErrorCodeCast )
Variables ¶
View Source
var ( ErrValidation = errors.New("validation failed") ErrCastToEntityFailed = errors.New("cast to entity failed") )
Functions ¶
This section is empty.
Types ¶
type CreatedInput ¶
type CreatedInput struct { Name string `json:"name" validate:"required,lte=30,alphanum"` Description string `json:"description" validate:"required,lte=200"` OwnerID string `json:"ownerId" validate:"omitempty,alphanum,len=20"` }
func (*CreatedInput) ToEntity ¶
func (c *CreatedInput) ToEntity() *entity.Group
func (*CreatedInput) Validate ¶
func (c *CreatedInput) Validate() error
type DeletedInput ¶
type DeletedInput struct {
ID string `json:"id" validate:"required,alphanum,len=20"`
}
func (*DeletedInput) Validate ¶
func (i *DeletedInput) Validate() error
type DetailGotInput ¶
type DetailGotInput struct {
ID string `json:"id" validate:"required,alphanum,len=20"`
}
func (*DetailGotInput) Validate ¶
func (i *DetailGotInput) Validate() error
type IService ¶
type IService interface { // Command CreateGroup(ctx context.Context, groupInfo *CreatedInput) (*Output, error) // AssignGroup(ctx context.Context, groupInfo *AssignedInput) (*Output, error) UpdateGroup(ctx context.Context, groupInfo *UpdatedInput) (*Output, error) DeleteGroup(ctx context.Context, groupInfo *DeletedInput) (*Output, error) // // Query GetGroupList(ctx context.Context, groupInfo *ListGotInput) (*OutputList, error) GetGroupDetail(ctx context.Context, groupInfo *DetailGotInput) (*Output, error) }
type ListGotInput ¶
type ListGotInput struct { Limit int `json:"limit"` Offset int `json:"offset"` FilterName string `json:"filterName" validate:"omitempty,oneof=name"` SortFields []string `json:"sortFields" validate:"dive,oneof=id name updated_at created_at"` Dir string `json:"dir" validate:"oneof=asc desc"` }
func (*ListGotInput) ToEntity ¶
func (i *ListGotInput) ToEntity() *entity.Group
func (*ListGotInput) ToSearchQuery ¶
func (i *ListGotInput) ToSearchQuery() *domain.SearchQuery
func (*ListGotInput) Validate ¶
func (i *ListGotInput) Validate() error
type Output ¶
type Output struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Users []application_user.Output `json:"users"` OwnerID string `json:"ownerId"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt time.Time `json:"deletedAt"` }
type OutputList ¶
type OutputList struct { Offset int64 `json:"offset"` Limit int64 `json:"limit"` Total int64 `json:"total"` Items []Output `json:"items"` }
func NewListOutput ¶
func NewListOutput(e *domain.List) *OutputList
type ServiceImpl ¶
type ServiceImpl struct { TransactionRepo domain.ITransactionRepo GroupRepo repository.GroupRepository UserRepo repository.UserRepository EventProducer event.Producer // contains filtered or unexported fields }
ServiceImpl -.
func NewServiceImpl ¶
func NewServiceImpl(groupRepo repository.GroupRepository, userRepo repository.UserRepository, transactionRepo domain.ITransactionRepo, eventProducer event.Producer, l pwlogger.Interface) *ServiceImpl
NewServiceImpl -.
func (*ServiceImpl) CreateGroup ¶
func (u *ServiceImpl) CreateGroup(ctx context.Context, groupInfo *CreatedInput) (*Output, error)
CreateGroup creates a group.
func (*ServiceImpl) DeleteGroup ¶
func (u *ServiceImpl) DeleteGroup(ctx context.Context, groupInfo *DeletedInput) (*Output, error)
DeleteGroup deletes group.
func (*ServiceImpl) GetGroupDetail ¶
func (u *ServiceImpl) GetGroupDetail(ctx context.Context, groupInfo *DetailGotInput) (*Output, error)
GetGroupDetail gets group detail.
func (*ServiceImpl) GetGroupList ¶
func (u *ServiceImpl) GetGroupList(ctx context.Context, groupInfo *ListGotInput) (*OutputList, error)
GetGroupList gets group list.
func (*ServiceImpl) UpdateGroup ¶
func (u *ServiceImpl) UpdateGroup(ctx context.Context, groupInfo *UpdatedInput) (*Output, error)
UpdateGroup updates group.
type UpdatedInput ¶
type UpdatedInput struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Permissions string `json:"permissions"` }
func (*UpdatedInput) ToEntity ¶
func (c *UpdatedInput) ToEntity() *entity.Group
func (*UpdatedInput) Validate ¶
func (c *UpdatedInput) Validate() error
Click to show internal directories.
Click to hide internal directories.