diff --git a/db/migrations/907-add_pictures.sql b/db/migrations/907-add_pictures.sql new file mode 100644 index 00000000..c8910726 --- /dev/null +++ b/db/migrations/907-add_pictures.sql @@ -0,0 +1,8 @@ +CREATE TABLE pictures ( + id TEXT PRIMARY KEY, + "reportId" TEXT REFERENCES report(id) ON DELETE CASCADE, + url TEXT, + "createdAt" TIMESTAMP +); + +ALTER TABLE pictures ENABLE ELECTRIC; \ No newline at end of file diff --git a/packages/backend/openapi.json b/packages/backend/openapi.json index ef81e17d..5852837f 100644 --- a/packages/backend/openapi.json +++ b/packages/backend/openapi.json @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"CR VIF API","description":"CR VIF API Documentation","version":"1.0"},"components":{"schemas":{}},"paths":{"/api/create-user":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"udap_id":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"}},"required":["name","udap_id","email","password"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"udap_id":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}},"required":["id","name","udap_id","udap"]},"token":{"type":"string"},"expiresAt":{"type":"string"},"refreshToken":{"type":"string"}},"required":["token","expiresAt","refreshToken"]}}}}}}},"/api/login":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"password":{"type":"string"}},"required":["email","password"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"udap_id":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}},"required":["id","name","udap_id","udap"]},"token":{"type":"string"},"expiresAt":{"type":"string"},"refreshToken":{"type":"string"}},"required":["token","expiresAt","refreshToken"]}}}}}}},"/api/refresh-token":{"get":{"parameters":[{"schema":{"type":"string"},"in":"query","name":"token","required":true},{"schema":{"type":"string"},"in":"query","name":"refreshToken","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"udap_id":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}},"required":["id","name","udap_id","udap"]},"token":{"type":"string"},"expiresAt":{"type":"string"},"refreshToken":{"type":"string"}},"required":["token","expiresAt","refreshToken"]}}}}}}},"/api/send-reset-password":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/reset-password":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"temporaryLink":{"type":"string"},"newPassword":{"type":"string"}},"required":["temporaryLink","newPassword"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/udaps":{"get":{"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}}}}}}}},"/api/pdf/report":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"htmlString":{"type":"string"},"reportId":{"type":"string"},"recipients":{"type":"string"}},"required":["htmlString","reportId","recipients"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"string"}}}}}},"get":{"parameters":[{"schema":{"type":"string"},"in":"query","name":"reportId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{}}}}}}}}}} \ No newline at end of file +{"openapi":"3.1.0","info":{"title":"CR VIF API","description":"CR VIF API Documentation","version":"1.0"},"components":{"schemas":{}},"paths":{"/api/create-user":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"udap_id":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"}},"required":["name","udap_id","email","password"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"udap_id":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}},"required":["id","name","udap_id","udap"]},"token":{"type":"string"},"expiresAt":{"type":"string"},"refreshToken":{"type":"string"}},"required":["token","expiresAt","refreshToken"]}}}}}}},"/api/login":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"password":{"type":"string"}},"required":["email","password"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"udap_id":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}},"required":["id","name","udap_id","udap"]},"token":{"type":"string"},"expiresAt":{"type":"string"},"refreshToken":{"type":"string"}},"required":["token","expiresAt","refreshToken"]}}}}}}},"/api/refresh-token":{"get":{"parameters":[{"schema":{"type":"string"},"in":"query","name":"token","required":true},{"schema":{"type":"string"},"in":"query","name":"refreshToken","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"udap_id":{"type":"string"},"udap":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}},"required":["id","name","udap_id","udap"]},"token":{"type":"string"},"expiresAt":{"type":"string"},"refreshToken":{"type":"string"}},"required":["token","expiresAt","refreshToken"]}}}}}}},"/api/send-reset-password":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/reset-password":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"temporaryLink":{"type":"string"},"newPassword":{"type":"string"}},"required":["temporaryLink","newPassword"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/udaps":{"get":{"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string"},"completeCoords":{"type":"string"},"visible":{"type":"boolean"},"name":{"type":"string"},"address":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"marianne_text":{"type":"string"},"drac_text":{"type":"string"},"udap_text":{"type":"string"}},"required":["id","department"]}}}}}}}},"/api/upload/image":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/api/pdf/report":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"htmlString":{"type":"string"},"reportId":{"type":"string"},"recipients":{"type":"string"}},"required":["htmlString","reportId","recipients"]}}},"required":true},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"string"}}}}}},"get":{"parameters":[{"schema":{"type":"string"},"in":"query","name":"reportId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{}}}}}}}}}} \ No newline at end of file diff --git a/packages/backend/package.json b/packages/backend/package.json index 6f6eacc3..8a63fb66 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -53,6 +53,7 @@ "drizzle-typebox": "^0.1.1", "drizzle-zod": "^0.5.1", "fastify": "^4.26.2", + "fastify-multer": "^2.0.3", "jsonwebtoken": "^9.0.2", "nodemailer": "^6.9.13", "pastable": "^2.2.1", diff --git a/packages/backend/src/router.ts b/packages/backend/src/router.ts index 72154c76..7a464cca 100644 --- a/packages/backend/src/router.ts +++ b/packages/backend/src/router.ts @@ -10,6 +10,7 @@ import fs from "node:fs/promises"; import { makeDebug } from "./features/debug"; import { staticDataPlugin } from "./routes/staticDataRoutes"; import { pdfPlugin } from "./routes/pdfRoutes"; +import { uploadPlugin } from "./routes/uploadRoutes"; const debug = makeDebug("fastify"); @@ -52,6 +53,7 @@ export const initFastify = async () => { await instance.register(userPlugin); await instance.register(staticDataPlugin); + await instance.register(uploadPlugin, { prefix: "/upload" }); await instance.register(pdfPlugin, { prefix: "/pdf" }); }, { prefix: "/api" }, diff --git a/packages/backend/src/routes/uploadRoutes.tsx b/packages/backend/src/routes/uploadRoutes.tsx index 7340432c..09bf8809 100644 --- a/packages/backend/src/routes/uploadRoutes.tsx +++ b/packages/backend/src/routes/uploadRoutes.tsx @@ -1,6 +1,12 @@ -import { FastifyPluginAsyncTypebox } from "@fastify/type-provider-typebox"; +import { FastifyPluginAsyncTypebox, Type } from "@fastify/type-provider-typebox"; import multipart, { MultipartFile } from "@fastify/multipart"; import { AppError } from "../features/errors"; +import util from "node:util"; +import { pipeline } from "node:stream"; +import { getPictureName } from "../services/uploadService"; +import { db } from "../db/db"; + +const pump = util.promisify(pipeline); export const uploadPlugin: FastifyPluginAsyncTypebox = async (fastify, _) => { fastify.register(multipart, { @@ -9,25 +15,58 @@ export const uploadPlugin: FastifyPluginAsyncTypebox = async (fastify, _) => { }, }); - fastify.post("/upload-image", async (request) => { - const files = request.files(); + fastify.post("/image", async (request, reply) => { + const file = await request.file(); + const { reportId, id } = request.query || ({} as any); + + if (!file) throw new AppError(400, "No file provided"); + if (!reportId || !id) throw new AppError(400, "No reportId or id provided"); + + const url = await request.services.upload.addPDFToReport({ + reportId: (request.query as any).reportId as string, + buffer: await file.toBuffer(), + name: getPictureName(reportId, id), + publicRead: true, + }); + + await db.pictures.update({ where: { id }, data: { url } }); + + reply.send(); - for await (const file of files) { - const isImage = ["image/png", "image/jpeg", "image/jpg"].includes(file.mimetype); + // for await (const file of files) { + // const isImage = ["image/png", "image/jpeg", "image/jpg"].includes(file.mimetype); - if (!isImage) { - throw new AppError(400, "File is not an image"); - } + // if (!isImage) { + // throw new AppError(400, "File is not an image"); + // } - // await request.services.upload.addImageToReport({ - // reportId: "", - // buffer: await file.toBuffer(), - // name: getFileName(file), - // }); - } + // // await request.services.upload.addImageToReport({ + // // reportId: "", + // // buffer: await file.toBuffer(), + // // name: getFileName(file), + // // }); + // } + + console.log("done"); return "ok"; }); + + fastify.get( + "/picture", + { + schema: { + querystring: Type.Object({ reportId: Type.String(), pictureId: Type.String() }), + response: { 200: Type.Any() }, + }, + }, + async (request) => { + const { reportId, pictureId } = request.query; + const buffer = await request.services.upload.getReportPicture({ reportId, pictureId }); + + return buffer.toString("base64"); + }, + ); }; const getFileName = (file: MultipartFile) => { diff --git a/packages/backend/src/services/uploadService.ts b/packages/backend/src/services/uploadService.ts index 0c2ea997..42886981 100644 --- a/packages/backend/src/services/uploadService.ts +++ b/packages/backend/src/services/uploadService.ts @@ -8,9 +8,24 @@ const debug = makeDebug("upload"); export const upload = async () => {}; export class UploadService { - async addPDFToReport({ reportId, buffer, name }: { reportId: string; buffer: Buffer; name: string }) { + async addPDFToReport({ + reportId, + buffer, + name, + publicRead, + }: { + reportId: string; + buffer: Buffer; + name: string; + publicRead?: boolean; + }) { debug("Uploading PDF to S3", reportId); - const command = new PutObjectCommand({ Bucket: ENV.AWS_BUCKET_NAME, Body: buffer, Key: name }); + const command = new PutObjectCommand({ + Bucket: ENV.AWS_BUCKET_NAME, + Body: buffer, + Key: name, + ACL: publicRead ? "public-read" : undefined, + }); await client.send(command); const url = `https://${ENV.AWS_BUCKET_NAME}.s3.${ENV.AWS_REGION}.scw.cloud/${name}`; @@ -30,6 +45,19 @@ export class UploadService { return Buffer.from(buffer); } + + async getReportPicture({ reportId, pictureId }: { reportId: string; pictureId: string }) { + const name = getPictureName(reportId, pictureId); + + const command = new GetObjectCommand({ Bucket: ENV.AWS_BUCKET_NAME, Key: name }); + const response = await client.send(command); + + const buffer = await response.Body?.transformToByteArray(); + if (!buffer) throw new AppError(404, "Picture not found"); + + return Buffer.from(buffer); + } } export const getPDFName = (reportId: string) => `${reportId}/compte_rendu.pdf`; +export const getPictureName = (reportId: string, pictureId: string) => `${reportId}/pictures/${pictureId}.png`; diff --git a/packages/electric-client/prisma/schema.prisma b/packages/electric-client/prisma/schema.prisma index 6fa911b2..41f27029 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,14 +52,17 @@ model report { contacts String? furtherInformation String? createdBy String - createdAt DateTime @db.Timestamp(6) + createdAt DateTime @db.Timestamp(6) serviceInstructeur Int? pdf String? disabled Boolean? udap_id String? redactedById String? applicantEmail String? - user user @relation(fields: [createdBy], references: [id], onDelete: SetNull, onUpdate: NoAction) + city String? + zipCode String? + pictures pictures[] + user user @relation(fields: [createdBy], references: [id], onDelete: SetNull, onUpdate: NoAction) } model delegation { @@ -131,3 +134,19 @@ model clause_v2 { udap_id String? text String } + +model pdf_snapshot { + id String @id + report_id String? + html String? + report String? + user_id String? +} + +model pictures { + id String @id + reportId String? + url 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 fee2901b..0a5931b4 100644 --- a/packages/electric-client/src/generated/client/index.ts +++ b/packages/electric-client/src/generated/client/index.ts @@ -21,6 +21,8 @@ export const DelegationScalarFieldEnumSchema = z.enum(['createdBy','delegatedTo' export const Pdf_snapshotScalarFieldEnumSchema = z.enum(['id','report_id','html','report','user_id']); +export const PicturesScalarFieldEnumSchema = z.enum(['id','reportId','url','createdAt']); + export const QueryModeSchema = z.enum(['default','insensitive']); export const ReportScalarFieldEnumSchema = z.enum(['id','title','projectDescription','redactedBy','meetDate','applicantName','applicantAddress','projectCadastralRef','projectSpaceType','decision','precisions','contacts','furtherInformation','createdBy','createdAt','serviceInstructeur','pdf','disabled','udap_id','redactedById','applicantEmail','city','zipCode']); @@ -92,6 +94,19 @@ export const Pdf_snapshotSchema = z.object({ export type Pdf_snapshot = z.infer +///////////////////////////////////////// +// PICTURES SCHEMA +///////////////////////////////////////// + +export const PicturesSchema = z.object({ + id: z.string(), + reportId: z.string().nullable(), + url: z.string().nullable(), + createdAt: z.coerce.date().nullable(), +}) + +export type Pictures = z.infer + ///////////////////////////////////////// // REPORT SCHEMA ///////////////////////////////////////// @@ -231,11 +246,33 @@ export const Pdf_snapshotSelectSchema: z.ZodType = z. user_id: z.boolean().optional(), }).strict() +// PICTURES +//------------------------------------------------------ + +export const PicturesIncludeSchema: z.ZodType = z.object({ + report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), +}).strict() + +export const PicturesArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => PicturesSelectSchema).optional(), + include: z.lazy(() => PicturesIncludeSchema).optional(), +}).strict(); + +export const PicturesSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + reportId: z.boolean().optional(), + url: z.boolean().optional(), + createdAt: z.boolean().optional(), + report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), +}).strict() + // REPORT //------------------------------------------------------ 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(), + _count: z.union([z.boolean(),z.lazy(() => ReportCountOutputTypeArgsSchema)]).optional(), }).strict() export const ReportArgsSchema: z.ZodType = z.object({ @@ -243,6 +280,14 @@ export const ReportArgsSchema: z.ZodType = z.object({ include: z.lazy(() => ReportIncludeSchema).optional(), }).strict(); +export const ReportCountOutputTypeArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => ReportCountOutputTypeSelectSchema).nullish(), +}).strict(); + +export const ReportCountOutputTypeSelectSchema: z.ZodType = z.object({ + pictures: z.boolean().optional(), +}).strict(); + export const ReportSelectSchema: z.ZodType = z.object({ id: z.boolean().optional(), title: z.boolean().optional(), @@ -267,7 +312,9 @@ export const ReportSelectSchema: z.ZodType = z.object({ applicantEmail: z.boolean().optional(), city: z.boolean().optional(), zipCode: z.boolean().optional(), + pictures: z.union([z.boolean(),z.lazy(() => PicturesFindManyArgsSchema)]).optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), + _count: z.union([z.boolean(),z.lazy(() => ReportCountOutputTypeArgsSchema)]).optional(), }).strict() // SERVICE INSTRUCTEURS @@ -541,6 +588,49 @@ export const Pdf_snapshotScalarWhereWithAggregatesInputSchema: z.ZodType StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), }).strict(); +export const PicturesWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => PicturesWhereInputSchema),z.lazy(() => PicturesWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => PicturesWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => PicturesWhereInputSchema),z.lazy(() => PicturesWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + reportId: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + url: 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 PicturesOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + url: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + report: z.lazy(() => ReportOrderByWithRelationInputSchema).optional() +}).strict(); + +export const PicturesWhereUniqueInputSchema: z.ZodType = z.object({ + id: z.string().optional() +}).strict(); + +export const PicturesOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + url: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => PicturesCountOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => PicturesMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => PicturesMinOrderByAggregateInputSchema).optional() +}).strict(); + +export const PicturesScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => PicturesScalarWhereWithAggregatesInputSchema),z.lazy(() => PicturesScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => PicturesScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => PicturesScalarWhereWithAggregatesInputSchema),z.lazy(() => PicturesScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + reportId: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + url: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + createdAt: z.union([ z.lazy(() => DateTimeNullableWithAggregatesFilterSchema),z.coerce.date() ]).optional().nullable(), +}).strict(); + export const ReportWhereInputSchema: z.ZodType = z.object({ AND: z.union([ z.lazy(() => ReportWhereInputSchema),z.lazy(() => ReportWhereInputSchema).array() ]).optional(), OR: z.lazy(() => ReportWhereInputSchema).array().optional(), @@ -568,6 +658,7 @@ export const ReportWhereInputSchema: z.ZodType = z.obje applicantEmail: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), city: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), 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(), }).strict(); @@ -595,6 +686,7 @@ export const ReportOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), city: z.lazy(() => SortOrderSchema).optional(), zipCode: z.lazy(() => SortOrderSchema).optional(), + pictures: z.lazy(() => PicturesOrderByRelationAggregateInputSchema).optional(), user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() }).strict(); @@ -1045,6 +1137,54 @@ export const Pdf_snapshotUncheckedUpdateManyInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); +export const PicturesCreateInputSchema: z.ZodType = z.object({ + id: z.string(), + url: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable(), + report: z.lazy(() => ReportCreateNestedOneWithoutPicturesInputSchema).optional() +}).strict(); + +export const PicturesUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string(), + reportId: z.string().optional().nullable(), + url: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const PicturesUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), + report: z.lazy(() => ReportUpdateOneWithoutPicturesNestedInputSchema).optional() +}).strict(); + +export const PicturesUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + reportId: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const PicturesCreateManyInputSchema: z.ZodType = z.object({ + id: z.string(), + reportId: z.string().optional().nullable(), + url: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const PicturesUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const PicturesUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + reportId: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + export const ReportCreateInputSchema: z.ZodType = z.object({ id: z.string(), title: z.string().optional().nullable(), @@ -1068,6 +1208,7 @@ export const ReportCreateInputSchema: z.ZodType = z.ob 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(); @@ -1094,7 +1235,8 @@ export const ReportUncheckedCreateInputSchema: z.ZodType PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportUpdateInputSchema: z.ZodType = z.object({ @@ -1120,6 +1262,7 @@ export const ReportUpdateInputSchema: z.ZodType = z.ob 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(); @@ -1147,6 +1290,7 @@ 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() }).strict(); export const ReportCreateManyInputSchema: z.ZodType = z.object({ @@ -1689,6 +1833,46 @@ export const DateTimeNullableFilterSchema: z.ZodType NestedDateTimeNullableFilterSchema) ]).optional().nullable(), }).strict(); +export const ReportRelationFilterSchema: z.ZodType = z.object({ + is: z.lazy(() => ReportWhereInputSchema).optional().nullable(), + isNot: z.lazy(() => ReportWhereInputSchema).optional().nullable() +}).strict(); + +export const PicturesCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + url: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const PicturesMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + url: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const PicturesMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + reportId: z.lazy(() => SortOrderSchema).optional(), + url: z.lazy(() => SortOrderSchema).optional(), + createdAt: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const DateTimeNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.coerce.date().optional().nullable(), + in: z.coerce.date().array().optional().nullable(), + notIn: z.coerce.date().array().optional().nullable(), + lt: z.coerce.date().optional(), + lte: z.coerce.date().optional(), + gt: z.coerce.date().optional(), + gte: z.coerce.date().optional(), + not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedDateTimeNullableFilterSchema).optional(), + _max: z.lazy(() => NestedDateTimeNullableFilterSchema).optional() +}).strict(); + export const DateTimeFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional(), in: z.coerce.date().array().optional(), @@ -1700,6 +1884,16 @@ export const DateTimeFilterSchema: z.ZodType = z.object({ not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), }).strict(); +export const PicturesListRelationFilterSchema: z.ZodType = z.object({ + every: z.lazy(() => PicturesWhereInputSchema).optional(), + some: z.lazy(() => PicturesWhereInputSchema).optional(), + none: z.lazy(() => PicturesWhereInputSchema).optional() +}).strict(); + +export const 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(), @@ -1786,20 +1980,6 @@ export const ReportSumOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); -export const DateTimeNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.coerce.date().optional().nullable(), - in: z.coerce.date().array().optional().nullable(), - notIn: z.coerce.date().array().optional().nullable(), - lt: z.coerce.date().optional(), - lte: z.coerce.date().optional(), - gt: z.coerce.date().optional(), - gte: z.coerce.date().optional(), - not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedDateTimeNullableFilterSchema).optional(), - _max: z.lazy(() => NestedDateTimeNullableFilterSchema).optional() -}).strict(); - export const DateTimeWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional(), in: z.coerce.date().array().optional(), @@ -2025,20 +2205,64 @@ export const UserUpdateOneRequiredWithoutDelegation_delegation_delegatedToTouser update: z.union([ z.lazy(() => UserUpdateWithoutDelegation_delegation_delegatedToTouserInputSchema),z.lazy(() => UserUncheckedUpdateWithoutDelegation_delegation_delegatedToTouserInputSchema) ]).optional(), }).strict(); +export const ReportCreateNestedOneWithoutPicturesInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ReportCreateWithoutPicturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutPicturesInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutPicturesInputSchema).optional(), + connect: z.lazy(() => ReportWhereUniqueInputSchema).optional() +}).strict(); + +export const NullableDateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.coerce.date().optional().nullable() +}).strict(); + +export const ReportUpdateOneWithoutPicturesNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ReportCreateWithoutPicturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutPicturesInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutPicturesInputSchema).optional(), + upsert: z.lazy(() => ReportUpsertWithoutPicturesInputSchema).optional(), + disconnect: z.boolean().optional(), + delete: z.boolean().optional(), + connect: z.lazy(() => ReportWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => ReportUpdateWithoutPicturesInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutPicturesInputSchema) ]).optional(), +}).strict(); + +export const PicturesCreateNestedManyWithoutReportInputSchema: 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(), + createMany: z.lazy(() => PicturesCreateManyReportInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const UserCreateNestedOneWithoutReportInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]).optional(), connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutReportInputSchema).optional(), connect: z.lazy(() => UserWhereUniqueInputSchema).optional() }).strict(); -export const NullableDateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.coerce.date().optional().nullable() +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(), + createMany: z.lazy(() => PicturesCreateManyReportInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), }).strict(); export const DateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.coerce.date().optional() }).strict(); +export const PicturesUpdateManyWithoutReportNestedInputSchema: 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(), + upsert: z.union([ z.lazy(() => PicturesUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => PicturesUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + createMany: z.lazy(() => PicturesCreateManyReportInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => PicturesUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => PicturesUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => PicturesUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => PicturesUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => PicturesScalarWhereInputSchema),z.lazy(() => PicturesScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const UserUpdateOneRequiredWithoutReportNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]).optional(), connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutReportInputSchema).optional(), @@ -2047,6 +2271,20 @@ export const UserUpdateOneRequiredWithoutReportNestedInputSchema: z.ZodType UserUpdateWithoutReportInputSchema),z.lazy(() => UserUncheckedUpdateWithoutReportInputSchema) ]).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(), + upsert: z.union([ z.lazy(() => PicturesUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => PicturesUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + createMany: z.lazy(() => PicturesCreateManyReportInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => PicturesWhereUniqueInputSchema),z.lazy(() => PicturesWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => PicturesUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => PicturesUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => PicturesUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => PicturesUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => PicturesScalarWhereInputSchema),z.lazy(() => PicturesScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.number().optional(), increment: z.number().optional(), @@ -2372,17 +2610,6 @@ export const NestedDateTimeNullableFilterSchema: z.ZodType NestedDateTimeNullableFilterSchema) ]).optional().nullable(), }).strict(); -export const NestedDateTimeFilterSchema: z.ZodType = z.object({ - equals: z.coerce.date().optional(), - in: z.coerce.date().array().optional(), - notIn: z.coerce.date().array().optional(), - lt: z.coerce.date().optional(), - lte: z.coerce.date().optional(), - gt: z.coerce.date().optional(), - gte: z.coerce.date().optional(), - not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), -}).strict(); - export const NestedDateTimeNullableWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional().nullable(), in: z.coerce.date().array().optional().nullable(), @@ -2397,6 +2624,17 @@ export const NestedDateTimeNullableWithAggregatesFilterSchema: z.ZodType NestedDateTimeNullableFilterSchema).optional() }).strict(); +export const NestedDateTimeFilterSchema: z.ZodType = z.object({ + equals: z.coerce.date().optional(), + in: z.coerce.date().array().optional(), + notIn: z.coerce.date().array().optional(), + lt: z.coerce.date().optional(), + lte: z.coerce.date().optional(), + gt: z.coerce.date().optional(), + gte: z.coerce.date().optional(), + not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), +}).strict(); + export const NestedDateTimeWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional(), in: z.coerce.date().array().optional(), @@ -2522,6 +2760,142 @@ export const UserUncheckedUpdateWithoutDelegation_delegation_delegatedToTouserIn report: z.lazy(() => ReportUncheckedUpdateManyWithoutUserNestedInputSchema).optional() }).strict(); +export const ReportCreateWithoutPicturesInputSchema: 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(), + user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema) +}).strict(); + +export const ReportUncheckedCreateWithoutPicturesInputSchema: 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() +}).strict(); + +export const ReportCreateOrConnectWithoutPicturesInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ReportWhereUniqueInputSchema), + create: z.union([ z.lazy(() => ReportCreateWithoutPicturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutPicturesInputSchema) ]), +}).strict(); + +export const ReportUpsertWithoutPicturesInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => ReportUpdateWithoutPicturesInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutPicturesInputSchema) ]), + create: z.union([ z.lazy(() => ReportCreateWithoutPicturesInputSchema),z.lazy(() => ReportUncheckedCreateWithoutPicturesInputSchema) ]), +}).strict(); + +export const ReportUpdateWithoutPicturesInputSchema: 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(), + user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional() +}).strict(); + +export const ReportUncheckedUpdateWithoutPicturesInputSchema: 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(), +}).strict(); + +export const PicturesCreateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.string(), + url: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const PicturesUncheckedCreateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.string(), + url: z.string().optional().nullable(), + createdAt: z.coerce.date().optional().nullable() +}).strict(); + +export const PicturesCreateOrConnectWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => PicturesWhereUniqueInputSchema), + create: z.union([ z.lazy(() => PicturesCreateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedCreateWithoutReportInputSchema) ]), +}).strict(); + +export const PicturesCreateManyReportInputEnvelopeSchema: z.ZodType = z.object({ + data: z.lazy(() => PicturesCreateManyReportInputSchema).array(), + skipDuplicates: z.boolean().optional() +}).strict(); + export const UserCreateWithoutReportInputSchema: z.ZodType = z.object({ id: z.string(), name: z.string(), @@ -2543,6 +2917,32 @@ export const UserCreateOrConnectWithoutReportInputSchema: z.ZodType UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]), }).strict(); +export const PicturesUpsertWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => PicturesWhereUniqueInputSchema), + update: z.union([ z.lazy(() => PicturesUpdateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedUpdateWithoutReportInputSchema) ]), + create: z.union([ z.lazy(() => PicturesCreateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedCreateWithoutReportInputSchema) ]), +}).strict(); + +export const PicturesUpdateWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => PicturesWhereUniqueInputSchema), + data: z.union([ z.lazy(() => PicturesUpdateWithoutReportInputSchema),z.lazy(() => PicturesUncheckedUpdateWithoutReportInputSchema) ]), +}).strict(); + +export const PicturesUpdateManyWithWhereWithoutReportInputSchema: z.ZodType = z.object({ + where: z.lazy(() => PicturesScalarWhereInputSchema), + data: z.union([ z.lazy(() => PicturesUpdateManyMutationInputSchema),z.lazy(() => PicturesUncheckedUpdateManyWithoutPicturesInputSchema) ]), +}).strict(); + +export const PicturesScalarWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => PicturesScalarWhereInputSchema),z.lazy(() => PicturesScalarWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => PicturesScalarWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => PicturesScalarWhereInputSchema),z.lazy(() => PicturesScalarWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + reportId: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + url: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + createdAt: z.union([ z.lazy(() => DateTimeNullableFilterSchema),z.coerce.date() ]).optional().nullable(), +}).strict(); + export const UserUpsertWithoutReportInputSchema: z.ZodType = z.object({ update: z.union([ z.lazy(() => UserUpdateWithoutReportInputSchema),z.lazy(() => UserUncheckedUpdateWithoutReportInputSchema) ]), create: z.union([ z.lazy(() => UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]), @@ -2673,7 +3073,8 @@ export const ReportCreateWithoutUserInputSchema: z.ZodType PicturesCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportUncheckedCreateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2698,7 +3099,8 @@ export const ReportUncheckedCreateWithoutUserInputSchema: z.ZodType PicturesUncheckedCreateNestedManyWithoutReportInputSchema).optional() }).strict(); export const ReportCreateOrConnectWithoutUserInputSchema: z.ZodType = z.object({ @@ -2870,6 +3272,30 @@ export const UdapUncheckedUpdateWithoutUserInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); +export const PicturesCreateManyReportInputSchema: z.ZodType = z.object({ + id: z.string(), + url: z.string().optional().nullable(), + 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(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const PicturesUncheckedUpdateWithoutReportInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const PicturesUncheckedUpdateManyWithoutPicturesInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + url: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + 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() @@ -2976,6 +3402,7 @@ 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() }).strict(); export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType = z.object({ @@ -3001,6 +3428,7 @@ 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() }).strict(); export const ReportUncheckedUpdateManyWithoutReportInputSchema: z.ZodType = z.object({ @@ -3265,6 +3693,68 @@ export const Pdf_snapshotFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereInputSchema.optional(), + orderBy: z.union([ PicturesOrderByWithRelationInputSchema.array(),PicturesOrderByWithRelationInputSchema ]).optional(), + cursor: PicturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: PicturesScalarFieldEnumSchema.array().optional(), +}).strict() as z.ZodType + +export const PicturesFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereInputSchema.optional(), + orderBy: z.union([ PicturesOrderByWithRelationInputSchema.array(),PicturesOrderByWithRelationInputSchema ]).optional(), + cursor: PicturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: PicturesScalarFieldEnumSchema.array().optional(), +}).strict() as z.ZodType + +export const PicturesFindManyArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereInputSchema.optional(), + orderBy: z.union([ PicturesOrderByWithRelationInputSchema.array(),PicturesOrderByWithRelationInputSchema ]).optional(), + cursor: PicturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: PicturesScalarFieldEnumSchema.array().optional(), +}).strict() as z.ZodType + +export const PicturesAggregateArgsSchema: z.ZodType = z.object({ + where: PicturesWhereInputSchema.optional(), + orderBy: z.union([ PicturesOrderByWithRelationInputSchema.array(),PicturesOrderByWithRelationInputSchema ]).optional(), + cursor: PicturesWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() as z.ZodType + +export const PicturesGroupByArgsSchema: z.ZodType = z.object({ + where: PicturesWhereInputSchema.optional(), + orderBy: z.union([ PicturesOrderByWithAggregationInputSchema.array(),PicturesOrderByWithAggregationInputSchema ]).optional(), + by: PicturesScalarFieldEnumSchema.array(), + having: PicturesScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() as z.ZodType + +export const PicturesFindUniqueArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereUniqueInputSchema, +}).strict() as z.ZodType + +export const PicturesFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereUniqueInputSchema, +}).strict() as z.ZodType + export const ReportFindFirstArgsSchema: z.ZodType = z.object({ select: ReportSelectSchema.optional(), include: ReportIncludeSchema.optional(), @@ -3660,6 +4150,47 @@ export const Pdf_snapshotDeleteManyArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + data: z.union([ PicturesCreateInputSchema,PicturesUncheckedCreateInputSchema ]), +}).strict() as z.ZodType + +export const PicturesUpsertArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereUniqueInputSchema, + create: z.union([ PicturesCreateInputSchema,PicturesUncheckedCreateInputSchema ]), + update: z.union([ PicturesUpdateInputSchema,PicturesUncheckedUpdateInputSchema ]), +}).strict() as z.ZodType + +export const PicturesCreateManyArgsSchema: z.ZodType = z.object({ + data: PicturesCreateManyInputSchema.array(), + skipDuplicates: z.boolean().optional(), +}).strict() as z.ZodType + +export const PicturesDeleteArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + where: PicturesWhereUniqueInputSchema, +}).strict() as z.ZodType + +export const PicturesUpdateArgsSchema: z.ZodType = z.object({ + select: PicturesSelectSchema.optional(), + include: PicturesIncludeSchema.optional(), + data: z.union([ PicturesUpdateInputSchema,PicturesUncheckedUpdateInputSchema ]), + where: PicturesWhereUniqueInputSchema, +}).strict() as z.ZodType + +export const PicturesUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ PicturesUpdateManyMutationInputSchema,PicturesUncheckedUpdateManyInputSchema ]), + where: PicturesWhereInputSchema.optional(), +}).strict() as z.ZodType + +export const PicturesDeleteManyArgsSchema: z.ZodType = z.object({ + where: PicturesWhereInputSchema.optional(), +}).strict() as z.ZodType + export const ReportCreateArgsSchema: z.ZodType = z.object({ select: ReportSelectSchema.optional(), include: ReportIncludeSchema.optional(), @@ -3840,6 +4371,11 @@ interface Pdf_snapshotGetPayload extends HKT { readonly type: Omit, "Please either choose `select` or `include`"> } +interface PicturesGetPayload extends HKT { + readonly _A?: boolean | null | undefined | Prisma.PicturesArgs + readonly type: Omit, "Please either choose `select` or `include`"> +} + interface ReportGetPayload extends HKT { readonly _A?: boolean | null | undefined | Prisma.ReportArgs readonly type: Omit, "Please either choose `select` or `include`"> @@ -4051,6 +4587,52 @@ export const tableSchemas = { Prisma.Pdf_snapshotScalarFieldEnum, Pdf_snapshotGetPayload >, + pictures: { + fields: new Map([ + [ + "id", + "TEXT" + ], + [ + "reportId", + "TEXT" + ], + [ + "url", + "TEXT" + ], + [ + "createdAt", + "TIMESTAMP" + ] + ]), + relations: [ + new Relation("report", "reportId", "id", "report", "PicturesToReport", "one"), + ], + modelSchema: (PicturesCreateInputSchema as any) + .partial() + .or((PicturesUncheckedCreateInputSchema as any).partial()), + createSchema: PicturesCreateArgsSchema, + createManySchema: PicturesCreateManyArgsSchema, + findUniqueSchema: PicturesFindUniqueArgsSchema, + findSchema: PicturesFindFirstArgsSchema, + updateSchema: PicturesUpdateArgsSchema, + updateManySchema: PicturesUpdateManyArgsSchema, + upsertSchema: PicturesUpsertArgsSchema, + deleteSchema: PicturesDeleteArgsSchema, + deleteManySchema: PicturesDeleteManyArgsSchema + } as TableSchema< + z.infer, + Prisma.PicturesCreateArgs['data'], + Prisma.PicturesUpdateArgs['data'], + Prisma.PicturesFindFirstArgs['select'], + Prisma.PicturesFindFirstArgs['where'], + Prisma.PicturesFindUniqueArgs['where'], + Omit, + Prisma.PicturesFindFirstArgs['orderBy'], + Prisma.PicturesScalarFieldEnum, + PicturesGetPayload + >, report: { fields: new Map([ [ @@ -4147,6 +4729,7 @@ export const tableSchemas = { ] ]), relations: [ + new Relation("pictures", "", "", "pictures", "PicturesToReport", "many"), new Relation("user", "createdBy", "id", "user", "ReportToUser", "one"), ], modelSchema: (ReportCreateInputSchema as any) diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index 78b43583..6b2e2cf9 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -215,5 +215,24 @@ export default [ "CREATE TRIGGER compensation_update_main_report_createdBy_into_oplog\n AFTER UPDATE ON \"main\".\"report\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'report') 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', 'user', 'COMPENSATION', json_patch('{}', json_object('id', \"id\")), json_object('id', \"id\"), NULL, NULL\n FROM \"main\".\"user\" WHERE \"id\" = new.\"createdBy\";\nEND;" ], "version": "906" + }, + { + "statements": [ + "CREATE TABLE \"pictures\" (\n \"id\" TEXT NOT NULL,\n \"reportId\" TEXT,\n \"url\" TEXT,\n \"createdAt\" TEXT,\n CONSTRAINT \"pictures_reportId_fkey\" FOREIGN KEY (\"reportId\") REFERENCES \"report\" (\"id\") ON DELETE CASCADE,\n CONSTRAINT \"pictures_pkey\" PRIMARY KEY (\"id\")\n) WITHOUT ROWID;\n", + "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'pictures', 1);", + "DROP TRIGGER IF EXISTS update_ensure_main_pictures_primarykey;", + "CREATE TRIGGER update_ensure_main_pictures_primarykey\n BEFORE UPDATE ON \"main\".\"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_pictures_into_oplog;", + "CREATE TRIGGER insert_main_pictures_into_oplog\n AFTER INSERT ON \"main\".\"pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'pictures')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'pictures', 'INSERT', json_patch('{}', json_object('id', new.\"id\")), json_object('createdAt', new.\"createdAt\", 'id', new.\"id\", 'reportId', new.\"reportId\", 'url', new.\"url\"), NULL, NULL);\nEND;", + "DROP TRIGGER IF EXISTS update_main_pictures_into_oplog;", + "CREATE TRIGGER update_main_pictures_into_oplog\n AFTER UPDATE ON \"main\".\"pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'pictures')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'pictures', 'UPDATE', json_patch('{}', json_object('id', new.\"id\")), json_object('createdAt', new.\"createdAt\", 'id', new.\"id\", 'reportId', new.\"reportId\", 'url', new.\"url\"), json_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\", 'url', old.\"url\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS delete_main_pictures_into_oplog;", + "CREATE TRIGGER delete_main_pictures_into_oplog\n AFTER DELETE ON \"main\".\"pictures\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'pictures')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'pictures', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\", 'url', old.\"url\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS compensation_insert_main_pictures_reportId_into_oplog;", + "CREATE TRIGGER compensation_insert_main_pictures_reportId_into_oplog\n AFTER INSERT 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;", + "DROP TRIGGER IF EXISTS compensation_update_main_pictures_reportId_into_oplog;", + "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" } ] \ 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 3421aa67..4fff7d48 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -283,5 +283,30 @@ export default [ "CREATE TRIGGER compensation_update_public_report_createdBy_into_oplog\n AFTER UPDATE ON \"public\".\"report\"\n FOR EACH ROW\n EXECUTE FUNCTION compensation_update_public_report_createdBy_into_oplog_function();" ], "version": "906" + }, + { + "statements": [ + "CREATE TABLE pictures (\n id text NOT NULL,\n \"reportId\" text,\n url text,\n \"createdAt\" timestamp without time zone,\n CONSTRAINT pictures_pkey PRIMARY KEY (id),\n CONSTRAINT \"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', 'pictures', 1)\n ON CONFLICT DO NOTHING;", + "DROP TRIGGER IF EXISTS update_ensure_public_pictures_primarykey ON \"public\".\"pictures\";", + "CREATE OR REPLACE FUNCTION update_ensure_public_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_pictures_primarykey\n BEFORE UPDATE ON \"public\".\"pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_pictures_primarykey_function();", + "DROP TRIGGER IF EXISTS insert_public_pictures_into_oplog ON \"public\".\"pictures\";", + " CREATE OR REPLACE FUNCTION insert_public_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 = '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 '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\", 'url', new.\"url\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER insert_public_pictures_into_oplog\n AFTER INSERT ON \"public\".\"pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_pictures_into_oplog_function();", + "DROP TRIGGER IF EXISTS update_public_pictures_into_oplog ON \"public\".\"pictures\";", + " CREATE OR REPLACE FUNCTION update_public_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 = '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 '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\", 'url', new.\"url\"),\n jsonb_build_object('createdAt', old.\"createdAt\", 'id', old.\"id\", 'reportId', old.\"reportId\", 'url', old.\"url\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_public_pictures_into_oplog\n AFTER UPDATE ON \"public\".\"pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_pictures_into_oplog_function();", + "DROP TRIGGER IF EXISTS delete_public_pictures_into_oplog ON \"public\".\"pictures\";", + " CREATE OR REPLACE FUNCTION delete_public_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 = '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 '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\", 'url', old.\"url\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER delete_public_pictures_into_oplog\n AFTER DELETE ON \"public\".\"pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_pictures_into_oplog_function();", + "DROP TRIGGER IF EXISTS compensation_insert_public_pictures_reportId_into_oplog ON \"public\".\"pictures\";", + " CREATE OR REPLACE FUNCTION compensation_insert_public_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 = '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_pictures_reportId_into_oplog\n AFTER INSERT ON \"public\".\"pictures\"\n FOR EACH ROW\n EXECUTE FUNCTION compensation_insert_public_pictures_reportId_into_oplog_function();", + "DROP TRIGGER IF EXISTS compensation_update_public_pictures_reportId_into_oplog ON \"public\".\"pictures\";", + " CREATE OR REPLACE FUNCTION compensation_update_public_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 = '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_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" } ] \ 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 0c0d095d..133f5f79 100644 --- a/packages/electric-client/src/generated/client/prismaClient.d.ts +++ b/packages/electric-client/src/generated/client/prismaClient.d.ts @@ -88,9 +88,29 @@ export type Pdf_snapshotPayload +export type PicturesPayload = { + name: "Pictures" + objects: { + report: ReportPayload | null + } + scalars: $Extensions.GetResult<{ + id: string + reportId: string | null + url: string | null + createdAt: Date | null + }, ExtArgs["result"]["pictures"]> + composites: {} +} + +/** + * Model Pictures + * + */ +export type Pictures = runtime.Types.DefaultSelection export type ReportPayload = { name: "Report" objects: { + pictures: PicturesPayload[] user: UserPayload } scalars: $Extensions.GetResult<{ @@ -366,6 +386,16 @@ export class PrismaClient< */ get pdf_snapshot(): Prisma.Pdf_snapshotDelegate; + /** + * `prisma.pictures`: Exposes CRUD operations for the **Pictures** model. + * Example usage: + * ```ts + * // Fetch zero or more Pictures + * const pictures = await prisma.pictures.findMany() + * ``` + */ + get pictures(): Prisma.PicturesDelegate; + /** * `prisma.report`: Exposes CRUD operations for the **Report** model. * Example usage: @@ -892,6 +922,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject Clause_v2: 'Clause_v2', Delegation: 'Delegation', Pdf_snapshot: 'Pdf_snapshot', + Pictures: 'Pictures', Report: 'Report', Service_instructeurs: 'Service_instructeurs', Udap: 'Udap', @@ -912,7 +943,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type TypeMap = { meta: { - modelProps: 'clause' | 'clause_v2' | 'delegation' | 'pdf_snapshot' | 'report' | 'service_instructeurs' | 'udap' | 'user' + modelProps: 'clause' | 'clause_v2' | 'delegation' | 'pdf_snapshot' | 'pictures' | 'report' | 'service_instructeurs' | 'udap' | 'user' txIsolationLevel: Prisma.TransactionIsolationLevel }, model: { @@ -1176,6 +1207,71 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } } } + Pictures: { + payload: PicturesPayload + operations: { + findUnique: { + args: Prisma.PicturesFindUniqueArgs, + result: $Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.PicturesFindUniqueOrThrowArgs, + result: $Utils.PayloadToResult + } + findFirst: { + args: Prisma.PicturesFindFirstArgs, + result: $Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.PicturesFindFirstOrThrowArgs, + result: $Utils.PayloadToResult + } + findMany: { + args: Prisma.PicturesFindManyArgs, + result: $Utils.PayloadToResult[] + } + create: { + args: Prisma.PicturesCreateArgs, + result: $Utils.PayloadToResult + } + createMany: { + args: Prisma.PicturesCreateManyArgs, + result: Prisma.BatchPayload + } + delete: { + args: Prisma.PicturesDeleteArgs, + result: $Utils.PayloadToResult + } + update: { + args: Prisma.PicturesUpdateArgs, + result: $Utils.PayloadToResult + } + deleteMany: { + args: Prisma.PicturesDeleteManyArgs, + result: Prisma.BatchPayload + } + updateMany: { + args: Prisma.PicturesUpdateManyArgs, + result: Prisma.BatchPayload + } + upsert: { + args: Prisma.PicturesUpsertArgs, + result: $Utils.PayloadToResult + } + aggregate: { + args: Prisma.PicturesAggregateArgs, + result: $Utils.Optional + } + groupBy: { + args: Prisma.PicturesGroupByArgs, + result: $Utils.Optional[] + } + count: { + args: Prisma.PicturesCountArgs, + result: $Utils.Optional | number + } + } + } Report: { payload: ReportPayload operations: { @@ -1612,6 +1708,41 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject */ + /** + * Count Type ReportCountOutputType + */ + + + export type ReportCountOutputType = { + pictures: number + } + + export type ReportCountOutputTypeSelect = { + pictures?: boolean | ReportCountOutputTypeCountPicturesArgs + } + + // Custom InputTypes + + /** + * ReportCountOutputType without action + */ + export type ReportCountOutputTypeArgs = { + /** + * Select specific fields to fetch from the ReportCountOutputType + */ + select?: ReportCountOutputTypeSelect | null + } + + + /** + * ReportCountOutputType without action + */ + export type ReportCountOutputTypeCountPicturesArgs = { + where?: PicturesWhereInput + } + + + /** * Count Type UdapCountOutputType */ @@ -5285,255 +5416,1170 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject /** - * Model Report + * Model Pictures */ - export type AggregateReport = { - _count: ReportCountAggregateOutputType | null - _avg: ReportAvgAggregateOutputType | null - _sum: ReportSumAggregateOutputType | null - _min: ReportMinAggregateOutputType | null - _max: ReportMaxAggregateOutputType | null - } - - export type ReportAvgAggregateOutputType = { - serviceInstructeur: number | null - } - - export type ReportSumAggregateOutputType = { - serviceInstructeur: number | null + export type AggregatePictures = { + _count: PicturesCountAggregateOutputType | null + _min: PicturesMinAggregateOutputType | null + _max: PicturesMaxAggregateOutputType | null } - export type ReportMinAggregateOutputType = { + export type PicturesMinAggregateOutputType = { id: string | null - title: string | null - projectDescription: string | null - redactedBy: string | null - meetDate: Date | 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 | null + reportId: string | null + url: string | null createdAt: Date | null - 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 } - export type ReportMaxAggregateOutputType = { + export type PicturesMaxAggregateOutputType = { id: string | null - title: string | null - projectDescription: string | null - redactedBy: string | null - meetDate: Date | 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 | null + reportId: string | null + url: string | null createdAt: Date | null - 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 } - export type ReportCountAggregateOutputType = { + export type PicturesCountAggregateOutputType = { id: number - title: number - projectDescription: number - redactedBy: number - meetDate: number - applicantName: number - applicantAddress: number - projectCadastralRef: number - projectSpaceType: number - decision: number - precisions: number - contacts: number - furtherInformation: number - createdBy: number + reportId: number + url: number createdAt: number - serviceInstructeur: number - pdf: number - disabled: number - udap_id: number - redactedById: number - applicantEmail: number - city: number - zipCode: number _all: number } - export type ReportAvgAggregateInputType = { - serviceInstructeur?: true - } - - export type ReportSumAggregateInputType = { - serviceInstructeur?: true - } - - export type ReportMinAggregateInputType = { + export type PicturesMinAggregateInputType = { id?: true - title?: true - projectDescription?: true - redactedBy?: true - meetDate?: true - applicantName?: true - applicantAddress?: true - projectCadastralRef?: true - projectSpaceType?: true - decision?: true - precisions?: true - contacts?: true - furtherInformation?: true - createdBy?: true + reportId?: true + url?: true createdAt?: true - serviceInstructeur?: true - pdf?: true - disabled?: true - udap_id?: true - redactedById?: true - applicantEmail?: true - city?: true - zipCode?: true } - export type ReportMaxAggregateInputType = { + export type PicturesMaxAggregateInputType = { id?: true - title?: true - projectDescription?: true - redactedBy?: true - meetDate?: true - applicantName?: true - applicantAddress?: true - projectCadastralRef?: true - projectSpaceType?: true - decision?: true - precisions?: true - contacts?: true - furtherInformation?: true - createdBy?: true + reportId?: true + url?: true createdAt?: true - serviceInstructeur?: true - pdf?: true - disabled?: true - udap_id?: true - redactedById?: true - applicantEmail?: true - city?: true - zipCode?: true } - export type ReportCountAggregateInputType = { + export type PicturesCountAggregateInputType = { id?: true - title?: true - projectDescription?: true - redactedBy?: true - meetDate?: true - applicantName?: true - applicantAddress?: true - projectCadastralRef?: true - projectSpaceType?: true - decision?: true - precisions?: true - contacts?: true - furtherInformation?: true - createdBy?: true + reportId?: true + url?: true createdAt?: true - serviceInstructeur?: true - pdf?: true - disabled?: true - udap_id?: true - redactedById?: true - applicantEmail?: true - city?: true - zipCode?: true _all?: true } - export type ReportAggregateArgs = { + export type PicturesAggregateArgs = { /** - * Filter which Report to aggregate. + * Filter which Pictures to aggregate. */ - where?: ReportWhereInput + where?: PicturesWhereInput /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} * - * Determine the order of Reports to fetch. + * Determine the order of 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?: ReportWhereUniqueInput + cursor?: PicturesWhereUniqueInput /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} * - * Take `±n` Reports from the position of the cursor. + * Take `±n` 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` Reports. + * Skip the first `n` Pictures. */ skip?: number /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * - * Count returned Reports - **/ - _count?: true | ReportCountAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to average - **/ - _avg?: ReportAvgAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to sum + * Count returned Pictures **/ - _sum?: ReportSumAggregateInputType + _count?: true | PicturesCountAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * * Select which fields to find the minimum value **/ - _min?: ReportMinAggregateInputType + _min?: PicturesMinAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * * Select which fields to find the maximum value **/ - _max?: ReportMaxAggregateInputType + _max?: PicturesMaxAggregateInputType } - export type GetReportAggregateType = { + export type GetPicturesAggregateType = { + [P in keyof T & keyof AggregatePictures]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : GetScalarType + : GetScalarType + } + + + + + export type PicturesGroupByArgs = { + where?: PicturesWhereInput + orderBy?: Enumerable + by: PicturesScalarFieldEnum[] + having?: PicturesScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: PicturesCountAggregateInputType | true + _min?: PicturesMinAggregateInputType + _max?: PicturesMaxAggregateInputType + } + + + export type PicturesGroupByOutputType = { + id: string + reportId: string | null + url: string | null + createdAt: Date | null + _count: PicturesCountAggregateOutputType | null + _min: PicturesMinAggregateOutputType | null + _max: PicturesMaxAggregateOutputType | null + } + + type GetPicturesGroupByPayload = Prisma.PrismaPromise< + Array< + PickArray & + { + [P in ((keyof T) & (keyof PicturesGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : GetScalarType + : GetScalarType + } + > + > + + + export type PicturesSelect = $Extensions.GetSelect<{ + id?: boolean + reportId?: boolean + url?: boolean + createdAt?: boolean + report?: boolean | ReportArgs + }, ExtArgs["result"]["pictures"]> + + export type PicturesSelectScalar = { + id?: boolean + reportId?: boolean + url?: boolean + createdAt?: boolean + } + + export type PicturesInclude = { + report?: boolean | ReportArgs + } + + + type PicturesGetPayload = $Types.GetResult + + type PicturesCountArgs = + Omit & { + select?: PicturesCountAggregateInputType | true + } + + export interface PicturesDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Pictures'], meta: { name: 'Pictures' } } + /** + * Find zero or one Pictures that matches the filter. + * @param {PicturesFindUniqueArgs} args - Arguments to find a Pictures + * @example + * // Get one Pictures + * const pictures = await prisma.pictures.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findUnique, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args: SelectSubset> + ): HasReject extends True ? Prisma__PicturesClient<$Types.GetResult, T, 'findUnique', never>, never, ExtArgs> : Prisma__PicturesClient<$Types.GetResult, T, 'findUnique', never> | null, null, ExtArgs> + + /** + * Find one Pictures that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {PicturesFindUniqueOrThrowArgs} args - Arguments to find a Pictures + * @example + * // Get one Pictures + * const pictures = await prisma.pictures.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findUniqueOrThrow>( + args?: SelectSubset> + ): Prisma__PicturesClient<$Types.GetResult, T, 'findUniqueOrThrow', never>, never, ExtArgs> + + /** + * Find the first 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 {PicturesFindFirstArgs} args - Arguments to find a Pictures + * @example + * // Get one Pictures + * const pictures = await prisma.pictures.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findFirst, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args?: SelectSubset> + ): HasReject extends True ? Prisma__PicturesClient<$Types.GetResult, T, 'findFirst', never>, never, ExtArgs> : Prisma__PicturesClient<$Types.GetResult, T, 'findFirst', never> | null, null, ExtArgs> + + /** + * Find the first 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 {PicturesFindFirstOrThrowArgs} args - Arguments to find a Pictures + * @example + * // Get one Pictures + * const pictures = await prisma.pictures.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findFirstOrThrow>( + args?: SelectSubset> + ): Prisma__PicturesClient<$Types.GetResult, T, 'findFirstOrThrow', never>, never, ExtArgs> + + /** + * Find zero or more 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 {PicturesFindManyArgs=} args - Arguments to filter and select certain fields only. + * @example + * // Get all Pictures + * const pictures = await prisma.pictures.findMany() + * + * // Get first 10 Pictures + * const pictures = await prisma.pictures.findMany({ take: 10 }) + * + * // Only select the `id` + * const picturesWithIdOnly = await prisma.pictures.findMany({ select: { id: true } }) + * + **/ + findMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>> + + /** + * Create a Pictures. + * @param {PicturesCreateArgs} args - Arguments to create a Pictures. + * @example + * // Create one Pictures + * const Pictures = await prisma.pictures.create({ + * data: { + * // ... data to create a Pictures + * } + * }) + * + **/ + create>( + args: SelectSubset> + ): Prisma__PicturesClient<$Types.GetResult, T, 'create', never>, never, ExtArgs> + + /** + * Create many Pictures. + * @param {PicturesCreateManyArgs} args - Arguments to create many Pictures. + * @example + * // Create many Pictures + * const pictures = await prisma.pictures.createMany({ + * data: { + * // ... provide data here + * } + * }) + * + **/ + createMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Delete a Pictures. + * @param {PicturesDeleteArgs} args - Arguments to delete one Pictures. + * @example + * // Delete one Pictures + * const Pictures = await prisma.pictures.delete({ + * where: { + * // ... filter to delete one Pictures + * } + * }) + * + **/ + delete>( + args: SelectSubset> + ): Prisma__PicturesClient<$Types.GetResult, T, 'delete', never>, never, ExtArgs> + + /** + * Update one Pictures. + * @param {PicturesUpdateArgs} args - Arguments to update one Pictures. + * @example + * // Update one Pictures + * const pictures = await prisma.pictures.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + **/ + update>( + args: SelectSubset> + ): Prisma__PicturesClient<$Types.GetResult, T, 'update', never>, never, ExtArgs> + + /** + * Delete zero or more Pictures. + * @param {PicturesDeleteManyArgs} args - Arguments to filter Pictures to delete. + * @example + * // Delete a few Pictures + * const { count } = await prisma.pictures.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + **/ + deleteMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Update zero or more Pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {PicturesUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Pictures + * const pictures = await prisma.pictures.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + **/ + updateMany>( + args: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Create or update one Pictures. + * @param {PicturesUpsertArgs} args - Arguments to update or create a Pictures. + * @example + * // Update or create a Pictures + * const pictures = await prisma.pictures.upsert({ + * create: { + * // ... data to create a Pictures + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Pictures we want to update + * } + * }) + **/ + upsert>( + args: SelectSubset> + ): Prisma__PicturesClient<$Types.GetResult, T, 'upsert', never>, never, ExtArgs> + + /** + * Count the number of Pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {PicturesCountArgs} args - Arguments to filter Pictures to count. + * @example + * // Count the number of Pictures + * const count = await prisma.pictures.count({ + * where: { + * // ... the filter for the 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 Pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {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 Pictures. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {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 PicturesGroupByArgs, + HasSelectOrTake extends Or< + Extends<'skip', Keys>, + Extends<'take', Keys> + >, + OrderByArg extends True extends HasSelectOrTake + ? { orderBy: PicturesGroupByArgs['orderBy'] } + : { orderBy?: 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 ? GetPicturesGroupByPayload : Prisma.PrismaPromise + + } + + /** + * The delegate class that acts as a "Promise-like" for 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__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 + + /** + * Pictures base type for findUnique actions + */ + export type PicturesFindUniqueArgsBase = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * Filter, which Pictures to fetch. + */ + where: PicturesWhereUniqueInput + } + + /** + * Pictures findUnique + */ + export interface PicturesFindUniqueArgs extends PicturesFindUniqueArgsBase { + /** + * Throw an Error if query returns no results + * @deprecated since 4.0.0: use `findUniqueOrThrow` method instead + */ + rejectOnNotFound?: RejectOnNotFound + } + + + /** + * Pictures findUniqueOrThrow + */ + export type PicturesFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * Filter, which Pictures to fetch. + */ + where: PicturesWhereUniqueInput + } + + + /** + * Pictures base type for findFirst actions + */ + export type PicturesFindFirstArgsBase = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * Filter, which Pictures to fetch. + */ + where?: PicturesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of 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 Pictures. + */ + cursor?: PicturesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` 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` Pictures. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Pictures. + */ + distinct?: Enumerable + } + + /** + * Pictures findFirst + */ + export interface PicturesFindFirstArgs extends PicturesFindFirstArgsBase { + /** + * Throw an Error if query returns no results + * @deprecated since 4.0.0: use `findFirstOrThrow` method instead + */ + rejectOnNotFound?: RejectOnNotFound + } + + + /** + * Pictures findFirstOrThrow + */ + export type PicturesFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * Filter, which Pictures to fetch. + */ + where?: PicturesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of 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 Pictures. + */ + cursor?: PicturesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` 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` Pictures. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Pictures. + */ + distinct?: Enumerable + } + + + /** + * Pictures findMany + */ + export type PicturesFindManyArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * Filter, which Pictures to fetch. + */ + where?: PicturesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of 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 Pictures. + */ + cursor?: PicturesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` 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` Pictures. + */ + skip?: number + distinct?: Enumerable + } + + + /** + * Pictures create + */ + export type PicturesCreateArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * The data needed to create a Pictures. + */ + data: XOR + } + + + /** + * Pictures createMany + */ + export type PicturesCreateManyArgs = { + /** + * The data used to create many Pictures. + */ + data: Enumerable + skipDuplicates?: boolean + } + + + /** + * Pictures update + */ + export type PicturesUpdateArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * The data needed to update a Pictures. + */ + data: XOR + /** + * Choose, which Pictures to update. + */ + where: PicturesWhereUniqueInput + } + + + /** + * Pictures updateMany + */ + export type PicturesUpdateManyArgs = { + /** + * The data used to update Pictures. + */ + data: XOR + /** + * Filter which Pictures to update + */ + where?: PicturesWhereInput + } + + + /** + * Pictures upsert + */ + export type PicturesUpsertArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * The filter to search for the Pictures to update in case it exists. + */ + where: PicturesWhereUniqueInput + /** + * In case the Pictures found by the `where` argument doesn't exist, create a new Pictures with this data. + */ + create: XOR + /** + * In case the Pictures was found with the provided `where` argument, update it with this data. + */ + update: XOR + } + + + /** + * Pictures delete + */ + export type PicturesDeleteArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + /** + * Filter which Pictures to delete. + */ + where: PicturesWhereUniqueInput + } + + + /** + * Pictures deleteMany + */ + export type PicturesDeleteManyArgs = { + /** + * Filter which Pictures to delete + */ + where?: PicturesWhereInput + } + + + /** + * Pictures without action + */ + export type PicturesArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + } + + + + /** + * Model Report + */ + + + export type AggregateReport = { + _count: ReportCountAggregateOutputType | null + _avg: ReportAvgAggregateOutputType | null + _sum: ReportSumAggregateOutputType | null + _min: ReportMinAggregateOutputType | null + _max: ReportMaxAggregateOutputType | null + } + + export type ReportAvgAggregateOutputType = { + serviceInstructeur: number | null + } + + export type ReportSumAggregateOutputType = { + serviceInstructeur: number | null + } + + export type ReportMinAggregateOutputType = { + id: string | null + title: string | null + projectDescription: string | null + redactedBy: string | null + meetDate: Date | 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 | null + createdAt: Date | null + 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 + } + + export type ReportMaxAggregateOutputType = { + id: string | null + title: string | null + projectDescription: string | null + redactedBy: string | null + meetDate: Date | 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 | null + createdAt: Date | null + 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 + } + + export type ReportCountAggregateOutputType = { + id: number + title: number + projectDescription: number + redactedBy: number + meetDate: number + applicantName: number + applicantAddress: number + projectCadastralRef: number + projectSpaceType: number + decision: number + precisions: number + contacts: number + furtherInformation: number + createdBy: number + createdAt: number + serviceInstructeur: number + pdf: number + disabled: number + udap_id: number + redactedById: number + applicantEmail: number + city: number + zipCode: number + _all: number + } + + + export type ReportAvgAggregateInputType = { + serviceInstructeur?: true + } + + export type ReportSumAggregateInputType = { + serviceInstructeur?: true + } + + export type ReportMinAggregateInputType = { + id?: true + title?: true + projectDescription?: true + redactedBy?: true + meetDate?: true + applicantName?: true + applicantAddress?: true + projectCadastralRef?: true + projectSpaceType?: true + decision?: true + precisions?: true + contacts?: true + furtherInformation?: true + createdBy?: true + createdAt?: true + serviceInstructeur?: true + pdf?: true + disabled?: true + udap_id?: true + redactedById?: true + applicantEmail?: true + city?: true + zipCode?: true + } + + export type ReportMaxAggregateInputType = { + id?: true + title?: true + projectDescription?: true + redactedBy?: true + meetDate?: true + applicantName?: true + applicantAddress?: true + projectCadastralRef?: true + projectSpaceType?: true + decision?: true + precisions?: true + contacts?: true + furtherInformation?: true + createdBy?: true + createdAt?: true + serviceInstructeur?: true + pdf?: true + disabled?: true + udap_id?: true + redactedById?: true + applicantEmail?: true + city?: true + zipCode?: true + } + + export type ReportCountAggregateInputType = { + id?: true + title?: true + projectDescription?: true + redactedBy?: true + meetDate?: true + applicantName?: true + applicantAddress?: true + projectCadastralRef?: true + projectSpaceType?: true + decision?: true + precisions?: true + contacts?: true + furtherInformation?: true + createdBy?: true + createdAt?: true + serviceInstructeur?: true + pdf?: true + disabled?: true + udap_id?: true + redactedById?: true + applicantEmail?: true + city?: true + zipCode?: true + _all?: true + } + + export type ReportAggregateArgs = { + /** + * Filter which Report to aggregate. + */ + where?: ReportWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Reports 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?: ReportWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Reports 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` Reports. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Reports + **/ + _count?: true | ReportCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: ReportAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: ReportSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: ReportMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: ReportMaxAggregateInputType + } + + export type GetReportAggregateType = { [P in keyof T & keyof AggregateReport]: P extends '_count' | 'count' ? T[P] extends true ? number @@ -5628,7 +6674,9 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: boolean city?: boolean zipCode?: boolean + pictures?: boolean | Report$picturesArgs user?: boolean | UserArgs + _count?: boolean | ReportCountOutputTypeArgs }, ExtArgs["result"]["report"]> export type ReportSelectScalar = { @@ -5658,7 +6706,9 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } export type ReportInclude = { + pictures?: boolean | Report$picturesArgs user?: boolean | UserArgs + _count?: boolean | ReportCountOutputTypeArgs } @@ -6031,6 +7081,8 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject 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); + pictures = {}>(args?: Subset>): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>| Null>; + user = {}>(args?: Subset>): Prisma__UserClient<$Types.GetResult, T, 'findUnique', never> | Null, never, ExtArgs>; private get _document(); @@ -6388,6 +7440,27 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } + /** + * Report.pictures + */ + export type Report$picturesArgs = { + /** + * Select specific fields to fetch from the Pictures + */ + select?: PicturesSelect | null + /** + * Choose, which related nodes to fetch as well. + */ + include?: PicturesInclude | null + where?: PicturesWhereInput + orderBy?: Enumerable + cursor?: PicturesWhereUniqueInput + take?: number + skip?: number + distinct?: Enumerable + } + + /** * Report without action */ @@ -9383,6 +10456,16 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type Pdf_snapshotScalarFieldEnum = (typeof Pdf_snapshotScalarFieldEnum)[keyof typeof Pdf_snapshotScalarFieldEnum] + export const PicturesScalarFieldEnum: { + id: 'id', + reportId: 'reportId', + url: 'url', + createdAt: 'createdAt' + }; + + export type PicturesScalarFieldEnum = (typeof PicturesScalarFieldEnum)[keyof typeof PicturesScalarFieldEnum] + + export const ReportScalarFieldEnum: { id: 'id', title: 'title', @@ -9659,6 +10742,49 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject user_id?: StringNullableWithAggregatesFilter | string | null } + export type PicturesWhereInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringFilter | string + reportId?: StringNullableFilter | string | null + url?: StringNullableFilter | string | null + createdAt?: DateTimeNullableFilter | Date | string | null + report?: XOR | null + } + + export type PicturesOrderByWithRelationInput = { + id?: SortOrder + reportId?: SortOrderInput | SortOrder + url?: SortOrderInput | SortOrder + createdAt?: SortOrderInput | SortOrder + report?: ReportOrderByWithRelationInput + } + + export type PicturesWhereUniqueInput = { + id?: string + } + + export type PicturesOrderByWithAggregationInput = { + id?: SortOrder + reportId?: SortOrderInput | SortOrder + url?: SortOrderInput | SortOrder + createdAt?: SortOrderInput | SortOrder + _count?: PicturesCountOrderByAggregateInput + _max?: PicturesMaxOrderByAggregateInput + _min?: PicturesMinOrderByAggregateInput + } + + export type PicturesScalarWhereWithAggregatesInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringWithAggregatesFilter | string + reportId?: StringNullableWithAggregatesFilter | string | null + url?: StringNullableWithAggregatesFilter | string | null + createdAt?: DateTimeNullableWithAggregatesFilter | Date | string | null + } + export type ReportWhereInput = { AND?: Enumerable OR?: Enumerable @@ -9686,6 +10812,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: StringNullableFilter | string | null city?: StringNullableFilter | string | null zipCode?: StringNullableFilter | string | null + pictures?: PicturesListRelationFilter user?: XOR } @@ -9713,6 +10840,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: SortOrderInput | SortOrder city?: SortOrderInput | SortOrder zipCode?: SortOrderInput | SortOrder + pictures?: PicturesOrderByRelationAggregateInput user?: UserOrderByWithRelationInput } @@ -10164,6 +11292,54 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject user_id?: NullableStringFieldUpdateOperationsInput | string | null } + export type PicturesCreateInput = { + id: string + url?: string | null + createdAt?: Date | string | null + report?: ReportCreateNestedOneWithoutPicturesInput + } + + export type PicturesUncheckedCreateInput = { + id: string + reportId?: string | null + url?: string | null + createdAt?: Date | string | null + } + + export type PicturesUpdateInput = { + id?: StringFieldUpdateOperationsInput | string + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + report?: ReportUpdateOneWithoutPicturesNestedInput + } + + export type PicturesUncheckedUpdateInput = { + id?: StringFieldUpdateOperationsInput | string + reportId?: NullableStringFieldUpdateOperationsInput | string | null + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type PicturesCreateManyInput = { + id: string + reportId?: string | null + url?: string | null + createdAt?: Date | string | null + } + + export type PicturesUpdateManyMutationInput = { + id?: StringFieldUpdateOperationsInput | string + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type PicturesUncheckedUpdateManyInput = { + id?: StringFieldUpdateOperationsInput | string + reportId?: NullableStringFieldUpdateOperationsInput | string | null + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + export type ReportCreateInput = { id: string title?: string | null @@ -10187,6 +11363,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: string | null city?: string | null zipCode?: string | null + pictures?: PicturesCreateNestedManyWithoutReportInput user: UserCreateNestedOneWithoutReportInput } @@ -10214,6 +11391,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: string | null city?: string | null zipCode?: string | null + pictures?: PicturesUncheckedCreateNestedManyWithoutReportInput } export type ReportUpdateInput = { @@ -10239,6 +11417,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null + pictures?: PicturesUpdateManyWithoutReportNestedInput user?: UserUpdateOneRequiredWithoutReportNestedInput } @@ -10266,6 +11445,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null + pictures?: PicturesUncheckedUpdateManyWithoutReportNestedInput } export type ReportCreateManyInput = { @@ -10813,6 +11993,46 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedDateTimeNullableFilter | Date | string | null } + export type ReportRelationFilter = { + is?: ReportWhereInput | null + isNot?: ReportWhereInput | null + } + + export type PicturesCountOrderByAggregateInput = { + id?: SortOrder + reportId?: SortOrder + url?: SortOrder + createdAt?: SortOrder + } + + export type PicturesMaxOrderByAggregateInput = { + id?: SortOrder + reportId?: SortOrder + url?: SortOrder + createdAt?: SortOrder + } + + export type PicturesMinOrderByAggregateInput = { + id?: SortOrder + reportId?: SortOrder + url?: SortOrder + createdAt?: SortOrder + } + + export type DateTimeNullableWithAggregatesFilter = { + equals?: Date | string | null + in?: Enumerable | Enumerable | Date | string | null + notIn?: Enumerable | Enumerable | Date | string | null + lt?: Date | string + lte?: Date | string + gt?: Date | string + gte?: Date | string + not?: NestedDateTimeNullableWithAggregatesFilter | Date | string | null + _count?: NestedIntNullableFilter + _min?: NestedDateTimeNullableFilter + _max?: NestedDateTimeNullableFilter + } + export type DateTimeFilter = { equals?: Date | string in?: Enumerable | Enumerable | Date | string @@ -10824,6 +12044,16 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedDateTimeFilter | Date | string } + export type PicturesListRelationFilter = { + every?: PicturesWhereInput + some?: PicturesWhereInput + none?: PicturesWhereInput + } + + export type PicturesOrderByRelationAggregateInput = { + _count?: SortOrder + } + export type ReportCountOrderByAggregateInput = { id?: SortOrder title?: SortOrder @@ -10910,20 +12140,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject serviceInstructeur?: SortOrder } - export type DateTimeNullableWithAggregatesFilter = { - equals?: Date | string | null - in?: Enumerable | Enumerable | Date | string | null - notIn?: Enumerable | Enumerable | Date | string | null - lt?: Date | string - lte?: Date | string - gt?: Date | string - gte?: Date | string - not?: NestedDateTimeNullableWithAggregatesFilter | Date | string | null - _count?: NestedIntNullableFilter - _min?: NestedDateTimeNullableFilter - _max?: NestedDateTimeNullableFilter - } - export type DateTimeWithAggregatesFilter = { equals?: Date | string in?: Enumerable | Enumerable | Date | string @@ -11149,20 +12365,64 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject update?: XOR } + export type ReportCreateNestedOneWithoutPicturesInput = { + create?: XOR + connectOrCreate?: ReportCreateOrConnectWithoutPicturesInput + connect?: ReportWhereUniqueInput + } + + export type NullableDateTimeFieldUpdateOperationsInput = { + set?: Date | string | null + } + + export type ReportUpdateOneWithoutPicturesNestedInput = { + create?: XOR + connectOrCreate?: ReportCreateOrConnectWithoutPicturesInput + upsert?: ReportUpsertWithoutPicturesInput + disconnect?: boolean + delete?: boolean + connect?: ReportWhereUniqueInput + update?: XOR + } + + export type PicturesCreateNestedManyWithoutReportInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + createMany?: PicturesCreateManyReportInputEnvelope + connect?: Enumerable + } + export type UserCreateNestedOneWithoutReportInput = { create?: XOR connectOrCreate?: UserCreateOrConnectWithoutReportInput connect?: UserWhereUniqueInput } - export type NullableDateTimeFieldUpdateOperationsInput = { - set?: Date | string | null + export type PicturesUncheckedCreateNestedManyWithoutReportInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + createMany?: PicturesCreateManyReportInputEnvelope + connect?: Enumerable } export type DateTimeFieldUpdateOperationsInput = { set?: Date | string } + export type PicturesUpdateManyWithoutReportNestedInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + upsert?: Enumerable + createMany?: PicturesCreateManyReportInputEnvelope + set?: Enumerable + disconnect?: Enumerable + delete?: Enumerable + connect?: Enumerable + update?: Enumerable + updateMany?: Enumerable + deleteMany?: Enumerable + } + export type UserUpdateOneRequiredWithoutReportNestedInput = { create?: XOR connectOrCreate?: UserCreateOrConnectWithoutReportInput @@ -11171,6 +12431,20 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject update?: XOR } + export type PicturesUncheckedUpdateManyWithoutReportNestedInput = { + create?: XOR, Enumerable> + connectOrCreate?: Enumerable + upsert?: Enumerable + createMany?: PicturesCreateManyReportInputEnvelope + set?: Enumerable + disconnect?: Enumerable + delete?: Enumerable + connect?: Enumerable + update?: Enumerable + updateMany?: Enumerable + deleteMany?: Enumerable + } + export type IntFieldUpdateOperationsInput = { set?: number increment?: number @@ -11496,17 +12770,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedDateTimeNullableFilter | Date | string | null } - export type NestedDateTimeFilter = { - equals?: Date | string - in?: Enumerable | Enumerable | Date | string - notIn?: Enumerable | Enumerable | Date | string - lt?: Date | string - lte?: Date | string - gt?: Date | string - gte?: Date | string - not?: NestedDateTimeFilter | Date | string - } - export type NestedDateTimeNullableWithAggregatesFilter = { equals?: Date | string | null in?: Enumerable | Enumerable | Date | string | null @@ -11521,6 +12784,17 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedDateTimeNullableFilter } + export type NestedDateTimeFilter = { + equals?: Date | string + in?: Enumerable | Enumerable | Date | string + notIn?: Enumerable | Enumerable | Date | string + lt?: Date | string + lte?: Date | string + gt?: Date | string + gte?: Date | string + not?: NestedDateTimeFilter | Date | string + } + export type NestedDateTimeWithAggregatesFilter = { equals?: Date | string in?: Enumerable | Enumerable | Date | string @@ -11646,6 +12920,142 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject report?: ReportUncheckedUpdateManyWithoutUserNestedInput } + export type ReportCreateWithoutPicturesInput = { + 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 + user: UserCreateNestedOneWithoutReportInput + } + + export type ReportUncheckedCreateWithoutPicturesInput = { + 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 + } + + export type ReportCreateOrConnectWithoutPicturesInput = { + where: ReportWhereUniqueInput + create: XOR + } + + export type ReportUpsertWithoutPicturesInput = { + update: XOR + create: XOR + } + + export type ReportUpdateWithoutPicturesInput = { + 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 + user?: UserUpdateOneRequiredWithoutReportNestedInput + } + + export type ReportUncheckedUpdateWithoutPicturesInput = { + 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 + } + + export type PicturesCreateWithoutReportInput = { + id: string + url?: string | null + createdAt?: Date | string | null + } + + export type PicturesUncheckedCreateWithoutReportInput = { + id: string + url?: string | null + createdAt?: Date | string | null + } + + export type PicturesCreateOrConnectWithoutReportInput = { + where: PicturesWhereUniqueInput + create: XOR + } + + export type PicturesCreateManyReportInputEnvelope = { + data: Enumerable + skipDuplicates?: boolean + } + export type UserCreateWithoutReportInput = { id: string name: string @@ -11667,6 +13077,32 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject create: XOR } + export type PicturesUpsertWithWhereUniqueWithoutReportInput = { + where: PicturesWhereUniqueInput + update: XOR + create: XOR + } + + export type PicturesUpdateWithWhereUniqueWithoutReportInput = { + where: PicturesWhereUniqueInput + data: XOR + } + + export type PicturesUpdateManyWithWhereWithoutReportInput = { + where: PicturesScalarWhereInput + data: XOR + } + + export type PicturesScalarWhereInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringFilter | string + reportId?: StringNullableFilter | string | null + url?: StringNullableFilter | string | null + createdAt?: DateTimeNullableFilter | Date | string | null + } + export type UserUpsertWithoutReportInput = { update: XOR create: XOR @@ -11798,6 +13234,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: string | null city?: string | null zipCode?: string | null + pictures?: PicturesCreateNestedManyWithoutReportInput } export type ReportUncheckedCreateWithoutUserInput = { @@ -11823,6 +13260,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: string | null city?: string | null zipCode?: string | null + pictures?: PicturesUncheckedCreateNestedManyWithoutReportInput } export type ReportCreateOrConnectWithoutUserInput = { @@ -11994,6 +13432,30 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject udap_text?: NullableStringFieldUpdateOperationsInput | string | null } + export type PicturesCreateManyReportInput = { + id: string + url?: string | null + createdAt?: Date | string | null + } + + export type PicturesUpdateWithoutReportInput = { + id?: StringFieldUpdateOperationsInput | string + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type PicturesUncheckedUpdateWithoutReportInput = { + id?: StringFieldUpdateOperationsInput | string + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + + export type PicturesUncheckedUpdateManyWithoutPicturesInput = { + id?: StringFieldUpdateOperationsInput | string + url?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + } + export type UserCreateManyUdapInput = { id: string name: string @@ -12100,6 +13562,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null + pictures?: PicturesUpdateManyWithoutReportNestedInput } export type ReportUncheckedUpdateWithoutUserInput = { @@ -12125,6 +13588,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null zipCode?: NullableStringFieldUpdateOperationsInput | string | null + pictures?: 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 102a354f..4f11756d 100644 --- a/packages/electric-client/src/generated/typebox/index.ts +++ b/packages/electric-client/src/generated/typebox/index.ts @@ -1,7 +1,7 @@ export * from './atdatabases_migrations_applied'; export * from './atdatabases_migrations_appliedInput'; -export * from './atdatabases_migrations_versionInput'; export * from './atdatabases_migrations_version'; +export * from './atdatabases_migrations_versionInput'; export * from './clause'; export * from './clauseInput'; export * from './report'; @@ -12,11 +12,15 @@ export * from './udap'; export * from './udapInput'; export * from './user'; export * from './userInput'; -export * from './whitelistInput'; export * from './whitelist'; +export * from './whitelistInput'; export * from './internal_user'; export * from './internal_userInput'; export * from './service_instructeurs'; export * from './service_instructeursInput'; export * from './clause_v2'; export * from './clause_v2Input'; +export * from './pdf_snapshot'; +export * from './pdf_snapshotInput'; +export * from './pictures'; +export * from './picturesInput'; diff --git a/packages/electric-client/src/generated/typebox/pdf_snapshot.ts b/packages/electric-client/src/generated/typebox/pdf_snapshot.ts new file mode 100644 index 00000000..693209d3 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/pdf_snapshot.ts @@ -0,0 +1,11 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const pdf_snapshot = Type.Object({ + id: Type.String(), + report_id: Type.Optional(Type.String()), + html: Type.Optional(Type.String()), + report: Type.Optional(Type.String()), + user_id: Type.Optional(Type.String()), +}); + +export type pdf_snapshotType = Static; diff --git a/packages/electric-client/src/generated/typebox/pdf_snapshotInput.ts b/packages/electric-client/src/generated/typebox/pdf_snapshotInput.ts new file mode 100644 index 00000000..df4da339 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/pdf_snapshotInput.ts @@ -0,0 +1,11 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const pdf_snapshotInput = Type.Object({ + id: Type.String(), + report_id: Type.Optional(Type.String()), + html: Type.Optional(Type.String()), + report: Type.Optional(Type.String()), + user_id: Type.Optional(Type.String()), +}); + +export type pdf_snapshotInputType = Static; diff --git a/packages/electric-client/src/generated/typebox/pictures.ts b/packages/electric-client/src/generated/typebox/pictures.ts new file mode 100644 index 00000000..044489b6 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/pictures.ts @@ -0,0 +1,37 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const pictures = Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + url: 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 picturesType = Static; diff --git a/packages/electric-client/src/generated/typebox/picturesInput.ts b/packages/electric-client/src/generated/typebox/picturesInput.ts new file mode 100644 index 00000000..63d4544a --- /dev/null +++ b/packages/electric-client/src/generated/typebox/picturesInput.ts @@ -0,0 +1,37 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const picturesInput = Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + url: 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 picturesInputType = Static; diff --git a/packages/electric-client/src/generated/typebox/report.ts b/packages/electric-client/src/generated/typebox/report.ts index 3c7277eb..9b7d3da9 100644 --- a/packages/electric-client/src/generated/typebox/report.ts +++ b/packages/electric-client/src/generated/typebox/report.ts @@ -22,6 +22,16 @@ export const report = Type.Object({ 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()), + pictures: Type.Array( + Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + url: Type.Optional(Type.String()), + createdAt: Type.Optional(Type.String()), + }) + ), user: Type.Object({ id: Type.String(), name: Type.String(), diff --git a/packages/electric-client/src/generated/typebox/reportInput.ts b/packages/electric-client/src/generated/typebox/reportInput.ts index 3061e52f..71001aef 100644 --- a/packages/electric-client/src/generated/typebox/reportInput.ts +++ b/packages/electric-client/src/generated/typebox/reportInput.ts @@ -22,6 +22,16 @@ export const reportInput = Type.Object({ 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()), + pictures: Type.Array( + Type.Object({ + id: Type.String(), + reportId: Type.Optional(Type.String()), + url: Type.Optional(Type.String()), + createdAt: Type.Optional(Type.String()), + }) + ), user: Type.Object({ id: Type.String(), name: Type.String(), diff --git a/packages/electric-client/src/generated/typebox/user.ts b/packages/electric-client/src/generated/typebox/user.ts index 1f150aa9..4ddd3a6d 100644 --- a/packages/electric-client/src/generated/typebox/user.ts +++ b/packages/electric-client/src/generated/typebox/user.ts @@ -50,6 +50,8 @@ export const user = Type.Object({ 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()), }) ), udap: Type.Object({ diff --git a/packages/electric-client/src/generated/typebox/userInput.ts b/packages/electric-client/src/generated/typebox/userInput.ts index 669fb214..bebd0869 100644 --- a/packages/electric-client/src/generated/typebox/userInput.ts +++ b/packages/electric-client/src/generated/typebox/userInput.ts @@ -50,6 +50,8 @@ export const userInput = Type.Object({ 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()), }) ), udap: Type.Object({ diff --git a/packages/frontend/package.json b/packages/frontend/package.json index eaf0242a..6bb5ea1d 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -47,8 +47,10 @@ "@tiptap/starter-kit": "^2.4.0", "@ungap/with-resolvers": "^0.1.0", "@xstate/store": "^0.0.5", + "buffer": "^6.0.3", "date-fns": "^3.6.0", "electric-sql": "^0.12.1", + "idb-keyval": "^6.2.1", "install": "^0.13.0", "npm": "^10.5.0", "ofetch": "^1.3.4", @@ -80,6 +82,7 @@ "@types/react": "^18.2.64", "@types/react-dom": "^18.2.21", "@types/react-pdf": "^7.0.0", + "@types/serviceworker": "^0.0.95", "@types/uuid": "^9.0.8", "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", @@ -96,6 +99,12 @@ "vite": "^5.1.6", "vite-node": "^1.4.0", "vite-plugin-pwa": "^0.20.0", + "vite-plugin-top-level-await": "^1.4.4", + "workbox-core": "^7.1.0", + "workbox-expiration": "^7.1.0", + "workbox-precaching": "^7.1.0", + "workbox-routing": "^7.1.0", + "workbox-strategies": "^7.1.0", "workbox-window": "^7.1.0" } } diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index cd6229da..94521721 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -1,10 +1,10 @@ import { RouterProvider, createRouter } from "@tanstack/react-router"; import { useAuthContext } from "./contexts/AuthContext"; import { routeTree } from "./routeTree.gen"; +import { useEffect } from "react"; export const App = () => { const [auth] = useAuthContext(); - return ; }; diff --git a/packages/frontend/src/api.gen.ts b/packages/frontend/src/api.gen.ts index af6f750b..6e9cdbf2 100644 --- a/packages/frontend/src/api.gen.ts +++ b/packages/frontend/src/api.gen.ts @@ -144,6 +144,12 @@ export namespace Endpoints { udap_text?: string | undefined; }>; }; + export type post_Apiuploadimage = { + method: "POST"; + path: "/api/upload/image"; + parameters: never; + response: unknown; + }; export type post_Apipdfreport = { method: "POST"; path: "/api/pdf/report"; @@ -171,6 +177,7 @@ export type EndpointByMethod = { "/api/login": Endpoints.post_Apilogin; "/api/send-reset-password": Endpoints.post_ApisendResetPassword; "/api/reset-password": Endpoints.post_ApiresetPassword; + "/api/upload/image": Endpoints.post_Apiuploadimage; "/api/pdf/report": Endpoints.post_Apipdfreport; }; get: { diff --git a/packages/frontend/src/api.ts b/packages/frontend/src/api.ts index d45ea3e0..794826ae 100644 --- a/packages/frontend/src/api.ts +++ b/packages/frontend/src/api.ts @@ -2,6 +2,8 @@ import { ofetch } from "ofetch"; import { type GetEndpoints, type PostEndpoints, createApiClient } from "./api.gen"; import { ENV } from "./envVars"; +import { createStore, get, set } from "idb-keyval"; + export const api = createApiClient((method, url, parameters) => { const { body, query, header } = parameters || {}; @@ -19,6 +21,12 @@ const ref = { export const setToken = (token?: string | null) => { ref.token = token ?? null; + set("token", token, store); +}; + +const store = createStore("auth", "access"); +export const getTokenFromIdb = async () => { + return get("token", store); }; export type RouterInputs = AllEndpoints[T]["parameters"]; diff --git a/packages/frontend/src/db.ts b/packages/frontend/src/db.ts index f2efbb6b..76c628be 100644 --- a/packages/frontend/src/db.ts +++ b/packages/frontend/src/db.ts @@ -1,12 +1,5 @@ -import { electrify, ElectricDatabase } from "electric-sql/wa-sqlite"; -import type { ElectricConfig } from "electric-sql/config"; -import { ENV } from "./envVars"; -import { schema } from "@cr-vif/electric-client/frontend"; +import { initElectric } from "./service-worker/electric"; -const config = { - url: ENV.VITE_ELECTRIC_URL, -} satisfies ElectricConfig; -const conn = await ElectricDatabase.init("crvif.db", "/"); +const { electric, db } = await initElectric(); -export const electric = await electrify(conn, schema, config); -export const db = electric.db; +export { electric, db }; diff --git a/packages/frontend/src/features/InfoForm.tsx b/packages/frontend/src/features/InfoForm.tsx index cac17d67..a5441b25 100644 --- a/packages/frontend/src/features/InfoForm.tsx +++ b/packages/frontend/src/features/InfoForm.tsx @@ -1,20 +1,24 @@ -import { Box, Center, Divider, Flex, Stack, styled } from "#styled-system/jsx"; +import { InputGroup, InputGroupWithTitle } from "#components/InputGroup"; +import { SpaceTypeChips } from "#components/chips/SpaceTypeChips"; +import { css } from "#styled-system/css"; +import { Box, Center, Divider, Flex, Grid, Stack, styled } from "#styled-system/jsx"; 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 { useMutation, useQuery } from "@tanstack/react-query"; import { format, parse } from "date-fns"; -import { useRef } from "react"; +import { useLiveQuery } from "electric-sql/react"; +import { get, set } from "idb-keyval"; +import { ChangeEvent, useRef } from "react"; import { useFormContext, useWatch } from "react-hook-form"; -import { InputGroupWithTitle } from "#components/InputGroup"; -import { SpaceTypeChips } from "#components/chips/SpaceTypeChips"; +import { v4 } from "uuid"; import { useUser } from "../contexts/AuthContext"; -import type { Report } from "@cr-vif/electric-client/frontend"; -import { css } from "#styled-system/css"; -import { ServiceInstructeurSelect } from "./ServiceInstructeurSelect"; -import { useIsFormDisabled } from "./DisabledContext"; -import { useLiveQuery } from "electric-sql/react"; import { db } from "../db"; +import { useIsFormDisabled } from "./DisabledContext"; +import { ServiceInstructeurSelect } from "./ServiceInstructeurSelect"; +import { getPicturesStore, syncImages } from "./idb"; export const InfoForm = () => { const form = useFormContext(); @@ -131,6 +135,9 @@ export const InfoForm = () => { + + + { className={css({ flex: { base: "none", lg: 1 }, mb: "24px" })} disabled={isFormDisabled} label="Référence cadastrale" - nativeInputProps={form.register("projectCadastralRef")} + nativeInputProps={{ ...form.register("projectCadastralRef"), placeholder: "Seulement la principale" }} /> { ); }; + +const UploadImage = ({ reportId }: { reportId: string }) => { + const ref = useRef(null); + + const onChange = async (e: ChangeEvent) => { + const picturesStore = getPicturesStore(); + + const id = v4(); + const file = e.target.files?.[0]; + if (!file) return; + + const buffer = await getArrayBufferFromBlob(file); + set(id, buffer, picturesStore); + + await db.pictures.create({ + data: { + id, + reportId, + createdAt: new Date(), + }, + }); + + syncImages(); + }; + + return ( + <> + + + + ); +}; + +const ReportPictures = () => { + const form = useFormContext(); + + const picturesQuery = useLiveQuery( + db.pictures.liveMany({ + where: { reportId: form.getValues().id }, + orderBy: { createdAt: "asc" }, + }), + ); + + return ( + + + {/* */} + + {picturesQuery.results?.map((picture, index) => ( + + ))} + + {/* */} + + + ); +}; + +const PictureThumbnail = ({ picture, index }: { picture: Pictures; index: number }) => { + const deletePictureMutation = useMutation(() => db.pictures.delete({ where: { id: picture.id } })); + + const bgUrlQuery = useQuery({ + queryKey: ["picture", picture.id], + queryFn: async () => { + // if (picture.url) return picture.url; + const buffer = await get(picture.id, getPicturesStore()); + const blob = new Blob([buffer], { type: "image/png" }); + + return URL.createObjectURL(blob); + }, + }); + + return ( + + + + N° {index + 1} + + deletePictureMutation.mutate()} borderLeft="1px solid #DFDFDF"> +