24 lines
667 B
Python
24 lines
667 B
Python
from typing import Optional
|
|
from Services.Redis import RedisActions
|
|
from ApiLayers.AllConfigs.Redis.configs import RedisValidationKeysAction
|
|
|
|
|
|
class StaticValidationRetriever:
|
|
|
|
lang: str = "tr"
|
|
code: str = ""
|
|
|
|
def __init__(self, lang: str, code: str):
|
|
self.lang = lang
|
|
self.code = code
|
|
|
|
@property
|
|
def response(self) -> Optional[dict]:
|
|
language_model = RedisActions.get_json(
|
|
list_keys=[RedisValidationKeysAction.static_response_key, self.code, self.lang]
|
|
)
|
|
if language_model.status:
|
|
return language_model.first
|
|
return {"message": f"{self.code} -> Language model not found"}
|
|
|