Skip to content

Commit

Permalink
service: allow passing custom expires_at
Browse files Browse the repository at this point in the history
  • Loading branch information
carlinmack authored and slint committed Dec 11, 2024
1 parent 8192aa6 commit 113fd11
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions invenio_communities/subcommunities/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,23 @@ def join(self, identity, id_, data, uow=None):

@unit_of_work()
def create_subcommunity_invitation_request(
self, identity, parent_community_id, child_community_id, data, uow=None
self,
identity,
parent_community_id,
child_community_id,
data,
expires_at=None,
uow=None,
):
"""Create and submit a SubCommunityInvitation request."""
type_ = current_request_type_registry.lookup(
SubCommunityInvitationRequest.type_id
)
parent_community = community_service.record_cls.pid.resolve(parent_community_id)
child_community = community_service.record_cls.pid.resolve(child_community_id)
expires_at = datetime.now(timezone.utc) + timedelta(days=45)

if not expires_at:
expires_at = datetime.now(timezone.utc) + timedelta(days=45)

requests_service.create(
identity=identity,
Expand Down

0 comments on commit 113fd11

Please sign in to comment.