fix: small return fixes in api schema
This commit is contained in:
@@ -210,7 +210,9 @@ def list_user_submissions(request: HttpRequest, event_path: str, scope_id: UUID)
|
||||
return submissions.select_related("user").order_by("-created_at")
|
||||
|
||||
|
||||
@router.get(f"{PREFIX}/submission/by/game", response=list[SubmissionOut])
|
||||
@router.get(
|
||||
f"{PREFIX}/submission/by/game", response={200: list[SubmissionOut], 403: dict}
|
||||
)
|
||||
def list_submissions_by_game(request: HttpRequest, event_path: str, game_path: str):
|
||||
game = get_object_or_404(Game, path=game_path)
|
||||
|
||||
@@ -220,7 +222,9 @@ def list_submissions_by_game(request: HttpRequest, event_path: str, game_path: s
|
||||
return Submission.for_event.filter(scope__event_game__game=game)
|
||||
|
||||
|
||||
@router.get(f"{PREFIX}/submission/{{submission_id}}", response=SubmissionOut)
|
||||
@router.get(
|
||||
f"{PREFIX}/submission/{{submission_id}}", response={200: SubmissionOut, 403: dict}
|
||||
)
|
||||
def get_submission(request: HttpRequest, event_path: str, submission_id: UUID):
|
||||
submission = get_object_or_404(Submission.for_event, id=submission_id)
|
||||
|
||||
@@ -230,7 +234,9 @@ def get_submission(request: HttpRequest, event_path: str, submission_id: UUID):
|
||||
return submission
|
||||
|
||||
|
||||
@router.post(f"{PREFIX}/crops/s/{{submission_file_id}}", response=ImageCropOut)
|
||||
@router.post(
|
||||
f"{PREFIX}/crops/s/{{submission_file_id}}", response={200: ImageCropOut, 403: dict}
|
||||
)
|
||||
def create_image_crop(
|
||||
request: HttpRequest,
|
||||
event_path: str,
|
||||
@@ -257,7 +263,7 @@ def create_image_crop(
|
||||
return crop
|
||||
|
||||
|
||||
@router.delete(f"{PREFIX}/crops/{{crop_id}}", response=dict)
|
||||
@router.delete(f"{PREFIX}/crops/{{crop_id}}", response={200: dict, 403: dict})
|
||||
def delete_image_crop(request: HttpRequest, event_path: str, crop_id: UUID):
|
||||
if not request.user.is_staff:
|
||||
return 403, {"detail": "Admin access required"}
|
||||
@@ -270,7 +276,7 @@ def delete_image_crop(request: HttpRequest, event_path: str, crop_id: UUID):
|
||||
return {"status": "deleted"}
|
||||
|
||||
|
||||
@router.post(f"{PREFIX}/files/{{file_id}}/process-ocr", response=dict)
|
||||
@router.post(f"{PREFIX}/files/{{file_id}}/process-ocr", response={200: dict, 403: dict})
|
||||
def process_file_ocr(request: HttpRequest, event_path: str, file_id: UUID):
|
||||
if not request.user.is_staff:
|
||||
return 403, {"detail": "Admin access required"}
|
||||
@@ -287,7 +293,7 @@ def process_file_ocr(request: HttpRequest, event_path: str, file_id: UUID):
|
||||
return {"status": "queued"}
|
||||
|
||||
|
||||
@router.post(f"{PREFIX}/crops/{{crop_id}}/process-ocr", response=dict)
|
||||
@router.post(f"{PREFIX}/crops/{{crop_id}}/process-ocr", response={200: dict, 403: dict})
|
||||
def process_crop_ocr(request: HttpRequest, event_path: str, crop_id: UUID):
|
||||
if not request.user.is_staff:
|
||||
return 403, {"detail": "Admin access required"}
|
||||
|
||||
Reference in New Issue
Block a user