Skip to content

Commit

Permalink
LF-4528 Update animal models and controllers
Browse files Browse the repository at this point in the history
* include animals and batches in GET tasks API response
  • Loading branch information
SayakaOno committed Nov 27, 2024
1 parent 273f1f7 commit 9f26f35
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/api/src/controllers/animalBatchController.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const animalBatchController = {
group_ids: true,
sex_detail: true,
animal_batch_use_relationships: true,
tasks: true,
});
return res.status(200).send(
rows.map(({ animal_union_batch, group_ids, ...rest }) => ({
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/controllers/animalController.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const animalController = {
animal_union_batch: true,
group_ids: true,
animal_use_relationships: true,
tasks: true,
});
return res.status(200).send(
rows.map(({ animal_union_batch, group_ids, ...rest }) => ({
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/models/animalBatchModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class AnimalBatchModel extends baseModel {
},
to: 'task.task_id',
},
modify: (query) => query.select('task.task_id').where('deleted', false),
},
default_type: {
modelClass: DefaultAnimalTypeModel,
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/models/animalModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class Animal extends baseModel {
},
to: 'task.task_id',
},
modify: (query) => query.select('task.task_id').where('deleted', false),
},
default_type: {
modelClass: DefaultAnimalTypeModel,
Expand Down

0 comments on commit 9f26f35

Please sign in to comment.