(refactor): locationNotes removed

This commit is contained in:
Knee Cola
2025-11-18 11:55:42 +01:00
parent 6a4c869fa3
commit 92b2b74b66
2 changed files with 7 additions and 19 deletions

View File

@@ -14,7 +14,6 @@ import { getTranslations, getLocale } from "next-intl/server";
export type State = {
errors?: {
locationName?: string[];
locationNotes?: string[];
generateTenantCode?: string[];
tenantFirstName?: string[];
tenantLastName?: string[];
@@ -34,7 +33,6 @@ export type State = {
const FormSchema = (t:IntlTemplateFn) => z.object({
_id: z.string(),
locationName: z.coerce.string().min(1, t("location-name-required")),
locationNotes: z.string(),
generateTenantCode: z.boolean().optional().nullable(),
tenantFirstName: z.string().optional().nullable(),
tenantLastName: z.string().optional().nullable(),
@@ -92,7 +90,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
const validatedFields = FormSchema(t).safeParse({
locationName: formData.get('locationName'),
locationNotes: formData.get('locationNotes'),
generateTenantCode: formData.get('generateTenantCode') === 'on',
tenantFirstName: formData.get('tenantFirstName') || null,
tenantLastName: formData.get('tenantLastName') || null,
@@ -115,7 +112,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
const {
locationName,
locationNotes,
generateTenantCode,
tenantFirstName,
tenantLastName,
@@ -156,7 +152,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
{
$set: {
name: locationName,
notes: locationNotes,
generateTenantCode: generateTenantCode || false,
tenantFirstName: tenantFirstName || null,
tenantLastName: tenantLastName || null,
@@ -185,7 +180,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
{
$set: {
name: locationName,
notes: locationNotes,
generateTenantCode: generateTenantCode || false,
tenantFirstName: tenantFirstName || null,
tenantLastName: tenantLastName || null,
@@ -207,7 +201,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
{
$set: {
name: locationName,
notes: locationNotes,
generateTenantCode: generateTenantCode || false,
tenantFirstName: tenantFirstName || null,
tenantLastName: tenantLastName || null,
@@ -227,7 +220,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
userId,
userEmail,
name: locationName,
notes: locationNotes,
generateTenantCode: generateTenantCode || false,
tenantFirstName: tenantFirstName || null,
tenantLastName: tenantLastName || null,
@@ -299,7 +291,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat
userId,
userEmail,
name: locationName,
notes: locationNotes,
generateTenantCode: generateTenantCode || false,
tenantFirstName: tenantFirstName || null,
tenantLastName: tenantLastName || null,