Implement validation
This commit is contained in:
parent
061462460b
commit
c7571120cc
1 changed files with 10 additions and 1 deletions
|
@ -51,7 +51,12 @@ class CurateAdd(BaseModel):
|
|||
url: str
|
||||
|
||||
|
||||
T = TypeVar('T', CurateAdd, CurateDelete, CurateMove)
|
||||
class CurateValidate(BaseModel):
|
||||
validate_index: int
|
||||
is_validated: bool
|
||||
|
||||
|
||||
T = TypeVar('T', CurateAdd, CurateDelete, CurateMove, CurateValidate)
|
||||
|
||||
|
||||
class Curation(BaseModel, Generic[T]):
|
||||
|
@ -119,6 +124,10 @@ def create_router() -> APIRouter:
|
|||
def user_add_result(curate_add: Curation[CurateAdd]):
|
||||
return _create_comment("curate_add", curate_add)
|
||||
|
||||
@router.post("/curation/validate")
|
||||
def user_add_result(curate_validate: Curation[CurateValidate]):
|
||||
return _create_comment("curate_validate", curate_validate)
|
||||
|
||||
def _create_comment(curation_type: str, curation: Curation):
|
||||
content = json.dumps({curation_type: curation.curation.dict()}, indent=2)
|
||||
create_comment = {
|
||||
|
|
Loading…
Reference in a new issue