-
Notifications
You must be signed in to change notification settings - Fork 43
feat(comment-file): file upload delete read #550
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
feat(comment-file): file upload delete read #550
Conversation
54697d7 to
0d5843d
Compare
| ["object_version_id"], | ||
| unique=False, | ||
| ) | ||
| # TODO: Is ix_request_files_record_id needed? (We do not have it in Zenodo prod for communities) |
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.
leftover?
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.
Oh, I removed it in the 2nd commit instead of the first one, my bad.
And indeed, I checked and I don't think that these indexes make sense.
We decided that commits will be squashed.
Same for comment below.
| # op.create_index( | ||
| # "uidx_request_files_id_key", "request_files", ["id", "key"], unique=True | ||
| # ) | ||
| # TODO: Is uidx_request_files_record_id_key needed? (We do not have it in Zenodo prod for communities, but instead have uidx_request_files_id_key) |
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.
leftover?
invenio_requests/records/jsonschemas/requests/request-v1.0.0.json
Outdated
Show resolved
Hide resolved
| yield projection | ||
|
|
||
|
|
||
| class RequestFileLink(Link): |
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.
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.
Guidance on the change would be to:
- replace
LinkbyEndpointLinkimported withfrom invenio_records_resources.services import EndpointLink - replace the
"{api}/..."by the name of the endpoint - add
params=[...]argument with string name of the route variables - define
vars=lambda obj, vars: ...to updatevarswith those route variables
You can see: https://github.com/inveniosoftware/invenio-requests/pull/522/changes#diff-1dc8e4a7059ecea92c9ede417ea4f8e769f1963c9d94a7f37d8e80d3e4d8222eR131 for the Request work. (and invenio-records-resources and so on for various takes)
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.
@ptamarit I think we need to note down the above so that we upgrade the links after the next major release including the above changes. @fenekku we plan to release this feature first as part of the current major release so that we avoid having to bump to the major including your work on links refactoring among others.
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.
Can you clarify that part:
we plan to release this feature first as part of the current major release so that we avoid having to bump to the major including your work on links refactoring among others.
given the below: ?
The links change in this repo will necessitate a major bump of invenio-requests. The UTC change that Christoph will apply: #487 would also necessitate a major bump of this repo. The current plan, was to get the Links and UTC changes as part of the same major bump.
Either this PR can be part of that same major bump or it can be part of its own separate major bump (ordering to your liking).
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.
We will release this as part of the major bump inveniosoftware/invenio-app-rdm@c540fa1 which includes already the commenting features. Of course, after you bump the major with the Links and UTC we will need to include the feature applying the changes as you pointed out in https://github.com/inveniosoftware/invenio-requests/pull/522/changes#diff-1dc8e4a7059ecea92c9ede417ea4f8e769f1963c9d94a7f37d8e80d3e4d8222eR131 .
We want to do this because we dont want to block you but also Zenodo wants to deploy all the commenting features rather soon without having to bump to the changes you introduce with Christoph. @ptamarit correct me if I am wrong :)
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.
Got it. If you want to get commenting and files sooner, it makes sense to do your own major bump. That major bump will have to be incremented again on invenio-app-rdm once my work and @utnapischtim's work is merged and released.
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.
We had done our own last December so we will continue in that one as a maint release if you are faster than us :)
| Additional replies can be loaded via pagination. | ||
| """ | ||
|
|
||
| REQUESTS_FILES_DEFAULT_QUOTA_SIZE = 100 * 10**6 # 100MB |
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.
Make sure there is some nice error when we reach that in the UI
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 just tested, and we get an HTTP status code 400 and the following response:
{'message': 'Bucket quota exceeded.', 'status': 400}
(This makes me think that my explicit check and custom exception RequestFileSizeLimitError are not that useful, since the underlying bucket already takes care of returning errors which are properly handled.)
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.
Unless, we want to have a specific error for comments when this bubbles up
| raise RequestFileNotFoundError() | ||
|
|
||
| return deleted_file.file.dumps() | ||
| return request_file.file |
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.
Return it via result item?
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.
Using file_result_item in the last commit (different than the 2 other results, so that we can rely on the send_file implemented by FileService).
d4a0708 to
76a06fd
Compare
|
FYI, I disabled assertions in the Alembic test which are failing since SQLAlchemy-Continuum 1.6.0 (not related to changes on this PR, failing in master too). |
76a06fd to
5e51ffb
Compare
|
Just squashed commits before merging. |
Partially fixes #489