Skip to content

Commit

Permalink
fix: include demographics in partners applicant csv export (#3933)
Browse files Browse the repository at this point in the history
* fix: add flag to include demographics for partners

* refactor: change migration folder name
  • Loading branch information
KrissDrawing authored Mar 11, 2024
1 parent cfc20e1 commit e492219
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "jurisdictions" ADD COLUMN "enable_partner_demographics" BOOLEAN NOT NULL DEFAULT false;
11 changes: 6 additions & 5 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ model AmiChart {
@@map("ami_chart")
}

// Note: [birth_month, birth_day, birth_year] formerly max length 8; [phone_number, phone_number_type] formerly max length 16;
// Note: [birth_month, birth_day, birth_year] formerly max length 8; [phone_number, phone_number_type] formerly max length 16;
// [first_name, middle_name, last_name] formerly max length 64
// Note: [first_name, last_name] formerly min length 1
// Note: [email_address] needs to have lower case enforcement and needs isEmail validator
Expand Down Expand Up @@ -167,9 +167,9 @@ model ApplicationMethods {
@@map("application_methods")
}

// Note: [additional_phone_number, additional_phone_number_type, household_size] formerly max length 16;
// Note: [additional_phone_number, additional_phone_number_type, household_size] formerly max length 16;
// [contact_preferences, income] formerly max length 64;
// [app_url] formerly max length 256;
// [app_url] formerly max length 256;
// Note: [contact_preferences] formerly max array length of 8
// Note: [household_member] formerly had max array lenght of 32
// Note: missing virtual [flagged] field
Expand Down Expand Up @@ -284,7 +284,7 @@ model GeneratedListingTranslations {
@@map("generated_listing_translations")
}

// Note: [birth_month, birth_day, birth_year] formerly max length 8;
// Note: [birth_month, birth_day, birth_year] formerly max length 8;
// [phone_number, phone_number_type] formerly max length 16
// [first_name, middle_name, last_name, relationship] formerly max length 64;
// Note: [email_address] formerly enforced lower case
Expand Down Expand Up @@ -326,6 +326,7 @@ model Jurisdictions {
emailFromAddress String? @map("email_from_address")
rentalAssistanceDefault String @map("rental_assistance_default")
enablePartnerSettings Boolean @default(false) @map("enable_partner_settings")
enablePartnerDemographics Boolean @default(false) @map("enable_partner_demographics")
enableAccessibilityFeatures Boolean @default(false) @map("enable_accessibility_features")
enableUtilitiesIncluded Boolean @default(false) @map("enable_utilities_included")
enableGeocodingPreferences Boolean @default(false) @map("enable_geocoding_preferences")
Expand Down Expand Up @@ -580,7 +581,7 @@ model MapLayers {
@@map("map_layers")
}

// Note: hold over from TypeORM
// Note: hold over from TypeORM
model Migrations {
id Int @id() @default(autoincrement())
timestamp BigInt
Expand Down
5 changes: 5 additions & 0 deletions api/src/dtos/jurisdictions/jurisdiction.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export class Jurisdiction extends AbstractDTO {
@ApiPropertyOptional()
enablePartnerSettings?: boolean;

@Expose()
@IsBoolean({ groups: [ValidationsGroupsEnum.default] })
@ApiPropertyOptional()
enablePartnerDemographics?: boolean;

@Expose()
@IsBoolean({ groups: [ValidationsGroupsEnum.default] })
@ApiPropertyOptional()
Expand Down
9 changes: 9 additions & 0 deletions shared-helpers/src/types/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,9 @@ export interface Jurisdiction {
/** */
enablePartnerSettings?: boolean

/** */
enablePartnerDemographics?: boolean

/** */
enableGeocodingPreferences?: boolean

Expand Down Expand Up @@ -4354,6 +4357,9 @@ export interface JurisdictionCreate {
/** */
enablePartnerSettings?: boolean

/** */
enablePartnerDemographics?: boolean

/** */
enableGeocodingPreferences?: boolean

Expand Down Expand Up @@ -4398,6 +4404,9 @@ export interface JurisdictionUpdate {
/** */
enablePartnerSettings?: boolean

/** */
enablePartnerDemographics?: boolean

/** */
enableGeocodingPreferences?: boolean

Expand Down
12 changes: 9 additions & 3 deletions sites/partners/src/pages/listings/[id]/applications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ const ApplicationsList = () => {

const tableOptions = useAgTable()

/* Data Fetching */
const { listingDto } = useSingleListingData(listingId)

const listingJurisdiction = profile.jurisdictions.find(
(jurisdiction) => jurisdiction.id === listingDto?.jurisdictions.id
)
const includeDemographicsPartner =
profile?.userRoles?.isPartner && listingJurisdiction?.enablePartnerDemographics
const { onExport, csvExportLoading, csvExportError, csvExportSuccess } = useApplicationsExport(
listingId,
profile?.userRoles?.isAdmin ?? false
(profile?.userRoles?.isAdmin || includeDemographicsPartner) ?? false
)

/* Data Fetching */
const { listingDto } = useSingleListingData(listingId)
const countyCode = listingDto?.jurisdictions.name
const listingName = listingDto?.name
const isListingOpen = listingDto?.status === "active"
Expand Down

0 comments on commit e492219

Please sign in to comment.