Skip to content

Commit

Permalink
domains: add find by id function
Browse files Browse the repository at this point in the history
  • Loading branch information
carlinmack committed Nov 6, 2024
1 parent e865a3c commit 31ddca0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions invenio_accounts/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ def find_domain(self, domain):
.one_or_none()
)

def find_domain_by_id(self, domain_id):
"""Find a domain by id."""
return (
Domain.query.filter_by(id=domain_id)
.options(joinedload(Domain.category_name))
.one_or_none()
)

def create_domain(self, domain, **kwargs):
"""Create a new domain."""
return Domain.create(domain, **kwargs)

0 comments on commit 31ddca0

Please sign in to comment.