Skip to content

Commit 39368d0

Browse files
fix: users ingestion bash
1 parent 8b8fd92 commit 39368d0

File tree

11 files changed

+125
-113
lines changed

11 files changed

+125
-113
lines changed

api/src/dtos/assets/asset.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import { ApiProperty } from '@nestjs/swagger';
77
export class Asset extends AbstractDTO {
88
@Expose()
99
@IsString({ groups: [ValidationsGroupsEnum.default] })
10-
@MaxLength(128, { groups: [ValidationsGroupsEnum.default] })
10+
@MaxLength(2048, { groups: [ValidationsGroupsEnum.default] })
1111
@IsDefined({ groups: [ValidationsGroupsEnum.default] })
1212
@ApiProperty()
1313
fileId: string;
1414

1515
@Expose()
1616
@IsString({ groups: [ValidationsGroupsEnum.default] })
17-
@MaxLength(128, { groups: [ValidationsGroupsEnum.default] })
17+
@MaxLength(2048, { groups: [ValidationsGroupsEnum.default] })
1818
@IsDefined({ groups: [ValidationsGroupsEnum.default] })
1919
@ApiProperty()
2020
label: string;

sites/public/src/components/account/AccountFieldHelpers.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,16 @@ export const AccountSection = ({
614614
</Card.Section>
615615
)
616616

617+
const omitPhoneIfPublic = (
618+
updateFn: "updatePublic" | "updateAdvocate",
619+
user: any // eslint-disable-line @typescript-eslint/no-explicit-any
620+
) => {
621+
if (updateFn !== "updatePublic" || !user) return user
622+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
623+
const { phoneNumber, ...rest } = user
624+
return rest
625+
}
626+
617627
// Submit handler factory for name submission
618628
export const createNameSubmitHandler = (
619629
userService: UserService,
@@ -629,7 +639,7 @@ export const createNameSubmitHandler = (
629639
setAlert(null)
630640
try {
631641
const newUser = await userService[updateFn]({
632-
body: { ...user, firstName, middleName, lastName },
642+
body: { ...omitPhoneIfPublic(updateFn, user), firstName, middleName, lastName },
633643
})
634644
setUser(newUser)
635645
setAlert({ type: "success", message: `${t("account.settings.alerts.nameSuccess")}` })
@@ -658,7 +668,7 @@ export const createEmailSubmitHandler = (
658668
try {
659669
const newUser = await userService[updateFn]({
660670
body: {
661-
...user,
671+
...omitPhoneIfPublic(updateFn, user),
662672
appUrl: window.location.origin,
663673
newEmail: email,
664674
},
@@ -704,7 +714,7 @@ export const createPasswordSubmitHandler = (
704714
}
705715
try {
706716
const newUser = await userService[updateFn]({
707-
body: { ...user, password, currentPassword },
717+
body: { ...omitPhoneIfPublic(updateFn, user), password, currentPassword },
708718
})
709719
setUser(newUser)
710720
setAlert({
@@ -744,7 +754,7 @@ export const createDobSubmitHandler = (
744754
try {
745755
const newUser = await userService[updateFn]({
746756
body: {
747-
...user,
757+
...omitPhoneIfPublic(updateFn, user),
748758
dob: dayjs(`${dob.birthYear}-${dob.birthMonth}-${dob.birthDay}`).toDate(),
749759
},
750760
})

sites/public/src/components/shared/FormSummaryDetails.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,11 @@ const FormSummaryDetails = ({
228228
testId={"app-summary-applicant-phone"}
229229
id="applicantPhone"
230230
label={t("t.phone")}
231-
helpText={t(
232-
`application.contact.phoneNumberTypes.${application.applicant.phoneNumberType}`
233-
)}
231+
helpText={
232+
application.applicant.phoneNumberType
233+
? t(`application.contact.phoneNumberTypes.${application.applicant.phoneNumberType}`)
234+
: undefined
235+
}
234236
className={styles["summary-value"]}
235237
>
236238
{application.applicant.phoneNumber}
@@ -241,9 +243,11 @@ const FormSummaryDetails = ({
241243
testId={"app-summary-applicant-additional-phone"}
242244
id="applicantAdditionalPhone"
243245
label={t("t.additionalPhone")}
244-
helpText={t(
245-
`application.contact.phoneNumberTypes.${application.additionalPhoneNumberType}`
246-
)}
246+
helpText={
247+
application.additionalPhoneNumberType
248+
? t(`application.contact.phoneNumberTypes.${application.additionalPhoneNumberType}`)
249+
: undefined
250+
}
247251
className={styles["summary-value"]}
248252
>
249253
{application.additionalPhoneNumber}
@@ -383,7 +387,7 @@ const FormSummaryDetails = ({
383387
</>
384388
)}
385389

386-
{application.householdSize > 1 && (
390+
{application.householdSize > 1 && !!application.householdMember.length && (
387391
<>
388392
<Card.Header className={styles["summary-header"]}>
389393
<Heading priority={3} size="xl">

sites/public/src/lib/applications/ApplicationConductor.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { ApplicationFormConfig, StepRoute } from "./configInterfaces"
88
import StepDefinition from "./StepDefinition"
99
import AlternateContactStep from "./AlternateContactStep"
1010
import AlternateContactTypeStep from "./AlternateContactTypeStep"
11-
import LiveAloneStep from "./LiveAloneStep"
1211
import HouseholdMemberStep from "./HouseholdMemberStep"
1312
import SelectedPreferencesStep from "./SelectedPreferencesStep"
1413
import PreferencesAllStep from "./PreferencesAllStep"
@@ -75,7 +74,6 @@ export default class ApplicationConductor {
7574
},
7675
liveAlone: {
7776
url: "/applications/household/live-alone",
78-
definition: LiveAloneStep,
7977
},
8078
householdMemberInfo: {
8179
url: "/applications/household/members-info",

sites/public/src/lib/applications/LiveAloneStep.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

sites/public/src/lib/applications/appAutofill.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class AutofillCleaner {
4545

4646
removeAdditionalKeys() {
4747
const unsetIdentifiers = (obj: { id: string; createdAt?: Date; updatedAt?: Date }) => {
48+
if (!obj) return
4849
delete obj.id
4950
delete obj.createdAt
5051
delete obj.updatedAt
@@ -53,18 +54,19 @@ class AutofillCleaner {
5354
unsetIdentifiers(this.application.accessibility)
5455
unsetIdentifiers(this.application.applicant)
5556
unsetIdentifiers(this.application.applicationsMailingAddress)
57+
unsetIdentifiers(this.application.applicationsAlternateAddress)
58+
59+
if (this.application.householdMember) {
60+
this.application.householdMember
61+
.sort((a, b) => a.orderId - b.orderId)
62+
.forEach((member, index) => {
63+
unsetIdentifiers(member)
64+
member.orderId = index
65+
unsetIdentifiers(member.householdMemberAddress)
66+
unsetIdentifiers(member.householdMemberWorkAddress)
67+
})
68+
}
5669

57-
if (this.application.applicationsAlternateAddress)
58-
unsetIdentifiers(this.application.applicationsAlternateAddress)
59-
60-
this.application.householdMember
61-
.sort((a, b) => a.orderId - b.orderId)
62-
.forEach((member, index) => {
63-
unsetIdentifiers(member)
64-
member.orderId = index
65-
if (member.householdMemberAddress) unsetIdentifiers(member.householdMemberAddress)
66-
if (member.householdMemberWorkAddress) unsetIdentifiers(member.householdMemberWorkAddress)
67-
})
6870
unsetIdentifiers(this.application.demographics)
6971

7072
if (this.application.alternateContact) {

sites/public/src/pages/applications/contact/alternate-contact-type.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const ApplicationAlternateContactType = () => {
3737
const validation = await trigger()
3838
if (!validation) return
3939

40+
application.alternateContact = application.alternateContact || {}
4041
application.alternateContact.type = data.type
4142
application.alternateContact.otherType = data.otherType
4243

@@ -48,7 +49,7 @@ const ApplicationAlternateContactType = () => {
4849
const onError = () => {
4950
onFormError()
5051
}
51-
const type = watch("type", application.alternateContact.type)
52+
const type = watch("type", application.alternateContact?.type)
5253
const getOptionLabel = (option: string) => {
5354
if (option === "caseManager" && enableHousingAdvocate) {
5455
return t("application.alternateContact.type.options.caseManagerAdvocate")
@@ -108,7 +109,7 @@ const ApplicationAlternateContactType = () => {
108109
error={errors.type}
109110
inputProps={{
110111
value: option,
111-
defaultChecked: application.alternateContact.type === option,
112+
defaultChecked: application.alternateContact?.type === option,
112113
}}
113114
dataTestId={"app-alternate-type"}
114115
/>

sites/public/src/pages/applications/household/live-alone.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ const ApplicationLiveAlone = () => {
4646
value: "liveAlone",
4747
label: t("application.household.liveAlone.willLiveAlone"),
4848
dataTestId: "app-household-live-alone",
49+
defaultChecked: application.householdSize === 1,
4950
},
5051
{
5152
id: "householdSizeLiveWithOthers",
5253
value: "withOthers",
5354
label: t("application.household.liveAlone.liveWithOtherPeople"),
5455
dataTestId: "app-household-with-others",
56+
defaultChecked: application.householdSize > 1,
5557
},
5658
]
5759

sites/public/src/pages/applications/review/demographics.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const ApplicationDemographics = () => {
4040
// eslint-disable-next-line @typescript-eslint/unbound-method
4141
const { register, handleSubmit, watch } = useForm({
4242
defaultValues: {
43-
ethnicity: application.demographics.ethnicity,
44-
race: application.demographics.race,
43+
ethnicity: application.demographics?.ethnicity,
44+
race: application.demographics?.race,
4545
},
4646
})
4747

@@ -95,7 +95,7 @@ const ApplicationDemographics = () => {
9595
return (enableLimitedHowDidYouHear ? limitedHowDidYouHear : howDidYouHear)?.map((item) => ({
9696
id: item.id,
9797
label: t(`application.review.demographics.howDidYouHearOptions.${item.id}`),
98-
defaultChecked: application.demographics.howDidYouHear?.includes(item.id),
98+
defaultChecked: application.demographics?.howDidYouHear?.includes(item.id),
9999
register,
100100
}))
101101
}
@@ -199,9 +199,9 @@ const ApplicationDemographics = () => {
199199
id="spokenLanguage"
200200
name="spokenLanguage"
201201
defaultValue={
202-
application.demographics.spokenLanguage?.includes("notListed")
202+
application.demographics?.spokenLanguage?.includes("notListed")
203203
? "notListed"
204-
: application.demographics.spokenLanguage
204+
: application.demographics?.spokenLanguage
205205
}
206206
label={t("application.review.demographics.spokenLanguageLabel")}
207207
placeholder={t("t.selectOne")}
@@ -217,8 +217,8 @@ const ApplicationDemographics = () => {
217217
id="spokenLanguageNotListed"
218218
name="spokenLanguageNotListed"
219219
defaultValue={
220-
application.demographics.spokenLanguage?.includes("notListed")
221-
? application.demographics.spokenLanguage.split(":")[1]
220+
application.demographics?.spokenLanguage?.includes("notListed")
221+
? application.demographics?.spokenLanguage.split(":")[1]
222222
: undefined
223223
}
224224
label={t("application.review.demographics.spokenLanguageSpecify")}

0 commit comments

Comments
 (0)