Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions print_service/routes/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import aiofiles
import aiofiles.os
from auth_lib.fastapi import UnionAuth
from fastapi import APIRouter, File, UploadFile
from fastapi.exceptions import HTTPException
from fastapi.params import Depends
Expand Down Expand Up @@ -160,10 +159,7 @@ async def send(inp: SendInput, settings: Settings = Depends(get_settings)):
response_model=SendOutput,
)
async def upload_file(
pin: str,
file: UploadFile = File(...),
settings: Settings = Depends(get_settings),
_=Depends(UnionAuth(scopes=["print.file.create"], allow_none=False, auto_error=True)),
pin: str, file: UploadFile = File(...), settings: Settings = Depends(get_settings)
):
"""Загрузить файл на сервер.

Expand Down Expand Up @@ -233,10 +229,7 @@ async def upload_file(
response_model=SendOutput,
)
async def update_file_options(
pin: str,
inp: SendInputUpdate,
settings: Settings = Depends(get_settings),
_=Depends(UnionAuth(scopes=["print.file.update"], allow_none=False, auto_error=True)),
pin: str, inp: SendInputUpdate, settings: Settings = Depends(get_settings)
):
"""Обновляет настройки печати.

Expand Down Expand Up @@ -282,11 +275,7 @@ async def update_file_options(
},
response_model=ReceiveOutput,
)
async def print_file(
pin: str,
settings: Settings = Depends(get_settings),
_=Depends(UnionAuth(scopes=["print.file.get"], allow_none=False, auto_error=True)),
):
async def print_file(pin: str, settings: Settings = Depends(get_settings)):
"""Получить файл для печати.

Требует пин-код, полученный в методе POST `/file`. Файл можно скачать
Expand Down