niki/service/admin/kind_box_req/service.go

43 lines
1.5 KiB
Go
Raw Normal View History

2023-12-25 17:08:19 +00:00
package adminkindboxreqservice
import (
"context"
"git.gocasts.ir/ebhomengo/niki/entity"
adminkindboxparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
)
type Repository interface {
// AddKindBoxReq(ctx context.Context, kindBoxReq entity.KindBoxReq) (entity.KindBoxReq, error)
// UpdateKindBoxReq(ctx context.Context, kindBoxReqID uint, kindBoxReq entity.KindBoxReq) (entity.KindBoxReq, error)
2023-12-25 17:08:19 +00:00
// TODO: can benefactor cancel its request ?
// DeleteKindBoxReq(ctx context.Context, kindBoxReqID uint) error
// GetAllKindBoxReq(ctx context.Context) ([]entity.KindBoxReq, error)
// GetKindBoxReq(ctx context.Context, kindBoxReqID uint) (entity.KindBoxReq, error)
AcceptKindBoxReq(ctx context.Context, kindBoxReqID uint, countAccepted uint) error
GetByID(ctx context.Context, id uint) (entity.KindBoxReq, error)
2024-01-22 15:21:13 +00:00
RejectKindBoxReq(ctx context.Context, kindBoxReqID uint, description string) error
}
type KindBoxClient interface {
AddKindBoxAfterAcceptingRequest(ctx context.Context, param adminkindboxparam.KindBoxAddAfterAcceptingReqRequest) (adminkindboxparam.KindBoxAddAfterAcceptingReqResponse, error)
}
// TODO: check validation.
2023-12-26 20:01:45 +00:00
// type BenefactorService interface {
// IsBenefactorExist(ctx context.Context, benefactorID uint) (bool, error)
// }
type Service struct {
repo Repository
2023-12-26 20:01:45 +00:00
// benefactorService BenefactorService
kindBoxClient KindBoxClient
}
func New(repository Repository, kindBoxClient KindBoxClient) Service {
return Service{
repo: repository,
kindBoxClient: kindBoxClient,
}
}