forked from ebhomengo/niki
66 lines
2.7 KiB
Go
66 lines
2.7 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"
|
|
adminkindboxvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/kind_box"
|
|
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
|
|
AdminKindBoxVld adminkindboxvalidator.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 InitAdminKindBoxValidator(db *mysql.DB, cfg config.Config) adminkindboxvalidator.Validator {
|
|
return adminkindboxvalidator.New(InitKindBoxRepo(db), InitAdminService(cfg, 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),
|
|
)
|
|
}
|