from dataclasses import dataclass from anydi import singleton from fansifter_common.legal_info.services import LegalInfoService from preference_center.profile.requests import IPCountryRequest from preference_center.profile.types import SettingsDict @dataclass class GetSettingsRequest(IPCountryRequest): pass @singleton class GetSettingsHandler: def __init__(self, legal_info_service: LegalInfoService) -> None: self.legal_info_service = legal_info_service def handle(self, request: GetSettingsRequest) -> SettingsDict: is_date_of_birth_allowed = self.legal_info_service.is_date_of_birth_allowed( request.ip_country ) privacy_links = self.legal_info_service.get_privacy_links(request.ip_country) legal_entity = self.legal_info_service.get_legal_entity(request.ip_country) return { "is_date_of_birth_allowed": is_date_of_birth_allowed, "privacy_links": privacy_links, "legal_entity": legal_entity, }