-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
整理: ユーザー辞書機能を API Router でモジュール化 (#1156)
* refactor: user_dict 機能をサブサーバに切り出して整理 * refactor: router を生成関数に変更 * fix: lint * fix: `router` 名を明瞭化 * fix: グローバル変数 FIXME 追加 * fix: lint
- Loading branch information
Showing
5 changed files
with
230 additions
and
190 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
Empty file.
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,21 @@ | ||
from dataclasses import dataclass | ||
|
||
from fastapi import HTTPException | ||
|
||
|
||
# 許可されていないAPIを無効化する | ||
@dataclass | ||
class MutableAPI: | ||
enable: bool = True | ||
|
||
|
||
# FIXME: グローバル変数が複数ファイルに分散しているため、DI 等で局所化する | ||
deprecated_mutable_api = MutableAPI() | ||
|
||
|
||
async def check_disabled_mutable_api() -> None: | ||
if not deprecated_mutable_api.enable: | ||
raise HTTPException( | ||
status_code=403, | ||
detail="エンジンの静的なデータを変更するAPIは無効化されています", | ||
) |
Empty file.
Oops, something went wrong.