-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2b734a
commit 3c92de0
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from fastapi import Request | ||
|
||
from fastapi_injector import Injected | ||
from fastapi_utils.cbv import cbv | ||
from fastapi_utils.inferring_router import InferringRouter | ||
|
||
from main.summer_mode.summer_mode import SummerMode | ||
|
||
from main.summer_mode.summer_mode_repository import ISummerModeRepository | ||
|
||
summer_mode_router = InferringRouter(tags=["SummerModeController"]) | ||
|
||
|
||
@cbv(summer_mode_router) | ||
class SummerModeController: | ||
summer_mode_repository: ISummerModeRepository = Injected(ISummerModeRepository) | ||
|
||
@summer_mode_router.get("/api/summer_mode") | ||
async def summer_mode(self, request: Request) -> str: | ||
summer_mode: SummerMode = await self.summer_mode_repository.get_summer_mode() | ||
if summer_mode: | ||
return summer_mode.get_mode() | ||
else: | ||
return SummerMode.UNKNOWN |