Skip to content

Commit

Permalink
[#38] latest version of beanie fixes the extra field 'revision_id' issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdash committed Feb 2, 2024
1 parent a552324 commit 337eae2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions api/routes/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ async def create_dataset(document: DatasetMetadataDOC, user: Annotated[User, Dep
submission = document.as_submission()
user.submissions.append(submission)
await user.save(link_rule=WriteRules.WRITE)
# TODO: due to this bug (https://github.com/roman-right/beanie/issues/648) in beanie an
# extra attribute (revision_id) seems to be added to the document - that's why the tests are failing
document.delete_revision_id()
return document


Expand All @@ -39,7 +36,6 @@ async def get_dataset(submission_id: PydanticObjectId):
if document is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Dataset metadata record was not found")

document.delete_revision_id()
document = inject_repository_identifier(submission, document)
return document

Expand All @@ -48,8 +44,6 @@ async def get_dataset(submission_id: PydanticObjectId):
async def get_datasets(user: Annotated[User, Depends(get_current_user)]):
documents = [inject_repository_identifier(submission, await DatasetMetadataDOC.get(submission.identifier)) for
submission in user.submissions]
for document in documents:
document.delete_revision_id()
return documents


Expand Down Expand Up @@ -77,7 +71,6 @@ async def update_dataset(
updated_submission.submitted = submission.submitted
await updated_submission.replace()
dataset = inject_repository_identifier(updated_submission, dataset)
dataset.delete_revision_id()
return dataset


Expand Down Expand Up @@ -156,7 +149,6 @@ async def _save_to_db(repository_type: RepositoryType, identifier: str, user: Us
dataset = updated_dataset
submission = updated_submission

dataset.delete_revision_id()
dataset = inject_repository_identifier(submission, dataset)
return dataset

Expand Down
2 changes: 1 addition & 1 deletion docker/requirements/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ requests
fastapi[all]==0.101.*
uvicorn[standard]
motor==3.*
beanie[httpx]==1.22.*
beanie[httpx]==1.25.*
python-jose==3.*
pydantic==2.*
pydantic-settings==2.*

0 comments on commit 337eae2

Please sign in to comment.