forked from ebhomengo/niki
60 lines
2.4 KiB
Go
60 lines
2.4 KiB
Go
package initial
|
|
|
|
import (
|
|
"git.gocasts.ir/ebhomengo/niki/adapter/redis"
|
|
"git.gocasts.ir/ebhomengo/niki/config"
|
|
"git.gocasts.ir/ebhomengo/niki/repository/mysql"
|
|
adminvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/admin"
|
|
adminkindboxreqvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/kind_box_req"
|
|
benefactoraddressvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/address"
|
|
benefactorvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/benefactor"
|
|
benefactorkindboxvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/kind_box"
|
|
benefactorkindboxreqvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/kind_box_req"
|
|
)
|
|
|
|
type Validators struct {
|
|
BenefactorVld benefactorvalidator.Validator
|
|
BenefactorKindBoxReqVld benefactorkindboxreqvalidator.Validator
|
|
BenefactorAddressVld benefactoraddressvalidator.Validator
|
|
BenefactorKindBoxVld benefactorkindboxvalidator.Validator
|
|
AdminKindBoxReqVld adminkindboxreqvalidator.Validator
|
|
AdminVld adminvalidator.Validator
|
|
}
|
|
|
|
func InitAdminKindBoxReqValidator(db *mysql.DB, cfg config.Config) adminkindboxreqvalidator.Validator {
|
|
return adminkindboxreqvalidator.New(InitBenefactorKindBoxReqDB(db), InitAdminService(cfg, db), InitBenefactorForAdminService(db))
|
|
}
|
|
|
|
func InitAdminValidator(db *mysql.DB) adminvalidator.Validator {
|
|
return adminvalidator.New(InitAdminMysql(db))
|
|
}
|
|
|
|
func InitBenefactorValidator() benefactorvalidator.Validator {
|
|
return benefactorvalidator.New()
|
|
}
|
|
|
|
func InitBenefactorKindBoxReqValidator(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactorkindboxreqvalidator.Validator {
|
|
return benefactorkindboxreqvalidator.New(
|
|
InitBenefactorService(cfg, redisAdapter, db),
|
|
InitBenefactorAddressService(db),
|
|
InitAdminReferTimeService(db),
|
|
InitBenefactorKindBoxReqDB(db),
|
|
)
|
|
}
|
|
|
|
func InitBenefactorAddressValidator(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactoraddressvalidator.Validator {
|
|
return benefactoraddressvalidator.New(
|
|
InitBenefactorService(cfg, redisAdapter, db),
|
|
InitBenefactorAddressDB(db),
|
|
)
|
|
}
|
|
|
|
func InitBenefactorKindBoxValidator(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactorkindboxvalidator.Validator {
|
|
return benefactorkindboxvalidator.New(
|
|
InitKindBoxRepo(db),
|
|
InitBenefactorService(cfg, redisAdapter, db),
|
|
InitBenefactorAddressService(db),
|
|
InitAdminReferTimeService(db),
|
|
)
|
|
}
|