-
Notifications
You must be signed in to change notification settings - Fork 71
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
systemfields: add parent community #1082
Conversation
eef0415
to
712a438
Compare
invenio_communities/communities/records/jsonschemas/communities/communities-v1.0.0.json
Outdated
Show resolved
Hide resolved
712a438
to
f689afc
Compare
invenio_communities/communities/records/systemfields/parent_community.py
Outdated
Show resolved
Hide resolved
f689afc
to
f522a50
Compare
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.
Reviewed with @0einstein0. Some minor comments on mixing service/data layers, but otherwise looks good.
if ( | ||
community.access.visibility_is_public | ||
and record.access.visibility_is_public | ||
): | ||
record["parent"] = {"id": str(community.id)} | ||
else: | ||
raise ValueError("Parent community and child community must be public.") |
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.
minor: logically this would belong in the service layer, since here (in the data layer) we only care about managing the child/parent relationship in terms of data (not business rules/validation).
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 have removed it. Pinging @yashlamba as we probably want to add this check in the service layer.
invenio_communities/communities/records/systemfields/parent_community.py
Outdated
Show resolved
Hide resolved
invenio_communities/communities/records/systemfields/parent_community.py
Outdated
Show resolved
Hide resolved
invenio_communities/communities/records/systemfields/parent_community.py
Outdated
Show resolved
Hide resolved
invenio_communities/communities/records/systemfields/parent_community.py
Outdated
Show resolved
Hide resolved
invenio_communities/communities/records/systemfields/parent_community.py
Outdated
Show resolved
Hide resolved
141633c
to
269fdfe
Compare
269fdfe
to
efa84ff
Compare
ParentCommunity
systemfield zenodo/zenodo-rdm#696