forked from ebhomengo/niki
1
0
Fork 0
niki/internal/initial/validator.go

72 lines
3.0 KiB
Go
Raw Normal View History

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"
2024-07-01 17:13:28 +00:00
adminkindboxvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/kind_box"
adminkindboxreqvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/kind_box_req"
agentkindboxvalidator "git.gocasts.ir/ebhomengo/niki/validator/agent/kind_box"
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
2024-07-01 17:13:28 +00:00
AdminKindBoxVld adminkindboxvalidator.Validator
AgentKindBoxVld agentkindboxvalidator.Validator
}
func InitAdminKindBoxReqValidator(db *mysql.DB, cfg config.Config) adminkindboxreqvalidator.Validator {
return adminkindboxreqvalidator.New(InitBenefactorKindBoxReqDB(db), InitAdminService(cfg, db), InitBenefactorForAdminService(db), InitAdminReferTimeService(db), InitBenefactorAddressService(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))
2024-07-01 17:13:28 +00:00
}
func InitAgentKindBoxValidator(db *mysql.DB) agentkindboxvalidator.Validator {
return agentkindboxvalidator.New(InitKindBoxRepo(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),
)
}