Skip to content

Commit

Permalink
chore: type for form
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar committed Jun 27, 2024
1 parent aeefdc3 commit 2a44b06
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
12 changes: 0 additions & 12 deletions src/modules/moodle/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ class InSections(CustomModel):
sections: list[InSection]


# {
# "course_id": 1114,
# "module_id": 83459,
# "contents": [
# {
# "type": "file",
# "filename": "Lab 5 (AddersSubtractors).pdf"
# }
# ]
# }


class InContents(CustomModel):
course_id: int
module_id: int
Expand Down
3 changes: 1 addition & 2 deletions src/modules/moodle/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from fastapi import Form, HTTPException
from fastapi.encoders import jsonable_encoder
from pydantic import ValidationError
from pydantic.json_schema import SkipJsonSchema
from starlette import status

from src.modules.moodle.schemas import InContents
Expand All @@ -15,7 +14,7 @@ def module_to_minio_prefix(course_id: int, module_id: int) -> str:
return f"moodle/{course_id}/{module_id}/"


def checker(data: InContents | SkipJsonSchema[str] = Form(...)):
def checker(data: InContents | str = Form(...)):
try:
return InContents.model_validate_json(data)
except ValidationError as e:
Expand Down

0 comments on commit 2a44b06

Please sign in to comment.