admin: Superforms + Zod validation, three-address-defaults schema, profiles toast fix

- Add Superforms + Zod 4 for all admin form validation
- Replace address isDefault with three separate boolean defaults (Mailing, Billing, Shipping)
- Update profiles page with three-checkbox address form and toast improvements
- Convert all admin page server actions to pass request directly to crud
- Export superFormErrorsToFieldErrors helper for profiles server actions
- Regenerate Prisma client for new schema fields
This commit is contained in:
NeilClack
2026-07-07 13:36:23 -05:00
parent 38347f5f24
commit 38d1752f5b
98 changed files with 3408 additions and 1758 deletions
+147 -2
View File
@@ -32,6 +32,10 @@ export type AddressMinAggregateOutputType = {
state: string | null
postalCode: string | null
country: string | null
type: string | null
isDefaultMailing: boolean | null
isDefaultBilling: boolean | null
isDefaultShipping: boolean | null
}
export type AddressMaxAggregateOutputType = {
@@ -42,6 +46,10 @@ export type AddressMaxAggregateOutputType = {
state: string | null
postalCode: string | null
country: string | null
type: string | null
isDefaultMailing: boolean | null
isDefaultBilling: boolean | null
isDefaultShipping: boolean | null
}
export type AddressCountAggregateOutputType = {
@@ -52,6 +60,10 @@ export type AddressCountAggregateOutputType = {
state: number
postalCode: number
country: number
type: number
isDefaultMailing: number
isDefaultBilling: number
isDefaultShipping: number
_all: number
}
@@ -64,6 +76,10 @@ export type AddressMinAggregateInputType = {
state?: true
postalCode?: true
country?: true
type?: true
isDefaultMailing?: true
isDefaultBilling?: true
isDefaultShipping?: true
}
export type AddressMaxAggregateInputType = {
@@ -74,6 +90,10 @@ export type AddressMaxAggregateInputType = {
state?: true
postalCode?: true
country?: true
type?: true
isDefaultMailing?: true
isDefaultBilling?: true
isDefaultShipping?: true
}
export type AddressCountAggregateInputType = {
@@ -84,6 +104,10 @@ export type AddressCountAggregateInputType = {
state?: true
postalCode?: true
country?: true
type?: true
isDefaultMailing?: true
isDefaultBilling?: true
isDefaultShipping?: true
_all?: true
}
@@ -167,12 +191,16 @@ export type AddressGroupByOutputType = {
state: string
postalCode: string
country: string
type: string
isDefaultMailing: boolean
isDefaultBilling: boolean
isDefaultShipping: boolean
_count: AddressCountAggregateOutputType | null
_min: AddressMinAggregateOutputType | null
_max: AddressMaxAggregateOutputType | null
}
type GetAddressGroupByPayload<T extends AddressGroupByArgs> = Prisma.PrismaPromise<
export type GetAddressGroupByPayload<T extends AddressGroupByArgs> = Prisma.PrismaPromise<
Array<
Prisma.PickEnumerable<AddressGroupByOutputType, T['by']> &
{
@@ -198,6 +226,10 @@ export type AddressWhereInput = {
state?: Prisma.StringFilter<"Address"> | string
postalCode?: Prisma.StringFilter<"Address"> | string
country?: Prisma.StringFilter<"Address"> | string
type?: Prisma.StringFilter<"Address"> | string
isDefaultMailing?: Prisma.BoolFilter<"Address"> | boolean
isDefaultBilling?: Prisma.BoolFilter<"Address"> | boolean
isDefaultShipping?: Prisma.BoolFilter<"Address"> | boolean
profile?: Prisma.XOR<Prisma.ProfileScalarRelationFilter, Prisma.ProfileWhereInput>
}
@@ -209,6 +241,10 @@ export type AddressOrderByWithRelationInput = {
state?: Prisma.SortOrder
postalCode?: Prisma.SortOrder
country?: Prisma.SortOrder
type?: Prisma.SortOrder
isDefaultMailing?: Prisma.SortOrder
isDefaultBilling?: Prisma.SortOrder
isDefaultShipping?: Prisma.SortOrder
profile?: Prisma.ProfileOrderByWithRelationInput
}
@@ -223,6 +259,10 @@ export type AddressWhereUniqueInput = Prisma.AtLeast<{
state?: Prisma.StringFilter<"Address"> | string
postalCode?: Prisma.StringFilter<"Address"> | string
country?: Prisma.StringFilter<"Address"> | string
type?: Prisma.StringFilter<"Address"> | string
isDefaultMailing?: Prisma.BoolFilter<"Address"> | boolean
isDefaultBilling?: Prisma.BoolFilter<"Address"> | boolean
isDefaultShipping?: Prisma.BoolFilter<"Address"> | boolean
profile?: Prisma.XOR<Prisma.ProfileScalarRelationFilter, Prisma.ProfileWhereInput>
}, "id">
@@ -234,6 +274,10 @@ export type AddressOrderByWithAggregationInput = {
state?: Prisma.SortOrder
postalCode?: Prisma.SortOrder
country?: Prisma.SortOrder
type?: Prisma.SortOrder
isDefaultMailing?: Prisma.SortOrder
isDefaultBilling?: Prisma.SortOrder
isDefaultShipping?: Prisma.SortOrder
_count?: Prisma.AddressCountOrderByAggregateInput
_max?: Prisma.AddressMaxOrderByAggregateInput
_min?: Prisma.AddressMinOrderByAggregateInput
@@ -250,6 +294,10 @@ export type AddressScalarWhereWithAggregatesInput = {
state?: Prisma.StringWithAggregatesFilter<"Address"> | string
postalCode?: Prisma.StringWithAggregatesFilter<"Address"> | string
country?: Prisma.StringWithAggregatesFilter<"Address"> | string
type?: Prisma.StringWithAggregatesFilter<"Address"> | string
isDefaultMailing?: Prisma.BoolWithAggregatesFilter<"Address"> | boolean
isDefaultBilling?: Prisma.BoolWithAggregatesFilter<"Address"> | boolean
isDefaultShipping?: Prisma.BoolWithAggregatesFilter<"Address"> | boolean
}
export type AddressCreateInput = {
@@ -259,6 +307,10 @@ export type AddressCreateInput = {
state: string
postalCode: string
country: string
type?: string
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
profile: Prisma.ProfileCreateNestedOneWithoutAddressesInput
}
@@ -270,6 +322,10 @@ export type AddressUncheckedCreateInput = {
state: string
postalCode: string
country: string
type?: string
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
}
export type AddressUpdateInput = {
@@ -279,6 +335,10 @@ export type AddressUpdateInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
profile?: Prisma.ProfileUpdateOneRequiredWithoutAddressesNestedInput
}
@@ -290,6 +350,10 @@ export type AddressUncheckedUpdateInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
export type AddressCreateManyInput = {
@@ -300,6 +364,10 @@ export type AddressCreateManyInput = {
state: string
postalCode: string
country: string
type?: string
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
}
export type AddressUpdateManyMutationInput = {
@@ -309,6 +377,10 @@ export type AddressUpdateManyMutationInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
export type AddressUncheckedUpdateManyInput = {
@@ -319,6 +391,10 @@ export type AddressUncheckedUpdateManyInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
export type AddressListRelationFilter = {
@@ -339,6 +415,10 @@ export type AddressCountOrderByAggregateInput = {
state?: Prisma.SortOrder
postalCode?: Prisma.SortOrder
country?: Prisma.SortOrder
type?: Prisma.SortOrder
isDefaultMailing?: Prisma.SortOrder
isDefaultBilling?: Prisma.SortOrder
isDefaultShipping?: Prisma.SortOrder
}
export type AddressMaxOrderByAggregateInput = {
@@ -349,6 +429,10 @@ export type AddressMaxOrderByAggregateInput = {
state?: Prisma.SortOrder
postalCode?: Prisma.SortOrder
country?: Prisma.SortOrder
type?: Prisma.SortOrder
isDefaultMailing?: Prisma.SortOrder
isDefaultBilling?: Prisma.SortOrder
isDefaultShipping?: Prisma.SortOrder
}
export type AddressMinOrderByAggregateInput = {
@@ -359,6 +443,10 @@ export type AddressMinOrderByAggregateInput = {
state?: Prisma.SortOrder
postalCode?: Prisma.SortOrder
country?: Prisma.SortOrder
type?: Prisma.SortOrder
isDefaultMailing?: Prisma.SortOrder
isDefaultBilling?: Prisma.SortOrder
isDefaultShipping?: Prisma.SortOrder
}
export type AddressCreateNestedManyWithoutProfileInput = {
@@ -410,6 +498,10 @@ export type AddressCreateWithoutProfileInput = {
state: string
postalCode: string
country: string
type?: string
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
}
export type AddressUncheckedCreateWithoutProfileInput = {
@@ -419,6 +511,10 @@ export type AddressUncheckedCreateWithoutProfileInput = {
state: string
postalCode: string
country: string
type?: string
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
}
export type AddressCreateOrConnectWithoutProfileInput = {
@@ -458,6 +554,10 @@ export type AddressScalarWhereInput = {
state?: Prisma.StringFilter<"Address"> | string
postalCode?: Prisma.StringFilter<"Address"> | string
country?: Prisma.StringFilter<"Address"> | string
type?: Prisma.StringFilter<"Address"> | string
isDefaultMailing?: Prisma.BoolFilter<"Address"> | boolean
isDefaultBilling?: Prisma.BoolFilter<"Address"> | boolean
isDefaultShipping?: Prisma.BoolFilter<"Address"> | boolean
}
export type AddressCreateManyProfileInput = {
@@ -467,6 +567,10 @@ export type AddressCreateManyProfileInput = {
state: string
postalCode: string
country: string
type?: string
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
}
export type AddressUpdateWithoutProfileInput = {
@@ -476,6 +580,10 @@ export type AddressUpdateWithoutProfileInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
export type AddressUncheckedUpdateWithoutProfileInput = {
@@ -485,6 +593,10 @@ export type AddressUncheckedUpdateWithoutProfileInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
export type AddressUncheckedUpdateManyWithoutProfileInput = {
@@ -494,6 +606,10 @@ export type AddressUncheckedUpdateManyWithoutProfileInput = {
state?: Prisma.StringFieldUpdateOperationsInput | string
postalCode?: Prisma.StringFieldUpdateOperationsInput | string
country?: Prisma.StringFieldUpdateOperationsInput | string
type?: Prisma.StringFieldUpdateOperationsInput | string
isDefaultMailing?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultBilling?: Prisma.BoolFieldUpdateOperationsInput | boolean
isDefaultShipping?: Prisma.BoolFieldUpdateOperationsInput | boolean
}
@@ -506,6 +622,10 @@ export type AddressSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
state?: boolean
postalCode?: boolean
country?: boolean
type?: boolean
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
profile?: boolean | Prisma.ProfileDefaultArgs<ExtArgs>
}, ExtArgs["result"]["address"]>
@@ -517,6 +637,10 @@ export type AddressSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exten
state?: boolean
postalCode?: boolean
country?: boolean
type?: boolean
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
profile?: boolean | Prisma.ProfileDefaultArgs<ExtArgs>
}, ExtArgs["result"]["address"]>
@@ -528,6 +652,10 @@ export type AddressSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exten
state?: boolean
postalCode?: boolean
country?: boolean
type?: boolean
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
profile?: boolean | Prisma.ProfileDefaultArgs<ExtArgs>
}, ExtArgs["result"]["address"]>
@@ -539,9 +667,13 @@ export type AddressSelectScalar = {
state?: boolean
postalCode?: boolean
country?: boolean
type?: boolean
isDefaultMailing?: boolean
isDefaultBilling?: boolean
isDefaultShipping?: boolean
}
export type AddressOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "profileId" | "street" | "city" | "state" | "postalCode" | "country", ExtArgs["result"]["address"]>
export type AddressOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "profileId" | "street" | "city" | "state" | "postalCode" | "country" | "type" | "isDefaultMailing" | "isDefaultBilling" | "isDefaultShipping", ExtArgs["result"]["address"]>
export type AddressInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
profile?: boolean | Prisma.ProfileDefaultArgs<ExtArgs>
}
@@ -565,6 +697,10 @@ export type $AddressPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
state: string
postalCode: string
country: string
type: string
isDefaultMailing: boolean
isDefaultBilling: boolean
isDefaultShipping: boolean
}, ExtArgs["result"]["address"]>
composites: {}
}
@@ -996,6 +1132,10 @@ export interface AddressFieldRefs {
readonly state: Prisma.FieldRef<"Address", 'String'>
readonly postalCode: Prisma.FieldRef<"Address", 'String'>
readonly country: Prisma.FieldRef<"Address", 'String'>
readonly type: Prisma.FieldRef<"Address", 'String'>
readonly isDefaultMailing: Prisma.FieldRef<"Address", 'Boolean'>
readonly isDefaultBilling: Prisma.FieldRef<"Address", 'Boolean'>
readonly isDefaultShipping: Prisma.FieldRef<"Address", 'Boolean'>
}
@@ -1192,6 +1332,11 @@ export type AddressFindManyArgs<ExtArgs extends runtime.Types.Extensions.Interna
* Skip the first `n` Addresses.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of Addresses.
*/
distinct?: Prisma.AddressScalarFieldEnum | Prisma.AddressScalarFieldEnum[]
}