Rename 'street' to 'ownerStreet' in UserSettings with 25 character max length
Changes:
- Updated UserSettings interface: street -> ownerStreet
- Updated userSettingsActions.ts:
- Changed State type to use ownerStreet
- Added max length validation (25 characters) to FormSchema
- Updated validation refinement to check ownerStreet
- Updated form data parsing to read ownerStreet
- Updated database write operations to use ownerStreet
- Updated UserSettingsForm.tsx:
- Changed state tracking to use ownerStreet
- Updated validation check to reference ownerStreet
- Updated input field: id, name, maxLength={25}
- Updated ViewLocationCard.tsx to use ownerStreet instead of street
- Updated English translations:
- street-label -> owner-street-label: "Your Street and House Number"
- street-placeholder -> owner-street-placeholder
- street-required -> owner-street-required
- Updated Croatian translations with corresponding ownerStreet keys
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import * as IBAN from 'iban';
|
||||
export type State = {
|
||||
errors?: {
|
||||
ownerName?: string[];
|
||||
street?: string[];
|
||||
ownerStreet?: string[];
|
||||
town?: string[];
|
||||
iban?: string[];
|
||||
currency?: string[];
|
||||
@@ -30,7 +30,7 @@ export type State = {
|
||||
*/
|
||||
const FormSchema = (t: IntlTemplateFn) => z.object({
|
||||
ownerName: z.string().max(25).optional(),
|
||||
street: z.string().optional(),
|
||||
ownerStreet: z.string().max(25).optional(),
|
||||
town: z.string().optional(),
|
||||
iban: z.string()
|
||||
.optional()
|
||||
@@ -57,12 +57,12 @@ const FormSchema = (t: IntlTemplateFn) => z.object({
|
||||
})
|
||||
.refine((data) => {
|
||||
if (data.show2dCodeInMonthlyStatement) {
|
||||
return !!data.street && data.street.trim().length > 0;
|
||||
return !!data.ownerStreet && data.ownerStreet.trim().length > 0;
|
||||
}
|
||||
return true;
|
||||
}, {
|
||||
message: t("street-required"),
|
||||
path: ["street"],
|
||||
message: t("owner-street-required"),
|
||||
path: ["ownerStreet"],
|
||||
})
|
||||
.refine((data) => {
|
||||
if (data.show2dCodeInMonthlyStatement) {
|
||||
@@ -137,7 +137,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
|
||||
|
||||
const validatedFields = FormSchema(t).safeParse({
|
||||
ownerName: formData.get('ownerName') || undefined,
|
||||
street: formData.get('street') || undefined,
|
||||
ownerStreet: formData.get('ownerStreet') || undefined,
|
||||
town: formData.get('town') || undefined,
|
||||
iban: formData.get('iban') || undefined,
|
||||
currency: formData.get('currency') || undefined,
|
||||
@@ -153,7 +153,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
|
||||
};
|
||||
}
|
||||
|
||||
const { ownerName, street, town, iban, currency, show2dCodeInMonthlyStatement } = validatedFields.data;
|
||||
const { ownerName, ownerStreet, town, iban, currency, show2dCodeInMonthlyStatement } = validatedFields.data;
|
||||
|
||||
// Normalize IBAN: remove spaces and convert to uppercase
|
||||
const normalizedIban = iban ? iban.replace(/\s/g, '').toUpperCase() : null;
|
||||
@@ -165,7 +165,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
|
||||
const userSettings: UserSettings = {
|
||||
userId,
|
||||
ownerName: ownerName || null,
|
||||
street: street || null,
|
||||
ownerStreet: ownerStreet || null,
|
||||
town: town || null,
|
||||
iban: normalizedIban,
|
||||
currency: currency || null,
|
||||
|
||||
@@ -20,8 +20,8 @@ export interface UserSettings {
|
||||
userId: string;
|
||||
/** owner name */
|
||||
ownerName?: string | null;
|
||||
/** street */
|
||||
street?: string | null;
|
||||
/** owner street */
|
||||
ownerStreet?: string | null;
|
||||
/** town */
|
||||
town?: string | null;
|
||||
/** IBAN */
|
||||
|
||||
Reference in New Issue
Block a user