New fields for complex
This commit is contained in:
@@ -2,6 +2,9 @@ model Complex {
|
||||
id String @id @db.Uuid
|
||||
complexName String @map("complex_name")
|
||||
physicalAddress String? @map("physical_address") @db.VarChar(200)
|
||||
city String? @map("city") @db.VarChar(100)
|
||||
state String? @map("state") @db.VarChar(100)
|
||||
country String? @map("country") @db.VarChar(100)
|
||||
complexSlug String @unique @map("complex_slug")
|
||||
adminEmail String @map("admin_email")
|
||||
planCode String? @map("plan_code") @db.VarChar(10)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "complexes" ADD COLUMN "city" VARCHAR(100),
|
||||
ADD COLUMN "country" VARCHAR(100),
|
||||
ADD COLUMN "state" VARCHAR(100);
|
||||
File diff suppressed because one or more lines are too long
@@ -1196,6 +1196,9 @@ export const ComplexScalarFieldEnum = {
|
||||
id: 'id',
|
||||
complexName: 'complexName',
|
||||
physicalAddress: 'physicalAddress',
|
||||
city: 'city',
|
||||
state: 'state',
|
||||
country: 'country',
|
||||
complexSlug: 'complexSlug',
|
||||
adminEmail: 'adminEmail',
|
||||
planCode: 'planCode',
|
||||
|
||||
@@ -83,6 +83,9 @@ export const ComplexScalarFieldEnum = {
|
||||
id: 'id',
|
||||
complexName: 'complexName',
|
||||
physicalAddress: 'physicalAddress',
|
||||
city: 'city',
|
||||
state: 'state',
|
||||
country: 'country',
|
||||
complexSlug: 'complexSlug',
|
||||
adminEmail: 'adminEmail',
|
||||
planCode: 'planCode',
|
||||
|
||||
@@ -28,6 +28,9 @@ export type ComplexMinAggregateOutputType = {
|
||||
id: string | null
|
||||
complexName: string | null
|
||||
physicalAddress: string | null
|
||||
city: string | null
|
||||
state: string | null
|
||||
country: string | null
|
||||
complexSlug: string | null
|
||||
adminEmail: string | null
|
||||
planCode: string | null
|
||||
@@ -39,6 +42,9 @@ export type ComplexMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
complexName: string | null
|
||||
physicalAddress: string | null
|
||||
city: string | null
|
||||
state: string | null
|
||||
country: string | null
|
||||
complexSlug: string | null
|
||||
adminEmail: string | null
|
||||
planCode: string | null
|
||||
@@ -50,6 +56,9 @@ export type ComplexCountAggregateOutputType = {
|
||||
id: number
|
||||
complexName: number
|
||||
physicalAddress: number
|
||||
city: number
|
||||
state: number
|
||||
country: number
|
||||
complexSlug: number
|
||||
adminEmail: number
|
||||
planCode: number
|
||||
@@ -63,6 +72,9 @@ export type ComplexMinAggregateInputType = {
|
||||
id?: true
|
||||
complexName?: true
|
||||
physicalAddress?: true
|
||||
city?: true
|
||||
state?: true
|
||||
country?: true
|
||||
complexSlug?: true
|
||||
adminEmail?: true
|
||||
planCode?: true
|
||||
@@ -74,6 +86,9 @@ export type ComplexMaxAggregateInputType = {
|
||||
id?: true
|
||||
complexName?: true
|
||||
physicalAddress?: true
|
||||
city?: true
|
||||
state?: true
|
||||
country?: true
|
||||
complexSlug?: true
|
||||
adminEmail?: true
|
||||
planCode?: true
|
||||
@@ -85,6 +100,9 @@ export type ComplexCountAggregateInputType = {
|
||||
id?: true
|
||||
complexName?: true
|
||||
physicalAddress?: true
|
||||
city?: true
|
||||
state?: true
|
||||
country?: true
|
||||
complexSlug?: true
|
||||
adminEmail?: true
|
||||
planCode?: true
|
||||
@@ -169,6 +187,9 @@ export type ComplexGroupByOutputType = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress: string | null
|
||||
city: string | null
|
||||
state: string | null
|
||||
country: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
planCode: string | null
|
||||
@@ -201,6 +222,9 @@ export type ComplexWhereInput = {
|
||||
id?: Prisma.UuidFilter<"Complex"> | string
|
||||
complexName?: Prisma.StringFilter<"Complex"> | string
|
||||
physicalAddress?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
city?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
state?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
country?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
complexSlug?: Prisma.StringFilter<"Complex"> | string
|
||||
adminEmail?: Prisma.StringFilter<"Complex"> | string
|
||||
planCode?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
@@ -215,6 +239,9 @@ export type ComplexOrderByWithRelationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
complexName?: Prisma.SortOrder
|
||||
physicalAddress?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
city?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
state?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
country?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
complexSlug?: Prisma.SortOrder
|
||||
adminEmail?: Prisma.SortOrder
|
||||
planCode?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
@@ -233,6 +260,9 @@ export type ComplexWhereUniqueInput = Prisma.AtLeast<{
|
||||
NOT?: Prisma.ComplexWhereInput | Prisma.ComplexWhereInput[]
|
||||
complexName?: Prisma.StringFilter<"Complex"> | string
|
||||
physicalAddress?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
city?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
state?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
country?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
adminEmail?: Prisma.StringFilter<"Complex"> | string
|
||||
planCode?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"Complex"> | Date | string
|
||||
@@ -246,6 +276,9 @@ export type ComplexOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
complexName?: Prisma.SortOrder
|
||||
physicalAddress?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
city?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
state?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
country?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
complexSlug?: Prisma.SortOrder
|
||||
adminEmail?: Prisma.SortOrder
|
||||
planCode?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
@@ -263,6 +296,9 @@ export type ComplexScalarWhereWithAggregatesInput = {
|
||||
id?: Prisma.UuidWithAggregatesFilter<"Complex"> | string
|
||||
complexName?: Prisma.StringWithAggregatesFilter<"Complex"> | string
|
||||
physicalAddress?: Prisma.StringNullableWithAggregatesFilter<"Complex"> | string | null
|
||||
city?: Prisma.StringNullableWithAggregatesFilter<"Complex"> | string | null
|
||||
state?: Prisma.StringNullableWithAggregatesFilter<"Complex"> | string | null
|
||||
country?: Prisma.StringNullableWithAggregatesFilter<"Complex"> | string | null
|
||||
complexSlug?: Prisma.StringWithAggregatesFilter<"Complex"> | string
|
||||
adminEmail?: Prisma.StringWithAggregatesFilter<"Complex"> | string
|
||||
planCode?: Prisma.StringNullableWithAggregatesFilter<"Complex"> | string | null
|
||||
@@ -274,6 +310,9 @@ export type ComplexCreateInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
createdAt?: Date | string
|
||||
@@ -287,6 +326,9 @@ export type ComplexUncheckedCreateInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
planCode?: string | null
|
||||
@@ -300,6 +342,9 @@ export type ComplexUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -313,6 +358,9 @@ export type ComplexUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
planCode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -326,6 +374,9 @@ export type ComplexCreateManyInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
planCode?: string | null
|
||||
@@ -337,6 +388,9 @@ export type ComplexUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -347,6 +401,9 @@ export type ComplexUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
planCode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -358,6 +415,9 @@ export type ComplexCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
complexName?: Prisma.SortOrder
|
||||
physicalAddress?: Prisma.SortOrder
|
||||
city?: Prisma.SortOrder
|
||||
state?: Prisma.SortOrder
|
||||
country?: Prisma.SortOrder
|
||||
complexSlug?: Prisma.SortOrder
|
||||
adminEmail?: Prisma.SortOrder
|
||||
planCode?: Prisma.SortOrder
|
||||
@@ -369,6 +429,9 @@ export type ComplexMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
complexName?: Prisma.SortOrder
|
||||
physicalAddress?: Prisma.SortOrder
|
||||
city?: Prisma.SortOrder
|
||||
state?: Prisma.SortOrder
|
||||
country?: Prisma.SortOrder
|
||||
complexSlug?: Prisma.SortOrder
|
||||
adminEmail?: Prisma.SortOrder
|
||||
planCode?: Prisma.SortOrder
|
||||
@@ -380,6 +443,9 @@ export type ComplexMinOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
complexName?: Prisma.SortOrder
|
||||
physicalAddress?: Prisma.SortOrder
|
||||
city?: Prisma.SortOrder
|
||||
state?: Prisma.SortOrder
|
||||
country?: Prisma.SortOrder
|
||||
complexSlug?: Prisma.SortOrder
|
||||
adminEmail?: Prisma.SortOrder
|
||||
planCode?: Prisma.SortOrder
|
||||
@@ -488,6 +554,9 @@ export type ComplexCreateWithoutUsersInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
createdAt?: Date | string
|
||||
@@ -500,6 +569,9 @@ export type ComplexUncheckedCreateWithoutUsersInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
planCode?: string | null
|
||||
@@ -528,6 +600,9 @@ export type ComplexUpdateWithoutUsersInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -540,6 +615,9 @@ export type ComplexUncheckedUpdateWithoutUsersInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
planCode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -552,6 +630,9 @@ export type ComplexCreateWithoutCourtsInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
createdAt?: Date | string
|
||||
@@ -564,6 +645,9 @@ export type ComplexUncheckedCreateWithoutCourtsInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
planCode?: string | null
|
||||
@@ -592,6 +676,9 @@ export type ComplexUpdateWithoutCourtsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -604,6 +691,9 @@ export type ComplexUncheckedUpdateWithoutCourtsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
planCode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -616,6 +706,9 @@ export type ComplexCreateWithoutPlanInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
createdAt?: Date | string
|
||||
@@ -628,6 +721,9 @@ export type ComplexUncheckedCreateWithoutPlanInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
createdAt?: Date | string
|
||||
@@ -669,6 +765,9 @@ export type ComplexScalarWhereInput = {
|
||||
id?: Prisma.UuidFilter<"Complex"> | string
|
||||
complexName?: Prisma.StringFilter<"Complex"> | string
|
||||
physicalAddress?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
city?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
state?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
country?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
complexSlug?: Prisma.StringFilter<"Complex"> | string
|
||||
adminEmail?: Prisma.StringFilter<"Complex"> | string
|
||||
planCode?: Prisma.StringNullableFilter<"Complex"> | string | null
|
||||
@@ -680,6 +779,9 @@ export type ComplexCreateManyPlanInput = {
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
createdAt?: Date | string
|
||||
@@ -690,6 +792,9 @@ export type ComplexUpdateWithoutPlanInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -702,6 +807,9 @@ export type ComplexUncheckedUpdateWithoutPlanInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -714,6 +822,9 @@ export type ComplexUncheckedUpdateManyWithoutPlanInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
complexName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
physicalAddress?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
complexSlug?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
adminEmail?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -764,6 +875,9 @@ export type ComplexSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
id?: boolean
|
||||
complexName?: boolean
|
||||
physicalAddress?: boolean
|
||||
city?: boolean
|
||||
state?: boolean
|
||||
country?: boolean
|
||||
complexSlug?: boolean
|
||||
adminEmail?: boolean
|
||||
planCode?: boolean
|
||||
@@ -779,6 +893,9 @@ export type ComplexSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exten
|
||||
id?: boolean
|
||||
complexName?: boolean
|
||||
physicalAddress?: boolean
|
||||
city?: boolean
|
||||
state?: boolean
|
||||
country?: boolean
|
||||
complexSlug?: boolean
|
||||
adminEmail?: boolean
|
||||
planCode?: boolean
|
||||
@@ -791,6 +908,9 @@ export type ComplexSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exten
|
||||
id?: boolean
|
||||
complexName?: boolean
|
||||
physicalAddress?: boolean
|
||||
city?: boolean
|
||||
state?: boolean
|
||||
country?: boolean
|
||||
complexSlug?: boolean
|
||||
adminEmail?: boolean
|
||||
planCode?: boolean
|
||||
@@ -803,6 +923,9 @@ export type ComplexSelectScalar = {
|
||||
id?: boolean
|
||||
complexName?: boolean
|
||||
physicalAddress?: boolean
|
||||
city?: boolean
|
||||
state?: boolean
|
||||
country?: boolean
|
||||
complexSlug?: boolean
|
||||
adminEmail?: boolean
|
||||
planCode?: boolean
|
||||
@@ -810,7 +933,7 @@ export type ComplexSelectScalar = {
|
||||
updatedAt?: boolean
|
||||
}
|
||||
|
||||
export type ComplexOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "complexName" | "physicalAddress" | "complexSlug" | "adminEmail" | "planCode" | "createdAt" | "updatedAt", ExtArgs["result"]["complex"]>
|
||||
export type ComplexOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "complexName" | "physicalAddress" | "city" | "state" | "country" | "complexSlug" | "adminEmail" | "planCode" | "createdAt" | "updatedAt", ExtArgs["result"]["complex"]>
|
||||
export type ComplexInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
plan?: boolean | Prisma.Complex$planArgs<ExtArgs>
|
||||
users?: boolean | Prisma.Complex$usersArgs<ExtArgs>
|
||||
@@ -835,6 +958,9 @@ export type $ComplexPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
id: string
|
||||
complexName: string
|
||||
physicalAddress: string | null
|
||||
city: string | null
|
||||
state: string | null
|
||||
country: string | null
|
||||
complexSlug: string
|
||||
adminEmail: string
|
||||
planCode: string | null
|
||||
@@ -1269,6 +1395,9 @@ export interface ComplexFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly complexName: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly physicalAddress: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly city: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly state: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly country: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly complexSlug: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly adminEmail: Prisma.FieldRef<"Complex", 'String'>
|
||||
readonly planCode: Prisma.FieldRef<"Complex", 'String'>
|
||||
|
||||
@@ -17,6 +17,9 @@ export async function createComplexHandler(c: AppContext) {
|
||||
physicalAddress: payload.physicalAddress,
|
||||
adminEmail,
|
||||
planCode: payload.planCode,
|
||||
city: payload.city,
|
||||
state: payload.state,
|
||||
country: payload.country,
|
||||
})
|
||||
|
||||
return c.json(complex, 201)
|
||||
|
||||
@@ -7,6 +7,9 @@ export type CreateComplexInput = {
|
||||
physicalAddress: string
|
||||
adminEmail: string
|
||||
planCode?: string
|
||||
city?: string
|
||||
state?: string
|
||||
country?: string
|
||||
}
|
||||
|
||||
export type UpdateComplexInput = {
|
||||
@@ -15,6 +18,9 @@ export type UpdateComplexInput = {
|
||||
complexSlug?: string
|
||||
adminEmail?: string
|
||||
planCode?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
}
|
||||
|
||||
function slugify(value: string): string {
|
||||
@@ -68,6 +74,9 @@ export async function createComplex(input: CreateComplexInput) {
|
||||
id: uuidv7(),
|
||||
complexName: input.complexName,
|
||||
physicalAddress: input.physicalAddress.trim(),
|
||||
city: input.city?.trim() || null,
|
||||
state: input.state?.trim() || null,
|
||||
country: input.country?.trim() || null,
|
||||
complexSlug,
|
||||
adminEmail: input.adminEmail,
|
||||
planCode: input.planCode,
|
||||
@@ -125,6 +134,18 @@ export async function updateComplex(id: string, input: UpdateComplexInput) {
|
||||
data.physicalAddress = input.physicalAddress?.trim() ?? null
|
||||
}
|
||||
|
||||
if (input.city !== undefined) {
|
||||
data.city = input.city?.trim() ?? null
|
||||
}
|
||||
|
||||
if (input.state !== undefined) {
|
||||
data.state = input.state?.trim() ?? null
|
||||
}
|
||||
|
||||
if (input.country !== undefined) {
|
||||
data.country = input.country?.trim() ?? null
|
||||
}
|
||||
|
||||
return db.complex.update({
|
||||
where: { id },
|
||||
data: data as Prisma.ComplexUncheckedUpdateInput,
|
||||
|
||||
@@ -475,6 +475,9 @@ export async function completeOnboarding(input: OnboardingCompleteInput) {
|
||||
id: uuidv7(),
|
||||
complexName: input.complexName.trim(),
|
||||
physicalAddress: input.physicalAddress.trim(),
|
||||
city: input.city?.trim() || null,
|
||||
state: input.state?.trim() || null,
|
||||
country: input.country?.trim() || null,
|
||||
complexSlug,
|
||||
adminEmail: onboardingRequest.email,
|
||||
planCode: input.planCode,
|
||||
|
||||
87
apps/frontend/src/features/complex/complex-settings-page.tsx
Normal file
87
apps/frontend/src/features/complex/complex-settings-page.tsx
Normal file
@@ -0,0 +1,87 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Building2, MapPin, Settings } from 'lucide-react'
|
||||
import { apiClient } from '@/lib/api-client'
|
||||
import { setCurrentComplexSlug } from '@/lib/current-complex'
|
||||
import { ComplexDetailsSection } from './components/complex-details-section'
|
||||
import { ComplexCourtsSection } from './components/complex-courts-section'
|
||||
|
||||
type ComplexSettingsPageProps = {
|
||||
complexSlug: string
|
||||
}
|
||||
|
||||
type TabOption = 'details' | 'courts'
|
||||
|
||||
export function ComplexSettingsPage({ complexSlug }: ComplexSettingsPageProps) {
|
||||
const [activeTab, setActiveTab] = useState<TabOption>('details')
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentComplexSlug(complexSlug)
|
||||
}, [complexSlug])
|
||||
|
||||
const complexQuery = useQuery({
|
||||
queryKey: ['complex-by-slug', complexSlug],
|
||||
queryFn: () => apiClient.complexes.getBySlug(complexSlug),
|
||||
})
|
||||
|
||||
const complexId = complexQuery.data?.id ?? null
|
||||
|
||||
const tabs = [
|
||||
{ id: 'details' as const, label: 'Datos del complejo', icon: Building2 },
|
||||
{ id: 'courts' as const, label: 'Canchas', icon: MapPin },
|
||||
]
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-6xl px-4 py-4 sm:px-6">
|
||||
<section className="rounded-xl border bg-card p-4 text-card-foreground shadow-sm sm:p-5">
|
||||
<h2 className="text-2xl font-semibold">
|
||||
<Settings className="mb-1 mr-2 inline size-6" />
|
||||
Configuración del complejo
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
{complexQuery.data?.complexName ?? 'Configura los datos de tu complejo'}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<div className="mt-6 grid gap-6 lg:grid-cols-[200px_1fr]">
|
||||
<nav className="flex flex-row gap-1 overflow-x-auto lg:flex-col lg:overflow-visible">
|
||||
{tabs.map((tab) => {
|
||||
const Icon = tab.icon
|
||||
const isActive = activeTab === tab.id
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={`inline-flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors lg:w-full lg:justify-start ${
|
||||
isActive
|
||||
? 'bg-muted text-foreground'
|
||||
: 'text-muted-foreground hover:bg-muted hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
<Icon className="size-4" />
|
||||
{tab.label}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</nav>
|
||||
|
||||
<div className="min-w-0">
|
||||
{activeTab === 'details' && (
|
||||
<ComplexDetailsSection
|
||||
complex={complexQuery.data ?? null}
|
||||
isLoading={complexQuery.isLoading}
|
||||
isError={complexQuery.isError}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeTab === 'courts' && (
|
||||
<ComplexCourtsSection
|
||||
complexId={complexId}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { type Court, type CreateCourtInput } from '@repo/api-contract'
|
||||
import { MapPin } from 'lucide-react'
|
||||
import { apiClient } from '@/lib/api-client'
|
||||
import { CourtFormSection } from './court-form-section'
|
||||
import { CourtListSection } from './court-list-section'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
|
||||
type ComplexCourtsSectionProps = {
|
||||
complexId: string | null
|
||||
}
|
||||
|
||||
export function ComplexCourtsSection({
|
||||
complexId,
|
||||
}: ComplexCourtsSectionProps) {
|
||||
const [editingCourt, setEditingCourt] = useState<Court | null>(null)
|
||||
const [initialDraft, setInitialDraft] = useState<CreateCourtInput | null>(null)
|
||||
|
||||
const courtsQuery = useQuery({
|
||||
queryKey: ['courts', complexId],
|
||||
enabled: Boolean(complexId),
|
||||
queryFn: () => apiClient.courts.listByComplex(complexId as string),
|
||||
})
|
||||
|
||||
return (
|
||||
<section className="mt-6 rounded-xl border bg-card p-5">
|
||||
<div className="flex items-center gap-2">
|
||||
<MapPin className="size-5 text-muted-foreground" />
|
||||
<h3 className="text-lg font-medium">Canchas</h3>
|
||||
</div>
|
||||
<Separator className="my-4" />
|
||||
<p className="mb-4 text-sm text-muted-foreground">
|
||||
Alta y edición de canchas del complejo.
|
||||
</p>
|
||||
|
||||
<CourtFormSection
|
||||
complexId={complexId}
|
||||
editingCourt={editingCourt}
|
||||
initialDraft={initialDraft}
|
||||
onCancelEdit={() => {
|
||||
setEditingCourt(null)
|
||||
}}
|
||||
/>
|
||||
|
||||
<CourtListSection
|
||||
courts={courtsQuery.data ?? []}
|
||||
isLoading={courtsQuery.isLoading}
|
||||
isError={courtsQuery.isError}
|
||||
onDuplicateCourt={(court) => {
|
||||
setEditingCourt(null)
|
||||
setInitialDraft({
|
||||
name: `${court.name} - Copy`,
|
||||
sportId: court.sportId,
|
||||
slotDurationMinutes: court.slotDurationMinutes,
|
||||
basePrice: court.basePrice,
|
||||
availability: court.availability.map((slot) => ({
|
||||
dayOfWeek: slot.dayOfWeek,
|
||||
startTime: slot.startTime,
|
||||
endTime: slot.endTime,
|
||||
})),
|
||||
})
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}}
|
||||
onEditCourt={(court) => {
|
||||
setInitialDraft(null)
|
||||
setEditingCourt(court)
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import type { Complex, UpdateComplexInput } from '@repo/api-contract'
|
||||
import { updateComplexSchema } from '@repo/api-contract'
|
||||
import { Building2, Loader2 } from 'lucide-react'
|
||||
import { apiClient } from '@/lib/api-client'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Field, FieldLabel } from '@/components/ui/field'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
|
||||
type ComplexDetailsSectionProps = {
|
||||
complex: Complex | null
|
||||
isLoading: boolean
|
||||
isError: boolean
|
||||
}
|
||||
|
||||
type FormValues = {
|
||||
complexName: string
|
||||
physicalAddress: string
|
||||
city: string
|
||||
state: string
|
||||
country: string
|
||||
}
|
||||
|
||||
export function ComplexDetailsSection({
|
||||
complex,
|
||||
isLoading,
|
||||
isError,
|
||||
}: ComplexDetailsSectionProps) {
|
||||
const queryClient = useQueryClient()
|
||||
const [formValues, setFormValues] = useState<FormValues>({
|
||||
complexName: '',
|
||||
physicalAddress: '',
|
||||
city: '',
|
||||
state: '',
|
||||
country: '',
|
||||
})
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null)
|
||||
const [successMessage, setSuccessMessage] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (complex) {
|
||||
setFormValues({
|
||||
complexName: complex.complexName,
|
||||
physicalAddress: complex.physicalAddress ?? '',
|
||||
city: complex.city ?? '',
|
||||
state: complex.state ?? '',
|
||||
country: complex.country ?? '',
|
||||
})
|
||||
}
|
||||
}, [complex])
|
||||
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: (data: UpdateComplexInput) =>
|
||||
apiClient.complexes.update(complex!.id, data),
|
||||
onSuccess: (updatedComplex) => {
|
||||
setSuccessMessage('Datos actualizados correctamente.')
|
||||
setErrorMessage(null)
|
||||
queryClient.setQueryData(['complex-by-slug', complex?.complexSlug], updatedComplex)
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
setErrorMessage(error.message || 'Error al actualizar los datos.')
|
||||
setSuccessMessage(null)
|
||||
},
|
||||
})
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
setErrorMessage(null)
|
||||
setSuccessMessage(null)
|
||||
|
||||
const result = updateComplexSchema.safeParse({
|
||||
complexName: formValues.complexName,
|
||||
physicalAddress: formValues.physicalAddress || null,
|
||||
city: formValues.city || null,
|
||||
state: formValues.state || null,
|
||||
country: formValues.country || null,
|
||||
})
|
||||
|
||||
if (!result.success) {
|
||||
setErrorMessage(result.error.errors[0]?.message || 'Datos inválidos.')
|
||||
return
|
||||
}
|
||||
|
||||
updateMutation.mutate(result.data)
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<section className="rounded-xl border bg-card p-5">
|
||||
<div className="flex items-center gap-2">
|
||||
<Building2 className="size-5 text-muted-foreground" />
|
||||
<h3 className="text-lg font-medium">Datos del complejo</h3>
|
||||
</div>
|
||||
<Separator className="my-4" />
|
||||
<p className="text-sm text-muted-foreground">Cargando...</p>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
if (isError || !complex) {
|
||||
return (
|
||||
<section className="rounded-xl border bg-card p-5">
|
||||
<div className="flex items-center gap-2">
|
||||
<Building2 className="size-5 text-muted-foreground" />
|
||||
<h3 className="text-lg font-medium">Datos del complejo</h3>
|
||||
</div>
|
||||
<Separator className="my-4" />
|
||||
<p className="text-sm text-destructive">
|
||||
No se pudieron cargar los datos del complejo.
|
||||
</p>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="rounded-xl border bg-card p-5">
|
||||
<div className="flex items-center gap-2">
|
||||
<Building2 className="size-5 text-muted-foreground" />
|
||||
<h3 className="text-lg font-medium">Datos del complejo</h3>
|
||||
</div>
|
||||
<Separator className="my-4" />
|
||||
|
||||
<form className="space-y-4" onSubmit={handleSubmit}>
|
||||
<Field>
|
||||
<FieldLabel htmlFor="complex-name">Nombre del complejo</FieldLabel>
|
||||
<Input
|
||||
id="complex-name"
|
||||
type="text"
|
||||
value={formValues.complexName}
|
||||
onChange={(e) =>
|
||||
setFormValues((prev) => ({ ...prev, complexName: e.target.value }))
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel htmlFor="physical-address">Dirección</FieldLabel>
|
||||
<Input
|
||||
id="physical-address"
|
||||
type="text"
|
||||
placeholder="Ej: Av. San Martín 1234"
|
||||
value={formValues.physicalAddress}
|
||||
onChange={(e) =>
|
||||
setFormValues((prev) => ({ ...prev, physicalAddress: e.target.value }))
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<div className="grid gap-4 sm:grid-cols-3">
|
||||
<Field>
|
||||
<FieldLabel htmlFor="city">Ciudad</FieldLabel>
|
||||
<Input
|
||||
id="city"
|
||||
type="text"
|
||||
placeholder="Ej: Salta"
|
||||
value={formValues.city}
|
||||
onChange={(e) =>
|
||||
setFormValues((prev) => ({ ...prev, city: e.target.value }))
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel htmlFor="state">Provincia / Estado</FieldLabel>
|
||||
<Input
|
||||
id="state"
|
||||
type="text"
|
||||
placeholder="Ej: Salta"
|
||||
value={formValues.state}
|
||||
onChange={(e) =>
|
||||
setFormValues((prev) => ({ ...prev, state: e.target.value }))
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel htmlFor="country">País</FieldLabel>
|
||||
<Input
|
||||
id="country"
|
||||
type="text"
|
||||
placeholder="Ej: Argentina"
|
||||
value={formValues.country}
|
||||
onChange={(e) =>
|
||||
setFormValues((prev) => ({ ...prev, country: e.target.value }))
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
|
||||
{errorMessage && <p className="text-sm text-destructive">{errorMessage}</p>}
|
||||
{successMessage && (
|
||||
<p className="text-sm text-green-600 dark:text-green-400">
|
||||
{successMessage}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={updateMutation.isPending}
|
||||
>
|
||||
{updateMutation.isPending && (
|
||||
<Loader2 className="mr-2 size-4 animate-spin" />
|
||||
)}
|
||||
Guardar cambios
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { ComplexCourtsPage } from '@/features/complex/complex-courts-page'
|
||||
import { ComplexSettingsPage } from '@/features/complex/complex-settings-page'
|
||||
|
||||
export const Route = createFileRoute('/_app/_authenticated/complex/$slug/edit')({
|
||||
component: RouteComponent,
|
||||
@@ -7,5 +7,5 @@ export const Route = createFileRoute('/_app/_authenticated/complex/$slug/edit')(
|
||||
|
||||
function RouteComponent() {
|
||||
const { slug } = Route.useParams()
|
||||
return <ComplexCourtsPage complexSlug={slug} />
|
||||
return <ComplexSettingsPage complexSlug={slug} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user