Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterEnum

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file name needs to be updated to the sequential number system we are using before merging

ALTER TYPE "unit_type_enum" ADD VALUE 'sixBdrm';
ALTER TYPE "unit_type_enum" ADD VALUE 'sevenBdrm';
2 changes: 2 additions & 0 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2591,6 +2591,8 @@ enum UnitTypeEnum {
fourBdrm
SRO
fiveBdrm
sixBdrm
sevenBdrm

@@map("unit_type_enum")
}
Expand Down
2 changes: 2 additions & 0 deletions api/prisma/seed-helpers/unit-type-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ export const unitTypeMapping = {
[UnitTypeEnum.threeBdrm]: 3,
[UnitTypeEnum.fourBdrm]: 4,
[UnitTypeEnum.fiveBdrm]: 5,
[UnitTypeEnum.sixBdrm]: 6,
[UnitTypeEnum.sevenBdrm]: 7,
};
2 changes: 2 additions & 0 deletions api/src/utilities/application-export-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,8 @@ export const typeMap = {
threeBdrm: 'Three Bedroom',
fourBdrm: 'Four+ Bedroom',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I know this is already existing, but shouldn't this be changed to Four Bedroom?

fiveBdrm: 'Five Bedroom',
sixBdrm: 'Six Bedroom',
sevenBdrm: 'Seven+ Bedroom',
};

/**
Expand Down
5 changes: 5 additions & 0 deletions api/src/utilities/unit-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const UnitTypeSort = [
UnitTypeEnum.threeBdrm,
UnitTypeEnum.fourBdrm,
UnitTypeEnum.fiveBdrm,
UnitTypeEnum.sixBdrm,
UnitTypeEnum.sevenBdrm,
];

export const usd = new Intl.NumberFormat('en-US', {
Expand Down Expand Up @@ -176,6 +178,9 @@ export const generateHmiData = (
'listings.unitTypes.twoBdrm',
'listings.unitTypes.threeBdrm',
'listings.unitTypes.fourBdrm',
'listings.unitTypes.fiveBdrm',
'listings.unitTypes.sixBdrm',
'listings.unitTypes.sevenBdrm',
];
// this is to map currentHouseholdSize to a units max occupancy
const unitOccupancy = [];
Expand Down
4 changes: 3 additions & 1 deletion api/test/integration/unit-type.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ describe('UnitType Controller Tests', () => {
.set('Cookie', cookies)
.expect(200);
// all unit types are returned
expect(res.body.length).toBeGreaterThanOrEqual(7);
expect(res.body.length).toBeGreaterThanOrEqual(9);
// check for random unit types
const unitTypeNames = res.body.map((value) => value.name);
expect(unitTypeNames).toContain(UnitTypeEnum.SRO);
expect(unitTypeNames).toContain(UnitTypeEnum.threeBdrm);
expect(unitTypeNames).toContain(UnitTypeEnum.sixBdrm);
expect(unitTypeNames).toContain(UnitTypeEnum.sevenBdrm);
});

it("retrieve endpoint with id that doesn't exist should error", async () => {
Expand Down
54 changes: 43 additions & 11 deletions api/test/unit/services/listing.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1261,15 +1261,15 @@ describe('Testing listing service', () => {
occupancyRange: { min: 1, max: 8 },
rentRange: { min: '$1', max: '$8' },
rentAsPercentIncomeRange: { min: 1, max: 1 },
floorRange: { min: 1, max: 8 },
floorRange: { min: 1, max: 1 },
unitTypes: {
id: 'unitType 1',
createdAt: date,
updatedAt: date,
name: 'studio',
numBedrooms: 1,
},
totalAvailable: 2,
totalAvailable: 1,
},
{
areaRange: { min: 2, max: 2 },
Expand Down Expand Up @@ -1351,6 +1351,38 @@ describe('Testing listing service', () => {
},
totalAvailable: 1,
},
{
areaRange: { min: 7, max: 7 },
minIncomeRange: { min: '$7', max: '$7' },
occupancyRange: { min: 7, max: 7 },
rentRange: { min: '$7', max: '$7' },
rentAsPercentIncomeRange: { min: 7, max: 7 },
floorRange: { min: 7, max: 7 },
unitTypes: {
id: 'unitType 7',
createdAt: date,
updatedAt: date,
name: 'sixBdrm',
numBedrooms: 7,
},
totalAvailable: 1,
},
{
areaRange: { min: 8, max: 8 },
minIncomeRange: { min: '$8', max: '$8' },
occupancyRange: { min: 8, max: 8 },
rentRange: { min: '$8', max: '$8' },
rentAsPercentIncomeRange: { min: 8, max: 8 },
floorRange: { min: 8, max: 8 },
unitTypes: {
id: 'unitType 8',
createdAt: date,
updatedAt: date,
name: 'sevenBdrm',
numBedrooms: 8,
},
totalAvailable: 1,
},
],
priorityTypes: [UnitAccessibilityPriorityTypeEnum.mobility],
});
Expand Down Expand Up @@ -3237,13 +3269,13 @@ describe('Testing listing service', () => {
minIncomeRange: { min: '$7', max: '$7' },
occupancyRange: { min: 7, max: 7 },
rentRange: { min: '$7', max: '$7' },
rentAsPercentIncomeRange: { min: 0, max: 0 },
rentAsPercentIncomeRange: { min: 7, max: 7 },
floorRange: { min: 7, max: 7 },
unitTypes: {
id: 'unitType 7',
createdAt: date,
updatedAt: date,
name: 'SRO',
name: 'sixBdrm',
numBedrooms: 7,
},
totalAvailable: 1,
Expand All @@ -3258,13 +3290,13 @@ describe('Testing listing service', () => {
minIncomeRange: { min: '$8', max: '$8' },
occupancyRange: { min: 8, max: 8 },
rentRange: { min: '$8', max: '$8' },
rentAsPercentIncomeRange: { min: 1, max: 1 },
rentAsPercentIncomeRange: { min: 8, max: 8 },
floorRange: { min: 8, max: 8 },
unitTypes: {
id: 'unitType 8',
createdAt: date,
updatedAt: date,
name: 'studio',
name: 'sevenBdrm',
numBedrooms: 8,
},
totalAvailable: 1,
Expand All @@ -3279,13 +3311,13 @@ describe('Testing listing service', () => {
minIncomeRange: { min: '$9', max: '$9' },
occupancyRange: { min: 9, max: 9 },
rentRange: { min: '$9', max: '$9' },
rentAsPercentIncomeRange: { min: 2, max: 2 },
rentAsPercentIncomeRange: { min: 0, max: 0 },
floorRange: { min: 9, max: 9 },
unitTypes: {
id: 'unitType 9',
createdAt: date,
updatedAt: date,
name: 'oneBdrm',
name: 'SRO',
numBedrooms: 9,
},
totalAvailable: 1,
Expand Down Expand Up @@ -3346,21 +3378,21 @@ describe('Testing listing service', () => {
{
createdAt: date,
id: 'unitType 7',
name: 'SRO',
name: 'sixBdrm',
numBedrooms: 7,
updatedAt: date,
},
{
createdAt: date,
id: 'unitType 8',
name: 'studio',
name: 'sevenBdrm',
numBedrooms: 8,
updatedAt: date,
},
{
createdAt: date,
id: 'unitType 9',
name: 'oneBdrm',
name: 'SRO',
numBedrooms: 9,
updatedAt: date,
},
Expand Down
6 changes: 6 additions & 0 deletions api/test/unit/utilities/application-export-helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,9 @@ describe('Testing application export helpers', () => {
'twoBdrm',
'threeBdrm',
'fourBdrm',
'fiveBdrm',
'sixBdrm',
'sevenBdrm',
];

const readableTypes = [
Expand All @@ -891,6 +894,9 @@ describe('Testing application export helpers', () => {
'Two Bedroom',
'Three Bedroom',
'Four+ Bedroom',
'Five Bedroom',
'Six Bedroom',
'Seven+ Bedroom',
];

for (let i = 0; i < types.length; i++) {
Expand Down
14 changes: 14 additions & 0 deletions shared-helpers/__tests__/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,20 @@ export const unitTypes: UnitType[] = [
name: UnitTypeEnum.fiveBdrm,
numBedrooms: 5,
},
{
id: "b3f2a6b1-3c4d-4e5f-8a9b-0c1d2e3f4a5b",
createdAt: new Date(),
updatedAt: new Date(),
name: UnitTypeEnum.sixBdrm,
numBedrooms: 6,
},
{
id: "c4a3b7c2-4d5e-4f60-9b0c-1d2e3f4a5b6c",
createdAt: new Date(),
updatedAt: new Date(),
name: UnitTypeEnum.sevenBdrm,
numBedrooms: 7,
},
]

export const unitGroup: UnitGroup = {
Expand Down
8 changes: 8 additions & 0 deletions shared-helpers/__tests__/unitTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ describe("unit type: sortUnitTypes helper", () => {
{ id: "twoBdrm", name: "twoBdrm" },
{ id: "threeBdrm", name: "threeBdrm" },
{ id: "fourBdrm", name: "fourBdrm" },
{ id: "sixBdrm", name: "sixBdrm" },
{ id: "sevenBdrm", name: "sevenBdrm" },
])
).toStrictEqual([
{ id: "SRO", name: "sro" },
Expand All @@ -29,14 +31,18 @@ describe("unit type: sortUnitTypes helper", () => {
{ id: "twoBdrm", name: "twoBdrm" },
{ id: "threeBdrm", name: "threeBdrm" },
{ id: "fourBdrm", name: "fourBdrm" },
{ id: "sixBdrm", name: "sixBdrm" },
{ id: "sevenBdrm", name: "sevenBdrm" },
])
expect(
sortUnitTypes([
{ id: "sevenBdrm", name: "sevenBdrm" },
{ id: "fourBdrm", name: "fourBdrm" },
{ id: "studio", name: "studio" },
{ id: "oneBdrm", name: "oneBdrm" },
{ id: "twoBdrm", name: "twoBdrm" },
{ id: "threeBdrm", name: "threeBdrm" },
{ id: "sixBdrm", name: "sixBdrm" },
{ id: "SRO", name: "sro" },
])
).toStrictEqual([
Expand All @@ -46,6 +52,8 @@ describe("unit type: sortUnitTypes helper", () => {
{ id: "twoBdrm", name: "twoBdrm" },
{ id: "threeBdrm", name: "threeBdrm" },
{ id: "fourBdrm", name: "fourBdrm" },
{ id: "sixBdrm", name: "sixBdrm" },
{ id: "sevenBdrm", name: "sevenBdrm" },
])
})
it("should sort complex arrays", () => {
Expand Down
6 changes: 6 additions & 0 deletions shared-helpers/src/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
"application.household.preferredUnit.options.fiveBdrm": "5 غرف نوم",
"application.household.preferredUnit.options.fourBdrm": "4 غرف نوم",
"application.household.preferredUnit.options.oneBdrm": "غرفة نوم واحدة",
"application.household.preferredUnit.options.sevenBdrm": "7 غرف نوم",
"application.household.preferredUnit.options.sixBdrm": "6 غرف نوم",
"application.household.preferredUnit.options.SRO": "منظمة SRO",
"application.household.preferredUnit.options.studio": "ستوديو",
"application.household.preferredUnit.options.threeBdrm": "3 غرف نوم",
Expand Down Expand Up @@ -1103,11 +1105,15 @@
"listings.unitTypes.expanded.fiveBdrm": "5 غرف نوم",
"listings.unitTypes.expanded.fourBdrm": "4 غرف نوم",
"listings.unitTypes.expanded.oneBdrm": "غرفة نوم واحدة",
"listings.unitTypes.expanded.sevenBdrm": "7 غرف نوم",
"listings.unitTypes.expanded.sixBdrm": "6 غرف نوم",
"listings.unitTypes.expanded.threeBdrm": "3 غرف نوم",
"listings.unitTypes.expanded.twoBdrm": "غرفتي نوم",
"listings.unitTypes.fiveBdrm": "5 غرف نوم",
"listings.unitTypes.fourBdrm": "4 غرف نوم",
"listings.unitTypes.oneBdrm": "غرفة نوم واحدة",
"listings.unitTypes.sevenBdrm": "7 غرف نوم",
"listings.unitTypes.sixBdrm": "6 غرف نوم",
"listings.unitTypes.SRO": "إشغال الغرفة الفردية",
"listings.unitTypes.studio": "ستوديو",
"listings.unitTypes.threeBdrm": "3 غرف نوم",
Expand Down
6 changes: 6 additions & 0 deletions shared-helpers/src/locales/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
"application.household.preferredUnit.options.fiveBdrm": "৫টি শোবার ঘর",
"application.household.preferredUnit.options.fourBdrm": "৪টি শোবার ঘর",
"application.household.preferredUnit.options.oneBdrm": "১টি শোবার ঘর",
"application.household.preferredUnit.options.sevenBdrm": "৭টি শোবার ঘর",
"application.household.preferredUnit.options.sixBdrm": "৬টি শোবার ঘর",
"application.household.preferredUnit.options.SRO": "এসআরও",
"application.household.preferredUnit.options.studio": "স্টুডিও",
"application.household.preferredUnit.options.threeBdrm": "৩টি শোবার ঘর",
Expand Down Expand Up @@ -1103,11 +1105,15 @@
"listings.unitTypes.expanded.fiveBdrm": "৫টি শোবার ঘর",
"listings.unitTypes.expanded.fourBdrm": "৪টি শোবার ঘর",
"listings.unitTypes.expanded.oneBdrm": "১টি শোবার ঘর",
"listings.unitTypes.expanded.sevenBdrm": "৭টি শোবার ঘর",
"listings.unitTypes.expanded.sixBdrm": "৬টি শোবার ঘর",
"listings.unitTypes.expanded.threeBdrm": "৩টি শোবার ঘর",
"listings.unitTypes.expanded.twoBdrm": "২টি শোবার ঘর",
"listings.unitTypes.fiveBdrm": "৫টি বেডরুম",
"listings.unitTypes.fourBdrm": "৪টি বেডরুম",
"listings.unitTypes.oneBdrm": "১ বেডরুম",
"listings.unitTypes.sevenBdrm": "৭টি বেডরুম",
"listings.unitTypes.sixBdrm": "৬টি বেডরুম",
"listings.unitTypes.SRO": "একক কক্ষের আবাসন",
"listings.unitTypes.studio": "স্টুডিও",
"listings.unitTypes.threeBdrm": "৩টি বেডরুম",
Expand Down
6 changes: 6 additions & 0 deletions shared-helpers/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
"application.household.preferredUnit.options.fiveBdrm": "5 dormitorios",
"application.household.preferredUnit.options.fourBdrm": "4 dormitorios",
"application.household.preferredUnit.options.oneBdrm": "1 dormitorio",
"application.household.preferredUnit.options.sevenBdrm": "7+ dormitorios",
"application.household.preferredUnit.options.sixBdrm": "6 dormitorios",
"application.household.preferredUnit.options.SRO": "Organización con potestad reglamentaria",
"application.household.preferredUnit.options.studio": "Estudio",
"application.household.preferredUnit.options.threeBdrm": "3 dormitorios",
Expand Down Expand Up @@ -1103,11 +1105,15 @@
"listings.unitTypes.expanded.fiveBdrm": "5 dormitorios",
"listings.unitTypes.expanded.fourBdrm": "4 dormitorios",
"listings.unitTypes.expanded.oneBdrm": "1 dormitorio",
"listings.unitTypes.expanded.sevenBdrm": "7+ dormitorios",
"listings.unitTypes.expanded.sixBdrm": "6 dormitorios",
"listings.unitTypes.expanded.threeBdrm": "3 dormitorios",
"listings.unitTypes.expanded.twoBdrm": "2 dormitorios",
"listings.unitTypes.fiveBdrm": "5 habitaciones",
"listings.unitTypes.fourBdrm": "4 habitaciones",
"listings.unitTypes.oneBdrm": "1 dormitorio",
"listings.unitTypes.sevenBdrm": "7+ habitaciones",
"listings.unitTypes.sixBdrm": "6 habitaciones",
"listings.unitTypes.SRO": "Habitación individual",
"listings.unitTypes.studio": "Estudio",
"listings.unitTypes.threeBdrm": "3 habitaciones",
Expand Down
6 changes: 6 additions & 0 deletions shared-helpers/src/locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
"application.household.preferredUnit.options.fiveBdrm": "۵ خوابه",
"application.household.preferredUnit.options.fourBdrm": "۴ خوابه",
"application.household.preferredUnit.options.oneBdrm": "۱ اتاق خواب",
"application.household.preferredUnit.options.sevenBdrm": "۷ خوابه",
"application.household.preferredUnit.options.sixBdrm": "۶ خوابه",
"application.household.preferredUnit.options.SRO": "اس‌آر‌او",
"application.household.preferredUnit.options.studio": "استودیو",
"application.household.preferredUnit.options.threeBdrm": "۳ خوابه",
Expand Down Expand Up @@ -1107,11 +1109,15 @@
"listings.unitTypes.expanded.fiveBdrm": "۵ خوابه",
"listings.unitTypes.expanded.fourBdrm": "۴ خوابه",
"listings.unitTypes.expanded.oneBdrm": "۱ اتاق خواب",
"listings.unitTypes.expanded.sevenBdrm": "۷ خوابه",
"listings.unitTypes.expanded.sixBdrm": "۶ خوابه",
"listings.unitTypes.expanded.threeBdrm": "۳ خوابه",
"listings.unitTypes.expanded.twoBdrm": "۲ خوابه",
"listings.unitTypes.fiveBdrm": "۵ اتاق خواب",
"listings.unitTypes.fourBdrm": "۴ اتاق خواب",
"listings.unitTypes.oneBdrm": "۱ اتاق خواب",
"listings.unitTypes.sevenBdrm": "۷ اتاق خواب",
"listings.unitTypes.sixBdrm": "۶ اتاق خواب",
"listings.unitTypes.SRO": "ظرفیت اتاق یک تخته",
"listings.unitTypes.studio": "استودیو",
"listings.unitTypes.threeBdrm": "۳ اتاق خواب",
Expand Down
6 changes: 6 additions & 0 deletions shared-helpers/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
"application.household.preferredUnit.options.fiveBdrm": "5 bedroom",
"application.household.preferredUnit.options.fourBdrm": "4 bedroom",
"application.household.preferredUnit.options.oneBdrm": "1 bedroom",
"application.household.preferredUnit.options.sevenBdrm": "7+ bedroom",
"application.household.preferredUnit.options.sixBdrm": "6 bedroom",
"application.household.preferredUnit.options.SRO": "SRO",
"application.household.preferredUnit.options.studio": "Studio",
"application.household.preferredUnit.options.threeBdrm": "3 bedroom",
Expand Down Expand Up @@ -1099,11 +1101,15 @@
"listings.unitTypes.expanded.fiveBdrm": "5 bedroom",
"listings.unitTypes.expanded.fourBdrm": "4 bedroom",
"listings.unitTypes.expanded.oneBdrm": "1 bedroom",
"listings.unitTypes.expanded.sevenBdrm": "7+ bedroom",
"listings.unitTypes.expanded.sixBdrm": "6 bedroom",
"listings.unitTypes.expanded.threeBdrm": "3 bedroom",
"listings.unitTypes.expanded.twoBdrm": "2 bedroom",
"listings.unitTypes.fiveBdrm": "5 Bedrooms",
"listings.unitTypes.fourBdrm": "4 Bedrooms",
"listings.unitTypes.oneBdrm": "1 Bedroom",
"listings.unitTypes.sevenBdrm": "7+ Bedrooms",
"listings.unitTypes.sixBdrm": "6 Bedrooms",
"listings.unitTypes.SRO": "Single Room Occupancy",
"listings.unitTypes.studio": "Studio",
"listings.unitTypes.threeBdrm": "3 Bedrooms",
Expand Down
Loading
Loading