forked from ebhomengo/niki
41 lines
1.5 KiB
Go
41 lines
1.5 KiB
Go
package adminkindboxreqservice
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.gocasts.ir/ebhomengo/niki/entity"
|
|
params "git.gocasts.ir/ebhomengo/niki/param"
|
|
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
|
|
validator "git.gocasts.ir/ebhomengo/niki/validator/admin/kind_box_req"
|
|
)
|
|
|
|
type Repository interface {
|
|
AcceptKindBoxReq(ctx context.Context, kindBoxReqID uint, countAccepted uint) error
|
|
GetByID(ctx context.Context, id uint) (entity.KindBoxReq, error)
|
|
RejectKindBoxReq(ctx context.Context, kindBoxReqID uint, description string) error
|
|
AssignSenderAgentToKindBoxReq(ctx context.Context, kindBoxReqID uint, senderAgentID uint) error
|
|
DeliverKindBoxReq(ctx context.Context, kindBoxReqID uint) error
|
|
GetAllKindBoxReq(ctx context.Context, filter params.FilterRequest, pagination params.PaginationRequest, sort params.SortRequest) ([]entity.KindBoxReq, uint, error)
|
|
GetAwaitingDeliveryByAgent(ctx context.Context, kindBoxReqID uint, agentID uint) (entity.KindBoxReq, error)
|
|
AddKindBoxReq(ctx context.Context, kindBoxReq entity.KindBoxReq) (entity.KindBoxReq, error)
|
|
UpdateKindBoxReq(ctx context.Context, kindBoxReq entity.KindBoxReq) error
|
|
}
|
|
|
|
type KindBoxSvc interface {
|
|
AddBatchKindBox(ctx context.Context, req param.AddKindBoxRequest) (param.AddKindBoxResponse, error)
|
|
}
|
|
|
|
type Service struct {
|
|
repo Repository
|
|
kindBoxSvc KindBoxSvc
|
|
vld validator.Validator
|
|
}
|
|
|
|
func New(repository Repository, kindBoxSvc KindBoxSvc, vld validator.Validator) Service {
|
|
return Service{
|
|
repo: repository,
|
|
kindBoxSvc: kindBoxSvc,
|
|
vld: vld,
|
|
}
|
|
}
|