Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/dev' into 1587/agent-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmalbert committed Aug 13, 2021
2 parents a171a8f + c5d877f commit bae535d
Show file tree
Hide file tree
Showing 46 changed files with 1,196 additions and 457 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ launch.json

# Jest unit test coverage
test-coverage/

# redis dumps
dump.rdb
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,41 @@ All notable changes to this project will be documented in this file. The format

- Added:

- Allow lottery results to be uploaded for a closed listing ([#1568](https://github.com/bloom-housing/bloom/pull/1568)) (Jared White)
- Update buttons / pages visibility depending on a user role ([#1609](https://github.com/bloom-housing/bloom/pull/1609)) (Dominik Barcikowski)
- Terms page checkbox text changed to blue ([#1645](https://github.com/bloom-housing/bloom/pull/1645)) (Emily Jablonski)

- Fixed:
- Update Listings component to sort listings by status ([#1585](https://github.com/bloom-housing/bloom/pull/1585))
- Preferences ordinal bug in listings management ([#1641](https://github.com/bloom-housing/bloom/pull/1641)) (Emily Jablonski)

### UI Components

- Added:

- Add ResponsiveTable for pricing

- Fixed:
- StandardTable styling bug ([#1632](https://github.com/bloom-housing/bloom/pull/1632)) (Emily Jablonski)

### Backend

- Added:

- Filtering, pagination, and tests for listings endpoint (Parts of Detroit Team [#18](https://github.com/CityOfDetroit/bloom/pull/18), [#133](https://github.com/CityOfDetroit/bloom/pull/133), [#180](https://github.com/CityOfDetroit/bloom/pull/180), [#257](https://github.com/CityOfDetroit/bloom/pull/257), [#264](https://github.com/CityOfDetroit/bloom/pull/264), [#271](https://github.com/CityOfDetroit/bloom/pull/271)) [#1578](https://github.com/CityOfDetroit/bloom/pull/1578)
- Units summary table ([#1607](https://github.com/bloom-housing/bloom/pull/1607))
- Add support for comma-separated lists to filters, ensure comparison is valid ([Detroit Team #356](https://github.com/CityOfDetroit/bloom/pull/356), [#1634](https://github.com/bloom-housing/bloom/pull/1634))

- Changed:

- updated listing's importer to handle latest unit and priority types changes ([#1584](https://github.com/bloom-housing/bloom/pull/1584)) (Marcin Jedras)
- Sets cache manager to use Redis [#1589](https://github.com/bloom-housing/bloom/compare/dev...seanmalbert:1589/redis-cache-manager)
- Updates redis reset call to flush all keys

- Fixed:
- Added checks for property in listing.dto transforms
- Display all listings on partners with `limit=all` ([#1635](https://github.com/bloom-housing/bloom/issues/1635)) (Marcin Jędras)
- Seed data should create unique application methods ([#1662](https://github.com/bloom-housing/bloom/issues/1662)) (Emily Jablonski)

### General

Expand All @@ -40,6 +61,7 @@ All notable changes to this project will be documented in this file. The format
- Added:

- /applicationMethods and /paperApplications endpoints and corresponding DB schema
- Added "bhaFormat" to CSV exporter ([#1640](https://github.com/bloom-housing/bloom/pull/1640)) (Emily Jablonski)

- Fixed:

Expand All @@ -48,12 +70,14 @@ All notable changes to this project will be documented in this file. The format
- unit summaries transformations after a regression coming from separating unitTypes from jsonb column into a table

- Changed:

- User module has been removed and incorporated into Auth module
- convert listing events jsonb column to separate listing_events table
- convert listing address jsonb columns to separate address tables
- removed unused inverse relations from entities
- recreated foreign keys constraints for `application_flagged_set_applications_applications`, `listings_leasing_agents_user_accounts`, `property_group_properties_property` and add missing `NOT NULL` migration for listing name column
- Listing applicationMethods jsonb column has been converted to a separate table

- Added:
- ability for an admin to confirm users by `/users` POST/PUT methods

Expand Down
3 changes: 2 additions & 1 deletion backend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typeorm": "ts-node ./node_modules/.bin/typeorm",
"herokusetup": "node heroku.setup.js",
"heroku-postbuild": "rimraf dist && nest build && yarn run db:migration:run",
"generate:client": "ts-node scripts/generate-axios-client.ts",
"generate:client": "ts-node scripts/generate-axios-client.ts && prettier -w types/src/backend-swagger.ts",
"migrator": "ts-node migrator.ts"
},
"dependencies": {
Expand All @@ -47,6 +47,7 @@
"async-retry": "^1.3.1",
"axios": "^0.21.0",
"cache-manager": "^3.4.0",
"cache-manager-redis-store": "^2.0.0",
"casbin": "^5.1.6",
"class-transformer": "0.3.1",
"class-validator": "^0.12.2",
Expand Down
19 changes: 18 additions & 1 deletion backend/core/scripts/listings-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const preferencesService = new client.PreferencesService()
const listingsService = new client.ListingsService()
const authService = new client.AuthService()
const amiChartService = new client.AmiChartsService()
const unitTypesService = new client.UnitTypesService()
const unitAccessibilityPriorityTypesService = new client.UnitAccessibilityPriorityTypesService()
const applicationMethodsService = new client.ApplicationMethodsService()
const reservedCommunityTypesService = new client.ReservedCommunityTypesService()

async function uploadEntity(entityKey, entityService, listing) {
const newRecordsIds = await Promise.all(
Expand Down Expand Up @@ -120,6 +124,10 @@ function reformatListing(listing, relationsKeys: string[]) {
return listing
}

const findByName = (list, name) => {
return list.find((el) => el.name === name)
}

async function main() {
const [email, password] = userAndPassword.split(":")
const { accessToken } = await authService.login({
Expand All @@ -136,19 +144,28 @@ async function main() {
Authorization: `Bearer ${accessToken}`,
},
})
const unitTypes = await unitTypesService.list()
const priorityTypes = await unitAccessibilityPriorityTypesService.list()
const reservedCommunityTypes = await reservedCommunityTypesService.list()

let listing = JSON.parse(fs.readFileSync(listingFilePath, "utf-8"))
const relationsKeys = []
listing = reformatListing(listing, relationsKeys)
listing = await uploadEntity("preferences", preferencesService, listing)
listing = await uploadEntity("applicationMethods", applicationMethodsService, listing)
listing.reservedCommunityType = findByName(reservedCommunityTypes, listing.reservedCommunityType)

const amiChartName = listing.amiChart.name
let chart = await getAmiChart(amiChartName)
if (!chart) {
chart = await uploadAmiChart(listing.amiChart)
}

listing.units.forEach((unit) => (unit.amiChart = chart))
listing.units.forEach((unit) => {
unit.priorityType = findByName(priorityTypes, unit.priorityType)
unit.unitType = findByName(unitTypes, unit.unitType)
unit.amiChart = chart
})

const newListing = await uploadListing(listing)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { PaperApplicationDto } from "../../paper-applications/dto/paper-applicat
import { IdDto } from "../../shared/dto/id.dto"

export class ApplicationMethodDto extends OmitType(ApplicationMethod, [
"listing",
"paperApplications",
] as const) {
@Expose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { basicFormattingMetadata } from "./metadata/basic-formatting-metadata"
import { CSVFormattingType } from "../types/csv-formatting-type-enum"
import { FormattingMetadataAggregateFactory } from "../types/formatting-metadata-aggregate-factory"
import { ohaFormattingMetadata } from "./metadata/oha-formatting-metadata"
import { bhaFormattingMetadata } from "./metadata/bha-formatting-metadata"

export const applicationFormattingMetadataAggregateFactory: FormattingMetadataAggregateFactory = (
type: CSVFormattingType
Expand All @@ -14,5 +15,7 @@ export const applicationFormattingMetadataAggregateFactory: FormattingMetadataAg
return haywardFormattingMetadata
case CSVFormattingType.ohaFormat:
return ohaFormattingMetadata
case CSVFormattingType.bhaFormat:
return bhaFormattingMetadata
}
}
17 changes: 17 additions & 0 deletions backend/core/src/csv/formatting/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,23 @@ export const formatHOPWAPreference = {
},
}

export const formatBHAPreference = {
label: "Berkeley Housing Authority",
discriminator: "",
formatter: (application: Application) => {
const bhaPreferences = application.preferences.filter((pref) => pref.key === "BHA")
if (bhaPreferences.length !== 1) {
return ""
}
return (
bhaPreferences[0].options
.filter((option) => option.checked)
.map((option) => option.key)
.join(",") || ""
)
},
}

export const formatMarkedAsDuplicate = {
label: "Marked as duplicate",
discriminator: "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import {
formatAccessibility,
formatAlternateContactAgency,
formatAlternateContactCity,
formatAlternateContactEmail,
formatAlternateContactFirstName,
formatAlternateContactLastName,
formatAlternateContactOther,
formatAlternateContactPhone,
formatAlternateContactState,
formatAlternateContactStreetAddress,
formatAlternateContactType,
formatAlternateContactZip,
formatAnnualIncome,
formatApplicationNumber,
formatApplicationType,
formatApplicatonSubmissionDate,
formatBHAPreference,
formatHoueholdMembers,
formatHouseholdSize,
formatLivePreference,
formatMonthlyIncome,
formatPrimaryApplicantAdditionalPhone,
formatPrimaryApplicantAdditionalPhoneType,
formatPrimaryApplicantDOB,
formatPrimaryApplicantEmail,
formatPrimaryApplicantFirstName,
formatPrimaryApplicantLastName,
formatPrimaryApplicantMailingCity,
formatPrimaryApplicantMailingState,
formatPrimaryApplicantMailingStreetAddress,
formatPrimaryApplicantMailingZip,
formatPrimaryApplicantMiddleName,
formatPrimaryApplicantPhone,
formatPrimaryApplicantPhoneType,
formatPrimaryApplicantPreferredContactType,
formatPrimaryApplicantResidenceAddress,
formatPrimaryApplicantResidenceCity,
formatPrimaryApplicantResidenceState,
formatPrimaryApplicantResidenceZip,
formatPrimaryApplicantWorkCity,
formatPrimaryApplicantWorkState,
formatPrimaryApplicantWorkStreetAddress,
formatPrimaryApplicantWorkZip,
formatRequestUnitType,
formatVouchersOrSubsidies,
formatWorkPreference,
} from "../formatters"

export const bhaFormattingMetadata = [
formatApplicationNumber,
formatApplicationType,
formatApplicatonSubmissionDate,
formatPrimaryApplicantFirstName,
formatPrimaryApplicantMiddleName,
formatPrimaryApplicantLastName,
formatPrimaryApplicantDOB,
formatPrimaryApplicantEmail,
formatPrimaryApplicantPhone,
formatPrimaryApplicantPhoneType,
formatPrimaryApplicantAdditionalPhone,
formatPrimaryApplicantAdditionalPhoneType,
formatPrimaryApplicantPreferredContactType,
formatPrimaryApplicantResidenceAddress,
formatPrimaryApplicantResidenceCity,
formatPrimaryApplicantResidenceState,
formatPrimaryApplicantResidenceZip,
formatPrimaryApplicantMailingStreetAddress,
formatPrimaryApplicantMailingCity,
formatPrimaryApplicantMailingState,
formatPrimaryApplicantMailingZip,
formatPrimaryApplicantWorkStreetAddress,
formatPrimaryApplicantWorkCity,
formatPrimaryApplicantWorkState,
formatPrimaryApplicantWorkZip,
formatAlternateContactFirstName,
formatAlternateContactLastName,
formatAlternateContactType,
formatAlternateContactAgency,
formatAlternateContactOther,
formatAlternateContactEmail,
formatAlternateContactPhone,
formatAlternateContactStreetAddress,
formatAlternateContactCity,
formatAlternateContactState,
formatAlternateContactZip,
formatMonthlyIncome,
formatAnnualIncome,
formatAccessibility,
formatVouchersOrSubsidies,
formatRequestUnitType,
formatLivePreference,
formatWorkPreference,
formatBHAPreference,
formatHouseholdSize,
formatHoueholdMembers,
]
1 change: 1 addition & 0 deletions backend/core/src/csv/types/csv-formatting-type-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export enum CSVFormattingType {
basic = "basic",
withDisplaceeNameAndAddress = "withDisplaceeNameAndAddress",
ohaFormat = "ohaFormat",
bhaFormat = "bhaFormat",
}
Loading

0 comments on commit bae535d

Please sign in to comment.