2022-08-05 11:14:29 +00:00
|
|
|
from utils.apps.manager import listener_service
|
2022-07-31 07:33:56 +00:00
|
|
|
from utils.mysql import MySQL
|
2022-08-04 13:19:17 +00:00
|
|
|
from utils.redisdb import RedisDB
|
|
|
|
from .cache import PublicCookiesCache
|
|
|
|
from .repositories import CookiesRepository
|
2022-08-05 11:14:29 +00:00
|
|
|
from .services import CookiesService, PublicCookiesService
|
2022-07-31 07:33:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
@listener_service()
|
|
|
|
def create_cookie_service(mysql: MySQL):
|
|
|
|
_repository = CookiesRepository(mysql)
|
2022-07-31 08:18:28 +00:00
|
|
|
_service = CookiesService(_repository)
|
2022-07-31 07:33:56 +00:00
|
|
|
return _service
|
2022-08-04 13:19:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
@listener_service()
|
|
|
|
def create_public_cookie_service(mysql: MySQL, redis: RedisDB):
|
|
|
|
_repository = CookiesRepository(mysql)
|
|
|
|
_cache = PublicCookiesCache(redis)
|
|
|
|
_service = PublicCookiesService(_repository, _cache)
|
|
|
|
return _service
|