Skip to content

Commit

Permalink
Release: 2024-01-23 (#658)
Browse files Browse the repository at this point in the history
* feat: seeds button uptake (bloom-housing#3677)

* fix: validate radius geocoding preferences (bloom-housing#3718)

* fix: validate radius geocoding preferences

* fix: move to more generic

* fix: add test

* fix: one more test

* fix: change to true/false

* feat: add address verification for preferences step (bloom-housing#3715)

* feat: add collectAddress checkbox with subfields

* test: update preference tests

* fix: add minimum value validation for radius field

* fix: make collect address not required

* fix: expand collect address fields

* fix: change fields order in PreferenceDrawer

* feat: add address holder fields to application

* fix: make added field optional

* fix: display errors properly

* feat: add address holder fields to application summary

* feat: add address verification for preferences step

* feat: adjust padding for application summary

* fix: move address holder name and relationship fields to extraData

* fix: remove redundant backend address holder fields

* fix: use enum for address holder fields

* fix: add alternate address form component

* fix: remove redundant fields from new address form

* fix: verify preferences address when collectAddress true

* fix: block going back on address verification

add string to translation

* fix: use onClick to block address Verification back button

* fix: update dependencies for backend (bloom-housing#3694)

* feat: core changes for application style alignment (bloom-housing#3662)

* test: fix cypress lat long error (bloom-housing#3746)

* fix: padding issue on address verify (bloom-housing#3745)

* feat: add show mandated accounts flag (bloom-housing#3773)

* feat: mA-3752 feat: add SHOW_MANDATED_ACCOUNTS flag

* fix: add feature flag to bloom public next config

* fix: remove flag from partners

* feat: add address holder fields to paper application (bloom-housing#3716)

* feat: add collectAddress checkbox with subfields

* test: update preference tests

* fix: add minimum value validation for radius field

* fix: make collect address not required

* fix: expand collect address fields

* fix: change fields order in PreferenceDrawer

* feat: add address holder fields to application

* fix: make added field optional

* fix: display errors properly

* feat: add address holder fields to application summary

* feat: adjust padding for application summary

* feat: add address holder fields to paper application

* fix: use enum for address holder paper application fields

* fix: remove redundant backend fields

* fix: add correct labels, and values for extraData summary

* fix: export geocoding values enum from backend

* fix: display address as last extraData field

* fix: remove placeholders from form

* fix: set default values after listingDto fetched

* style: adjust details multiselect question

* feat: add geocoding preference label (bloom-housing#3765)

* feat: add additional fields info to add listing preferences

* feat: add additional fields column to table

* refactor: reuse additional field tag

* refactor: change base tag style

* fix: revert onClose drawer function

* fix: add geocoding fields to csv (bloom-housing#3778)

* fix: update seeds button (bloom-housing#3793)

* fix: add translations for geocoding (bloom-housing#3784)

* fix: add translations for geocoding

* fix: capitalize translation for qualifying address in vi.json

* fix: provides additional fields info text overflows (bloom-housing#3809)

* fix: provides additional fields info text overflows

* fix: check if length of links greater than 0

* refactor: remove console.log

* fix: add links to preference description (bloom-housing#3813)

* fix: seeds button layout fixes for Partners Application sidebar (bloom-housing#3789)

* feat: geocoding preference set up fixed layers (bloom-housing#3808)

* feat: add geocoding map layers to multiselect option

* fix: remove link from select description

* fix: default value for mapLayerId

* fix: add decorators for mapLayers dto's and entities

* fix: use smaller font for mapLayer select helper text

* fix: test fixes

* fix: add map layer geocoding checks (bloom-housing#3825)

* fix: add map layer geocoding checks

* fix: review comment fix

---------

Co-authored-by: Krzysztof Zięcina <[email protected]>
Co-authored-by: Emily Jablonski <[email protected]>
Co-authored-by: cade-exygy <[email protected]>
Co-authored-by: ColinBuyck <[email protected]>
Co-authored-by: Jared White <[email protected]>
  • Loading branch information
6 people authored Jan 25, 2024
1 parent 6b7f7ac commit 65d949d
Show file tree
Hide file tree
Showing 155 changed files with 6,562 additions and 3,820 deletions.
16 changes: 10 additions & 6 deletions backend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@anchan828/nest-sendgrid": "^0.3.25",
"@google-cloud/translate": "^6.2.6",
"@google-cloud/translate": "^7.2.1",
"@nestjs/axios": "1.0.1",
"@nestjs/cli": "^9.5.0",
"@nestjs/common": "^9.4.2",
Expand All @@ -52,9 +52,13 @@
"@nestjs/swagger": "^6.3.0",
"@nestjs/throttler": "^4.0.0",
"@nestjs/typeorm": "^9.0.1",
"@turf/buffer": "6.5.0",
"@turf/helpers": "6.5.0",
"@turf/boolean-point-in-polygon": "6.5.0",
"@turf/points-within-polygon": "6.5.0",
"@types/cache-manager": "^3.4.0",
"async-retry": "^1.3.1",
"axios": "0.21.2",
"axios": "0.21.3",
"cache-manager": "^3.4.0",
"casbin": "5.13.0",
"class-transformer": "0.3.1",
Expand All @@ -72,17 +76,17 @@
"nanoid": "^3.1.12",
"nestjs-twilio": "^4.1.1",
"nestjs-typeorm-paginate": "^4.0.3",
"newrelic": "7.5.1",
"newrelic": "11.4.0",
"node-polyglot": "^2.4.0",
"passport": "^0.6.0",
"passport-custom": "^1.1.1",
"passport-jwt": "^4.0.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pg": "^8.4.1",
"pg": "^8.11.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.4",
"swagger-ui-express": "^4.1.4",
"swagger-ui-express": "^4.2.0",
"ts-node": "10.8.0",
"twilio": "^3.71.3",
"typeorm": "0.3.12",
Expand Down
2 changes: 2 additions & 0 deletions backend/core/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { PaperApplicationsModule } from "./paper-applications/paper-applications
import { ActivityLogModule } from "./activity-log/activity-log.module"
import { logger } from "./shared/middlewares/logger.middleware"
import { CatchAllFilter } from "./shared/filters/catch-all-filter"
import { MapLayersModule } from "./map-layers/map-layers.module"

export function applicationSetup(app: INestApplication) {
const { httpAdapter } = app.get(HttpAdapterHost)
Expand Down Expand Up @@ -106,6 +107,7 @@ export class AppModule {
UnitTypesModule,
UnitRentTypesModule,
UnitAccessibilityPriorityTypesModule,
MapLayersModule,
],
}
}
Expand Down
6 changes: 4 additions & 2 deletions backend/core/src/applications/applications.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SharedModule } from "../shared/shared.module"
import { ListingsModule } from "../listings/listings.module"
import { Address } from "../shared/entities/address.entity"
import { Applicant } from "./entities/applicant.entity"
import { MapLayer } from "../map-layers/entities/map-layer.entity"
import { ApplicationsSubmissionController } from "./applications-submission.controller"
import { TranslationsModule } from "../translations/translations.module"
import { Listing } from "../listings/entities/listing.entity"
Expand All @@ -16,10 +17,11 @@ import { CsvBuilder } from "./services/csv-builder.service"
import { ApplicationCsvExporterService } from "./services/application-csv-exporter.service"
import { EmailModule } from "../email/email.module"
import { ActivityLogModule } from "../activity-log/activity-log.module"
import { GeocodingService } from "./services/geocoding.service"

@Module({
imports: [
TypeOrmModule.forFeature([Application, Applicant, Address, Listing]),
TypeOrmModule.forFeature([Application, Applicant, Address, Listing, MapLayer]),
AuthModule,
ActivityLogModule,
SharedModule,
Expand All @@ -28,7 +30,7 @@ import { ActivityLogModule } from "../activity-log/activity-log.module"
EmailModule,
ScheduleModule.forRoot(),
],
providers: [ApplicationsService, CsvBuilder, ApplicationCsvExporterService],
providers: [ApplicationsService, CsvBuilder, ApplicationCsvExporterService, GeocodingService],
exports: [ApplicationsService],
controllers: [ApplicationsController, ApplicationsSubmissionController],
})
Expand Down
14 changes: 13 additions & 1 deletion backend/core/src/applications/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from "dayjs"
import { formatLocalDate } from "../shared/utils/format-local-date"
import { ApplicationSubmissionType } from "../../types"
import { ApplicationSubmissionType, GeocodingValues } from "../../types"
import { isEmpty } from "class-validator"

export const formatApplicationDate = (
Expand All @@ -14,3 +14,15 @@ export const formatApplicationDate = (
}
return dayjs(dateString).format("MM-DD-YYYY hh:mm:ssA")
}

export const formatGeocodingValues = (key: GeocodingValues) => {
switch (key) {
case GeocodingValues.true:
return "Yes"
case GeocodingValues.false:
return "No"
case GeocodingValues.unknown:
default:
return "Needs Manual Verification"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { formatBoolean } from "../../shared/utils/format-boolean"
import { ApplicationMultiselectQuestion } from "../entities/application-multiselect-question.entity"
import { AddressCreateDto } from "../../shared/dto/address.dto"
import { ApplicationReviewStatus } from "../types/application-review-status-enum"
import { formatApplicationDate } from "../helpers"
import { formatApplicationDate, formatGeocodingValues } from "../helpers"
import { GeocodingValues } from "../../shared/types/geocoding-values"

@Injectable({ scope: Scope.REQUEST })
export class ApplicationCsvExporterService {
Expand Down Expand Up @@ -88,20 +89,44 @@ export class ApplicationCsvExporterService {
claimedString = claimedString.concat(`${option.key}, `)
}
if (option.extraData?.length) {
const extraKey = `${root}: ${option.key} - Address`
let extraKey
let extraString = ""
option.extraData.forEach((extra) => {
if (extra.type === "address") {
extraString += `${(extra.value as AddressCreateDto).street}, ${
(extra.value as AddressCreateDto).street2
? `${(extra.value as AddressCreateDto).street2},`
: ""
} ${(extra.value as AddressCreateDto).city}, ${
(extra.value as AddressCreateDto).state
}, ${(extra.value as AddressCreateDto).zipCode}`
}
})
extraData[extraKey] = extraString
const order = [
"address",
"geocodingVerified",
"addressHolderName",
"addressHolderRelationship",
]

option.extraData
.sort((a, b) => order.indexOf(a.key) - order.indexOf(b.key))
.forEach((extra) => {
if (extra.type === "address") {
extraKey = `${root}: ${option.key} - Provided Address`
extraString += `${(extra.value as AddressCreateDto).street}, ${
(extra.value as AddressCreateDto).street2
? `${(extra.value as AddressCreateDto).street2},`
: ""
} ${(extra.value as AddressCreateDto).city}, ${
(extra.value as AddressCreateDto).state
}, ${(extra.value as AddressCreateDto).zipCode}`
}
if (extra.type === "text") {
if (extra.key === "geocodingVerified") {
extraKey = `${root}: ${option.key} - Passed Address Check`
extraString = formatGeocodingValues(extra.value as GeocodingValues)
}
if (extra.key === "addressHolderName") {
extraKey = `${root}: ${option.key} - Name of Address Holder`
extraString = extra.value as string
}
if (extra.key === "addressHolderRelationship") {
extraKey = `${root}: ${option.key} - Relationship to Address Holder`
extraString = extra.value as string
}
}
extraData[extraKey] = extraString
})
}
})
preferenceKeys[root] = 1
Expand Down
11 changes: 11 additions & 0 deletions backend/core/src/applications/services/applications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Listing } from "../../listings/entities/listing.entity"
import { ApplicationCsvExporterService } from "./application-csv-exporter.service"
import { User } from "../../auth/entities/user.entity"
import { StatusDto } from "../../shared/dto/status.dto"
import { GeocodingService } from "./geocoding.service"

@Injectable({ scope: Scope.REQUEST })
export class ApplicationsService {
Expand All @@ -38,6 +39,7 @@ export class ApplicationsService {
private readonly listingsService: ListingsService,
private readonly emailService: EmailService,
private readonly applicationCsvExporter: ApplicationCsvExporterService,
private readonly geocodingService: GeocodingService,
@InjectRepository(Application) private readonly repository: Repository<Application>,
@InjectRepository(Listing) private readonly listingsRepository: Repository<Listing>
) {}
Expand Down Expand Up @@ -423,6 +425,15 @@ export class ApplicationsService {
if (application.applicant.emailAddress && shouldSendConfirmation) {
await this.emailService.confirmation(listing, application, applicationCreateDto.appUrl)
}

// Calculate geocoding preferences after save and email sent
if (listing.jurisdiction?.enableGeocodingPreferences) {
try {
void this.geocodingService.validateGeocodingPreferences(application, listing)
} catch (e) {
console.warn("error while validating geocoding preferences")
}
}
return application
}

Expand Down
Loading

0 comments on commit 65d949d

Please sign in to comment.