Skip to content

Commit

Permalink
Add method to find configurations by a list of names
Browse files Browse the repository at this point in the history
  • Loading branch information
AimeeGao committed May 31, 2024
1 parent 55262fc commit 683fb2e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions legal-api/src/legal_api/models/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def find_by_name(cls, config_name: str) -> Configuration:
configuration = cls.query.filter_by(name=config_name).one_or_none()
return configuration

@classmethod
def find_by_names(cls, config_names: List[str]) -> List[Configuration]:
"""Return the configurations matching the names."""
return cls.query.filter(cls.name.in_(config_names)).all()

def validate_value(self):
"""Ensure the value is the correct type before insert or update."""
# Define keys that should have specific value types
Expand Down

0 comments on commit 683fb2e

Please sign in to comment.