diff --git a/api/prisma/migrations/07_enable_partner_demographics_flag/migration.sql b/api/prisma/migrations/07_enable_partner_demographics_flag/migration.sql new file mode 100644 index 0000000000..22f19ff2e5 --- /dev/null +++ b/api/prisma/migrations/07_enable_partner_demographics_flag/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "jurisdictions" ADD COLUMN "enable_partner_demographics" BOOLEAN NOT NULL DEFAULT false; diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma index e03c98fecc..7c59d76202 100644 --- a/api/prisma/schema.prisma +++ b/api/prisma/schema.prisma @@ -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 @@ -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 @@ -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 @@ -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") @@ -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 diff --git a/api/src/dtos/jurisdictions/jurisdiction.dto.ts b/api/src/dtos/jurisdictions/jurisdiction.dto.ts index 34c77b84e1..098ecb6d04 100644 --- a/api/src/dtos/jurisdictions/jurisdiction.dto.ts +++ b/api/src/dtos/jurisdictions/jurisdiction.dto.ts @@ -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() diff --git a/shared-helpers/src/types/backend-swagger.ts b/shared-helpers/src/types/backend-swagger.ts index ef7766c73f..47402d859f 100644 --- a/shared-helpers/src/types/backend-swagger.ts +++ b/shared-helpers/src/types/backend-swagger.ts @@ -2692,6 +2692,9 @@ export interface Jurisdiction { /** */ enablePartnerSettings?: boolean + /** */ + enablePartnerDemographics?: boolean + /** */ enableGeocodingPreferences?: boolean @@ -4354,6 +4357,9 @@ export interface JurisdictionCreate { /** */ enablePartnerSettings?: boolean + /** */ + enablePartnerDemographics?: boolean + /** */ enableGeocodingPreferences?: boolean @@ -4398,6 +4404,9 @@ export interface JurisdictionUpdate { /** */ enablePartnerSettings?: boolean + /** */ + enablePartnerDemographics?: boolean + /** */ enableGeocodingPreferences?: boolean diff --git a/sites/partners/src/pages/listings/[id]/applications/index.tsx b/sites/partners/src/pages/listings/[id]/applications/index.tsx index 821335f6fc..ed9ed4a0e0 100644 --- a/sites/partners/src/pages/listings/[id]/applications/index.tsx +++ b/sites/partners/src/pages/listings/[id]/applications/index.tsx @@ -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"