Skip to content

Commit

Permalink
storagefiles: fix conflicts when rebasing master
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiramtilakiiit committed Dec 5, 2024
1 parent ce5ec04 commit 9974018
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ def createStorageFile(


@strawberry.mutation
def editStorageFile(
id: str, details: StorageFileInput, info: Info
) -> StorageFileType:
def updateStorageFile(
id: str, info: Info
) -> bool:
"""
Edit an existing storagefile
returns the edited storagefile
Update an existing storagefile
returns the updated storagefile
Allowed Roles: ["cc"]
"""
Expand All @@ -196,23 +196,19 @@ def editStorageFile(
if storagefile is None:
raise ValueError("StorageFile not found.")

edited_storagefile = StorageFile(
updated_storagefile = StorageFile(
_id=id,
title=details.title,
url=details.url,
filetype=details.filetype,
title=storagefile["title"],
url=storagefile["url"],
filetype=storagefile["filetype"],
modified_time=time_str,
creation_time=storagefile["creation_time"],
)

filestoragedb.find_one_and_update(
{"_id": id}, {"$set": jsonable_encoder(edited_storagefile)}
)
updated_storagefile = filestoragedb.find_one({"_id": id})

return StorageFileType.from_pydantic(
StorageFile.model_validate(updated_storagefile)
{"_id": id}, {"$set": jsonable_encoder(updated_storagefile)}
)
return True


@strawberry.mutation
Expand Down Expand Up @@ -241,6 +237,6 @@ def deleteStorageFile(id: str, info: Info) -> bool:
sendMail,
ccApply,
createStorageFile,
editStorageFile,
updateStorageFile,
deleteStorageFile,
]

0 comments on commit 9974018

Please sign in to comment.