-
Notifications
You must be signed in to change notification settings - Fork 6
Metdata version updated with metadata update #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ta if specific version is not available
|
I think doing the black formatting should fix the build error, then I can mark this one approved. |
No idea why it's failing for a file where I haven't made any changes. However, still trying to format the file. |
|
Sorry for not understanding the context, do you mean that if metadata has been changed, the file version need to be automatically bumped up? If so could you point me to the part that |
There is 2 parts to this PR:
I hope that answers your question. Lmk if you have any more. |
| public static getFileMetadataApiV2FilesFileIdMetadataGet( | ||
| fileId: string, | ||
| allVersions: boolean = false, | ||
| allVersions: boolean = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@longshuicy I enabled this here to send the version with the request to update metadata
| Metadata document that was updated | ||
| """ | ||
|
|
||
| # check if metadata with file version exists, replace metadata if none exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace_metadata is the function which is already taking care of updating resource object etc.
If there is no specific version of metadata is available in mongodb, we want to update the version, hence called 'replace_metadata'
|
@ddey2 can you resolve conflicts? I am not seeing the black check. Does it only run it if there is no conflict? |
|
I added a file and added metadata. I updated the file, and when i changed the metadata it updated the version to v2. Is this the expected behavior? Or should the file v1 metadata still be saved in the db? |
This should be the expected behavior for now (as per our discussion). We plan to keep all the metadata versions, but that's for future. I have created an issue for that #277 |
tcnichol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and this work. Marking approved.
| { | ||
| "_id": ObjectId(metadata_in.metadata_id), | ||
| "resource.resource_id": ObjectId(file_id), | ||
| "resource.version": metadata_in.file_version, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the resource_id and version filters are unnecessary here since the _id of the metadata should be unique.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's necessary because I need to find out if metadata with the specific file id and version id exists. If it does, we can simple update the metadata here in this method, else I need to call 'replace_file_metadata' where it creates a new object with the file id and version. I could have updated the current method but chose to re-use what we already have.
Uh oh!
There was an error while loading. Please reload this page.