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
+43 -2
View File
@@ -30,6 +30,7 @@ export type ProfileMinAggregateOutputType = {
firstName: string | null
lastName: string | null
phoneNumber: string | null
ghlContactId: string | null
}
export type ProfileMaxAggregateOutputType = {
@@ -38,6 +39,7 @@ export type ProfileMaxAggregateOutputType = {
firstName: string | null
lastName: string | null
phoneNumber: string | null
ghlContactId: string | null
}
export type ProfileCountAggregateOutputType = {
@@ -46,6 +48,7 @@ export type ProfileCountAggregateOutputType = {
firstName: number
lastName: number
phoneNumber: number
ghlContactId: number
_all: number
}
@@ -56,6 +59,7 @@ export type ProfileMinAggregateInputType = {
firstName?: true
lastName?: true
phoneNumber?: true
ghlContactId?: true
}
export type ProfileMaxAggregateInputType = {
@@ -64,6 +68,7 @@ export type ProfileMaxAggregateInputType = {
firstName?: true
lastName?: true
phoneNumber?: true
ghlContactId?: true
}
export type ProfileCountAggregateInputType = {
@@ -72,6 +77,7 @@ export type ProfileCountAggregateInputType = {
firstName?: true
lastName?: true
phoneNumber?: true
ghlContactId?: true
_all?: true
}
@@ -153,12 +159,13 @@ export type ProfileGroupByOutputType = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId: string | null
_count: ProfileCountAggregateOutputType | null
_min: ProfileMinAggregateOutputType | null
_max: ProfileMaxAggregateOutputType | null
}
type GetProfileGroupByPayload<T extends ProfileGroupByArgs> = Prisma.PrismaPromise<
export type GetProfileGroupByPayload<T extends ProfileGroupByArgs> = Prisma.PrismaPromise<
Array<
Prisma.PickEnumerable<ProfileGroupByOutputType, T['by']> &
{
@@ -182,6 +189,7 @@ export type ProfileWhereInput = {
firstName?: Prisma.StringFilter<"Profile"> | string
lastName?: Prisma.StringFilter<"Profile"> | string
phoneNumber?: Prisma.StringFilter<"Profile"> | string
ghlContactId?: Prisma.StringNullableFilter<"Profile"> | string | null
user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
addresses?: Prisma.AddressListRelationFilter
}
@@ -192,6 +200,7 @@ export type ProfileOrderByWithRelationInput = {
firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder
phoneNumber?: Prisma.SortOrder
ghlContactId?: Prisma.SortOrderInput | Prisma.SortOrder
user?: Prisma.UserOrderByWithRelationInput
addresses?: Prisma.AddressOrderByRelationAggregateInput
}
@@ -205,6 +214,7 @@ export type ProfileWhereUniqueInput = Prisma.AtLeast<{
firstName?: Prisma.StringFilter<"Profile"> | string
lastName?: Prisma.StringFilter<"Profile"> | string
phoneNumber?: Prisma.StringFilter<"Profile"> | string
ghlContactId?: Prisma.StringNullableFilter<"Profile"> | string | null
user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
addresses?: Prisma.AddressListRelationFilter
}, "id" | "userId">
@@ -215,6 +225,7 @@ export type ProfileOrderByWithAggregationInput = {
firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder
phoneNumber?: Prisma.SortOrder
ghlContactId?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.ProfileCountOrderByAggregateInput
_max?: Prisma.ProfileMaxOrderByAggregateInput
_min?: Prisma.ProfileMinOrderByAggregateInput
@@ -229,6 +240,7 @@ export type ProfileScalarWhereWithAggregatesInput = {
firstName?: Prisma.StringWithAggregatesFilter<"Profile"> | string
lastName?: Prisma.StringWithAggregatesFilter<"Profile"> | string
phoneNumber?: Prisma.StringWithAggregatesFilter<"Profile"> | string
ghlContactId?: Prisma.StringNullableWithAggregatesFilter<"Profile"> | string | null
}
export type ProfileCreateInput = {
@@ -236,6 +248,7 @@ export type ProfileCreateInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
user: Prisma.UserCreateNestedOneWithoutProfileInput
addresses?: Prisma.AddressCreateNestedManyWithoutProfileInput
}
@@ -246,6 +259,7 @@ export type ProfileUncheckedCreateInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
addresses?: Prisma.AddressUncheckedCreateNestedManyWithoutProfileInput
}
@@ -254,6 +268,7 @@ export type ProfileUpdateInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
user?: Prisma.UserUpdateOneRequiredWithoutProfileNestedInput
addresses?: Prisma.AddressUpdateManyWithoutProfileNestedInput
}
@@ -264,6 +279,7 @@ export type ProfileUncheckedUpdateInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
addresses?: Prisma.AddressUncheckedUpdateManyWithoutProfileNestedInput
}
@@ -273,6 +289,7 @@ export type ProfileCreateManyInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
}
export type ProfileUpdateManyMutationInput = {
@@ -280,6 +297,7 @@ export type ProfileUpdateManyMutationInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type ProfileUncheckedUpdateManyInput = {
@@ -288,6 +306,7 @@ export type ProfileUncheckedUpdateManyInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type ProfileNullableScalarRelationFilter = {
@@ -301,6 +320,7 @@ export type ProfileCountOrderByAggregateInput = {
firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder
phoneNumber?: Prisma.SortOrder
ghlContactId?: Prisma.SortOrder
}
export type ProfileMaxOrderByAggregateInput = {
@@ -309,6 +329,7 @@ export type ProfileMaxOrderByAggregateInput = {
firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder
phoneNumber?: Prisma.SortOrder
ghlContactId?: Prisma.SortOrder
}
export type ProfileMinOrderByAggregateInput = {
@@ -317,6 +338,7 @@ export type ProfileMinOrderByAggregateInput = {
firstName?: Prisma.SortOrder
lastName?: Prisma.SortOrder
phoneNumber?: Prisma.SortOrder
ghlContactId?: Prisma.SortOrder
}
export type ProfileScalarRelationFilter = {
@@ -375,6 +397,7 @@ export type ProfileCreateWithoutUserInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
addresses?: Prisma.AddressCreateNestedManyWithoutProfileInput
}
@@ -383,6 +406,7 @@ export type ProfileUncheckedCreateWithoutUserInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
addresses?: Prisma.AddressUncheckedCreateNestedManyWithoutProfileInput
}
@@ -407,6 +431,7 @@ export type ProfileUpdateWithoutUserInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
addresses?: Prisma.AddressUpdateManyWithoutProfileNestedInput
}
@@ -415,6 +440,7 @@ export type ProfileUncheckedUpdateWithoutUserInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
addresses?: Prisma.AddressUncheckedUpdateManyWithoutProfileNestedInput
}
@@ -423,6 +449,7 @@ export type ProfileCreateWithoutAddressesInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
user: Prisma.UserCreateNestedOneWithoutProfileInput
}
@@ -432,6 +459,7 @@ export type ProfileUncheckedCreateWithoutAddressesInput = {
firstName: string
lastName: string
phoneNumber: string
ghlContactId?: string | null
}
export type ProfileCreateOrConnectWithoutAddressesInput = {
@@ -455,6 +483,7 @@ export type ProfileUpdateWithoutAddressesInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
user?: Prisma.UserUpdateOneRequiredWithoutProfileNestedInput
}
@@ -464,6 +493,7 @@ export type ProfileUncheckedUpdateWithoutAddressesInput = {
firstName?: Prisma.StringFieldUpdateOperationsInput | string
lastName?: Prisma.StringFieldUpdateOperationsInput | string
phoneNumber?: Prisma.StringFieldUpdateOperationsInput | string
ghlContactId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -503,6 +533,7 @@ export type ProfileSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
firstName?: boolean
lastName?: boolean
phoneNumber?: boolean
ghlContactId?: boolean
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
addresses?: boolean | Prisma.Profile$addressesArgs<ExtArgs>
_count?: boolean | Prisma.ProfileCountOutputTypeDefaultArgs<ExtArgs>
@@ -514,6 +545,7 @@ export type ProfileSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exten
firstName?: boolean
lastName?: boolean
phoneNumber?: boolean
ghlContactId?: boolean
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
}, ExtArgs["result"]["profile"]>
@@ -523,6 +555,7 @@ export type ProfileSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exten
firstName?: boolean
lastName?: boolean
phoneNumber?: boolean
ghlContactId?: boolean
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
}, ExtArgs["result"]["profile"]>
@@ -532,9 +565,10 @@ export type ProfileSelectScalar = {
firstName?: boolean
lastName?: boolean
phoneNumber?: boolean
ghlContactId?: boolean
}
export type ProfileOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "userId" | "firstName" | "lastName" | "phoneNumber", ExtArgs["result"]["profile"]>
export type ProfileOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "userId" | "firstName" | "lastName" | "phoneNumber" | "ghlContactId", ExtArgs["result"]["profile"]>
export type ProfileInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
addresses?: boolean | Prisma.Profile$addressesArgs<ExtArgs>
@@ -559,6 +593,7 @@ export type $ProfilePayload<ExtArgs extends runtime.Types.Extensions.InternalArg
firstName: string
lastName: string
phoneNumber: string
ghlContactId: string | null
}, ExtArgs["result"]["profile"]>
composites: {}
}
@@ -989,6 +1024,7 @@ export interface ProfileFieldRefs {
readonly firstName: Prisma.FieldRef<"Profile", 'String'>
readonly lastName: Prisma.FieldRef<"Profile", 'String'>
readonly phoneNumber: Prisma.FieldRef<"Profile", 'String'>
readonly ghlContactId: Prisma.FieldRef<"Profile", 'String'>
}
@@ -1185,6 +1221,11 @@ export type ProfileFindManyArgs<ExtArgs extends runtime.Types.Extensions.Interna
* Skip the first `n` Profiles.
*/
skip?: number
/**
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
*
* Filter by unique combinations of Profiles.
*/
distinct?: Prisma.ProfileScalarFieldEnum | Prisma.ProfileScalarFieldEnum[]
}