main
py 18 lines 649 Bytes
Raw
1 from helpers.api import ApiHandler, Request, Response
2
3 from helpers import settings
4
5 from typing import Any
6
7
8 class SetSettings(ApiHandler):
9 async def process(self, input: dict[Any, Any], request: Request) -> dict[Any, Any] | Response:
10 frontend = input.get("settings", input)
11 browser_timezone = input.get("browser_timezone")
12 backend = settings.convert_in(settings.Settings(**frontend))
13 backend = settings.set_settings(
14 backend,
15 browser_timezone=browser_timezone if isinstance(browser_timezone, str) else None,
16 )
17 out = settings.convert_out(backend)
18 return dict(out)