Skip to content

Commit

Permalink
feat: add more detail to Joi validation of organization_id array
Browse files Browse the repository at this point in the history
  • Loading branch information
gwynndp committed Nov 13, 2023
1 parent cf1f03b commit 5e1f29c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions server/infra/database/GrowerAccountRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ export default class GrowerAccountRepository extends BaseRepository<GrowerAccoun
}

if (filterObject.organization_id) {
result.where(
result.whereIn(
`${this.tableName}.organization_id`,
'=',
`${filterObject.organization_id}`,
filterObject.organization_id,
);
delete filterObject.organization_id;
}
Expand Down
4 changes: 2 additions & 2 deletions server/routers/growerAccountsRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ router.get(
limit: Joi.number().integer().min(1).max(1000),
offset: Joi.number().integer().min(0),
keyword: Joi.string(),
organization_id: Joi.string().uuid(),
organization_id: Joi.array().items(Joi.string().uuid()),
id: Joi.string().uuid(),
reference_id: Joi.number(),
person_id: Joi.string().uuid(),
Expand Down Expand Up @@ -138,7 +138,7 @@ router.get(
limit: Joi.number().integer().min(1).max(1000),
offset: Joi.number().integer().min(0),
keyword: Joi.string(),
organization_id: Joi.string().uuid(),
organization_id: Joi.array().items(Joi.string().uuid()),
id: Joi.string().uuid(),
reference_id: Joi.number(),
person_id: Joi.string().uuid(),
Expand Down

0 comments on commit 5e1f29c

Please # to comment.