Skip to content

Commit

Permalink
Update fetch docstring to handle lists
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklatimer committed Jan 6, 2025
1 parent 2bab5a9 commit 36cc243
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/aind_slims_api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def fetch(
start (int, optional): The first row to return
end (int, optional): The last row to return
*args (Slims.criteria.Criterion): Optional criteria to apply
**kwargs (dict[str,str]): "field=value" filters
**kwargs (dict[str,str|list]): "field=value" filters.
If value is a list, will apply "field IN value" criterion
Returns:
records (list[SlimsRecord] | None): Matching records, if any
Expand Down Expand Up @@ -333,9 +335,7 @@ def rest_link(self, table: SLIMS_TABLES, **kwargs):
queries = [f"?{k}={v}" for k, v in kwargs.items()]
return base_url + "".join(queries)

def add_model(
self, model: SlimsBaseModelTypeVar, *args, **kwargs
) -> SlimsBaseModelTypeVar:
def add_model(self, model: SlimsBaseModelTypeVar, *args, **kwargs) -> SlimsBaseModelTypeVar:
"""Given a SlimsBaseModel object, add it to SLIMS
Args
model (SlimsBaseModel): object to add
Expand Down Expand Up @@ -380,9 +380,7 @@ def update_model(self, model: SlimsBaseModel, *args, **kwargs):
rtn = self.update(
model._slims_table,
model.pk,
model.model_dump(
include=fields_to_include, by_alias=True, **kwargs, context="slims_post"
),
model.model_dump(include=fields_to_include, by_alias=True, **kwargs, context="slims_post"),
)
return type(model).model_validate(rtn)

Expand Down

0 comments on commit 36cc243

Please sign in to comment.