Skip to content
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

project: add collection resource #566

Merged
merged 3 commits into from
Jun 14, 2021
Merged

project: add collection resource #566

merged 3 commits into from
Jun 14, 2021

Conversation

sebdeleze
Copy link
Contributor

@sebdeleze sebdeleze commented May 21, 2021

@sebdeleze sebdeleze marked this pull request as ready for review June 7, 2021 07:03
Sébastien Délèze added 2 commits June 9, 2021 08:45
* Creates a new `collections` resource.
* Enables files management for this new resource.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
* Links collections to documents.
* Creates a collection and links it to document when a deposit is validated.
* Creates a collection when a collection is found in RERO DOC publication.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
@sebdeleze sebdeleze requested review from jma and zannkukai June 11, 2021 14:54
Comment on lines +45 to +61
@classmethod
def create(cls, data, id_=None, dbcommit=False, with_bucket=True,
**kwargs):
"""Create record.

:param dict data: Metadata of the new record
:param str id_: UUID to use if not generated
:param bool dbcommit: Wether to commit into DB during creation
:param bool with_bucket: Wether to create a bucket for record
:return: New record instance
:rtype: Record
"""
return super().create(data,
id_=id_,
dbcommit=dbcommit,
with_bucket=with_bucket,
**kwargs)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary if your create method did nothing more than class parent ?
Into RERO-ILS project, we skip this declaration into children classes if there are no specific process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's mandatory because I need to set the default value for with_bucket to True.

schema = f'{RESOURCE_NAME}/{JSON_SCHEMA_NAME}-v1.0.0.json'
pid_type = PID_TYPE
resolver_url = f'/api/{RESOURCE_NAME}/<pid>'
rest_endpoint = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like PEP-8 80 characters line limit. Not easy to read :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agree with you, we should increase this limit.

sonar/modules/collections/jsonresolvers.py Outdated Show resolved Hide resolved
* Adds a view to list the collections for an organisation.
* Adds a block containing the collection information in the search view in the collection context.
* Filters records corresponding to the collection in the collection context.
* Hides collection aggregation in the collection context.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
@sebdeleze sebdeleze merged commit fa21361 into rero:staging Jun 14, 2021
@sebdeleze sebdeleze deleted the sed-custom-collections branch June 14, 2021 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the definition of custom collections
2 participants