Remove lastName field from UserSettings and database

- Removed lastName from UserSettings interface
- Updated UserSettingsForm to remove lastName input field
- Removed lastName from all database operations
- Updated form validation schema to remove lastName validation
- Updated ViewLocationCard to use only firstName for recipient name
- Removed lastName from user settings form state tracking
- Updated Croatian translations to reflect changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-22 22:26:41 +01:00
parent 86913f60ec
commit c1762f7157
5 changed files with 15 additions and 55 deletions

View File

@@ -15,7 +15,6 @@ import * as IBAN from 'iban';
export type State = {
errors?: {
firstName?: string[];
lastName?: string[];
street?: string[];
town?: string[];
iban?: string[];
@@ -31,7 +30,6 @@ export type State = {
*/
const FormSchema = (t: IntlTemplateFn) => z.object({
firstName: z.string().optional(),
lastName: z.string().optional(),
street: z.string().optional(),
town: z.string().optional(),
iban: z.string()
@@ -57,15 +55,6 @@ const FormSchema = (t: IntlTemplateFn) => z.object({
message: t("first-name-required"),
path: ["firstName"],
})
.refine((data) => {
if (data.show2dCodeInMonthlyStatement) {
return !!data.lastName && data.lastName.trim().length > 0;
}
return true;
}, {
message: t("last-name-required"),
path: ["lastName"],
})
.refine((data) => {
if (data.show2dCodeInMonthlyStatement) {
return !!data.street && data.street.trim().length > 0;
@@ -148,7 +137,6 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
const validatedFields = FormSchema(t).safeParse({
firstName: formData.get('firstName') || undefined,
lastName: formData.get('lastName') || undefined,
street: formData.get('street') || undefined,
town: formData.get('town') || undefined,
iban: formData.get('iban') || undefined,
@@ -165,7 +153,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
};
}
const { firstName, lastName, street, town, iban, currency, show2dCodeInMonthlyStatement } = validatedFields.data;
const { firstName, street, town, iban, currency, show2dCodeInMonthlyStatement } = validatedFields.data;
// Normalize IBAN: remove spaces and convert to uppercase
const normalizedIban = iban ? iban.replace(/\s/g, '').toUpperCase() : null;
@@ -177,7 +165,6 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
const userSettings: UserSettings = {
userId,
firstName: firstName || null,
lastName: lastName || null,
street: street || null,
town: town || null,
iban: normalizedIban,