forked from ebhomengo/niki
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package notification
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
smscontract "git.gocasts.ir/ebhomengo/niki/contract/sms"
|
|
param "git.gocasts.ir/ebhomengo/niki/param/admin/admin"
|
|
adminbenefactorparam "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
|
|
kbp "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box"
|
|
adminkindboxreqparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
|
|
)
|
|
|
|
type Config struct {
|
|
Timeout time.Duration `koanf:"timeout"`
|
|
}
|
|
|
|
type KindBoxReqSvc interface {
|
|
Get(ctx context.Context, request adminkindboxreqparam.GetKindBoxReqRequest) (adminkindboxreqparam.GetKindBoxReqResponse, error)
|
|
}
|
|
|
|
type BenefactorSvc interface {
|
|
GetByID(ctx context.Context, req adminbenefactorparam.GetBenefactorByIDRequest) (adminbenefactorparam.GetBenefactorByIDResponse, error)
|
|
}
|
|
|
|
type AdminSvc interface {
|
|
AdminExistByID(ctx context.Context, req param.AdminExistByIDRequest) (param.AdminExistByIDResponse, error)
|
|
}
|
|
|
|
type KindBoxSvc interface {
|
|
Get(ctx context.Context, req kbp.KindBoxGetRequest) (kbp.KindBoxGetResponse, error)
|
|
}
|
|
|
|
type Service struct {
|
|
cfg Config
|
|
smsAdapter smscontract.SmsAdapter
|
|
KindBoxReqSvc KindBoxReqSvc
|
|
BenefactorSvc BenefactorSvc
|
|
AdminSvc AdminSvc
|
|
KindBoxSvc KindBoxSvc
|
|
}
|
|
|
|
func New(cfg Config, smsAdapter smscontract.SmsAdapter, kindBoxReqSvc KindBoxReqSvc, benefactorSvc BenefactorSvc,
|
|
adminSvc AdminSvc, kindBoxSvc KindBoxSvc,
|
|
) Service {
|
|
return Service{
|
|
cfg: cfg,
|
|
smsAdapter: smsAdapter,
|
|
KindBoxReqSvc: kindBoxReqSvc,
|
|
BenefactorSvc: benefactorSvc,
|
|
AdminSvc: adminSvc,
|
|
KindBoxSvc: kindBoxSvc,
|
|
}
|
|
}
|