forked from bloom-housing/bloom
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: 512/unit type filtering #571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cade-exygy
wants to merge
21
commits into
main
Choose a base branch
from
512/unit-type-filtering
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
532446d
feat(listing service search): change query construction to allow for …
cade-exygy c057b45
Merge branch 'main' into 512/unit-type-filtering
cade-exygy 6293766
feat: create ButtonCheckboxGroup component
cade-exygy c71f19d
feat: uptake seeds and use CheckboxGroup
cade-exygy 2d51b75
chore: merge main
cade-exygy ac4ec19
refactor(remove buttonselect): remove ButtonSelect
cade-exygy 2c2728e
Merge branch 'main' into 512/unit-type-filtering
cade-exygy 2eabdda
Merge branch 'main' into 512/unit-type-filtering
cade-exygy a3039a5
Merge branch 'main' into 512/unit-type-filtering
cade-exygy af3904c
refactor: create helper for unit filters
cade-exygy 1f4c683
feat: checkboxGroup on LandingSearch
cade-exygy 6622394
Merge branch 'main' into 512/unit-type-filtering
cade-exygy 03212ce
fix: fix import
cade-exygy 800a997
fix: test fix seeds intake
cade-exygy 91afb0f
Merge branch 'main' into 512/unit-type-filtering
cade-exygy 4b8c730
fix: seeds version and add padding
cade-exygy 4d27c15
fix: latest seeds
cade-exygy cd025a9
fix: fix bedroom type
cade-exygy 9141179
Merge branch 'main' into 512/unit-type-filtering
cade-exygy 9bb15b0
fix: latest seeds after merge
cade-exygy 9502659
Merge branch 'main' into 512/unit-type-filtering
cade-exygy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
cade-exygy marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { BadRequestException } from '@nestjs/common'; | ||
|
|
||
| enum ColumnName { | ||
| bedrooms = 'numBedrooms', | ||
| bathrooms = 'numBathrooms', | ||
| } | ||
| /* Takes a ColumnName and selected values to build a query that includes the values in the ColumnName | ||
| Returns a query String | ||
| */ | ||
|
|
||
| export const buildInclusiveWhereQuery = ( | ||
| key: keyof typeof ColumnName, | ||
| values: string[], | ||
| ): string => { | ||
| const columnName = ColumnName[key]; | ||
|
|
||
| const inclusiveWhereArray = []; | ||
| values.forEach((value) => { | ||
| switch (value) { | ||
| case '0': | ||
| inclusiveWhereArray.push( | ||
| `((combined_units->>'${columnName}')::INTEGER =0)`, | ||
| ); | ||
| break; | ||
| case '1': | ||
| inclusiveWhereArray.push( | ||
| `((combined_units->>'${columnName}')::INTEGER =1)`, | ||
| ); | ||
| break; | ||
| case '2': | ||
| inclusiveWhereArray.push( | ||
| `((combined_units->>'${columnName}')::INTEGER =2)`, | ||
| ); | ||
| break; | ||
| case '3': | ||
| inclusiveWhereArray.push( | ||
| `((combined_units->>'${columnName}')::INTEGER =3)`, | ||
| ); | ||
| break; | ||
| case '4': | ||
| inclusiveWhereArray.push( | ||
| `((combined_units->>'${columnName}')::INTEGER >=4)`, | ||
| ); | ||
| break; | ||
| default: | ||
| throw new BadRequestException( | ||
| `Invalid input for ${key} filter: "${value}"`, | ||
| ); | ||
| } | ||
| }); | ||
|
|
||
| return `(${inclusiveWhereArray.join(' OR ')})`; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
sites/public/src/components/listings/search/ListingsSearchModal.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .checkbox-group { | ||
| --inner-button-gap: var(--seeds-s3); | ||
| padding-top: var(--seeds-s4); | ||
| padding-bottom: var(--seeds-s4); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: missing EOF newline |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YazeedLoonat Do you have preferences on stronger typing here?