Skip to content

Commit

Permalink
fix: tests and query filters
Browse files Browse the repository at this point in the history
  • Loading branch information
loicguillois committed Oct 8, 2024
1 parent 36dc7d1 commit 87ecd7f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion server/src/controllers/housingController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Housing API', () => {
const { body, status } = await request(app)
.get(testRoute)
.query({
filters: {}
filters: JSON.stringify({})
})
.use(tokenProvider(user));

Expand Down Expand Up @@ -131,6 +131,7 @@ describe('Housing API', () => {
const { body, status } = await request(app)
.get(testRoute)
.query({
paginate: true,
page: 1,
perPage: 1
})
Expand Down
4 changes: 1 addition & 3 deletions server/src/controllers/housingController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ async function list(
const sort = sortApi.parse<HousingSortableApi>(
request.query.sort as string[] | undefined
);

const rawFilters = JSON.parse(query.filters);

const rawFilters = query.filters !== undefined ? JSON.parse(query.filters) : undefined;
const filters: HousingFiltersApi = {
...rawFilters,
multiOwners: rawFilters?.multiOwners?.map((value: string) =>
Expand Down
1 change: 0 additions & 1 deletion server/src/routers/protected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ router.use(userCheck());

router.post('/files', upload(), fileController.create);

// TODO: replace by GET /housing
router.get(
'/housing',
validatorNext.validate({
Expand Down

0 comments on commit 87ecd7f

Please sign in to comment.