feat(api,userbot,frontend): add accounts from the web ui and isolate per-account settings
This commit is contained in:
1 parent
92fd20137e
commit
9c265af3d3
19 files changed
+917
-268
No files matched your search
@@ -71,9 +71,15 @@ async def get_policy(pool: FromDishka[asyncpg.Pool], policy_id: int) -> PolicyRe
|
||||
|
||||
@router.put("/{policy_id}")
|
||||
async def update_policy(
|
||||
pool: FromDishka[asyncpg.Pool], policy_id: int, body: CaptureToggles
|
||||
pool: FromDishka[asyncpg.Pool],
|
||||
policy_id: int,
|
||||
body: CaptureToggles,
|
||||
account_id: Annotated[int | None, Query()] = None,
|
||||
) -> PolicyRecord:
|
||||
record = await repository.update_policy(pool, policy_id, body)
|
||||
if account_id is None:
|
||||
record = await repository.update_policy(pool, policy_id, body)
|
||||
else:
|
||||
record = await repository.override_policy(pool, policy_id, account_id, body)
|
||||
if record is None:
|
||||
raise HTTPException(status_code=404, detail="policy not found")
|
||||
await pool.execute(f"NOTIFY {POLICY_CHANGED_CHANNEL}")
|
||||
|
||||
Reference in new issue
Block a user