From 125ad0d1c83108a1f7bcc2fed76a7e3264eedd02 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 21 Oct 2024 11:25:09 +0200 Subject: [PATCH] feat: add tmp_pictures table and make backend create pictures --- db/migrations/908-add_tmp_pictures.sql | 7 + packages/backend/src/routes/uploadRoutes.tsx | 7 +- packages/electric-client/prisma/schema.prisma | 16 +- .../src/generated/client/index.ts | 574 +++++- .../src/generated/client/migrations.ts | 19 + .../src/generated/client/pg-migrations.ts | 25 + .../src/generated/client/prismaClient.d.ts | 1734 +++++++++++++++-- .../src/generated/typebox/index.ts | 2 + .../src/generated/typebox/report.ts | 7 + .../src/generated/typebox/reportInput.ts | 7 + .../src/generated/typebox/tmp_pictures.ts | 36 + .../generated/typebox/tmp_picturesInput.ts | 36 + packages/frontend/src/features/InfoForm.tsx | 82 +- 13 files changed, 2340 insertions(+), 212 deletions(-) create mode 100644 db/migrations/908-add_tmp_pictures.sql create mode 100644 packages/electric-client/src/generated/typebox/tmp_pictures.ts create mode 100644 packages/electric-client/src/generated/typebox/tmp_picturesInput.ts diff --git a/db/migrations/908-add_tmp_pictures.sql b/db/migrations/908-add_tmp_pictures.sql new file mode 100644 index 00000000..05445216 --- /dev/null +++ b/db/migrations/908-add_tmp_pictures.sql @@ -0,0 +1,7 @@ +CREATE TABLE tmp_pictures ( + id TEXT PRIMARY KEY, + "reportId" TEXT REFERENCES report(id) ON DELETE CASCADE, + "createdAt" TIMESTAMP +); + +ALTER TABLE tmp_pictures ENABLE ELECTRIC; \ No newline at end of file diff --git a/packages/backend/src/routes/uploadRoutes.tsx b/packages/backend/src/routes/uploadRoutes.tsx index 0f8bdad1..9696e859 100644 --- a/packages/backend/src/routes/uploadRoutes.tsx +++ b/packages/backend/src/routes/uploadRoutes.tsx @@ -32,8 +32,11 @@ export const uploadPlugin: FastifyPluginAsyncTypebox = async (fastify, _) => { debug("adding url to pic", id, "for report", reportId); - // await db.pictures.create({ data: { id, url, reportId, createdAt: new Date() } }); - await db.pictures.update({ where: { id }, data: { url } }); + await db.pictures.create({ data: { id, url, reportId, createdAt: new Date() } }); + // try { + // await db.tmp_pictures.delete({ where: { id } }); + // } catch (e) {} + // await db.pictures.update({ where: { id }, data: { url } }); reply.send(url); diff --git a/packages/electric-client/prisma/schema.prisma b/packages/electric-client/prisma/schema.prisma index 41f27029..9007e24b 100644 --- a/packages/electric-client/prisma/schema.prisma +++ b/packages/electric-client/prisma/schema.prisma @@ -38,11 +38,11 @@ model clause { } model report { - id String @id + id String @id title String? projectDescription String? redactedBy String? - meetDate DateTime? @db.Timestamp(6) + meetDate DateTime? @db.Timestamp(6) applicantName String? applicantAddress String? projectCadastralRef String? @@ -52,7 +52,7 @@ model report { contacts String? furtherInformation String? createdBy String - createdAt DateTime @db.Timestamp(6) + createdAt DateTime @db.Timestamp(6) serviceInstructeur Int? pdf String? disabled Boolean? @@ -62,7 +62,8 @@ model report { city String? zipCode String? pictures pictures[] - user user @relation(fields: [createdBy], references: [id], onDelete: SetNull, onUpdate: NoAction) + user user @relation(fields: [createdBy], references: [id], onDelete: SetNull, onUpdate: NoAction) + tmp_pictures tmp_pictures[] } model delegation { @@ -150,3 +151,10 @@ model pictures { createdAt DateTime? @db.Timestamp(6) report report? @relation(fields: [reportId], references: [id], onDelete: Cascade, onUpdate: NoAction) } + +model tmp_pictures { + id String @id + reportId String? + createdAt DateTime? @db.Timestamp(6) + report report? @relation(fields: [reportId], references: [id], onDelete: Cascade, onUpdate: NoAction) +} diff --git a/packages/electric-client/src/generated/client/index.ts b/packages/electric-client/src/generated/client/index.ts index 0a5931b4..475f94c0 100644 --- a/packages/electric-client/src/generated/client/index.ts +++ b/packages/electric-client/src/generated/client/index.ts @@ -31,6 +31,8 @@ export const Service_instructeursScalarFieldEnumSchema = z.enum(['id','full_name export const SortOrderSchema = z.enum(['asc','desc']); +export const Tmp_picturesScalarFieldEnumSchema = z.enum(['id','reportId','createdAt']); + export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']); export const UdapScalarFieldEnumSchema = z.enum(['id','department','completeCoords','visible','name','address','zipCode','city','phone','email','marianne_text','drac_text','udap_text']); @@ -154,6 +156,18 @@ export const Service_instructeursSchema = z.object({ export type Service_instructeurs = z.infer +///////////////////////////////////////// +// TMP PICTURES SCHEMA +///////////////////////////////////////// + +export const Tmp_picturesSchema = z.object({ + id: z.string(), + reportId: z.string().nullable(), + createdAt: z.coerce.date().nullable(), +}) + +export type Tmp_pictures = z.infer + ///////////////////////////////////////// // UDAP SCHEMA ///////////////////////////////////////// @@ -272,6 +286,7 @@ export const PicturesSelectSchema: z.ZodType = z.object({ export const ReportIncludeSchema: z.ZodType = z.object({ pictures: z.union([z.boolean(),z.lazy(() => PicturesFindManyArgsSchema)]).optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), + tmp_pictures: z.union([z.boolean(),z.lazy(() => Tmp_picturesFindManyArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => ReportCountOutputTypeArgsSchema)]).optional(), }).strict() @@ -286,6 +301,7 @@ export const ReportCountOutputTypeArgsSchema: z.ZodType = z.object({ pictures: z.boolean().optional(), + tmp_pictures: z.boolean().optional(), }).strict(); export const ReportSelectSchema: z.ZodType = z.object({ @@ -314,6 +330,7 @@ export const ReportSelectSchema: z.ZodType = z.object({ zipCode: z.boolean().optional(), pictures: z.union([z.boolean(),z.lazy(() => PicturesFindManyArgsSchema)]).optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), + tmp_pictures: z.union([z.boolean(),z.lazy(() => Tmp_picturesFindManyArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => ReportCountOutputTypeArgsSchema)]).optional(), }).strict() @@ -329,6 +346,25 @@ export const Service_instructeursSelectSchema: z.ZodType = z.object({ + report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), +}).strict() + +export const Tmp_picturesArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => Tmp_picturesSelectSchema).optional(), + include: z.lazy(() => Tmp_picturesIncludeSchema).optional(), +}).strict(); + +export const Tmp_picturesSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + reportId: z.boolean().optional(), + createdAt: z.boolean().optional(), + report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), +}).strict() + // UDAP //------------------------------------------------------ @@ -660,6 +696,7 @@ export const ReportWhereInputSchema: z.ZodType = z.obje zipCode: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), pictures: z.lazy(() => PicturesListRelationFilterSchema).optional(), user: z.union([ z.lazy(() => UserRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesListRelationFilterSchema).optional() }).strict(); export const ReportOrderByWithRelationInputSchema: z.ZodType = z.object({ @@ -687,7 +724,8 @@ export const ReportOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), zipCode: z.lazy(() => SortOrderSchema).optional(), pictures: z.lazy(() => PicturesOrderByRelationAggregateInputSchema).optional(), - user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() + user: z.lazy(() => UserOrderByWithRelationInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesOrderByRelationAggregateInputSchema).optional() }).strict(); export const ReportWhereUniqueInputSchema: z.ZodType = z.object({ @@ -805,6 +843,45 @@ export const Service_instructeursScalarWhereWithAggregatesInputSchema: z.ZodType udap_id: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), }).strict(); +export const Tmp_picturesWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => Tmp_picturesWhereInputSchema),z.lazy(() => Tmp_picturesWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => Tmp_picturesWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => Tmp_picturesWhereInputSchema),z.lazy(() => Tmp_picturesWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + reportId: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + createdAt: z.union([ z.lazy(() => DateTimeNullableFilterSchema),z.coerce.date() ]).optional().nullable(), + report: z.union([ z.lazy(() => ReportRelationFilterSchema),z.lazy(() => ReportWhereInputSchema) ]).optional().nullable(), +}).strict(); + +export const Tmp_picturesOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + report: z.lazy(() => ReportOrderByWithRelationInputSchema).optional() +}).strict(); + +export const Tmp_picturesWhereUniqueInputSchema: z.ZodType = z.object({ + id: z.string().optional() +}).strict(); + +export const Tmp_picturesOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => Tmp_picturesCountOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => Tmp_picturesMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => Tmp_picturesMinOrderByAggregateInputSchema).optional() +}).strict(); + +export const Tmp_picturesScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => Tmp_picturesScalarWhereWithAggregatesInputSchema),z.lazy(() => Tmp_picturesScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => Tmp_picturesScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => Tmp_picturesScalarWhereWithAggregatesInputSchema),z.lazy(() => Tmp_picturesScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + reportId: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + createdAt: z.union([ z.lazy(() => DateTimeNullableWithAggregatesFilterSchema),z.coerce.date() ]).optional().nullable(), +}).strict(); + export const UdapWhereInputSchema: z.ZodType = z.object({ AND: z.union([ z.lazy(() => UdapWhereInputSchema),z.lazy(() => UdapWhereInputSchema).array() ]).optional(), OR: z.lazy(() => UdapWhereInputSchema).array().optional(), @@ -1209,7 +1286,8 @@ export const ReportCreateInputSchema: z.ZodType = z.ob city: z.string().optional().nullable(), zipCode: z.string().optional().nullable(), pictures: z.lazy(() => PicturesCreateNestedManyWithoutReportInputSchema).optional(), - user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema) + user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema), + tmp_pictures: z.lazy(() => Tmp_picturesCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportUncheckedCreateInputSchema: z.ZodType = z.object({ @@ -1236,7 +1314,8 @@ export const ReportUncheckedCreateInputSchema: z.ZodType PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() + pictures: z.lazy(() => PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportUpdateInputSchema: z.ZodType = z.object({ @@ -1263,7 +1342,8 @@ export const ReportUpdateInputSchema: z.ZodType = z.ob city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), pictures: z.lazy(() => PicturesUpdateManyWithoutReportNestedInputSchema).optional(), - user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional() + user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUpdateManyWithoutReportNestedInputSchema).optional() }).strict(); export const ReportUncheckedUpdateInputSchema: z.ZodType = z.object({ @@ -1290,7 +1370,8 @@ export const ReportUncheckedUpdateInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - pictures: z.lazy(() => PicturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional() + pictures: z.lazy(() => PicturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional() }).strict(); export const ReportCreateManyInputSchema: z.ZodType = z.object({ @@ -1433,6 +1514,47 @@ export const Service_instructeursUncheckedUpdateManyInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); +export const Tmp_picturesCreateInputSchema: z.ZodType = z.object({ + id: z.string(), + createdAt: z.coerce.date().optional().nullable(), + report: z.lazy(() => ReportCreateNestedOneWithoutTmp_picturesInputSchema).optional() +}).strict(); + +export const Tmp_picturesUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string(), + reportId: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const Tmp_picturesUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), + report: z.lazy(() => ReportUpdateOneWithoutTmp_picturesNestedInputSchema).optional() +}).strict(); + +export const Tmp_picturesUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + reportId: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const Tmp_picturesCreateManyInputSchema: z.ZodType = z.object({ + id: z.string(), + reportId: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const Tmp_picturesUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const Tmp_picturesUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + reportId: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + export const UdapCreateInputSchema: z.ZodType = z.object({ id: z.string(), department: z.string(), @@ -1890,10 +2012,20 @@ export const PicturesListRelationFilterSchema: z.ZodType PicturesWhereInputSchema).optional() }).strict(); +export const Tmp_picturesListRelationFilterSchema: z.ZodType = z.object({ + every: z.lazy(() => Tmp_picturesWhereInputSchema).optional(), + some: z.lazy(() => Tmp_picturesWhereInputSchema).optional(), + none: z.lazy(() => Tmp_picturesWhereInputSchema).optional() +}).strict(); + export const PicturesOrderByRelationAggregateInputSchema: z.ZodType = z.object({ _count: z.lazy(() => SortOrderSchema).optional() }).strict(); +export const Tmp_picturesOrderByRelationAggregateInputSchema: z.ZodType = z.object({ + _count: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const ReportCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), title: z.lazy(() => SortOrderSchema).optional(), @@ -2056,6 +2188,24 @@ export const IntWithAggregatesFilterSchema: z.ZodType NestedIntFilterSchema).optional() }).strict(); +export const Tmp_picturesCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const Tmp_picturesMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const Tmp_picturesMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const UserListRelationFilterSchema: z.ZodType = z.object({ every: z.lazy(() => UserWhereInputSchema).optional(), some: z.lazy(() => UserWhereInputSchema).optional(), @@ -2238,6 +2388,13 @@ export const UserCreateNestedOneWithoutReportInputSchema: z.ZodType UserWhereUniqueInputSchema).optional() }).strict(); +export const Tmp_picturesCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema).array(),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema).array() ]).optional(), + createMany: z.lazy(() => Tmp_picturesCreateManyReportInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const PicturesUncheckedCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => PicturesCreateWithoutReportInputSchema),z.lazy(() => PicturesCreateWithoutReportInputSchema).array(),z.lazy(() => PicturesUncheckedCreateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedCreateWithoutReportInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => PicturesCreateOrConnectWithoutReportInputSchema),z.lazy(() => PicturesCreateOrConnectWithoutReportInputSchema).array() ]).optional(), @@ -2245,6 +2402,13 @@ export const PicturesUncheckedCreateNestedManyWithoutReportInputSchema: z.ZodTyp connect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const Tmp_picturesUncheckedCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema).array(),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema).array() ]).optional(), + createMany: z.lazy(() => Tmp_picturesCreateManyReportInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const DateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.coerce.date().optional() }).strict(); @@ -2271,6 +2435,20 @@ export const UserUpdateOneRequiredWithoutReportNestedInputSchema: z.ZodType UserUpdateWithoutReportInputSchema),z.lazy(() => UserUncheckedUpdateWithoutReportInputSchema) ]).optional(), }).strict(); +export const Tmp_picturesUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema).array(),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => Tmp_picturesUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Tmp_picturesUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + createMany: z.lazy(() => Tmp_picturesCreateManyReportInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => Tmp_picturesUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Tmp_picturesUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => Tmp_picturesUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => Tmp_picturesUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => Tmp_picturesScalarWhereInputSchema),z.lazy(() => Tmp_picturesScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const PicturesUncheckedUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => PicturesCreateWithoutReportInputSchema),z.lazy(() => PicturesCreateWithoutReportInputSchema).array(),z.lazy(() => PicturesUncheckedCreateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedCreateWithoutReportInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => PicturesCreateOrConnectWithoutReportInputSchema),z.lazy(() => PicturesCreateOrConnectWithoutReportInputSchema).array() ]).optional(), @@ -2285,6 +2463,20 @@ export const PicturesUncheckedUpdateManyWithoutReportNestedInputSchema: z.ZodTyp deleteMany: z.union([ z.lazy(() => PicturesScalarWhereInputSchema),z.lazy(() => PicturesScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const Tmp_picturesUncheckedUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema).array(),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema),z.lazy(() => Tmp_picturesCreateOrConnectWithoutReportInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => Tmp_picturesUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Tmp_picturesUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + createMany: z.lazy(() => Tmp_picturesCreateManyReportInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => Tmp_picturesWhereUniqueInputSchema),z.lazy(() => Tmp_picturesWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => Tmp_picturesUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Tmp_picturesUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => Tmp_picturesUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => Tmp_picturesUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => Tmp_picturesScalarWhereInputSchema),z.lazy(() => Tmp_picturesScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.number().optional(), increment: z.number().optional(), @@ -2293,6 +2485,22 @@ export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ReportCreateWithoutTmp_picturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutTmp_picturesInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutTmp_picturesInputSchema).optional(), + connect: z.lazy(() => ReportWhereUniqueInputSchema).optional() +}).strict(); + +export const ReportUpdateOneWithoutTmp_picturesNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ReportCreateWithoutTmp_picturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutTmp_picturesInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutTmp_picturesInputSchema).optional(), + upsert: z.lazy(() => ReportUpsertWithoutTmp_picturesInputSchema).optional(), + disconnect: z.boolean().optional(), + delete: z.boolean().optional(), + connect: z.lazy(() => ReportWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => ReportUpdateWithoutTmp_picturesInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutTmp_picturesInputSchema) ]).optional(), +}).strict(); + export const UserCreateNestedManyWithoutUdapInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutUdapInputSchema),z.lazy(() => UserCreateWithoutUdapInputSchema).array(),z.lazy(() => UserUncheckedCreateWithoutUdapInputSchema),z.lazy(() => UserUncheckedCreateWithoutUdapInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => UserCreateOrConnectWithoutUdapInputSchema),z.lazy(() => UserCreateOrConnectWithoutUdapInputSchema).array() ]).optional(), @@ -2783,7 +2991,8 @@ export const ReportCreateWithoutPicturesInputSchema: z.ZodType UserCreateNestedOneWithoutReportInputSchema) + user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema), + tmp_pictures: z.lazy(() => Tmp_picturesCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportUncheckedCreateWithoutPicturesInputSchema: z.ZodType = z.object({ @@ -2809,7 +3018,8 @@ export const ReportUncheckedCreateWithoutPicturesInputSchema: z.ZodType Tmp_picturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportCreateOrConnectWithoutPicturesInputSchema: z.ZodType = z.object({ @@ -2845,7 +3055,8 @@ export const ReportUpdateWithoutPicturesInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional() + user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUpdateManyWithoutReportNestedInputSchema).optional() }).strict(); export const ReportUncheckedUpdateWithoutPicturesInputSchema: z.ZodType = z.object({ @@ -2872,6 +3083,7 @@ export const ReportUncheckedUpdateWithoutPicturesInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + tmp_pictures: z.lazy(() => Tmp_picturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional() }).strict(); export const PicturesCreateWithoutReportInputSchema: z.ZodType = z.object({ @@ -2917,6 +3129,26 @@ export const UserCreateOrConnectWithoutReportInputSchema: z.ZodType UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]), }).strict(); +export const Tmp_picturesCreateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.string(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const Tmp_picturesUncheckedCreateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.string(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const Tmp_picturesCreateOrConnectWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => Tmp_picturesWhereUniqueInputSchema), + create: z.union([ z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema) ]), +}).strict(); + +export const Tmp_picturesCreateManyReportInputEnvelopeSchema: z.ZodType = z.object({ + data: z.lazy(() => Tmp_picturesCreateManyReportInputSchema).array(), + skipDuplicates: z.boolean().optional() +}).strict(); + export const PicturesUpsertWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ where: z.lazy(() => PicturesWhereUniqueInputSchema), update: z.union([ z.lazy(() => PicturesUpdateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedUpdateWithoutReportInputSchema) ]), @@ -2964,6 +3196,149 @@ export const UserUncheckedUpdateWithoutReportInputSchema: z.ZodType DelegationUncheckedUpdateManyWithoutUser_delegation_delegatedToTouserNestedInputSchema).optional() }).strict(); +export const Tmp_picturesUpsertWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => Tmp_picturesWhereUniqueInputSchema), + update: z.union([ z.lazy(() => Tmp_picturesUpdateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedUpdateWithoutReportInputSchema) ]), + create: z.union([ z.lazy(() => Tmp_picturesCreateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedCreateWithoutReportInputSchema) ]), +}).strict(); + +export const Tmp_picturesUpdateWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => Tmp_picturesWhereUniqueInputSchema), + data: z.union([ z.lazy(() => Tmp_picturesUpdateWithoutReportInputSchema),z.lazy(() => Tmp_picturesUncheckedUpdateWithoutReportInputSchema) ]), +}).strict(); + +export const Tmp_picturesUpdateManyWithWhereWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => Tmp_picturesScalarWhereInputSchema), + data: z.union([ z.lazy(() => Tmp_picturesUpdateManyMutationInputSchema),z.lazy(() => Tmp_picturesUncheckedUpdateManyWithoutTmp_picturesInputSchema) ]), +}).strict(); + +export const Tmp_picturesScalarWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => Tmp_picturesScalarWhereInputSchema),z.lazy(() => Tmp_picturesScalarWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => Tmp_picturesScalarWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => Tmp_picturesScalarWhereInputSchema),z.lazy(() => Tmp_picturesScalarWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + reportId: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + createdAt: z.union([ z.lazy(() => DateTimeNullableFilterSchema),z.coerce.date() ]).optional().nullable(), +}).strict(); + +export const ReportCreateWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + id: z.string(), + title: z.string().optional().nullable(), + projectDescription: z.string().optional().nullable(), + redactedBy: z.string().optional().nullable(), + meetDate: z.coerce.date().optional().nullable(), + applicantName: z.string().optional().nullable(), + applicantAddress: z.string().optional().nullable(), + projectCadastralRef: z.string().optional().nullable(), + projectSpaceType: z.string().optional().nullable(), + decision: z.string().optional().nullable(), + precisions: z.string().optional().nullable(), + contacts: z.string().optional().nullable(), + furtherInformation: z.string().optional().nullable(), + createdAt: z.coerce.date(), + serviceInstructeur: z.number().optional().nullable(), + pdf: z.string().optional().nullable(), + disabled: z.boolean().optional().nullable(), + udap_id: z.string().optional().nullable(), + redactedById: z.string().optional().nullable(), + applicantEmail: z.string().optional().nullable(), + city: z.string().optional().nullable(), + zipCode: z.string().optional().nullable(), + pictures: z.lazy(() => PicturesCreateNestedManyWithoutReportInputSchema).optional(), + user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema) +}).strict(); + +export const ReportUncheckedCreateWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + id: z.string(), + title: z.string().optional().nullable(), + projectDescription: z.string().optional().nullable(), + redactedBy: z.string().optional().nullable(), + meetDate: z.coerce.date().optional().nullable(), + applicantName: z.string().optional().nullable(), + applicantAddress: z.string().optional().nullable(), + projectCadastralRef: z.string().optional().nullable(), + projectSpaceType: z.string().optional().nullable(), + decision: z.string().optional().nullable(), + precisions: z.string().optional().nullable(), + contacts: z.string().optional().nullable(), + furtherInformation: z.string().optional().nullable(), + createdBy: z.string(), + createdAt: z.coerce.date(), + serviceInstructeur: z.number().optional().nullable(), + pdf: z.string().optional().nullable(), + disabled: z.boolean().optional().nullable(), + udap_id: z.string().optional().nullable(), + redactedById: z.string().optional().nullable(), + applicantEmail: z.string().optional().nullable(), + city: z.string().optional().nullable(), + zipCode: z.string().optional().nullable(), + pictures: z.lazy(() => PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() +}).strict(); + +export const ReportCreateOrConnectWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ReportWhereUniqueInputSchema), + create: z.union([ z.lazy(() => ReportCreateWithoutTmp_picturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutTmp_picturesInputSchema) ]), +}).strict(); + +export const ReportUpsertWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => ReportUpdateWithoutTmp_picturesInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutTmp_picturesInputSchema) ]), + create: z.union([ z.lazy(() => ReportCreateWithoutTmp_picturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutTmp_picturesInputSchema) ]), +}).strict(); + +export const ReportUpdateWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + projectDescription: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + redactedBy: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + meetDate: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), + applicantName: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + applicantAddress: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + projectCadastralRef: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + projectSpaceType: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + decision: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + precisions: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + contacts: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + furtherInformation: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + serviceInstructeur: z.union([ z.number(),z.lazy(() => NullableIntFieldUpdateOperationsInputSchema) ]).optional().nullable(), + pdf: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + disabled: z.union([ z.boolean(),z.lazy(() => NullableBoolFieldUpdateOperationsInputSchema) ]).optional().nullable(), + udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + redactedById: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + pictures: z.lazy(() => PicturesUpdateManyWithoutReportNestedInputSchema).optional(), + user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional() +}).strict(); + +export const ReportUncheckedUpdateWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + projectDescription: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + redactedBy: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + meetDate: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), + applicantName: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + applicantAddress: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + projectCadastralRef: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + projectSpaceType: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + decision: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + precisions: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + contacts: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + furtherInformation: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdBy: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + serviceInstructeur: z.union([ z.number(),z.lazy(() => NullableIntFieldUpdateOperationsInputSchema) ]).optional().nullable(), + pdf: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + disabled: z.union([ z.boolean(),z.lazy(() => NullableBoolFieldUpdateOperationsInputSchema) ]).optional().nullable(), + udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + redactedById: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + pictures: z.lazy(() => PicturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional() +}).strict(); + export const UserCreateWithoutUdapInputSchema: z.ZodType = z.object({ id: z.string(), name: z.string(), @@ -3074,7 +3449,8 @@ export const ReportCreateWithoutUserInputSchema: z.ZodType PicturesCreateNestedManyWithoutReportInputSchema).optional() + pictures: z.lazy(() => PicturesCreateNestedManyWithoutReportInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportUncheckedCreateWithoutUserInputSchema: z.ZodType = z.object({ @@ -3100,7 +3476,8 @@ export const ReportUncheckedCreateWithoutUserInputSchema: z.ZodType PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() + pictures: z.lazy(() => PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportCreateOrConnectWithoutUserInputSchema: z.ZodType = z.object({ @@ -3278,6 +3655,11 @@ export const PicturesCreateManyReportInputSchema: z.ZodType = z.object({ + id: z.string(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + export const PicturesUpdateWithoutReportInputSchema: z.ZodType = z.object({ id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), @@ -3296,6 +3678,21 @@ export const PicturesUncheckedUpdateManyWithoutPicturesInputSchema: z.ZodType NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); +export const Tmp_picturesUpdateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const Tmp_picturesUncheckedUpdateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const Tmp_picturesUncheckedUpdateManyWithoutTmp_picturesInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + export const UserCreateManyUdapInputSchema: z.ZodType = z.object({ id: z.string(), name: z.string() @@ -3402,7 +3799,8 @@ export const ReportUpdateWithoutUserInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - pictures: z.lazy(() => PicturesUpdateManyWithoutReportNestedInputSchema).optional() + pictures: z.lazy(() => PicturesUpdateManyWithoutReportNestedInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUpdateManyWithoutReportNestedInputSchema).optional() }).strict(); export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType = z.object({ @@ -3428,7 +3826,8 @@ export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - pictures: z.lazy(() => PicturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional() + pictures: z.lazy(() => PicturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional(), + tmp_pictures: z.lazy(() => Tmp_picturesUncheckedUpdateManyWithoutReportNestedInputSchema).optional() }).strict(); export const ReportUncheckedUpdateManyWithoutReportInputSchema: z.ZodType = z.object({ @@ -3874,6 +4273,68 @@ export const Service_instructeursFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereInputSchema.optional(), + orderBy: z.union([ Tmp_picturesOrderByWithRelationInputSchema.array(),Tmp_picturesOrderByWithRelationInputSchema ]).optional(), + cursor: Tmp_picturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: Tmp_picturesScalarFieldEnumSchema.array().optional(), +}).strict() as z.ZodType + +export const Tmp_picturesFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereInputSchema.optional(), + orderBy: z.union([ Tmp_picturesOrderByWithRelationInputSchema.array(),Tmp_picturesOrderByWithRelationInputSchema ]).optional(), + cursor: Tmp_picturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: Tmp_picturesScalarFieldEnumSchema.array().optional(), +}).strict() as z.ZodType + +export const Tmp_picturesFindManyArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereInputSchema.optional(), + orderBy: z.union([ Tmp_picturesOrderByWithRelationInputSchema.array(),Tmp_picturesOrderByWithRelationInputSchema ]).optional(), + cursor: Tmp_picturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: Tmp_picturesScalarFieldEnumSchema.array().optional(), +}).strict() as z.ZodType + +export const Tmp_picturesAggregateArgsSchema: z.ZodType = z.object({ + where: Tmp_picturesWhereInputSchema.optional(), + orderBy: z.union([ Tmp_picturesOrderByWithRelationInputSchema.array(),Tmp_picturesOrderByWithRelationInputSchema ]).optional(), + cursor: Tmp_picturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() as z.ZodType + +export const Tmp_picturesGroupByArgsSchema: z.ZodType = z.object({ + where: Tmp_picturesWhereInputSchema.optional(), + orderBy: z.union([ Tmp_picturesOrderByWithAggregationInputSchema.array(),Tmp_picturesOrderByWithAggregationInputSchema ]).optional(), + by: Tmp_picturesScalarFieldEnumSchema.array(), + having: Tmp_picturesScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() as z.ZodType + +export const Tmp_picturesFindUniqueArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereUniqueInputSchema, +}).strict() as z.ZodType + +export const Tmp_picturesFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereUniqueInputSchema, +}).strict() as z.ZodType + export const UdapFindFirstArgsSchema: z.ZodType = z.object({ select: UdapSelectSchema.optional(), include: UdapIncludeSchema.optional(), @@ -4269,6 +4730,47 @@ export const Service_instructeursDeleteManyArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + data: z.union([ Tmp_picturesCreateInputSchema,Tmp_picturesUncheckedCreateInputSchema ]), +}).strict() as z.ZodType + +export const Tmp_picturesUpsertArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereUniqueInputSchema, + create: z.union([ Tmp_picturesCreateInputSchema,Tmp_picturesUncheckedCreateInputSchema ]), + update: z.union([ Tmp_picturesUpdateInputSchema,Tmp_picturesUncheckedUpdateInputSchema ]), +}).strict() as z.ZodType + +export const Tmp_picturesCreateManyArgsSchema: z.ZodType = z.object({ + data: Tmp_picturesCreateManyInputSchema.array(), + skipDuplicates: z.boolean().optional(), +}).strict() as z.ZodType + +export const Tmp_picturesDeleteArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + where: Tmp_picturesWhereUniqueInputSchema, +}).strict() as z.ZodType + +export const Tmp_picturesUpdateArgsSchema: z.ZodType = z.object({ + select: Tmp_picturesSelectSchema.optional(), + include: Tmp_picturesIncludeSchema.optional(), + data: z.union([ Tmp_picturesUpdateInputSchema,Tmp_picturesUncheckedUpdateInputSchema ]), + where: Tmp_picturesWhereUniqueInputSchema, +}).strict() as z.ZodType + +export const Tmp_picturesUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ Tmp_picturesUpdateManyMutationInputSchema,Tmp_picturesUncheckedUpdateManyInputSchema ]), + where: Tmp_picturesWhereInputSchema.optional(), +}).strict() as z.ZodType + +export const Tmp_picturesDeleteManyArgsSchema: z.ZodType = z.object({ + where: Tmp_picturesWhereInputSchema.optional(), +}).strict() as z.ZodType + export const UdapCreateArgsSchema: z.ZodType = z.object({ select: UdapSelectSchema.optional(), include: UdapIncludeSchema.optional(), @@ -4386,6 +4888,11 @@ interface Service_instructeursGetPayload extends HKT { readonly type: Omit, "Please either choose `select` or `include`"> } +interface Tmp_picturesGetPayload extends HKT { + readonly _A?: boolean | null | undefined | Prisma.Tmp_picturesArgs + readonly type: Omit, "Please either choose `select` or `include`"> +} + interface UdapGetPayload extends HKT { readonly _A?: boolean | null | undefined | Prisma.UdapArgs readonly type: Omit, "Please either choose `select` or `include`"> @@ -4731,6 +5238,7 @@ export const tableSchemas = { relations: [ new Relation("pictures", "", "", "pictures", "PicturesToReport", "many"), new Relation("user", "createdBy", "id", "user", "ReportToUser", "one"), + new Relation("tmp_pictures", "", "", "tmp_pictures", "ReportToTmp_pictures", "many"), ], modelSchema: (ReportCreateInputSchema as any) .partial() @@ -4809,6 +5317,48 @@ export const tableSchemas = { Prisma.Service_instructeursScalarFieldEnum, Service_instructeursGetPayload >, + tmp_pictures: { + fields: new Map([ + [ + "id", + "TEXT" + ], + [ + "reportId", + "TEXT" + ], + [ + "createdAt", + "TIMESTAMP" + ] + ]), + relations: [ + new Relation("report", "reportId", "id", "report", "ReportToTmp_pictures", "one"), + ], + modelSchema: (Tmp_picturesCreateInputSchema as any) + .partial() + .or((Tmp_picturesUncheckedCreateInputSchema as any).partial()), + createSchema: Tmp_picturesCreateArgsSchema, + createManySchema: Tmp_picturesCreateManyArgsSchema, + findUniqueSchema: Tmp_picturesFindUniqueArgsSchema, + findSchema: Tmp_picturesFindFirstArgsSchema, + updateSchema: Tmp_picturesUpdateArgsSchema, + updateManySchema: Tmp_picturesUpdateManyArgsSchema, + upsertSchema: Tmp_picturesUpsertArgsSchema, + deleteSchema: Tmp_picturesDeleteArgsSchema, + deleteManySchema: Tmp_picturesDeleteManyArgsSchema + } as TableSchema< + z.infer, + Prisma.Tmp_picturesCreateArgs['data'], + Prisma.Tmp_picturesUpdateArgs['data'], + Prisma.Tmp_picturesFindFirstArgs['select'], + Prisma.Tmp_picturesFindFirstArgs['where'], + Prisma.Tmp_picturesFindUniqueArgs['where'], + Omit, + Prisma.Tmp_picturesFindFirstArgs['orderBy'], + Prisma.Tmp_picturesScalarFieldEnum, + Tmp_picturesGetPayload + >, udap: { fields: new Map([ [ diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index 6b2e2cf9..045b2dd1 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -234,5 +234,24 @@ export default [ "CREATE TRIGGER compensation_update_main_pictures_reportId_into_oplog\n AFTER UPDATE ON \"main\".\"pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'pictures') AND\n 1 = (SELECT value from _electric_meta WHERE key = 'compensations')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n SELECT 'main', 'report', 'COMPENSATION', json_patch('{}', json_object('id', \"id\")), json_object('id', \"id\"), NULL, NULL\n FROM \"main\".\"report\" WHERE \"id\" = new.\"reportId\";\nEND;" ], "version": "907" + }, + { + "statements": [ + "CREATE TABLE \"tmp_pictures\" (\n \"id\" TEXT NOT NULL,\n \"reportId\" TEXT,\n \"createdAt\" TEXT,\n CONSTRAINT \"tmp_pictures_reportId_fkey\" FOREIGN KEY (\"reportId\") REFERENCES \"report\" (\"id\") ON DELETE CASCADE,\n CONSTRAINT \"tmp_pictures_pkey\" PRIMARY KEY (\"id\")\n) WITHOUT ROWID;\n", + "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'tmp_pictures', 1);", + "DROP TRIGGER IF EXISTS update_ensure_main_tmp_pictures_primarykey;", + "CREATE TRIGGER update_ensure_main_tmp_pictures_primarykey\n BEFORE UPDATE ON \"main\".\"tmp_pictures\"\nBEGIN\n SELECT\n CASE\n WHEN old.\"id\" != new.\"id\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column id as it belongs to the primary key')\n END;\nEND;", + "DROP TRIGGER IF EXISTS insert_main_tmp_pictures_into_oplog;", + "CREATE TRIGGER insert_main_tmp_pictures_into_oplog\n AFTER INSERT ON \"main\".\"tmp_pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'tmp_pictures')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'tmp_pictures', 'INSERT', json_patch('{}', json_object('id', new.\"id\")), json_object('createdAt', new.\"createdAt\", 'id', new.\"id\", 'reportId', new.\"reportId\"), NULL, NULL);\nEND;", + "DROP TRIGGER IF EXISTS update_main_tmp_pictures_into_oplog;", + "CREATE TRIGGER update_main_tmp_pictures_into_oplog\n AFTER UPDATE ON \"main\".\"tmp_pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'tmp_pictures')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'tmp_pictures', 'UPDATE', json_patch('{}', json_object('id', new.\"id\")), json_object('createdAt', new.\"createdAt\", 'id', new.\"id\", 'reportId', new.\"reportId\"), json_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS delete_main_tmp_pictures_into_oplog;", + "CREATE TRIGGER delete_main_tmp_pictures_into_oplog\n AFTER DELETE ON \"main\".\"tmp_pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'tmp_pictures')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'tmp_pictures', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS compensation_insert_main_tmp_pictures_reportId_into_oplog;", + "CREATE TRIGGER compensation_insert_main_tmp_pictures_reportId_into_oplog\n AFTER INSERT ON \"main\".\"tmp_pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'tmp_pictures') AND\n 1 = (SELECT value from _electric_meta WHERE key = 'compensations')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n SELECT 'main', 'report', 'COMPENSATION', json_patch('{}', json_object('id', \"id\")), json_object('id', \"id\"), NULL, NULL\n FROM \"main\".\"report\" WHERE \"id\" = new.\"reportId\";\nEND;", + "DROP TRIGGER IF EXISTS compensation_update_main_tmp_pictures_reportId_into_oplog;", + "CREATE TRIGGER compensation_update_main_tmp_pictures_reportId_into_oplog\n AFTER UPDATE ON \"main\".\"tmp_pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'tmp_pictures') AND\n 1 = (SELECT value from _electric_meta WHERE key = 'compensations')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n SELECT 'main', 'report', 'COMPENSATION', json_patch('{}', json_object('id', \"id\")), json_object('id', \"id\"), NULL, NULL\n FROM \"main\".\"report\" WHERE \"id\" = new.\"reportId\";\nEND;" + ], + "version": "908" } ] \ No newline at end of file diff --git a/packages/electric-client/src/generated/client/pg-migrations.ts b/packages/electric-client/src/generated/client/pg-migrations.ts index 4fff7d48..e1f5c861 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -308,5 +308,30 @@ export default [ "CREATE TRIGGER compensation_update_public_pictures_reportId_into_oplog\n AFTER UPDATE ON \"public\".\"pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION compensation_update_public_pictures_reportId_into_oplog_function();" ], "version": "907" + }, + { + "statements": [ + "CREATE TABLE tmp_pictures (\n id text NOT NULL,\n \"reportId\" text,\n \"createdAt\" timestamp without time zone,\n CONSTRAINT tmp_pictures_pkey PRIMARY KEY (id),\n CONSTRAINT \"tmp_pictures_reportId_fkey\" FOREIGN KEY (\"reportId\") REFERENCES report(id) ON DELETE CASCADE\n)", + "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'tmp_pictures', 1)\n ON CONFLICT DO NOTHING;", + "DROP TRIGGER IF EXISTS update_ensure_public_tmp_pictures_primarykey ON \"public\".\"tmp_pictures\";", + "CREATE OR REPLACE FUNCTION update_ensure_public_tmp_pictures_primarykey_function()\nRETURNS TRIGGER AS $$\nBEGIN\n IF OLD.\"id\" IS DISTINCT FROM NEW.\"id\" THEN\n RAISE EXCEPTION 'Cannot change the value of column id as it belongs to the primary key';\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_ensure_public_tmp_pictures_primarykey\n BEFORE UPDATE ON \"public\".\"tmp_pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_tmp_pictures_primarykey_function();", + "DROP TRIGGER IF EXISTS insert_public_tmp_pictures_into_oplog ON \"public\".\"tmp_pictures\";", + " CREATE OR REPLACE FUNCTION insert_public_tmp_pictures_into_oplog_function()\n RETURNS TRIGGER AS $$\n BEGIN\n DECLARE\n flag_value INTEGER;\n BEGIN\n -- Get the flag value from _electric_trigger_settings\n SELECT flag INTO flag_value FROM \"public\"._electric_trigger_settings WHERE namespace = 'public' AND tablename = 'tmp_pictures';\n\n IF flag_value = 1 THEN\n -- Insert into _electric_oplog\n INSERT INTO \"public\"._electric_oplog (namespace, tablename, optype, \"primaryKey\", \"newRow\", \"oldRow\", timestamp)\n VALUES (\n 'public',\n 'tmp_pictures',\n 'INSERT',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('createdAt', new.\"createdAt\", 'id', new.\"id\", 'reportId', new.\"reportId\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER insert_public_tmp_pictures_into_oplog\n AFTER INSERT ON \"public\".\"tmp_pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_tmp_pictures_into_oplog_function();", + "DROP TRIGGER IF EXISTS update_public_tmp_pictures_into_oplog ON \"public\".\"tmp_pictures\";", + " CREATE OR REPLACE FUNCTION update_public_tmp_pictures_into_oplog_function()\n RETURNS TRIGGER AS $$\n BEGIN\n DECLARE\n flag_value INTEGER;\n BEGIN\n -- Get the flag value from _electric_trigger_settings\n SELECT flag INTO flag_value FROM \"public\"._electric_trigger_settings WHERE namespace = 'public' AND tablename = 'tmp_pictures';\n\n IF flag_value = 1 THEN\n -- Insert into _electric_oplog\n INSERT INTO \"public\"._electric_oplog (namespace, tablename, optype, \"primaryKey\", \"newRow\", \"oldRow\", timestamp)\n VALUES (\n 'public',\n 'tmp_pictures',\n 'UPDATE',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('createdAt', new.\"createdAt\", 'id', new.\"id\", 'reportId', new.\"reportId\"),\n jsonb_build_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_public_tmp_pictures_into_oplog\n AFTER UPDATE ON \"public\".\"tmp_pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_tmp_pictures_into_oplog_function();", + "DROP TRIGGER IF EXISTS delete_public_tmp_pictures_into_oplog ON \"public\".\"tmp_pictures\";", + " CREATE OR REPLACE FUNCTION delete_public_tmp_pictures_into_oplog_function()\n RETURNS TRIGGER AS $$\n BEGIN\n DECLARE\n flag_value INTEGER;\n BEGIN\n -- Get the flag value from _electric_trigger_settings\n SELECT flag INTO flag_value FROM \"public\"._electric_trigger_settings WHERE namespace = 'public' AND tablename = 'tmp_pictures';\n\n IF flag_value = 1 THEN\n -- Insert into _electric_oplog\n INSERT INTO \"public\"._electric_oplog (namespace, tablename, optype, \"primaryKey\", \"newRow\", \"oldRow\", timestamp)\n VALUES (\n 'public',\n 'tmp_pictures',\n 'DELETE',\n json_strip_nulls(json_build_object('id', old.\"id\")),\n NULL,\n jsonb_build_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER delete_public_tmp_pictures_into_oplog\n AFTER DELETE ON \"public\".\"tmp_pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_tmp_pictures_into_oplog_function();", + "DROP TRIGGER IF EXISTS compensation_insert_public_tmp_pictures_reportId_into_oplog ON \"public\".\"tmp_pictures\";", + " CREATE OR REPLACE FUNCTION compensation_insert_public_tmp_pictures_reportId_into_oplog_function()\n RETURNS TRIGGER AS $$\n BEGIN\n DECLARE\n flag_value INTEGER;\n meta_value INTEGER;\n BEGIN\n SELECT flag INTO flag_value FROM \"public\"._electric_trigger_settings WHERE namespace = 'public' AND tablename = 'tmp_pictures';\n\n SELECT value INTO meta_value FROM \"public\"._electric_meta WHERE key = 'compensations';\n\n IF flag_value = 1 AND meta_value = 1 THEN\n INSERT INTO \"public\"._electric_oplog (namespace, tablename, optype, \"primaryKey\", \"newRow\", \"oldRow\", timestamp)\n SELECT\n 'public',\n 'report',\n 'COMPENSATION',\n json_strip_nulls(json_strip_nulls(json_build_object('id', \"id\"))),\n jsonb_build_object('id', \"id\"),\n NULL,\n NULL\n FROM \"public\".\"report\"\n WHERE \"id\" = NEW.\"reportId\";\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER compensation_insert_public_tmp_pictures_reportId_into_oplog\n AFTER INSERT ON \"public\".\"tmp_pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION compensation_insert_public_tmp_pictures_reportId_into_oplog_function();", + "DROP TRIGGER IF EXISTS compensation_update_public_tmp_pictures_reportId_into_oplog ON \"public\".\"tmp_pictures\";", + " CREATE OR REPLACE FUNCTION compensation_update_public_tmp_pictures_reportId_into_oplog_function()\n RETURNS TRIGGER AS $$\n BEGIN\n DECLARE\n flag_value INTEGER;\n meta_value INTEGER;\n BEGIN\n SELECT flag INTO flag_value FROM \"public\"._electric_trigger_settings WHERE namespace = 'public' AND tablename = 'tmp_pictures';\n\n SELECT value INTO meta_value FROM \"public\"._electric_meta WHERE key = 'compensations';\n\n IF flag_value = 1 AND meta_value = 1 THEN\n INSERT INTO \"public\"._electric_oplog (namespace, tablename, optype, \"primaryKey\", \"newRow\", \"oldRow\", timestamp)\n SELECT\n 'public',\n 'report',\n 'COMPENSATION',\n json_strip_nulls(json_strip_nulls(json_build_object('id', \"id\"))),\n jsonb_build_object('id', \"id\"),\n NULL,\n NULL\n FROM \"public\".\"report\"\n WHERE \"id\" = NEW.\"reportId\";\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER compensation_update_public_tmp_pictures_reportId_into_oplog\n AFTER UPDATE ON \"public\".\"tmp_pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION compensation_update_public_tmp_pictures_reportId_into_oplog_function();" + ], + "version": "908" } ] \ No newline at end of file diff --git a/packages/electric-client/src/generated/client/prismaClient.d.ts b/packages/electric-client/src/generated/client/prismaClient.d.ts index 133f5f79..3de8f636 100644 --- a/packages/electric-client/src/generated/client/prismaClient.d.ts +++ b/packages/electric-client/src/generated/client/prismaClient.d.ts @@ -112,6 +112,7 @@ export type ReportPayload[] user: UserPayload + tmp_pictures: Tmp_picturesPayload[] } scalars: $Extensions.GetResult<{ id: string @@ -171,6 +172,24 @@ export type Service_instructeursPayload +export type Tmp_picturesPayload = { + name: "Tmp_pictures" + objects: { + report: ReportPayload | null + } + scalars: $Extensions.GetResult<{ + id: string + reportId: string | null + createdAt: Date | null + }, ExtArgs["result"]["tmp_pictures"]> + composites: {} +} + +/** + * Model Tmp_pictures + * + */ +export type Tmp_pictures = runtime.Types.DefaultSelection export type UdapPayload = { name: "Udap" objects: { @@ -416,6 +435,16 @@ export class PrismaClient< */ get service_instructeurs(): Prisma.Service_instructeursDelegate; + /** + * `prisma.tmp_pictures`: Exposes CRUD operations for the **Tmp_pictures** model. + * Example usage: + * ```ts + * // Fetch zero or more Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findMany() + * ``` + */ + get tmp_pictures(): Prisma.Tmp_picturesDelegate; + /** * `prisma.udap`: Exposes CRUD operations for the **Udap** model. * Example usage: @@ -925,6 +954,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject Pictures: 'Pictures', Report: 'Report', Service_instructeurs: 'Service_instructeurs', + Tmp_pictures: 'Tmp_pictures', Udap: 'Udap', User: 'User' }; @@ -943,7 +973,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type TypeMap = { meta: { - modelProps: 'clause' | 'clause_v2' | 'delegation' | 'pdf_snapshot' | 'pictures' | 'report' | 'service_instructeurs' | 'udap' | 'user' + modelProps: 'clause' | 'clause_v2' | 'delegation' | 'pdf_snapshot' | 'pictures' | 'report' | 'service_instructeurs' | 'tmp_pictures' | 'udap' | 'user' txIsolationLevel: Prisma.TransactionIsolationLevel }, model: { @@ -1402,6 +1432,71 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } } } + Tmp_pictures: { + payload: Tmp_picturesPayload + operations: { + findUnique: { + args: Prisma.Tmp_picturesFindUniqueArgs, + result: $Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.Tmp_picturesFindUniqueOrThrowArgs, + result: $Utils.PayloadToResult + } + findFirst: { + args: Prisma.Tmp_picturesFindFirstArgs, + result: $Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.Tmp_picturesFindFirstOrThrowArgs, + result: $Utils.PayloadToResult + } + findMany: { + args: Prisma.Tmp_picturesFindManyArgs, + result: $Utils.PayloadToResult[] + } + create: { + args: Prisma.Tmp_picturesCreateArgs, + result: $Utils.PayloadToResult + } + createMany: { + args: Prisma.Tmp_picturesCreateManyArgs, + result: Prisma.BatchPayload + } + delete: { + args: Prisma.Tmp_picturesDeleteArgs, + result: $Utils.PayloadToResult + } + update: { + args: Prisma.Tmp_picturesUpdateArgs, + result: $Utils.PayloadToResult + } + deleteMany: { + args: Prisma.Tmp_picturesDeleteManyArgs, + result: Prisma.BatchPayload + } + updateMany: { + args: Prisma.Tmp_picturesUpdateManyArgs, + result: Prisma.BatchPayload + } + upsert: { + args: Prisma.Tmp_picturesUpsertArgs, + result: $Utils.PayloadToResult + } + aggregate: { + args: Prisma.Tmp_picturesAggregateArgs, + result: $Utils.Optional + } + groupBy: { + args: Prisma.Tmp_picturesGroupByArgs, + result: $Utils.Optional[] + } + count: { + args: Prisma.Tmp_picturesCountArgs, + result: $Utils.Optional | number + } + } + } Udap: { payload: UdapPayload operations: { @@ -1715,10 +1810,12 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type ReportCountOutputType = { pictures: number + tmp_pictures: number } export type ReportCountOutputTypeSelect = { pictures?: boolean | ReportCountOutputTypeCountPicturesArgs + tmp_pictures?: boolean | ReportCountOutputTypeCountTmp_picturesArgs } // Custom InputTypes @@ -1742,6 +1839,14 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } + /** + * ReportCountOutputType without action + */ + export type ReportCountOutputTypeCountTmp_picturesArgs = { + where?: Tmp_picturesWhereInput + } + + /** * Count Type UdapCountOutputType @@ -6676,6 +6781,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject zipCode?: boolean pictures?: boolean | Report$picturesArgs user?: boolean | UserArgs + tmp_pictures?: boolean | Report$tmp_picturesArgs _count?: boolean | ReportCountOutputTypeArgs }, ExtArgs["result"]["report"]> @@ -6708,6 +6814,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type ReportInclude = { pictures?: boolean | Report$picturesArgs user?: boolean | UserArgs + tmp_pictures?: boolean | Report$tmp_picturesArgs _count?: boolean | ReportCountOutputTypeArgs } @@ -7085,6 +7192,8 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject user = {}>(args?: Subset>): Prisma__UserClient<$Types.GetResult, T, 'findUnique', never> | Null, never, ExtArgs>; + tmp_pictures = {}>(args?: Subset>): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>| Null>; + private get _document(); /** * Attaches callbacks for the resolution and/or rejection of the Promise. @@ -7461,6 +7570,27 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } + /** + * Report.tmp_pictures + */ + export type Report$tmp_picturesArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + where?: Tmp_picturesWhereInput + orderBy?: Enumerable + cursor?: Tmp_picturesWhereUniqueInput + take?: number + skip?: number + distinct?: Enumerable + } + + /** * Report without action */ @@ -8399,264 +8529,1170 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject /** - * Model Udap + * Model Tmp_pictures */ - export type AggregateUdap = { - _count: UdapCountAggregateOutputType | null - _min: UdapMinAggregateOutputType | null - _max: UdapMaxAggregateOutputType | null + export type AggregateTmp_pictures = { + _count: Tmp_picturesCountAggregateOutputType | null + _min: Tmp_picturesMinAggregateOutputType | null + _max: Tmp_picturesMaxAggregateOutputType | null } - export type UdapMinAggregateOutputType = { + export type Tmp_picturesMinAggregateOutputType = { id: string | null - department: string | null - completeCoords: string | null - visible: boolean | null - name: string | null - address: string | null - zipCode: string | null - city: string | null - phone: string | null - email: string | null - marianne_text: string | null - drac_text: string | null - udap_text: string | null + reportId: string | null + createdAt: Date | null } - export type UdapMaxAggregateOutputType = { + export type Tmp_picturesMaxAggregateOutputType = { id: string | null - department: string | null - completeCoords: string | null - visible: boolean | null - name: string | null - address: string | null - zipCode: string | null - city: string | null - phone: string | null - email: string | null - marianne_text: string | null - drac_text: string | null - udap_text: string | null + reportId: string | null + createdAt: Date | null } - export type UdapCountAggregateOutputType = { + export type Tmp_picturesCountAggregateOutputType = { id: number - department: number - completeCoords: number - visible: number - name: number - address: number - zipCode: number - city: number - phone: number - email: number - marianne_text: number - drac_text: number - udap_text: number + reportId: number + createdAt: number _all: number } - export type UdapMinAggregateInputType = { + export type Tmp_picturesMinAggregateInputType = { id?: true - department?: true - completeCoords?: true - visible?: true - name?: true - address?: true - zipCode?: true - city?: true - phone?: true - email?: true - marianne_text?: true - drac_text?: true - udap_text?: true + reportId?: true + createdAt?: true } - export type UdapMaxAggregateInputType = { + export type Tmp_picturesMaxAggregateInputType = { id?: true - department?: true - completeCoords?: true - visible?: true - name?: true - address?: true - zipCode?: true - city?: true - phone?: true - email?: true - marianne_text?: true - drac_text?: true - udap_text?: true + reportId?: true + createdAt?: true } - export type UdapCountAggregateInputType = { + export type Tmp_picturesCountAggregateInputType = { id?: true - department?: true - completeCoords?: true - visible?: true - name?: true - address?: true - zipCode?: true - city?: true - phone?: true - email?: true - marianne_text?: true - drac_text?: true - udap_text?: true + reportId?: true + createdAt?: true _all?: true } - export type UdapAggregateArgs = { + export type Tmp_picturesAggregateArgs = { /** - * Filter which Udap to aggregate. + * Filter which Tmp_pictures to aggregate. */ - where?: UdapWhereInput + where?: Tmp_picturesWhereInput /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} * - * Determine the order of Udaps to fetch. + * Determine the order of Tmp_pictures to fetch. */ - orderBy?: Enumerable + orderBy?: Enumerable /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} * * Sets the start position */ - cursor?: UdapWhereUniqueInput + cursor?: Tmp_picturesWhereUniqueInput /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} * - * Take `±n` Udaps from the position of the cursor. + * Take `±n` Tmp_pictures from the position of the cursor. */ take?: number /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} * - * Skip the first `n` Udaps. + * Skip the first `n` Tmp_pictures. */ skip?: number /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * - * Count returned Udaps + * Count returned Tmp_pictures **/ - _count?: true | UdapCountAggregateInputType + _count?: true | Tmp_picturesCountAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * * Select which fields to find the minimum value **/ - _min?: UdapMinAggregateInputType + _min?: Tmp_picturesMinAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * * Select which fields to find the maximum value **/ - _max?: UdapMaxAggregateInputType + _max?: Tmp_picturesMaxAggregateInputType } - export type GetUdapAggregateType = { - [P in keyof T & keyof AggregateUdap]: P extends '_count' | 'count' + export type GetTmp_picturesAggregateType = { + [P in keyof T & keyof AggregateTmp_pictures]: P extends '_count' | 'count' ? T[P] extends true ? number - : GetScalarType - : GetScalarType + : GetScalarType + : GetScalarType } - export type UdapGroupByArgs = { - where?: UdapWhereInput - orderBy?: Enumerable - by: UdapScalarFieldEnum[] - having?: UdapScalarWhereWithAggregatesInput + export type Tmp_picturesGroupByArgs = { + where?: Tmp_picturesWhereInput + orderBy?: Enumerable + by: Tmp_picturesScalarFieldEnum[] + having?: Tmp_picturesScalarWhereWithAggregatesInput take?: number skip?: number - _count?: UdapCountAggregateInputType | true - _min?: UdapMinAggregateInputType - _max?: UdapMaxAggregateInputType + _count?: Tmp_picturesCountAggregateInputType | true + _min?: Tmp_picturesMinAggregateInputType + _max?: Tmp_picturesMaxAggregateInputType } - export type UdapGroupByOutputType = { + export type Tmp_picturesGroupByOutputType = { id: string - department: string - completeCoords: string | null - visible: boolean | null - name: string | null - address: string | null - zipCode: string | null - city: string | null - phone: string | null - email: string | null - marianne_text: string | null - drac_text: string | null - udap_text: string | null - _count: UdapCountAggregateOutputType | null - _min: UdapMinAggregateOutputType | null - _max: UdapMaxAggregateOutputType | null + reportId: string | null + createdAt: Date | null + _count: Tmp_picturesCountAggregateOutputType | null + _min: Tmp_picturesMinAggregateOutputType | null + _max: Tmp_picturesMaxAggregateOutputType | null } - type GetUdapGroupByPayload = Prisma.PrismaPromise< + type GetTmp_picturesGroupByPayload = Prisma.PrismaPromise< Array< - PickArray & + PickArray & { - [P in ((keyof T) & (keyof UdapGroupByOutputType))]: P extends '_count' + [P in ((keyof T) & (keyof Tmp_picturesGroupByOutputType))]: P extends '_count' ? T[P] extends boolean ? number - : GetScalarType - : GetScalarType + : GetScalarType + : GetScalarType } > > - export type UdapSelect = $Extensions.GetSelect<{ + export type Tmp_picturesSelect = $Extensions.GetSelect<{ id?: boolean - department?: boolean - completeCoords?: boolean - visible?: boolean - name?: boolean - address?: boolean - zipCode?: boolean - city?: boolean - phone?: boolean - email?: boolean - marianne_text?: boolean - drac_text?: boolean - udap_text?: boolean - user?: boolean | Udap$userArgs - _count?: boolean | UdapCountOutputTypeArgs - }, ExtArgs["result"]["udap"]> + reportId?: boolean + createdAt?: boolean + report?: boolean | ReportArgs + }, ExtArgs["result"]["tmp_pictures"]> - export type UdapSelectScalar = { + export type Tmp_picturesSelectScalar = { id?: boolean - department?: boolean - completeCoords?: boolean - visible?: boolean - name?: boolean - address?: boolean - zipCode?: boolean - city?: boolean - phone?: boolean - email?: boolean - marianne_text?: boolean - drac_text?: boolean - udap_text?: boolean + reportId?: boolean + createdAt?: boolean } - export type UdapInclude = { - user?: boolean | Udap$userArgs - _count?: boolean | UdapCountOutputTypeArgs + export type Tmp_picturesInclude = { + report?: boolean | ReportArgs } - type UdapGetPayload = $Types.GetResult + type Tmp_picturesGetPayload = $Types.GetResult - type UdapCountArgs = + type Tmp_picturesCountArgs = + Omit & { + select?: Tmp_picturesCountAggregateInputType | true + } + + export interface Tmp_picturesDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Tmp_pictures'], meta: { name: 'Tmp_pictures' } } + /** + * Find zero or one Tmp_pictures that matches the filter. + * @param {Tmp_picturesFindUniqueArgs} args - Arguments to find a Tmp_pictures + * @example + * // Get one Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findUnique, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args: SelectSubset> + ): HasReject extends True ? Prisma__Tmp_picturesClient<$Types.GetResult, T, 'findUnique', never>, never, ExtArgs> : Prisma__Tmp_picturesClient<$Types.GetResult, T, 'findUnique', never> | null, null, ExtArgs> + + /** + * Find one Tmp_pictures that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {Tmp_picturesFindUniqueOrThrowArgs} args - Arguments to find a Tmp_pictures + * @example + * // Get one Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findUniqueOrThrow>( + args?: SelectSubset> + ): Prisma__Tmp_picturesClient<$Types.GetResult, T, 'findUniqueOrThrow', never>, never, ExtArgs> + + /** + * Find the first Tmp_pictures that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesFindFirstArgs} args - Arguments to find a Tmp_pictures + * @example + * // Get one Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findFirst, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args?: SelectSubset> + ): HasReject extends True ? Prisma__Tmp_picturesClient<$Types.GetResult, T, 'findFirst', never>, never, ExtArgs> : Prisma__Tmp_picturesClient<$Types.GetResult, T, 'findFirst', never> | null, null, ExtArgs> + + /** + * Find the first Tmp_pictures that matches the filter or + * throw `NotFoundError` if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesFindFirstOrThrowArgs} args - Arguments to find a Tmp_pictures + * @example + * // Get one Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findFirstOrThrow>( + args?: SelectSubset> + ): Prisma__Tmp_picturesClient<$Types.GetResult, T, 'findFirstOrThrow', never>, never, ExtArgs> + + /** + * Find zero or more Tmp_pictures that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesFindManyArgs=} args - Arguments to filter and select certain fields only. + * @example + * // Get all Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findMany() + * + * // Get first 10 Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.findMany({ take: 10 }) + * + * // Only select the `id` + * const tmp_picturesWithIdOnly = await prisma.tmp_pictures.findMany({ select: { id: true } }) + * + **/ + findMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>> + + /** + * Create a Tmp_pictures. + * @param {Tmp_picturesCreateArgs} args - Arguments to create a Tmp_pictures. + * @example + * // Create one Tmp_pictures + * const Tmp_pictures = await prisma.tmp_pictures.create({ + * data: { + * // ... data to create a Tmp_pictures + * } + * }) + * + **/ + create>( + args: SelectSubset> + ): Prisma__Tmp_picturesClient<$Types.GetResult, T, 'create', never>, never, ExtArgs> + + /** + * Create many Tmp_pictures. + * @param {Tmp_picturesCreateManyArgs} args - Arguments to create many Tmp_pictures. + * @example + * // Create many Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.createMany({ + * data: { + * // ... provide data here + * } + * }) + * + **/ + createMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Delete a Tmp_pictures. + * @param {Tmp_picturesDeleteArgs} args - Arguments to delete one Tmp_pictures. + * @example + * // Delete one Tmp_pictures + * const Tmp_pictures = await prisma.tmp_pictures.delete({ + * where: { + * // ... filter to delete one Tmp_pictures + * } + * }) + * + **/ + delete>( + args: SelectSubset> + ): Prisma__Tmp_picturesClient<$Types.GetResult, T, 'delete', never>, never, ExtArgs> + + /** + * Update one Tmp_pictures. + * @param {Tmp_picturesUpdateArgs} args - Arguments to update one Tmp_pictures. + * @example + * // Update one Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + **/ + update>( + args: SelectSubset> + ): Prisma__Tmp_picturesClient<$Types.GetResult, T, 'update', never>, never, ExtArgs> + + /** + * Delete zero or more Tmp_pictures. + * @param {Tmp_picturesDeleteManyArgs} args - Arguments to filter Tmp_pictures to delete. + * @example + * // Delete a few Tmp_pictures + * const { count } = await prisma.tmp_pictures.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + **/ + deleteMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Update zero or more Tmp_pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + **/ + updateMany>( + args: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Create or update one Tmp_pictures. + * @param {Tmp_picturesUpsertArgs} args - Arguments to update or create a Tmp_pictures. + * @example + * // Update or create a Tmp_pictures + * const tmp_pictures = await prisma.tmp_pictures.upsert({ + * create: { + * // ... data to create a Tmp_pictures + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Tmp_pictures we want to update + * } + * }) + **/ + upsert>( + args: SelectSubset> + ): Prisma__Tmp_picturesClient<$Types.GetResult, T, 'upsert', never>, never, ExtArgs> + + /** + * Count the number of Tmp_pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesCountArgs} args - Arguments to filter Tmp_pictures to count. + * @example + * // Count the number of Tmp_pictures + * const count = await prisma.tmp_pictures.count({ + * where: { + * // ... the filter for the Tmp_pictures we want to count + * } + * }) + **/ + count( + args?: Subset, + ): Prisma.PrismaPromise< + T extends $Utils.Record<'select', any> + ? T['select'] extends true + ? number + : GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a Tmp_pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Subset): Prisma.PrismaPromise> + + /** + * Group by Tmp_pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Tmp_picturesGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends Tmp_picturesGroupByArgs, + HasSelectOrTake extends Or< + Extends<'skip', Keys>, + Extends<'take', Keys> + >, + OrderByArg extends True extends HasSelectOrTake + ? { orderBy: Tmp_picturesGroupByArgs['orderBy'] } + : { orderBy?: Tmp_picturesGroupByArgs['orderBy'] }, + OrderFields extends ExcludeUnderscoreKeys>>, + ByFields extends TupleToUnion, + ByValid extends Has, + HavingFields extends GetHavingFields, + HavingValid extends Has, + ByEmpty extends T['by'] extends never[] ? True : False, + InputErrors extends ByEmpty extends True + ? `Error: "by" must not be empty.` + : HavingValid extends False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Keys + ? 'orderBy' extends Keys + ? ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Keys + ? 'orderBy' extends Keys + ? ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: SubsetIntersection & InputErrors): {} extends InputErrors ? GetTmp_picturesGroupByPayload : Prisma.PrismaPromise + + } + + /** + * The delegate class that acts as a "Promise-like" for Tmp_pictures. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ + export class Prisma__Tmp_picturesClient implements Prisma.PrismaPromise { + private readonly _dmmf; + private readonly _queryType; + private readonly _rootField; + private readonly _clientMethod; + private readonly _args; + private readonly _dataPath; + private readonly _errorFormat; + private readonly _measurePerformance?; + private _isList; + private _callsite; + private _requestPromise?; + readonly [Symbol.toStringTag]: 'PrismaPromise'; + constructor(_dmmf: runtime.DMMFClass, _queryType: 'query' | 'mutation', _rootField: string, _clientMethod: string, _args: any, _dataPath: string[], _errorFormat: ErrorFormat, _measurePerformance?: boolean | undefined, _isList?: boolean); + + report = {}>(args?: Subset>): Prisma__ReportClient<$Types.GetResult, T, 'findUnique', never> | Null, never, ExtArgs>; + + private get _document(); + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): Promise; + } + + + + // Custom InputTypes + + /** + * Tmp_pictures base type for findUnique actions + */ + export type Tmp_picturesFindUniqueArgsBase = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * Filter, which Tmp_pictures to fetch. + */ + where: Tmp_picturesWhereUniqueInput + } + + /** + * Tmp_pictures findUnique + */ + export interface Tmp_picturesFindUniqueArgs extends Tmp_picturesFindUniqueArgsBase { + /** + * Throw an Error if query returns no results + * @deprecated since 4.0.0: use `findUniqueOrThrow` method instead + */ + rejectOnNotFound?: RejectOnNotFound + } + + + /** + * Tmp_pictures findUniqueOrThrow + */ + export type Tmp_picturesFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * Filter, which Tmp_pictures to fetch. + */ + where: Tmp_picturesWhereUniqueInput + } + + + /** + * Tmp_pictures base type for findFirst actions + */ + export type Tmp_picturesFindFirstArgsBase = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * Filter, which Tmp_pictures to fetch. + */ + where?: Tmp_picturesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Tmp_pictures to fetch. + */ + orderBy?: Enumerable + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Tmp_pictures. + */ + cursor?: Tmp_picturesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Tmp_pictures from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Tmp_pictures. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Tmp_pictures. + */ + distinct?: Enumerable + } + + /** + * Tmp_pictures findFirst + */ + export interface Tmp_picturesFindFirstArgs extends Tmp_picturesFindFirstArgsBase { + /** + * Throw an Error if query returns no results + * @deprecated since 4.0.0: use `findFirstOrThrow` method instead + */ + rejectOnNotFound?: RejectOnNotFound + } + + + /** + * Tmp_pictures findFirstOrThrow + */ + export type Tmp_picturesFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * Filter, which Tmp_pictures to fetch. + */ + where?: Tmp_picturesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Tmp_pictures to fetch. + */ + orderBy?: Enumerable + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Tmp_pictures. + */ + cursor?: Tmp_picturesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Tmp_pictures from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Tmp_pictures. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Tmp_pictures. + */ + distinct?: Enumerable + } + + + /** + * Tmp_pictures findMany + */ + export type Tmp_picturesFindManyArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * Filter, which Tmp_pictures to fetch. + */ + where?: Tmp_picturesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Tmp_pictures to fetch. + */ + orderBy?: Enumerable + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Tmp_pictures. + */ + cursor?: Tmp_picturesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Tmp_pictures from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Tmp_pictures. + */ + skip?: number + distinct?: Enumerable + } + + + /** + * Tmp_pictures create + */ + export type Tmp_picturesCreateArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * The data needed to create a Tmp_pictures. + */ + data: XOR + } + + + /** + * Tmp_pictures createMany + */ + export type Tmp_picturesCreateManyArgs = { + /** + * The data used to create many Tmp_pictures. + */ + data: Enumerable + skipDuplicates?: boolean + } + + + /** + * Tmp_pictures update + */ + export type Tmp_picturesUpdateArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * The data needed to update a Tmp_pictures. + */ + data: XOR + /** + * Choose, which Tmp_pictures to update. + */ + where: Tmp_picturesWhereUniqueInput + } + + + /** + * Tmp_pictures updateMany + */ + export type Tmp_picturesUpdateManyArgs = { + /** + * The data used to update Tmp_pictures. + */ + data: XOR + /** + * Filter which Tmp_pictures to update + */ + where?: Tmp_picturesWhereInput + } + + + /** + * Tmp_pictures upsert + */ + export type Tmp_picturesUpsertArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * The filter to search for the Tmp_pictures to update in case it exists. + */ + where: Tmp_picturesWhereUniqueInput + /** + * In case the Tmp_pictures found by the `where` argument doesn't exist, create a new Tmp_pictures with this data. + */ + create: XOR + /** + * In case the Tmp_pictures was found with the provided `where` argument, update it with this data. + */ + update: XOR + } + + + /** + * Tmp_pictures delete + */ + export type Tmp_picturesDeleteArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + /** + * Filter which Tmp_pictures to delete. + */ + where: Tmp_picturesWhereUniqueInput + } + + + /** + * Tmp_pictures deleteMany + */ + export type Tmp_picturesDeleteManyArgs = { + /** + * Filter which Tmp_pictures to delete + */ + where?: Tmp_picturesWhereInput + } + + + /** + * Tmp_pictures without action + */ + export type Tmp_picturesArgs = { + /** + * Select specific fields to fetch from the Tmp_pictures + */ + select?: Tmp_picturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: Tmp_picturesInclude | null + } + + + + /** + * Model Udap + */ + + + export type AggregateUdap = { + _count: UdapCountAggregateOutputType | null + _min: UdapMinAggregateOutputType | null + _max: UdapMaxAggregateOutputType | null + } + + export type UdapMinAggregateOutputType = { + id: string | null + department: string | null + completeCoords: string | null + visible: boolean | null + name: string | null + address: string | null + zipCode: string | null + city: string | null + phone: string | null + email: string | null + marianne_text: string | null + drac_text: string | null + udap_text: string | null + } + + export type UdapMaxAggregateOutputType = { + id: string | null + department: string | null + completeCoords: string | null + visible: boolean | null + name: string | null + address: string | null + zipCode: string | null + city: string | null + phone: string | null + email: string | null + marianne_text: string | null + drac_text: string | null + udap_text: string | null + } + + export type UdapCountAggregateOutputType = { + id: number + department: number + completeCoords: number + visible: number + name: number + address: number + zipCode: number + city: number + phone: number + email: number + marianne_text: number + drac_text: number + udap_text: number + _all: number + } + + + export type UdapMinAggregateInputType = { + id?: true + department?: true + completeCoords?: true + visible?: true + name?: true + address?: true + zipCode?: true + city?: true + phone?: true + email?: true + marianne_text?: true + drac_text?: true + udap_text?: true + } + + export type UdapMaxAggregateInputType = { + id?: true + department?: true + completeCoords?: true + visible?: true + name?: true + address?: true + zipCode?: true + city?: true + phone?: true + email?: true + marianne_text?: true + drac_text?: true + udap_text?: true + } + + export type UdapCountAggregateInputType = { + id?: true + department?: true + completeCoords?: true + visible?: true + name?: true + address?: true + zipCode?: true + city?: true + phone?: true + email?: true + marianne_text?: true + drac_text?: true + udap_text?: true + _all?: true + } + + export type UdapAggregateArgs = { + /** + * Filter which Udap to aggregate. + */ + where?: UdapWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Udaps to fetch. + */ + orderBy?: Enumerable + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: UdapWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Udaps from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Udaps. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Udaps + **/ + _count?: true | UdapCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: UdapMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: UdapMaxAggregateInputType + } + + export type GetUdapAggregateType = { + [P in keyof T & keyof AggregateUdap]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : GetScalarType + : GetScalarType + } + + + + + export type UdapGroupByArgs = { + where?: UdapWhereInput + orderBy?: Enumerable + by: UdapScalarFieldEnum[] + having?: UdapScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: UdapCountAggregateInputType | true + _min?: UdapMinAggregateInputType + _max?: UdapMaxAggregateInputType + } + + + export type UdapGroupByOutputType = { + id: string + department: string + completeCoords: string | null + visible: boolean | null + name: string | null + address: string | null + zipCode: string | null + city: string | null + phone: string | null + email: string | null + marianne_text: string | null + drac_text: string | null + udap_text: string | null + _count: UdapCountAggregateOutputType | null + _min: UdapMinAggregateOutputType | null + _max: UdapMaxAggregateOutputType | null + } + + type GetUdapGroupByPayload = Prisma.PrismaPromise< + Array< + PickArray & + { + [P in ((keyof T) & (keyof UdapGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : GetScalarType + : GetScalarType + } + > + > + + + export type UdapSelect = $Extensions.GetSelect<{ + id?: boolean + department?: boolean + completeCoords?: boolean + visible?: boolean + name?: boolean + address?: boolean + zipCode?: boolean + city?: boolean + phone?: boolean + email?: boolean + marianne_text?: boolean + drac_text?: boolean + udap_text?: boolean + user?: boolean | Udap$userArgs + _count?: boolean | UdapCountOutputTypeArgs + }, ExtArgs["result"]["udap"]> + + export type UdapSelectScalar = { + id?: boolean + department?: boolean + completeCoords?: boolean + visible?: boolean + name?: boolean + address?: boolean + zipCode?: boolean + city?: boolean + phone?: boolean + email?: boolean + marianne_text?: boolean + drac_text?: boolean + udap_text?: boolean + } + + export type UdapInclude = { + user?: boolean | Udap$userArgs + _count?: boolean | UdapCountOutputTypeArgs + } + + + type UdapGetPayload = $Types.GetResult + + type UdapCountArgs = Omit & { select?: UdapCountAggregateInputType | true } @@ -10507,6 +11543,15 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type Service_instructeursScalarFieldEnum = (typeof Service_instructeursScalarFieldEnum)[keyof typeof Service_instructeursScalarFieldEnum] + export const Tmp_picturesScalarFieldEnum: { + id: 'id', + reportId: 'reportId', + createdAt: 'createdAt' + }; + + export type Tmp_picturesScalarFieldEnum = (typeof Tmp_picturesScalarFieldEnum)[keyof typeof Tmp_picturesScalarFieldEnum] + + export const UdapScalarFieldEnum: { id: 'id', department: 'department', @@ -10814,6 +11859,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject zipCode?: StringNullableFilter | string | null pictures?: PicturesListRelationFilter user?: XOR + tmp_pictures?: Tmp_picturesListRelationFilter } export type ReportOrderByWithRelationInput = { @@ -10842,6 +11888,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject zipCode?: SortOrderInput | SortOrder pictures?: PicturesOrderByRelationAggregateInput user?: UserOrderByWithRelationInput + tmp_pictures?: Tmp_picturesOrderByRelationAggregateInput } export type ReportWhereUniqueInput = { @@ -10959,6 +12006,45 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject udap_id?: StringNullableWithAggregatesFilter | string | null } + export type Tmp_picturesWhereInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringFilter | string + reportId?: StringNullableFilter | string | null + createdAt?: DateTimeNullableFilter | Date | string | null + report?: XOR | null + } + + export type Tmp_picturesOrderByWithRelationInput = { + id?: SortOrder + reportId?: SortOrderInput | SortOrder + createdAt?: SortOrderInput | SortOrder + report?: ReportOrderByWithRelationInput + } + + export type Tmp_picturesWhereUniqueInput = { + id?: string + } + + export type Tmp_picturesOrderByWithAggregationInput = { + id?: SortOrder + reportId?: SortOrderInput | SortOrder + createdAt?: SortOrderInput | SortOrder + _count?: Tmp_picturesCountOrderByAggregateInput + _max?: Tmp_picturesMaxOrderByAggregateInput + _min?: Tmp_picturesMinOrderByAggregateInput + } + + export type Tmp_picturesScalarWhereWithAggregatesInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringWithAggregatesFilter | string + reportId?: StringNullableWithAggregatesFilter | string | null + createdAt?: DateTimeNullableWithAggregatesFilter | Date | string | null + } + export type UdapWhereInput = { AND?: Enumerable OR?: Enumerable @@ -11365,6 +12451,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject zipCode?: string | null pictures?: PicturesCreateNestedManyWithoutReportInput user: UserCreateNestedOneWithoutReportInput + tmp_pictures?: Tmp_picturesCreateNestedManyWithoutReportInput } export type ReportUncheckedCreateInput = { @@ -11392,6 +12479,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: string | null zipCode?: string | null pictures?: PicturesUncheckedCreateNestedManyWithoutReportInput + tmp_pictures?: Tmp_picturesUncheckedCreateNestedManyWithoutReportInput } export type ReportUpdateInput = { @@ -11419,6 +12507,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject zipCode?: NullableStringFieldUpdateOperationsInput | string | null pictures?: PicturesUpdateManyWithoutReportNestedInput user?: UserUpdateOneRequiredWithoutReportNestedInput + tmp_pictures?: Tmp_picturesUpdateManyWithoutReportNestedInput } export type ReportUncheckedUpdateInput = { @@ -11446,6 +12535,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null pictures?: PicturesUncheckedUpdateManyWithoutReportNestedInput + tmp_pictures?: Tmp_picturesUncheckedUpdateManyWithoutReportNestedInput } export type ReportCreateManyInput = { @@ -11588,6 +12678,47 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject udap_id?: NullableStringFieldUpdateOperationsInput | string | null } + export type Tmp_picturesCreateInput = { + id: string + createdAt?: Date | string | null + report?: ReportCreateNestedOneWithoutTmp_picturesInput + } + + export type Tmp_picturesUncheckedCreateInput = { + id: string + reportId?: string | null + createdAt?: Date | string | null + } + + export type Tmp_picturesUpdateInput = { + id?: StringFieldUpdateOperationsInput | string + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + report?: ReportUpdateOneWithoutTmp_picturesNestedInput + } + + export type Tmp_picturesUncheckedUpdateInput = { + id?: StringFieldUpdateOperationsInput | string + reportId?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type Tmp_picturesCreateManyInput = { + id: string + reportId?: string | null + createdAt?: Date | string | null + } + + export type Tmp_picturesUpdateManyMutationInput = { + id?: StringFieldUpdateOperationsInput | string + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type Tmp_picturesUncheckedUpdateManyInput = { + id?: StringFieldUpdateOperationsInput | string + reportId?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + export type UdapCreateInput = { id: string department: string @@ -12050,10 +13181,20 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject none?: PicturesWhereInput } + export type Tmp_picturesListRelationFilter = { + every?: Tmp_picturesWhereInput + some?: Tmp_picturesWhereInput + none?: Tmp_picturesWhereInput + } + export type PicturesOrderByRelationAggregateInput = { _count?: SortOrder } + export type Tmp_picturesOrderByRelationAggregateInput = { + _count?: SortOrder + } + export type ReportCountOrderByAggregateInput = { id?: SortOrder title?: SortOrder @@ -12216,6 +13357,24 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedIntFilter } + export type Tmp_picturesCountOrderByAggregateInput = { + id?: SortOrder + reportId?: SortOrder + createdAt?: SortOrder + } + + export type Tmp_picturesMaxOrderByAggregateInput = { + id?: SortOrder + reportId?: SortOrder + createdAt?: SortOrder + } + + export type Tmp_picturesMinOrderByAggregateInput = { + id?: SortOrder + reportId?: SortOrder + createdAt?: SortOrder + } + export type UserListRelationFilter = { every?: UserWhereInput some?: UserWhereInput @@ -12398,6 +13557,13 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject connect?: UserWhereUniqueInput } + export type Tmp_picturesCreateNestedManyWithoutReportInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + createMany?: Tmp_picturesCreateManyReportInputEnvelope + connect?: Enumerable + } + export type PicturesUncheckedCreateNestedManyWithoutReportInput = { create?: XOR, Enumerable> connectOrCreate?: Enumerable @@ -12405,6 +13571,13 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject connect?: Enumerable } + export type Tmp_picturesUncheckedCreateNestedManyWithoutReportInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + createMany?: Tmp_picturesCreateManyReportInputEnvelope + connect?: Enumerable + } + export type DateTimeFieldUpdateOperationsInput = { set?: Date | string } @@ -12431,6 +13604,20 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject update?: XOR } + export type Tmp_picturesUpdateManyWithoutReportNestedInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + upsert?: Enumerable + createMany?: Tmp_picturesCreateManyReportInputEnvelope + set?: Enumerable + disconnect?: Enumerable + delete?: Enumerable + connect?: Enumerable + update?: Enumerable + updateMany?: Enumerable + deleteMany?: Enumerable + } + export type PicturesUncheckedUpdateManyWithoutReportNestedInput = { create?: XOR, Enumerable> connectOrCreate?: Enumerable @@ -12445,6 +13632,20 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject deleteMany?: Enumerable } + export type Tmp_picturesUncheckedUpdateManyWithoutReportNestedInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + upsert?: Enumerable + createMany?: Tmp_picturesCreateManyReportInputEnvelope + set?: Enumerable + disconnect?: Enumerable + delete?: Enumerable + connect?: Enumerable + update?: Enumerable + updateMany?: Enumerable + deleteMany?: Enumerable + } + export type IntFieldUpdateOperationsInput = { set?: number increment?: number @@ -12453,6 +13654,22 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject divide?: number } + export type ReportCreateNestedOneWithoutTmp_picturesInput = { + create?: XOR + connectOrCreate?: ReportCreateOrConnectWithoutTmp_picturesInput + connect?: ReportWhereUniqueInput + } + + export type ReportUpdateOneWithoutTmp_picturesNestedInput = { + create?: XOR + connectOrCreate?: ReportCreateOrConnectWithoutTmp_picturesInput + upsert?: ReportUpsertWithoutTmp_picturesInput + disconnect?: boolean + delete?: boolean + connect?: ReportWhereUniqueInput + update?: XOR + } + export type UserCreateNestedManyWithoutUdapInput = { create?: XOR, Enumerable> connectOrCreate?: Enumerable @@ -12944,6 +14161,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: string | null zipCode?: string | null user: UserCreateNestedOneWithoutReportInput + tmp_pictures?: Tmp_picturesCreateNestedManyWithoutReportInput } export type ReportUncheckedCreateWithoutPicturesInput = { @@ -12970,6 +14188,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: string | null city?: string | null zipCode?: string | null + tmp_pictures?: Tmp_picturesUncheckedCreateNestedManyWithoutReportInput } export type ReportCreateOrConnectWithoutPicturesInput = { @@ -13006,6 +14225,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null user?: UserUpdateOneRequiredWithoutReportNestedInput + tmp_pictures?: Tmp_picturesUpdateManyWithoutReportNestedInput } export type ReportUncheckedUpdateWithoutPicturesInput = { @@ -13032,6 +14252,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null + tmp_pictures?: Tmp_picturesUncheckedUpdateManyWithoutReportNestedInput } export type PicturesCreateWithoutReportInput = { @@ -13077,6 +14298,26 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject create: XOR } + export type Tmp_picturesCreateWithoutReportInput = { + id: string + createdAt?: Date | string | null + } + + export type Tmp_picturesUncheckedCreateWithoutReportInput = { + id: string + createdAt?: Date | string | null + } + + export type Tmp_picturesCreateOrConnectWithoutReportInput = { + where: Tmp_picturesWhereUniqueInput + create: XOR + } + + export type Tmp_picturesCreateManyReportInputEnvelope = { + data: Enumerable + skipDuplicates?: boolean + } + export type PicturesUpsertWithWhereUniqueWithoutReportInput = { where: PicturesWhereUniqueInput update: XOR @@ -13124,6 +14365,149 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject delegation_delegation_delegatedToTouser?: DelegationUncheckedUpdateManyWithoutUser_delegation_delegatedToTouserNestedInput } + export type Tmp_picturesUpsertWithWhereUniqueWithoutReportInput = { + where: Tmp_picturesWhereUniqueInput + update: XOR + create: XOR + } + + export type Tmp_picturesUpdateWithWhereUniqueWithoutReportInput = { + where: Tmp_picturesWhereUniqueInput + data: XOR + } + + export type Tmp_picturesUpdateManyWithWhereWithoutReportInput = { + where: Tmp_picturesScalarWhereInput + data: XOR + } + + export type Tmp_picturesScalarWhereInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringFilter | string + reportId?: StringNullableFilter | string | null + createdAt?: DateTimeNullableFilter | Date | string | null + } + + export type ReportCreateWithoutTmp_picturesInput = { + id: string + title?: string | null + projectDescription?: string | null + redactedBy?: string | null + meetDate?: Date | string | null + applicantName?: string | null + applicantAddress?: string | null + projectCadastralRef?: string | null + projectSpaceType?: string | null + decision?: string | null + precisions?: string | null + contacts?: string | null + furtherInformation?: string | null + createdAt: Date | string + serviceInstructeur?: number | null + pdf?: string | null + disabled?: boolean | null + udap_id?: string | null + redactedById?: string | null + applicantEmail?: string | null + city?: string | null + zipCode?: string | null + pictures?: PicturesCreateNestedManyWithoutReportInput + user: UserCreateNestedOneWithoutReportInput + } + + export type ReportUncheckedCreateWithoutTmp_picturesInput = { + id: string + title?: string | null + projectDescription?: string | null + redactedBy?: string | null + meetDate?: Date | string | null + applicantName?: string | null + applicantAddress?: string | null + projectCadastralRef?: string | null + projectSpaceType?: string | null + decision?: string | null + precisions?: string | null + contacts?: string | null + furtherInformation?: string | null + createdBy: string + createdAt: Date | string + serviceInstructeur?: number | null + pdf?: string | null + disabled?: boolean | null + udap_id?: string | null + redactedById?: string | null + applicantEmail?: string | null + city?: string | null + zipCode?: string | null + pictures?: PicturesUncheckedCreateNestedManyWithoutReportInput + } + + export type ReportCreateOrConnectWithoutTmp_picturesInput = { + where: ReportWhereUniqueInput + create: XOR + } + + export type ReportUpsertWithoutTmp_picturesInput = { + update: XOR + create: XOR + } + + export type ReportUpdateWithoutTmp_picturesInput = { + id?: StringFieldUpdateOperationsInput | string + title?: NullableStringFieldUpdateOperationsInput | string | null + projectDescription?: NullableStringFieldUpdateOperationsInput | string | null + redactedBy?: NullableStringFieldUpdateOperationsInput | string | null + meetDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + applicantName?: NullableStringFieldUpdateOperationsInput | string | null + applicantAddress?: NullableStringFieldUpdateOperationsInput | string | null + projectCadastralRef?: NullableStringFieldUpdateOperationsInput | string | null + projectSpaceType?: NullableStringFieldUpdateOperationsInput | string | null + decision?: NullableStringFieldUpdateOperationsInput | string | null + precisions?: NullableStringFieldUpdateOperationsInput | string | null + contacts?: NullableStringFieldUpdateOperationsInput | string | null + furtherInformation?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + serviceInstructeur?: NullableIntFieldUpdateOperationsInput | number | null + pdf?: NullableStringFieldUpdateOperationsInput | string | null + disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null + udap_id?: NullableStringFieldUpdateOperationsInput | string | null + redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null + city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null + pictures?: PicturesUpdateManyWithoutReportNestedInput + user?: UserUpdateOneRequiredWithoutReportNestedInput + } + + export type ReportUncheckedUpdateWithoutTmp_picturesInput = { + id?: StringFieldUpdateOperationsInput | string + title?: NullableStringFieldUpdateOperationsInput | string | null + projectDescription?: NullableStringFieldUpdateOperationsInput | string | null + redactedBy?: NullableStringFieldUpdateOperationsInput | string | null + meetDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + applicantName?: NullableStringFieldUpdateOperationsInput | string | null + applicantAddress?: NullableStringFieldUpdateOperationsInput | string | null + projectCadastralRef?: NullableStringFieldUpdateOperationsInput | string | null + projectSpaceType?: NullableStringFieldUpdateOperationsInput | string | null + decision?: NullableStringFieldUpdateOperationsInput | string | null + precisions?: NullableStringFieldUpdateOperationsInput | string | null + contacts?: NullableStringFieldUpdateOperationsInput | string | null + furtherInformation?: NullableStringFieldUpdateOperationsInput | string | null + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + serviceInstructeur?: NullableIntFieldUpdateOperationsInput | number | null + pdf?: NullableStringFieldUpdateOperationsInput | string | null + disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null + udap_id?: NullableStringFieldUpdateOperationsInput | string | null + redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null + city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null + pictures?: PicturesUncheckedUpdateManyWithoutReportNestedInput + } + export type UserCreateWithoutUdapInput = { id: string name: string @@ -13235,6 +14619,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: string | null zipCode?: string | null pictures?: PicturesCreateNestedManyWithoutReportInput + tmp_pictures?: Tmp_picturesCreateNestedManyWithoutReportInput } export type ReportUncheckedCreateWithoutUserInput = { @@ -13261,6 +14646,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: string | null zipCode?: string | null pictures?: PicturesUncheckedCreateNestedManyWithoutReportInput + tmp_pictures?: Tmp_picturesUncheckedCreateNestedManyWithoutReportInput } export type ReportCreateOrConnectWithoutUserInput = { @@ -13438,6 +14824,11 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject createdAt?: Date | string | null } + export type Tmp_picturesCreateManyReportInput = { + id: string + createdAt?: Date | string | null + } + export type PicturesUpdateWithoutReportInput = { id?: StringFieldUpdateOperationsInput | string url?: NullableStringFieldUpdateOperationsInput | string | null @@ -13456,6 +14847,21 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null } + export type Tmp_picturesUpdateWithoutReportInput = { + id?: StringFieldUpdateOperationsInput | string + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type Tmp_picturesUncheckedUpdateWithoutReportInput = { + id?: StringFieldUpdateOperationsInput | string + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type Tmp_picturesUncheckedUpdateManyWithoutTmp_picturesInput = { + id?: StringFieldUpdateOperationsInput | string + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + export type UserCreateManyUdapInput = { id: string name: string @@ -13563,6 +14969,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null pictures?: PicturesUpdateManyWithoutReportNestedInput + tmp_pictures?: Tmp_picturesUpdateManyWithoutReportNestedInput } export type ReportUncheckedUpdateWithoutUserInput = { @@ -13589,6 +14996,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null pictures?: PicturesUncheckedUpdateManyWithoutReportNestedInput + tmp_pictures?: Tmp_picturesUncheckedUpdateManyWithoutReportNestedInput } export type ReportUncheckedUpdateManyWithoutReportInput = { diff --git a/packages/electric-client/src/generated/typebox/index.ts b/packages/electric-client/src/generated/typebox/index.ts index 4f11756d..67b4d91c 100644 --- a/packages/electric-client/src/generated/typebox/index.ts +++ b/packages/electric-client/src/generated/typebox/index.ts @@ -24,3 +24,5 @@ export * from './pdf_snapshot'; export * from './pdf_snapshotInput'; export * from './pictures'; export * from './picturesInput'; +export * from './tmp_pictures'; +export * from './tmp_picturesInput'; diff --git a/packages/electric-client/src/generated/typebox/report.ts b/packages/electric-client/src/generated/typebox/report.ts index 9b7d3da9..2a2658f3 100644 --- a/packages/electric-client/src/generated/typebox/report.ts +++ b/packages/electric-client/src/generated/typebox/report.ts @@ -37,6 +37,13 @@ export const report = Type.Object({ name: Type.String(), udap_id: Type.String(), }), + tmp_pictures: Type.Array( + Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + createdAt: Type.Optional(Type.String()), + }) + ), }); export type reportType = Static; diff --git a/packages/electric-client/src/generated/typebox/reportInput.ts b/packages/electric-client/src/generated/typebox/reportInput.ts index 71001aef..d6faca30 100644 --- a/packages/electric-client/src/generated/typebox/reportInput.ts +++ b/packages/electric-client/src/generated/typebox/reportInput.ts @@ -37,6 +37,13 @@ export const reportInput = Type.Object({ name: Type.String(), udap_id: Type.String(), }), + tmp_pictures: Type.Array( + Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + createdAt: Type.Optional(Type.String()), + }) + ), }); export type reportInputType = Static; diff --git a/packages/electric-client/src/generated/typebox/tmp_pictures.ts b/packages/electric-client/src/generated/typebox/tmp_pictures.ts new file mode 100644 index 00000000..54957735 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/tmp_pictures.ts @@ -0,0 +1,36 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const tmp_pictures = Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + createdAt: Type.Optional(Type.String()), + report: Type.Optional( + Type.Object({ + id: Type.String(), + title: Type.Optional(Type.String()), + projectDescription: Type.Optional(Type.String()), + redactedBy: Type.Optional(Type.String()), + meetDate: Type.Optional(Type.String()), + applicantName: Type.Optional(Type.String()), + applicantAddress: Type.Optional(Type.String()), + projectCadastralRef: Type.Optional(Type.String()), + projectSpaceType: Type.Optional(Type.String()), + decision: Type.Optional(Type.String()), + precisions: Type.Optional(Type.String()), + contacts: Type.Optional(Type.String()), + furtherInformation: Type.Optional(Type.String()), + createdBy: Type.String(), + createdAt: Type.String(), + serviceInstructeur: Type.Optional(Type.Number()), + pdf: Type.Optional(Type.String()), + disabled: Type.Optional(Type.Boolean()), + udap_id: Type.Optional(Type.String()), + redactedById: Type.Optional(Type.String()), + applicantEmail: Type.Optional(Type.String()), + city: Type.Optional(Type.String()), + zipCode: Type.Optional(Type.String()), + }) + ), +}); + +export type tmp_picturesType = Static; diff --git a/packages/electric-client/src/generated/typebox/tmp_picturesInput.ts b/packages/electric-client/src/generated/typebox/tmp_picturesInput.ts new file mode 100644 index 00000000..96b22563 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/tmp_picturesInput.ts @@ -0,0 +1,36 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const tmp_picturesInput = Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + createdAt: Type.Optional(Type.String()), + report: Type.Optional( + Type.Object({ + id: Type.String(), + title: Type.Optional(Type.String()), + projectDescription: Type.Optional(Type.String()), + redactedBy: Type.Optional(Type.String()), + meetDate: Type.Optional(Type.String()), + applicantName: Type.Optional(Type.String()), + applicantAddress: Type.Optional(Type.String()), + projectCadastralRef: Type.Optional(Type.String()), + projectSpaceType: Type.Optional(Type.String()), + decision: Type.Optional(Type.String()), + precisions: Type.Optional(Type.String()), + contacts: Type.Optional(Type.String()), + furtherInformation: Type.Optional(Type.String()), + createdBy: Type.String(), + createdAt: Type.String(), + serviceInstructeur: Type.Optional(Type.Number()), + pdf: Type.Optional(Type.String()), + disabled: Type.Optional(Type.Boolean()), + udap_id: Type.Optional(Type.String()), + redactedById: Type.Optional(Type.String()), + applicantEmail: Type.Optional(Type.String()), + city: Type.Optional(Type.String()), + zipCode: Type.Optional(Type.String()), + }) + ), +}); + +export type tmp_picturesInputType = Static; diff --git a/packages/frontend/src/features/InfoForm.tsx b/packages/frontend/src/features/InfoForm.tsx index f3821efa..f74ca1fa 100644 --- a/packages/frontend/src/features/InfoForm.tsx +++ b/packages/frontend/src/features/InfoForm.tsx @@ -6,7 +6,7 @@ import { useTabsContext } from "@ark-ui/react/tabs"; import Button from "@codegouvfr/react-dsfr/Button"; import Input from "@codegouvfr/react-dsfr/Input"; import Select from "@codegouvfr/react-dsfr/Select"; -import type { Pictures, Report } from "@cr-vif/electric-client/frontend"; +import type { Pictures, Report, Tmp_pictures } from "@cr-vif/electric-client/frontend"; import { useMutation, useQuery } from "@tanstack/react-query"; import { format, parse } from "date-fns"; import { useLiveQuery } from "electric-sql/react"; @@ -227,7 +227,7 @@ const UploadImage = ({ reportId }: { reportId: string }) => { await set(id, buffer, picturesStore); await set(id, reportId, toUploadStore); - await db.pictures.create({ data: { id, reportId, createdAt: new Date() } }); + await db.tmp_pictures.create({ data: { id, reportId, createdAt: new Date() } }); syncImages(); }; @@ -264,47 +264,53 @@ const UploadImage = ({ reportId }: { reportId: string }) => { ); }; -const ReportStatus = ({ status }: { status: "uploading" | "success" | "error" }) => { - return ( - - - {status === "draft" ? "Brouillon" : "Envoyé"} - - ); -}; +// const ReportStatus = ({ status }: { status: "uploading" | "success" | "error" }) => { +// return ( +// +// +// {status === "draft" ? "Brouillon" : "Envoyé"} +// +// ); +// }; const ReportPictures = ({ statusMap }: { statusMap: Record }) => { const form = useFormContext(); + const reportId = form.getValues().id; + + const tmpPicturesQuery = useLiveQuery( + db.tmp_pictures.liveMany({ where: { reportId }, orderBy: { createdAt: "asc" } }), + ); + const picturesQuery = useLiveQuery( db.pictures.liveMany({ - where: { reportId: form.getValues().id }, + where: { reportId }, orderBy: { createdAt: "asc" }, }), ); - console.log(picturesQuery.results); + const pictures = mergePictureArrays(tmpPicturesQuery.results ?? [], picturesQuery.results ?? []); return ( {/* */} - {picturesQuery.results?.map((picture, index) => ( + {pictures?.map((picture, index) => ( ))} @@ -314,19 +320,33 @@ const ReportPictures = ({ statusMap }: { statusMap: Record }) => ); }; +const mergePictureArrays = (a: Tmp_pictures[], b: Pictures[]) => { + const map = new Map(); + + for (const item of a) { + map.set(item.id, item); + } + + for (const item of b) { + map.set(item.id, item); + } + + return Array.from(map.values()); +}; + const PictureThumbnail = ({ picture, index, status }: { picture: Pictures; index: number; status?: string }) => { const deletePictureMutation = useMutation(async () => { await deleteImageFromIdb(picture.id); - - return db.pictures.delete({ where: { id: picture.id } }); + if (picture.url) await db.pictures.delete({ where: { id: picture.id } }); + else await db.tmp_pictures.delete({ where: { id: picture.id } }); + return "ok"; }); const bgUrlQuery = useQuery({ queryKey: ["picture", picture.id, picture.url], queryFn: async () => { - if (picture.url) return picture.url; const buffer = await get(picture.id, getPicturesStore()); - if (!buffer) return null; + if (!buffer) return picture.url; const blob = new Blob([buffer], { type: "image/png" });