package initial import ( "git.gocasts.ir/ebhomengo/niki/adapter/redis" smsprovider "git.gocasts.ir/ebhomengo/niki/adapter/sms_provider/kavenegar" kavenegarnotification "git.gocasts.ir/ebhomengo/niki/adapter/sms_provider/kavenegar/notification" kavenegarotp "git.gocasts.ir/ebhomengo/niki/adapter/sms_provider/kavenegar/otp" "git.gocasts.ir/ebhomengo/niki/config" "git.gocasts.ir/ebhomengo/niki/repository/mysql" mysqladdress "git.gocasts.ir/ebhomengo/niki/repository/mysql/address" mysqlbenefactor "git.gocasts.ir/ebhomengo/niki/repository/mysql/benefactor" mysqlkindbox "git.gocasts.ir/ebhomengo/niki/repository/mysql/kind_box" mysqlkindboxreq "git.gocasts.ir/ebhomengo/niki/repository/mysql/kind_box_req" redisotp "git.gocasts.ir/ebhomengo/niki/repository/redis/redis_otp" adminservice "git.gocasts.ir/ebhomengo/niki/service/admin/admin" benefactorforadminservice "git.gocasts.ir/ebhomengo/niki/service/admin/benefactor" adminkindboxservice "git.gocasts.ir/ebhomengo/niki/service/admin/kind_box" adminkindboxreqservice "git.gocasts.ir/ebhomengo/niki/service/admin/kind_box_req" adminrefertimeservice "git.gocasts.ir/ebhomengo/niki/service/admin/refer_time" agentkindboxservice "git.gocasts.ir/ebhomengo/niki/service/agent/kind_box" benefactoraddressservice "git.gocasts.ir/ebhomengo/niki/service/benefactor/address" benefactorservice "git.gocasts.ir/ebhomengo/niki/service/benefactor/benefactor" benefactorkindboxservice "git.gocasts.ir/ebhomengo/niki/service/benefactor/kind_box" benefactorkindboxreqservice "git.gocasts.ir/ebhomengo/niki/service/benefactor/kind_box_req" "git.gocasts.ir/ebhomengo/niki/service/notification" ) type Services struct { BenefactorSvc benefactorservice.Service BenefactorKindBoxReqSvc benefactorkindboxreqservice.Service BenefactorAddressSvc benefactoraddressservice.Service BenefactorKindBoxSvc benefactorkindboxservice.Service AdminKindBoxSvc adminkindboxservice.Service AgentKindBoxSvc agentkindboxservice.Service AdminSvc adminservice.Service AdminKindBoxReqSvc adminkindboxreqservice.Service AdminReferTimeSvc adminrefertimeservice.Service NotificationSvc notification.Service } func initSmsOtp(cfg config.Config) *kavenegarotp.Adapter { return kavenegarotp.New(smsprovider.New(cfg.KavenegarSmsProvider)) } func initSmsNotification(cfg config.Config) *kavenegarnotification.Adapter { return kavenegarnotification.New(smsprovider.New(cfg.KavenegarSmsProvider)) } func InitAdminService(cfg config.Config, db *mysql.DB) adminservice.Service { return adminservice.New(InitAdminMysql(db), InitAdminAuthService(cfg)) } func InitBenefactorForAdminService(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactorforadminservice.Service { return benefactorforadminservice.New(InitAdminMysql(db), InitBenefactorService(cfg, redisAdapter, db)) } func InitBenefactorService(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactorservice.Service { return benefactorservice.New( cfg.BenefactorSvc, redisotp.New(redisAdapter), initSmsOtp(cfg), InitBenefactorAuthService(cfg), mysqlbenefactor.New(db), ) } func InitBenefactorAddressService(db *mysql.DB) benefactoraddressservice.Service { return benefactoraddressservice.New(mysqladdress.New(db)) } func InitBenefactorKindBoxReqService(db *mysql.DB) benefactorkindboxreqservice.Service { return benefactorkindboxreqservice.New(mysqlkindboxreq.New(db)) } func InitAdminKindBoxService(db *mysql.DB) adminkindboxservice.Service { return adminkindboxservice.New(InitKindBoxRepo(db)) } func InitAgentKindBoxService(db *mysql.DB) agentkindboxservice.Service { return agentkindboxservice.New(InitKindBoxRepo(db)) } func InitAdminKindBoxReqService(db *mysql.DB) adminkindboxreqservice.Service { return adminkindboxreqservice.New(InitBenefactorKindBoxReqDB(db), InitAdminKindBoxService(db)) } func InitAdminReferTimeService(db *mysql.DB) adminrefertimeservice.Service { return adminrefertimeservice.New( InitAdminReferTimeDB(db), ) } func InitBenefactorKindBoxService(db *mysql.DB) benefactorkindboxservice.Service { return benefactorkindboxservice.New(mysqlkindbox.New(db)) } func InitNotificationService(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) notification.Service { return notification.New(initSmsNotification(cfg), InitAdminKindBoxReqService(db), InitBenefactorForAdminService(cfg, redisAdapter, db)) }