forked from bloom-housing/bloom
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit size filter to backend (#368)
* initial thoughts * initial bedrooms filter (untested) * Fix code style issues with Prettier * fix typo in 'studio' * remove custom filter handling, switch to bedrooms field on unit table * add additional check for invalid comparisons, outside the filter handler * use unit_type table for bedrooms, add field to unit_type table, remove toLowerCase() from filter name comparisons to allow camelCase filter names * Fix code style issues with Prettier * add bedrooms filter to frontend comparison map * fix comparison type for frontend map * fix test and migration indentation * update changelog * regenerate swagger * fix tests * try to fix more ui tests * try to fix more ui tests * add comment for custom filter handling Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
- Loading branch information
1 parent
978cf64
commit 734a645
Showing
14 changed files
with
150 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
22 changes: 22 additions & 0 deletions
22
backend/core/src/migration/1628631437422-AddNumBedroomsFieldToUnitType.ts
This file contains 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,22 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm" | ||
|
||
export class AddNumBedroomsFieldToUnitType1628631437422 implements MigrationInterface { | ||
name = "AddNumBedroomsFieldToUnitType1628631437422" | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
queryRunner.query(`ALTER TABLE "unit_types" ADD "num_bedrooms" integer`) | ||
queryRunner.query(`UPDATE "unit_types" SET "num_bedrooms" = CASE | ||
WHEN "name" = 'studio' THEN 0 | ||
WHEN "name" = 'oneBdrm' THEN 1 | ||
WHEN "name" = 'twoBdrm' THEN 2 | ||
WHEN "name" = 'threeBdrm' THEN 3 | ||
WHEN "name" = 'fourBdrm' THEN 4 | ||
WHEN "name" = 'fiveBdrm' THEN 5 | ||
END`) | ||
queryRunner.query(`ALTER TABLE "unit_types" ALTER COLUMN "num_bedrooms" SET NOT NULL`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "unit_types" DROP COLUMN "num_bedrooms"`) | ||
} | ||
} |
This file contains 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 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 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 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 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.