From f1109ea12e050c60f696df8d47dd5eeb1da2c906 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 07:14:10 +0200 Subject: [PATCH 01/29] fix: replace strike with underline --- packages/frontend/package.json | 1 + .../src/features/text-editor/TextEditor.tsx | 44 +------------------ .../text-editor/TextEditorContext.tsx | 2 + .../text-editor/TextEditorToolbar.tsx | 4 +- pnpm-lock.yaml | 11 +++++ 5 files changed, 18 insertions(+), 44 deletions(-) diff --git a/packages/frontend/package.json b/packages/frontend/package.json index f01e60de..eb811af5 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -40,6 +40,7 @@ "@tiptap/extension-placeholder": "^2.3.0", "@tiptap/extension-text-align": "^2.3.0", "@tiptap/extension-text-style": "^2.3.0", + "@tiptap/extension-underline": "^2.4.0", "@tiptap/react": "^2.3.0", "@tiptap/starter-kit": "^2.3.0", "@ungap/with-resolvers": "^0.1.0", diff --git a/packages/frontend/src/features/text-editor/TextEditor.tsx b/packages/frontend/src/features/text-editor/TextEditor.tsx index 20b3f1cc..4e43b66d 100644 --- a/packages/frontend/src/features/text-editor/TextEditor.tsx +++ b/packages/frontend/src/features/text-editor/TextEditor.tsx @@ -1,48 +1,8 @@ -import { Placeholder } from "@tiptap/extension-placeholder"; -import { Color } from "@tiptap/extension-color"; -import { TextStyle } from "@tiptap/extension-text-style"; -import { Editor, EditorContent, useEditor } from "@tiptap/react"; -import StarterKit from "@tiptap/starter-kit"; -import { useContext, useEffect } from "react"; import { css, cx } from "#styled-system/css"; -import { TextEditorToolbar } from "./TextEditorToolbar"; +import { EditorContent } from "@tiptap/react"; +import { useContext, useEffect } from "react"; import { TextEditorContext } from "./TextEditorContext"; -interface Props { - defaultValue?: string; - onChange?: (value: string) => void; - autoFocus?: boolean; - readOnly?: boolean; - placeholder?: string; -} - -export const useTextEditor = (props: Props) => { - const { defaultValue, onChange, autoFocus, readOnly, placeholder } = props; - - return useEditor({ - autofocus: autoFocus ?? false, - editable: !readOnly, - extensions: [ - StarterKit.configure({ - codeBlock: false, - code: { - HTMLAttributes: { - class: "inline", - }, - }, - }), - Color.configure({ - types: ["textStyle"], - }), - Placeholder.configure({ - placeholder, - }), - TextStyle.configure(), - ], - content: defaultValue, - }); -}; - export const TextEditor = (props: { hasSubmitted?: boolean }) => { const { hasSubmitted } = props; diff --git a/packages/frontend/src/features/text-editor/TextEditorContext.tsx b/packages/frontend/src/features/text-editor/TextEditorContext.tsx index ebcc625f..4086c25b 100644 --- a/packages/frontend/src/features/text-editor/TextEditorContext.tsx +++ b/packages/frontend/src/features/text-editor/TextEditorContext.tsx @@ -4,6 +4,7 @@ import TextStyle from "@tiptap/extension-text-style"; import { Editor, useEditor } from "@tiptap/react"; import StarterKit from "@tiptap/starter-kit"; import { PropsWithChildren, createContext, useState } from "react"; +import { Underline } from "@tiptap/extension-underline"; export const TextEditorContext = createContext<{ editor: Editor | null }>({ editor: null, @@ -22,6 +23,7 @@ export const TextEditorContextProvider = ({ children }: PropsWithChildren) => { }, }, }), + Underline.configure({}), Color.configure({ types: ["textStyle"], }), diff --git a/packages/frontend/src/features/text-editor/TextEditorToolbar.tsx b/packages/frontend/src/features/text-editor/TextEditorToolbar.tsx index 24eb58ca..b4466e24 100644 --- a/packages/frontend/src/features/text-editor/TextEditorToolbar.tsx +++ b/packages/frontend/src/features/text-editor/TextEditorToolbar.tsx @@ -55,7 +55,7 @@ export const TextEditorToolbar = () => { > diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3bc8305..8e21fec6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -273,6 +273,9 @@ importers: '@tiptap/extension-text-style': specifier: ^2.3.0 version: 2.3.0(@tiptap/core@2.4.0) + '@tiptap/extension-underline': + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0) '@tiptap/react': specifier: ^2.3.0 version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0)(react-dom@18.2.0)(react@18.2.0) @@ -6506,6 +6509,14 @@ packages: '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) dev: false + /@tiptap/extension-underline@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-guWojb7JxUwLz4OKzwNExJwOkhZjgw/ttkXCMBT0PVe55k998MMYe1nvN0m2SeTW9IxurEPtScH4kYJ0XuSm8Q==} + peerDependencies: + '@tiptap/core': ^2.0.0 + dependencies: + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) + dev: false + /@tiptap/pm@2.4.0: resolution: {integrity: sha512-B1HMEqGS4MzIVXnpgRZDLm30mxDWj51LkBT/if1XD+hj5gm8B9Q0c84bhvODX6KIs+c6z+zsY9VkVu8w9Yfgxg==} dependencies: From 70599fbd6b0412508f0e8859a7b0e8ec5f2ba981 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 10:19:03 +0200 Subject: [PATCH 02/29] fix: carriage return on "precisions" and "description" --- packages/frontend/src/routeTree.gen.ts | 11 --- .../frontend/src/routes/export.$reportId.tsx | 72 ------------------- .../frontend/src/routes/pdf.$reportId.tsx | 2 +- packages/pdf/src/report.tsx | 12 +++- 4 files changed, 11 insertions(+), 86 deletions(-) delete mode 100644 packages/frontend/src/routes/export.$reportId.tsx diff --git a/packages/frontend/src/routeTree.gen.ts b/packages/frontend/src/routeTree.gen.ts index 46cc2968..24e35440 100644 --- a/packages/frontend/src/routeTree.gen.ts +++ b/packages/frontend/src/routeTree.gen.ts @@ -17,7 +17,6 @@ import { Route as LoginImport } from './routes/login' import { Route as IndexImport } from './routes/index' import { Route as ResetPasswordLinkImport } from './routes/reset-password.$link' import { Route as PdfReportIdImport } from './routes/pdf.$reportId' -import { Route as ExportReportIdImport } from './routes/export.$reportId' import { Route as EditReportIdImport } from './routes/edit.$reportId' // Create Virtual Routes @@ -59,11 +58,6 @@ const PdfReportIdRoute = PdfReportIdImport.update({ getParentRoute: () => rootRoute, } as any) -const ExportReportIdRoute = ExportReportIdImport.update({ - path: '/export/$reportId', - getParentRoute: () => rootRoute, -} as any) - const EditReportIdRoute = EditReportIdImport.update({ path: '/edit/$reportId', getParentRoute: () => rootRoute, @@ -89,10 +83,6 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof EditReportIdImport parentRoute: typeof rootRoute } - '/export/$reportId': { - preLoaderRoute: typeof ExportReportIdImport - parentRoute: typeof rootRoute - } '/pdf/$reportId': { preLoaderRoute: typeof PdfReportIdImport parentRoute: typeof rootRoute @@ -115,7 +105,6 @@ export const routeTree = rootRoute.addChildren([ LoginRoute, SignupLazyRoute, EditReportIdRoute, - ExportReportIdRoute, PdfReportIdRoute, ResetPasswordLinkRoute, ResetPasswordIndexLazyRoute, diff --git a/packages/frontend/src/routes/export.$reportId.tsx b/packages/frontend/src/routes/export.$reportId.tsx deleted file mode 100644 index 902dabe8..00000000 --- a/packages/frontend/src/routes/export.$reportId.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { Flex } from "#styled-system/jsx"; -import type { Udap } from "@cr-vif/electric-client/frontend"; -import { Chip } from "@cr-vif/electric-client/frontend"; -import { PDFViewer } from "@react-pdf/renderer"; -import { createFileRoute } from "@tanstack/react-router"; -import { useLiveQuery } from "electric-sql/react"; -import { useState } from "react"; -import useDebounce from "react-use/lib/useDebounce"; -import { useUser } from "../contexts/AuthContext"; -import { db } from "../db"; -import type { ReportWithUser } from "../features/ReportList"; -import { useChipOptions } from "../features/chips/useChipOptions"; -import { TextEditor } from "../features/text-editor/TextEditor"; -import { ReportPDFDocument, getReportHtmlString } from "@cr-vif/pdf"; -import Button from "@codegouvfr/react-dsfr/Button"; -import { useMutation } from "@tanstack/react-query"; -import { api } from "../api"; - -const ExportPdf = () => { - const { reportId } = Route.useParams(); - const { results: report } = useLiveQuery(db.report.liveUnique({ where: { id: reportId }, include: { user: true } })); - const chipOptions = useChipOptions(); - - return ( - - {report && chipOptions?.length ? : null} - - ); -}; - -const WithReport = ({ report, chipOptions }: { report: ReportWithUser; chipOptions: Chip[] }) => { - const { udap } = useUser()!; - const [value, setValue] = useState(getReportHtmlString(report, chipOptions, udap as Udap)); - const [debouncedValue, setDebouncedValue] = useState(value); - - const generatePdfMutation = useMutation((htmlString: string) => - api.post("/api/pdf/report", { body: { reportId: report.id, htmlString } }), - ); - - useDebounce(() => setDebouncedValue(value), 1000, [value, chipOptions]); - - return ( - - setValue(e)} /> - - - - - - - - ); -}; - -// const styles = StyleSheet.create({ -// page: { -// flexDirection: "row", -// backgroundColor: "white", -// color: "black", -// }, -// section: { -// margin: 10, -// padding: 10, -// flexGrow: 1, -// }, -// }); - -export const Route = createFileRoute("/export/$reportId")({ - component: () => , -}); diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index 11636c84..0c9bc681 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -112,7 +112,6 @@ export const PDF = () => { ); } - return ( @@ -342,6 +341,7 @@ const PdfCanvasPage = ({ file, page }: { file: string; page: number }) => { return ( Précisions :
- ${report.precisions} + ${report.precisions + ?.split("\n") + .map((s) => s.trim()) + .join("
")}

` : "" }

Le projet pour rappel :
- ${report.projectDescription ?? ""} + ${ + report.projectDescription + ?.split("\n") + .map((s) => s.trim()) + .join("
") ?? "" + }

From 019be571a785fd998ca84f5e806e40c9daf8f897 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 10:26:49 +0200 Subject: [PATCH 03/29] fix: text editor carriage return --- packages/frontend/package.json | 1 + packages/frontend/src/features/ReportList.tsx | 6 +++--- .../features/text-editor/TextEditorContext.tsx | 10 +++++++++- pnpm-lock.yaml | 17 ++++++++++++++--- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/packages/frontend/package.json b/packages/frontend/package.json index eb811af5..d67a12f4 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -36,6 +36,7 @@ "@tanstack/react-router": "^1.22.2", "@tanstack/router-devtools": "^1.22.2", "@tiptap/extension-color": "^2.3.0", + "@tiptap/extension-hard-break": "^2.4.0", "@tiptap/extension-link": "^2.3.0", "@tiptap/extension-placeholder": "^2.3.0", "@tiptap/extension-text-align": "^2.3.0", diff --git a/packages/frontend/src/features/ReportList.tsx b/packages/frontend/src/features/ReportList.tsx index 741e60ae..b696d12e 100644 --- a/packages/frontend/src/features/ReportList.tsx +++ b/packages/frontend/src/features/ReportList.tsx @@ -25,7 +25,7 @@ export const MyReports = () => { const user = useUser()!; const myReports = useLiveQuery( db.report.liveMany({ - where: { AND: [{ disabled: false }, { OR: [{ createdBy: user.id }, { redactedById: user.id }] }] }, + where: { disabled: false, OR: [{ createdBy: user.id }, { redactedById: user.id }] }, take: 20, skip: page * 20, orderBy: { createdAt: "desc" }, @@ -37,8 +37,8 @@ export const MyReports = () => { const nbReports = useLiveQuery<[{ count: number }]>( db.liveRawQuery({ - sql: `SELECT COUNT(*) AS count FROM report WHERE createdBy = ? AND disabled = FALSE`, - args: [user.id], + sql: `SELECT COUNT(*) AS count FROM report WHERE createdBy = ? OR redactedById = ? AND disabled = FALSE`, + args: [user.id, user.id], }), ); diff --git a/packages/frontend/src/features/text-editor/TextEditorContext.tsx b/packages/frontend/src/features/text-editor/TextEditorContext.tsx index 4086c25b..5b24efc0 100644 --- a/packages/frontend/src/features/text-editor/TextEditorContext.tsx +++ b/packages/frontend/src/features/text-editor/TextEditorContext.tsx @@ -1,10 +1,11 @@ import Color from "@tiptap/extension-color"; import Placeholder from "@tiptap/extension-placeholder"; import TextStyle from "@tiptap/extension-text-style"; -import { Editor, useEditor } from "@tiptap/react"; +import { Editor, Extension, useEditor } from "@tiptap/react"; import StarterKit from "@tiptap/starter-kit"; import { PropsWithChildren, createContext, useState } from "react"; import { Underline } from "@tiptap/extension-underline"; +import { HardBreak } from "@tiptap/extension-hard-break"; export const TextEditorContext = createContext<{ editor: Editor | null }>({ editor: null, @@ -29,6 +30,13 @@ export const TextEditorContextProvider = ({ children }: PropsWithChildren) => { }), Placeholder.configure({}), TextStyle.configure(), + HardBreak.extend({ + addKeyboardShortcuts() { + return { + Enter: () => this.editor.commands.setHardBreak(), + }; + }, + }), ], content: "", }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e21fec6..4e209b8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -261,6 +261,9 @@ importers: '@tiptap/extension-color': specifier: ^2.3.0 version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/extension-text-style@2.3.0) + '@tiptap/extension-hard-break': + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0) '@tiptap/extension-link': specifier: ^2.3.0 version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) @@ -6388,14 +6391,22 @@ packages: '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-hard-break@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-9pXi69SzLabbjY5KZ54UKzu7HAHTla9aYZKH56VatOAiJOPKJppFbU2/NfJwGzDrEtfOiDqr3dYbUDF3RuCFoQ==} + /@tiptap/extension-hard-break@2.4.0(@tiptap/core@2.3.0): + resolution: {integrity: sha512-3+Z6zxevtHza5IsDBZ4lZqvNR3Kvdqwxq/QKCKu9UhJN1DUjsg/l1Jn2NilSQ3NYkBYh2yJjT8CMo9pQIu776g==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) dev: false + /@tiptap/extension-hard-break@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-3+Z6zxevtHza5IsDBZ4lZqvNR3Kvdqwxq/QKCKu9UhJN1DUjsg/l1Jn2NilSQ3NYkBYh2yJjT8CMo9pQIu776g==} + peerDependencies: + '@tiptap/core': ^2.0.0 + dependencies: + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) + dev: false + /@tiptap/extension-heading@2.3.0(@tiptap/core@2.3.0): resolution: {integrity: sha512-YcZoUYfqb0nohoPgem4f8mjn5OqDomFrbJiC9VRHUOCIuEu+aJEYwp8mmdkLnS3f+LRCZ6G76cJJ50lkzSAZRw==} peerDependencies: @@ -6568,7 +6579,7 @@ packages: '@tiptap/extension-document': 2.3.0(@tiptap/core@2.3.0) '@tiptap/extension-dropcursor': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) '@tiptap/extension-gapcursor': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-hard-break': 2.3.0(@tiptap/core@2.3.0) + '@tiptap/extension-hard-break': 2.4.0(@tiptap/core@2.3.0) '@tiptap/extension-heading': 2.3.0(@tiptap/core@2.3.0) '@tiptap/extension-history': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) '@tiptap/extension-horizontal-rule': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) From dbb555ba66b8f733d89925499336a7ee1b44c5db Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 10:33:17 +0200 Subject: [PATCH 04/29] bump tiptap version --- packages/frontend/package.json | 14 +- .../text-editor/TextEditorContext.tsx | 8 +- pnpm-lock.yaml | 228 ++++++++---------- 3 files changed, 117 insertions(+), 133 deletions(-) diff --git a/packages/frontend/package.json b/packages/frontend/package.json index d67a12f4..314ce251 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -35,15 +35,15 @@ "@tanstack/react-query": "^4.18.0", "@tanstack/react-router": "^1.22.2", "@tanstack/router-devtools": "^1.22.2", - "@tiptap/extension-color": "^2.3.0", + "@tiptap/extension-color": "^2.4.0", "@tiptap/extension-hard-break": "^2.4.0", - "@tiptap/extension-link": "^2.3.0", - "@tiptap/extension-placeholder": "^2.3.0", - "@tiptap/extension-text-align": "^2.3.0", - "@tiptap/extension-text-style": "^2.3.0", + "@tiptap/extension-link": "^2.4.0", + "@tiptap/extension-placeholder": "^2.4.0", + "@tiptap/extension-text-align": "^2.4.0", + "@tiptap/extension-text-style": "^2.4.0", "@tiptap/extension-underline": "^2.4.0", - "@tiptap/react": "^2.3.0", - "@tiptap/starter-kit": "^2.3.0", + "@tiptap/react": "^2.4.0", + "@tiptap/starter-kit": "^2.4.0", "@ungap/with-resolvers": "^0.1.0", "@xstate/store": "^0.0.5", "date-fns": "^3.6.0", diff --git a/packages/frontend/src/features/text-editor/TextEditorContext.tsx b/packages/frontend/src/features/text-editor/TextEditorContext.tsx index 5b24efc0..96b9168e 100644 --- a/packages/frontend/src/features/text-editor/TextEditorContext.tsx +++ b/packages/frontend/src/features/text-editor/TextEditorContext.tsx @@ -1,11 +1,11 @@ import Color from "@tiptap/extension-color"; +import { HardBreak } from "@tiptap/extension-hard-break"; import Placeholder from "@tiptap/extension-placeholder"; import TextStyle from "@tiptap/extension-text-style"; -import { Editor, Extension, useEditor } from "@tiptap/react"; -import StarterKit from "@tiptap/starter-kit"; -import { PropsWithChildren, createContext, useState } from "react"; import { Underline } from "@tiptap/extension-underline"; -import { HardBreak } from "@tiptap/extension-hard-break"; +import { Editor, useEditor } from "@tiptap/react"; +import StarterKit from "@tiptap/starter-kit"; +import { PropsWithChildren, createContext } from "react"; export const TextEditorContext = createContext<{ editor: Editor | null }>({ editor: null, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4e209b8a..7298a4a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -259,32 +259,32 @@ importers: specifier: ^1.22.2 version: 1.26.7(csstype@3.1.3)(react-dom@18.2.0)(react@18.2.0) '@tiptap/extension-color': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/extension-text-style@2.3.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0)(@tiptap/extension-text-style@2.4.0) '@tiptap/extension-hard-break': specifier: ^2.4.0 version: 2.4.0(@tiptap/core@2.4.0) '@tiptap/extension-link': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) '@tiptap/extension-placeholder': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) '@tiptap/extension-text-align': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/core@2.4.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0) '@tiptap/extension-text-style': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/core@2.4.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0) '@tiptap/extension-underline': specifier: ^2.4.0 version: 2.4.0(@tiptap/core@2.4.0) '@tiptap/react': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0)(react-dom@18.2.0)(react@18.2.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0)(react-dom@18.2.0)(react@18.2.0) '@tiptap/starter-kit': - specifier: ^2.3.0 - version: 2.3.0(@tiptap/pm@2.4.0) + specifier: ^2.4.0 + version: 2.4.0(@tiptap/pm@2.4.0) '@ungap/with-resolvers': specifier: ^0.1.0 version: 0.1.0 @@ -6273,14 +6273,6 @@ packages: resolution: {integrity: sha512-cxHYbrXfnCWsklydIHSw5GCMHUPqpJ/enxWSyVHNOgNe61sit/+aOXTTI+VOdWkvVaJsI2vsB9N4+YDNITawOQ==} dev: true - /@tiptap/core@2.3.0(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-Gk2JN3i5CMkYGmsbyFI7cBUftWa+F7QYmeCLTWfbuy+hCM2OBsnYVKxhggFPGXRL5KLBEgBWeCeWMHfIw3B2MA==} - peerDependencies: - '@tiptap/pm': ^2.0.0 - dependencies: - '@tiptap/pm': 2.4.0 - dev: false - /@tiptap/core@2.4.0(@tiptap/pm@2.4.0): resolution: {integrity: sha512-YJSahk8pkxpCs8SflCZfTnJpE7IPyUWIylfgXM2DefjRQa5DZ+c6sNY0s/zbxKYFQ6AuHVX40r9pCfcqHChGxQ==} peerDependencies: @@ -6289,24 +6281,24 @@ packages: '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-blockquote@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-Cztt77t7f+f0fuPy+FWUL8rKTIpcdsVT0z0zYQFFafvGaom0ZALQSOdTR/q+Kle9I4DaCMO3/Q0mwax/D4k4+A==} + /@tiptap/extension-blockquote@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-nJJy4KsPgQqWTTDOWzFRdjCfG5+QExfZj44dulgDFNh+E66xhamnbM70PklllXJgEcge7xmT5oKM0gKls5XgFw==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-bold@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-SzkbJibHXFNU7TRaAebTtwbXUEhGZ8+MhlBn12aQ4QhdjNtFpQwKXQPyYeDyZGcyiOFgtFTb+WIfCGm8ZX0Fpw==} + /@tiptap/extension-bold@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-csnW6hMDEHoRfxcPRLSqeJn+j35Lgtt1YRiOwn7DlS66sAECGRuoGfCvQSPij0TCDp4VCR9if5Sf8EymhnQumQ==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-bubble-menu@2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-dqyfQ8idTlhapvt0fxCGvkyjw92pBEwPqmkJ01h3EE8wTh53j0ytOHyMSf1KBuzardxpd8Yya3zlrAcR0Z3DlQ==} + /@tiptap/extension-bubble-menu@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-s99HmttUtpW3rScWq8rqk4+CGCwergNZbHLTkF6Rp6TSboMwfp+rwL5Q/JkcAG9KGLso1vGyXKbt1xHOvm8zMw==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 @@ -6316,62 +6308,62 @@ packages: tippy.js: 6.3.7 dev: false - /@tiptap/extension-bullet-list@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-4nU4vJ5FjRDLqHm085vYAkuo68UK84Wl6CDSjm7sPVcu0FvQX02Okqt65azoSYQeS1SSSd5qq9YZuGWcYdp4Cw==} + /@tiptap/extension-bullet-list@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-9S5DLIvFRBoExvmZ+/ErpTvs4Wf1yOEs8WXlKYUCcZssK7brTFj99XDwpHFA29HKDwma5q9UHhr2OB2o0JYAdw==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-code-block@2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-+Ne6PRBwQt70Pp8aW2PewaEy4bHrNYn4N+y8MObsFtqLutXBz4nXnsXWiNYFQZwzlUY+CHG4XS73mx8oMOFfDw==} + /@tiptap/extension-code-block@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-QWGdv1D56TBGbbJSj2cIiXGJEKguPiAl9ONzJ/Ql1ZksiQsYwx0YHriXX6TOC//T4VIf6NSClHEtwtxWBQ/Csg==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-code@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-O2FZmosiIRoVbW82fZy8xW4h4gb2xAzxWzHEcsHPlwCbE3vYvcBMmbkQ5p+33eRtuRQInzl3Q/cwupv9ctIepQ==} + /@tiptap/extension-code@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-wjhBukuiyJMq4cTcK3RBTzUPV24k5n1eEPlpmzku6ThwwkMdwynnMGMAmSF3fErh3AOyOUPoTTjgMYN2d10SJA==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-color@2.3.0(@tiptap/core@2.4.0)(@tiptap/extension-text-style@2.3.0): - resolution: {integrity: sha512-rqtdTaGawPZSRszwC/BlkJTF1diosIBBRSO5/YCRHT7CfGJNJyomL3eFREynXLKnXZ69SMceDh6yU6B54uTHXQ==} + /@tiptap/extension-color@2.4.0(@tiptap/core@2.4.0)(@tiptap/extension-text-style@2.4.0): + resolution: {integrity: sha512-aVuqGtzTIZO93niADdu+Hx8g03X0pS7wjrJcCcYkkDEbC/siC03zlxKZIYBW1Jiabe99Z7/s2KdtLoK6DW2A2g==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/extension-text-style': ^2.0.0 dependencies: '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) - '@tiptap/extension-text-style': 2.3.0(@tiptap/core@2.4.0) + '@tiptap/extension-text-style': 2.4.0(@tiptap/core@2.4.0) dev: false - /@tiptap/extension-document@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-WC55SMrtlsNOnHXpzbXDzJOp7eKmZV0rXooKmvCDqoiLO/DKpyQXyF+0UHfcRPmUAi2GWFPaer7+p1H9xzcjXg==} + /@tiptap/extension-document@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-3jRodQJZDGbXlRPERaloS+IERg/VwzpC1IO6YSJR9jVIsBO6xC29P3cKTQlg1XO7p6ZH/0ksK73VC5BzzTwoHg==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-dropcursor@2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-WWxxGQPWdbzxyYP6jtBYSq4wMRhINhI0wBC8pgkxTVwCIWftMuYj++FP4LLIpuWgj78PWApuoM0QQxk4Lj7FOw==} + /@tiptap/extension-dropcursor@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-c46HoG2PEEpSZv5rmS5UX/lJ6/kP1iVO0Ax+6JrNfLEIiDULUoi20NqdjolEa38La2VhWvs+o20OviiTOKEE9g==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-floating-menu@2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-bNY43/yU/+wGfmk2eDV7EPDAN/akbC+YnSKTA5VPJADzscvlrL2HlQrxbd/STIdlwKqdPU5MokcvCChhfZ4f6w==} + /@tiptap/extension-floating-menu@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-vLb9v+htbHhXyty0oaXjT3VC8St4xuGSHWUB9GuAJAQ+NajIO6rBPbLUmm9qM0Eh2zico5mpSD1Qtn5FM6xYzg==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 @@ -6381,24 +6373,16 @@ packages: tippy.js: 6.3.7 dev: false - /@tiptap/extension-gapcursor@2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-OxcXcfD0uzNcXdXu2ZpXFAtXIsgK2MBHvFUs0t0gxtcL/t43pTOQBLy+29Ei30BxpwLghtX8jQ6IDzMiybq/sA==} + /@tiptap/extension-gapcursor@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-F4y/0J2lseohkFUw9P2OpKhrJ6dHz69ZScABUvcHxjznJLd6+0Zt7014Lw5PA8/m2d/w0fX8LZQ88pZr4quZPQ==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-hard-break@2.4.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-3+Z6zxevtHza5IsDBZ4lZqvNR3Kvdqwxq/QKCKu9UhJN1DUjsg/l1Jn2NilSQ3NYkBYh2yJjT8CMo9pQIu776g==} - peerDependencies: - '@tiptap/core': ^2.0.0 - dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) - dev: false - /@tiptap/extension-hard-break@2.4.0(@tiptap/core@2.4.0): resolution: {integrity: sha512-3+Z6zxevtHza5IsDBZ4lZqvNR3Kvdqwxq/QKCKu9UhJN1DUjsg/l1Jn2NilSQ3NYkBYh2yJjT8CMo9pQIu776g==} peerDependencies: @@ -6407,44 +6391,44 @@ packages: '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-heading@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-YcZoUYfqb0nohoPgem4f8mjn5OqDomFrbJiC9VRHUOCIuEu+aJEYwp8mmdkLnS3f+LRCZ6G76cJJ50lkzSAZRw==} + /@tiptap/extension-heading@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-fYkyP/VMo7YHO76YVrUjd95Qeo0cubWn/Spavmwm1gLTHH/q7xMtbod2Z/F0wd6QHnc7+HGhO7XAjjKWDjldaw==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-history@2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-EF5Oq9fe/VBzU1Lsow2ubOlx1e1r4OQT1WUPGsRnL7pr94GH1Skpk7/hs9COJ9K6kP3Ebt42XjP0JEQodR58YA==} + /@tiptap/extension-history@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-gr5qsKAXEVGr1Lyk1598F7drTaEtAxqZiuuSwTCzZzkiwgEQsWMWTWc9F8FlneCEaqe1aIYg6WKWlmYPaFwr0w==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-horizontal-rule@2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-4DB8GU3uuDzzyqUmONIb3CHXcQ6Nuy4mHHkFSmUyEjg1i5eMQU5H7S6mNvZbltcJB2ImgCSwSMlj1kVN3MLIPg==} + /@tiptap/extension-horizontal-rule@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-yDgxy+YxagcEsBbdWvbQiXYxsv3noS1VTuGwc9G7ZK9xPmBHJ5y0agOkB7HskwsZvJHoaSqNRsh7oZTkf0VR3g==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-italic@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-jdFjLjdt5JtPlGMpoS6TEq5rznjbAYVlPwcw5VkYENVIYIGIR1ylIw2JwK1nUEsQ+OgYwVxHLejcUXWG1dCi2g==} + /@tiptap/extension-italic@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-aaW/L9q+KNHHK+X73MPloHeIsT191n3VLd3xm6uUcFDnUNvzYJ/q65/1ZicdtCaOLvTutxdrEvhbkrVREX6a8g==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-link@2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-CnJAlV0ZOdEhKmDfYKuHJVG8g79iCFQ85cX/CROTWyuMfXz9uhj2rLpZ6nfidVbonqxAhQp7NAIr2y+Fj5/53A==} + /@tiptap/extension-link@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-r3PjT0bjSKAorHAEBPA0icSMOlqALbxVlWU9vAc+Q3ndzt7ht0CTPNewzFF9kjzARABVt1cblXP/2+c0qGzcsg==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 @@ -6454,32 +6438,32 @@ packages: linkifyjs: 4.1.3 dev: false - /@tiptap/extension-list-item@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-mHU+IuRa56OT6YCtxf5Z7OSUrbWdKhGCEX7RTrteDVs5oMB6W3oF9j88M5qQmZ1WDcxvQhAOoXctnMt6eX9zcA==} + /@tiptap/extension-list-item@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-reUVUx+2cI2NIAqMZhlJ9uK/+zvRzm1GTmlU2Wvzwc7AwLN4yemj6mBDsmBLEXAKPvitfLh6EkeHaruOGymQtg==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-ordered-list@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-gkf0tltXjlUj0cqyfDV2r7xy9YPKtcVSWwlCPun6OOi0KzKFiAMqQpA9hy2W6gJ+KCp8+KNRMClZOfH4TnnBfg==} + /@tiptap/extension-ordered-list@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-Zo0c9M0aowv+2+jExZiAvhCB83GZMjZsxywmuOrdUbq5EGYKb7q8hDyN3hkrktVHr9UPXdPAYTmLAHztTOHYRA==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-paragraph@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-peCpA7DFqkd0cHb+cHv4YHNoMsXG8tKFNJlCHpLmsZWl2hWmpKgKmUrXAUfzjcFSvkZxn0xYc5oWbqUgg+2LzA==} + /@tiptap/extension-paragraph@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-+yse0Ow67IRwcACd9K/CzBcxlpr9OFnmf0x9uqpaWt1eHck1sJnti6jrw5DVVkyEBHDh/cnkkV49gvctT/NyCw==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-placeholder@2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-1BOyxVLzyUYf6yOOeJ8CfpP6DSCS4L6HjBZqj6WP1z1NyBV8RAfhf3UuLNcimfSWAETXFR3g0ZbaxxWffI1cEg==} + /@tiptap/extension-placeholder@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-SmWOjgWpmhFt0BPOnL65abCUH0wS5yksUJgtANn5bQoHF4HFSsyl7ETRmgf0ykxdjc7tzOg31FfpWVH4wzKSYg==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 @@ -6488,36 +6472,36 @@ packages: '@tiptap/pm': 2.4.0 dev: false - /@tiptap/extension-strike@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-gOW4ALeH8gkJiUGGXVy/AOd5lAPTX0bzoOW1+sCLcTA7t8dluBW7M2ngNYxTEtlKqyv7aLfrgsYSiqucmmfSLw==} + /@tiptap/extension-strike@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-pE1uN/fQPOMS3i+zxPYMmPmI3keubnR6ivwM+KdXWOMnBiHl9N4cNpJgq1n2eUUGKLurC2qrQHpnVyGAwBS6Vg==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-text-align@2.3.0(@tiptap/core@2.4.0): - resolution: {integrity: sha512-Pj+Yuk8xpYLGxNKGRUwvjlrOQP66ZyzjpJN5xqjJ7anzb2OKrluWMBco3xhjd/h03viA+wYeJKfnEpk/SbzHTQ==} + /@tiptap/extension-text-align@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-wpRe2OiLXTK4kTy4RZEPnPjFbK16kYHPAx1552hLXrOdyxbS7Sdbo+w4x7aGLLZZqZdudCFfkdtnqrc7PDVZdA==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-text-style@2.3.0(@tiptap/core@2.4.0): - resolution: {integrity: sha512-S+sQZqd+QtJjbZ0LOp0Krf0dlrdMx7BQL0sUNKPq8XXRMcfW0pEEFGIU/0VDFQCldLIuyd7lZ8zo5cjaAgskIA==} + /@tiptap/extension-text-style@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-H0uPWeZ4sXz3o836TDWnpd38qClqzEM2d6QJ9TK+cQ1vE5Gp8wQ5W4fwUV1KAHzpJKE/15+BXBjLyVYQdmXDaQ==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false - /@tiptap/extension-text@2.3.0(@tiptap/core@2.3.0): - resolution: {integrity: sha512-zkudl0TyKRy/8vHtyo5dMzjBRD0HEUnsS8YOsjR4xwQq5EYUXleRgM1s6lb6Yms2sLUAZRWdDddoQ686iq4zQg==} + /@tiptap/extension-text@2.4.0(@tiptap/core@2.4.0): + resolution: {integrity: sha512-LV0bvE+VowE8IgLca7pM8ll7quNH+AgEHRbSrsI3SHKDCYB9gTHMjWaAkgkUVaO1u0IfCrjnCLym/PqFKa+vvg==} peerDependencies: '@tiptap/core': ^2.0.0 dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) dev: false /@tiptap/extension-underline@2.4.0(@tiptap/core@2.4.0): @@ -6551,8 +6535,8 @@ packages: prosemirror-view: 1.33.6 dev: false - /@tiptap/react@2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-ThgFJQTWYKRClTV2Zg0wBRqfy0EGz3U4NOey7jwncUjSjx5+o9nXbfQAYWDKQFfWyE+wnrBTYfddEP9pHNX5cQ==} + /@tiptap/react@2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-baxnIr6Dy+5iGagOEIKFeHzdl1ZRa6Cg+SJ3GDL/BVLpO6KiCM3Mm5ymB726UKP1w7icrBiQD2fGY3Bx8KaiSA==} peerDependencies: '@tiptap/core': ^2.0.0 '@tiptap/pm': ^2.0.0 @@ -6560,35 +6544,35 @@ packages: react-dom: ^17.0.0 || ^18.0.0 dependencies: '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) - '@tiptap/extension-bubble-menu': 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-floating-menu': 2.3.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-bubble-menu': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-floating-menu': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) '@tiptap/pm': 2.4.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /@tiptap/starter-kit@2.3.0(@tiptap/pm@2.4.0): - resolution: {integrity: sha512-TjvCd/hzEnuEYOdr5uQqcfHOMuj7JRoZBPdheupwl3SbuYiCxtcqYyAE5qoGXWwuVe9xVGerOLVPkDUgmyrH6A==} - dependencies: - '@tiptap/core': 2.3.0(@tiptap/pm@2.4.0) - '@tiptap/extension-blockquote': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-bold': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-bullet-list': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-code': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-code-block': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-document': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-dropcursor': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-gapcursor': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-hard-break': 2.4.0(@tiptap/core@2.3.0) - '@tiptap/extension-heading': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-history': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-horizontal-rule': 2.3.0(@tiptap/core@2.3.0)(@tiptap/pm@2.4.0) - '@tiptap/extension-italic': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-list-item': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-ordered-list': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-paragraph': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-strike': 2.3.0(@tiptap/core@2.3.0) - '@tiptap/extension-text': 2.3.0(@tiptap/core@2.3.0) + /@tiptap/starter-kit@2.4.0(@tiptap/pm@2.4.0): + resolution: {integrity: sha512-DYYzMZdTEnRn9oZhKOeRCcB+TjhNz5icLlvJKoHoOGL9kCbuUyEf8WRR2OSPckI0+KUIPJL3oHRqO4SqSdTjfg==} + dependencies: + '@tiptap/core': 2.4.0(@tiptap/pm@2.4.0) + '@tiptap/extension-blockquote': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-bold': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-bullet-list': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-code': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-code-block': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-document': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-dropcursor': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-gapcursor': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-hard-break': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-heading': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-history': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-horizontal-rule': 2.4.0(@tiptap/core@2.4.0)(@tiptap/pm@2.4.0) + '@tiptap/extension-italic': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-list-item': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-ordered-list': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-paragraph': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-strike': 2.4.0(@tiptap/core@2.4.0) + '@tiptap/extension-text': 2.4.0(@tiptap/core@2.4.0) transitivePeerDependencies: - '@tiptap/pm' dev: false From 2c7c34c7f72afedba2b964e10d545a4f99031407 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 10:33:27 +0200 Subject: [PATCH 05/29] fix: display correct clauses in correct panel --- packages/frontend/src/features/menu/ClauseMenu.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/features/menu/ClauseMenu.tsx b/packages/frontend/src/features/menu/ClauseMenu.tsx index ecf94240..7f2d8af0 100644 --- a/packages/frontend/src/features/menu/ClauseMenu.tsx +++ b/packages/frontend/src/features/menu/ClauseMenu.tsx @@ -12,7 +12,10 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => { const clausesQuery = useLiveQuery( db.clause.liveMany({ where: { - udap_id: isNational ? "ALL" : user.udap_id, + key: { + in: isNational ? ["type-espace", "decision"] : ["contacts-utiles", "bonnes-pratiques"], + }, + OR: [{ udap_id: "ALL" }, { udap_id: user.udap_id! }], }, }), ); @@ -29,7 +32,7 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => { - {key} + {(clauseNameMap as any)[key] ?? key} {clauses.map((clause) => ( @@ -53,3 +56,10 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => { ); }; + +const clauseNameMap = { + "type-espace": "Type d'espace", + decision: "Décision", + "contacts-utiles": "Contacts utiles", + "bonnes-pratiques": "Bonnes pratiques", +}; From 5b008c4a9dc0af02e7390f776d702b3a9b3c07ce Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 11:31:08 +0200 Subject: [PATCH 06/29] fix: home page display --- packages/frontend/src/features/ReportList.tsx | 59 +++++++++++-------- packages/frontend/src/routes/index.tsx | 12 +++- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/packages/frontend/src/features/ReportList.tsx b/packages/frontend/src/features/ReportList.tsx index b696d12e..78885da1 100644 --- a/packages/frontend/src/features/ReportList.tsx +++ b/packages/frontend/src/features/ReportList.tsx @@ -16,6 +16,7 @@ import { ReportActions } from "./ReportActions"; import { Pagination } from "@codegouvfr/react-dsfr/Pagination"; import welcomeImage from "../assets/welcome.svg"; import { useIsDesktop } from "../hooks/useIsDesktop"; +import { chunk, makeArrayOf } from "pastable"; export type ReportWithUser = Report & { user?: { email: string; name: string } }; @@ -37,7 +38,7 @@ export const MyReports = () => { const nbReports = useLiveQuery<[{ count: number }]>( db.liveRawQuery({ - sql: `SELECT COUNT(*) AS count FROM report WHERE createdBy = ? OR redactedById = ? AND disabled = FALSE`, + sql: `SELECT COUNT(*) AS count FROM report WHERE (createdBy = ? OR redactedById = ?) AND disabled = FALSE`, args: [user.id, user.id], }), ); @@ -113,6 +114,8 @@ const NoReport = () => { ); }; +const nbPerColumn = 10; + export const ReportList = ({ reports, page, @@ -132,29 +135,32 @@ export const ReportList = ({ }) => { const error = reports.length === 0 ? : null; + const columns = chunk(reports, nbPerColumn); + return ( - - *:nth-child(-n+10)": { - gridColumn: { - base: "0", - lg: "1", - }, - }, - })} - gap="8px 28px" - gridTemplateRows={{ base: "repeat(20, 1fr)", lg: "repeat(10, 1fr)" }} - gridAutoFlow="column" - w="100%" - > - {error - ? !hideEmpty && error - : reports.map((report, index) => ( - - ))} - -

+ + {!hideEmpty && error ? ( + error + ) : ( + + {columns.slice(0, 2).map((reports) => { + return ( + + {reports.map((report, index) => ( + + ))} + + ); + })} + {columns.length === 1 ? : null} + + )} +
{hidePagination || error ? null : ( + {report.createdAt.toLocaleDateString()} - Rédigé par {report.user?.name ?? ""} + {report.applicantName ? <>Pour {report.applicantName} : null} + + {report.applicantName ? "p" : "P"}ar {report.user?.name ?? ""} + diff --git a/packages/frontend/src/routes/index.tsx b/packages/frontend/src/routes/index.tsx index 8cba0180..2b14e81b 100644 --- a/packages/frontend/src/routes/index.tsx +++ b/packages/frontend/src/routes/index.tsx @@ -16,7 +16,6 @@ import { db } from "../db"; import { AllReports, MyReports } from "../features/ReportList"; const Index = () => { - // TODO: put this into an xstate/store const [search, setSearch] = useState(""); const user = useUser()!; @@ -26,7 +25,7 @@ const Index = () => { label: user.name, className: css({ position: "absolute", - left: { base: "16px", lg: "calc((100vw - 828px) / 2 - 8px)" }, + left: { base: "16px", lg: "calc((100vw - 400px * 2 - 126px) / 2)" }, }), }, { @@ -51,6 +50,7 @@ const Index = () => { disabled: false, udap_id: user.udap.id, redactedBy: user.name, + redactedById: user.id, }, }), onSuccess: (data) => { @@ -137,7 +137,13 @@ const Index = () => { > - +
From d59d536f000c47cd05fb78e5292a09cf7542e097 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 11:49:32 +0200 Subject: [PATCH 07/29] fix: spaces --- .../frontend/src/components/InputGroup.tsx | 2 +- packages/frontend/src/features/InfoForm.tsx | 19 ++++++++++--------- packages/frontend/src/features/NotesForm.tsx | 8 ++++---- packages/frontend/src/features/ReportList.tsx | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/frontend/src/components/InputGroup.tsx b/packages/frontend/src/components/InputGroup.tsx index f26f68b5..644e9d5b 100644 --- a/packages/frontend/src/components/InputGroup.tsx +++ b/packages/frontend/src/components/InputGroup.tsx @@ -41,7 +41,7 @@ const Slot = ({ children, className, ...props }: PropsWithChildren & BoxProps) = }; const Title = ({ children, ...props }: PropsWithChildren & BoxProps) => ( - + {children} ); diff --git a/packages/frontend/src/features/InfoForm.tsx b/packages/frontend/src/features/InfoForm.tsx index 6972c413..7658d7c1 100644 --- a/packages/frontend/src/features/InfoForm.tsx +++ b/packages/frontend/src/features/InfoForm.tsx @@ -1,4 +1,4 @@ -import { Box, Divider, Flex, Stack } from "#styled-system/jsx"; +import { Box, Center, Divider, Flex, 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"; @@ -84,7 +84,7 @@ export const InfoForm = () => { { { { /> { { -
+
-
+
); }; diff --git a/packages/frontend/src/features/NotesForm.tsx b/packages/frontend/src/features/NotesForm.tsx index f356ffab..cfac2b00 100644 --- a/packages/frontend/src/features/NotesForm.tsx +++ b/packages/frontend/src/features/NotesForm.tsx @@ -1,4 +1,4 @@ -import { Divider, Flex, Stack, styled } from "#styled-system/jsx"; +import { Center, Divider, Flex, Stack, styled } from "#styled-system/jsx"; import { useFormContext } from "react-hook-form"; import { InputGroupWithTitle } from "#components/InputGroup"; import Input from "@codegouvfr/react-dsfr/Input"; @@ -20,7 +20,7 @@ export const NotesForm = () => { { /> - +
- +
); }; diff --git a/packages/frontend/src/features/ReportList.tsx b/packages/frontend/src/features/ReportList.tsx index 78885da1..0d90f592 100644 --- a/packages/frontend/src/features/ReportList.tsx +++ b/packages/frontend/src/features/ReportList.tsx @@ -160,7 +160,7 @@ export const ReportList = ({ {columns.length === 1 ? : null} )} -
+
{hidePagination || error ? null : ( Date: Wed, 26 Jun 2024 11:49:43 +0200 Subject: [PATCH 08/29] fix: disable send button if isLoading --- .../frontend/src/routes/pdf.$reportId.tsx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index 0c9bc681..e14083c4 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -36,6 +36,17 @@ export const PDF = () => { const { mode } = Route.useSearch(); const navigate = useNavigate(); + const generatePdfMutation = useMutation( + async ({ htmlString, recipients }: { htmlString: string; recipients: string }) => { + await api.post("/api/pdf/report", { body: { reportId, htmlString, recipients } }); + // downloadFile(url); + }, + { + onSuccess: () => { + navigate({ search: { mode: "sent" } }); + }, + }, + ); const toggleMode = () => { navigate({ search: { mode: mode === "edit" ? "view" : "edit" }, replace: true }); }; @@ -86,7 +97,7 @@ export const PDF = () => { const SendButtons = () => { return (
-
@@ -98,7 +109,7 @@ export const PDF = () => { if (mode === "sent") { return (
- + Votre compte-rendu a bien été envoyé ! @@ -115,7 +126,7 @@ export const PDF = () => { return ( - + @@ -147,27 +158,18 @@ export const PDF = () => { ); }; -const SendForm = ({ children, reportId }: PropsWithChildren<{ reportId: string }>) => { +const SendForm = ({ + children, + generatePdf, +}: PropsWithChildren<{ generatePdf: (args: { htmlString: string; recipients: string }) => void }>) => { const { editor } = useContext(TextEditorContext); const form = useForm({ defaultValues: { recipients: "" } }); - const navigate = useNavigate(); - const generatePdfMutation = useMutation( - async ({ htmlString, recipients }: { htmlString: string; recipients: string }) => { - await api.post("/api/pdf/report", { body: { reportId, htmlString, recipients } }); - // downloadFile(url); - }, - { - onSuccess: () => { - navigate({ search: { mode: "sent" } }); - }, - }, - ); const send = (values: { recipients: string }) => { const recipients = values.recipients.split(/,|\s/).filter(Boolean).join(","); - generatePdfMutation.mutate({ htmlString: editor?.getHTML() ?? "", recipients }); + generatePdf({ htmlString: editor?.getHTML() ?? "", recipients }); }; return ( From 4af17fb55f048c10dad29e31bea6defc9e792d2f Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 11:52:26 +0200 Subject: [PATCH 09/29] fix: info form spaces --- packages/frontend/src/features/InfoForm.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/features/InfoForm.tsx b/packages/frontend/src/features/InfoForm.tsx index 7658d7c1..5718fd30 100644 --- a/packages/frontend/src/features/InfoForm.tsx +++ b/packages/frontend/src/features/InfoForm.tsx @@ -84,7 +84,7 @@ export const InfoForm = () => { Date: Wed, 26 Jun 2024 12:03:42 +0200 Subject: [PATCH 10/29] feat: allow recipients list to be separated using ; --- packages/frontend/src/routes/pdf.$reportId.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index e14083c4..64928e0a 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -167,7 +167,10 @@ const SendForm = ({ const form = useForm({ defaultValues: { recipients: "" } }); const send = (values: { recipients: string }) => { - const recipients = values.recipients.split(/,|\s/).filter(Boolean).join(","); + const recipients = values.recipients + .split(/,|\s|;/) + .filter(Boolean) + .join(","); generatePdf({ htmlString: editor?.getHTML() ?? "", recipients }); }; From ded244f9e44dfef22b09c3125fe2a4f3f23ae1b8 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 26 Jun 2024 13:46:47 +0200 Subject: [PATCH 11/29] feat: add applicant email and prefill recipients --- db/migrations/901-add_applicant_mail.sql | 1 + package.json | 4 +- packages/electric-client/package.json | 2 +- packages/electric-client/prisma/schema.prisma | 11 + .../src/generated/client/index.ts | 45 +- .../src/generated/client/migrations.ts | 19 + .../src/generated/client/pg-migrations.ts | 25 + .../src/generated/client/prismaClient.d.ts | 34 +- .../src/generated/typebox/index.ts | 2 + .../src/generated/typebox/report.ts | 2 + .../src/generated/typebox/reportInput.ts | 2 + .../generated/typebox/service_instructeurs.ts | 12 + .../typebox/service_instructeursInput.ts | 14 + .../src/generated/typebox/user.ts | 2 + .../src/generated/typebox/userInput.ts | 2 + packages/frontend/package.json | 2 +- packages/frontend/src/features/InfoForm.tsx | 35 +- .../frontend/src/routes/pdf.$reportId.tsx | 80 +- pnpm-lock.yaml | 28 +- src/generated/client/index.ts | 2802 ----------------- 20 files changed, 252 insertions(+), 2872 deletions(-) create mode 100644 db/migrations/901-add_applicant_mail.sql create mode 100644 packages/electric-client/src/generated/typebox/service_instructeurs.ts create mode 100644 packages/electric-client/src/generated/typebox/service_instructeursInput.ts delete mode 100644 src/generated/client/index.ts diff --git a/db/migrations/901-add_applicant_mail.sql b/db/migrations/901-add_applicant_mail.sql new file mode 100644 index 00000000..609cd21b --- /dev/null +++ b/db/migrations/901-add_applicant_mail.sql @@ -0,0 +1 @@ +ALTER TABLE "report" ADD COLUMN "applicantEmail" TEXT; \ No newline at end of file diff --git a/package.json b/package.json index 6e88e47d..6b1f39e0 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "db:migrate": "pnpm db:create", "electric:up": "pnpm electric-sql with-config \"pnpm pg-migrations apply --database {{ELECTRIC_PROXY}} --ignore-error migration_file_edited --directory ./db/migrations\"", "show-config": "pnpm electric-sql show-config", - "electric:migrate": "pnpm electric:up && pnpm electric-client generate:front && pnpm electric-client generate:back && pnpm client:generate", + "electric:migrate": "pnpm electric:up && pnpm electric-client generate:front", "client:json": "pnpm backend dev --create-only", "client:ts": "typed-openapi ./packages/backend/openapi.json --output ./packages/frontend/src/api.gen.ts", "client:generate": "pnpm client:json && pnpm client:ts", @@ -27,7 +27,7 @@ "@pandabox/prettier-plugin": "^0.1.0", "@playwright/test": "^1.43.0", "@types/node": "^20.11.28", - "electric-sql": "^0.12.0", + "electric-sql": "^0.12.1", "prettier": "^3.2.5", "prisma": "^4.8.1", "typed-openapi": "^0.4.1" diff --git a/packages/electric-client/package.json b/packages/electric-client/package.json index 77da553d..c203d2fd 100644 --- a/packages/electric-client/package.json +++ b/packages/electric-client/package.json @@ -41,7 +41,7 @@ "peerDependencies": { "@prisma/client": "^4.8.1", "@sinclair/typebox": "^0.32.20", - "electric-sql": "^0.12.0", + "electric-sql": "^0.12.1", "zod": "^3.22.4" }, "devDependencies": { diff --git a/packages/electric-client/prisma/schema.prisma b/packages/electric-client/prisma/schema.prisma index 6bfea15c..43b797d3 100644 --- a/packages/electric-client/prisma/schema.prisma +++ b/packages/electric-client/prisma/schema.prisma @@ -56,6 +56,8 @@ model report { pdf String? disabled Boolean? udap_id String? + redactedById String? + applicantEmail String? user user @relation(fields: [createdBy], references: [id], onDelete: SetNull, onUpdate: NoAction) } @@ -110,3 +112,12 @@ model internal_user { userId String user user @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: NoAction) } + +model service_instructeurs { + id Int @id + full_name String + short_name String + email String? + tel String? + udap_id String? +} diff --git a/packages/electric-client/src/generated/client/index.ts b/packages/electric-client/src/generated/client/index.ts index 83dfa100..dbe2e856 100644 --- a/packages/electric-client/src/generated/client/index.ts +++ b/packages/electric-client/src/generated/client/index.ts @@ -19,7 +19,7 @@ export const DelegationScalarFieldEnumSchema = z.enum(['createdBy','delegatedTo' 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']); +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']); export const Service_instructeursScalarFieldEnumSchema = z.enum(['id','full_name','short_name','email','tel','udap_id']); @@ -83,6 +83,7 @@ export const ReportSchema = z.object({ disabled: z.boolean().nullable(), udap_id: z.string().nullable(), redactedById: z.string().nullable(), + applicantEmail: z.string().nullable(), }) export type Report = z.infer @@ -203,6 +204,7 @@ export const ReportSelectSchema: z.ZodType = z.object({ disabled: z.boolean().optional(), udap_id: z.boolean().optional(), redactedById: z.boolean().optional(), + applicantEmail: z.boolean().optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), }).strict() @@ -401,6 +403,7 @@ export const ReportWhereInputSchema: z.ZodType = z.obje disabled: z.union([ z.lazy(() => BoolNullableFilterSchema),z.boolean() ]).optional().nullable(), udap_id: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), redactedById: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + applicantEmail: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), user: z.union([ z.lazy(() => UserRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), }).strict(); @@ -425,6 +428,7 @@ export const ReportOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), redactedById: z.lazy(() => SortOrderSchema).optional(), + applicantEmail: z.lazy(() => SortOrderSchema).optional(), user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() }).strict(); @@ -453,6 +457,7 @@ export const ReportOrderByWithAggregationInputSchema: z.ZodType SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), redactedById: z.lazy(() => SortOrderSchema).optional(), + applicantEmail: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => ReportCountOrderByAggregateInputSchema).optional(), _avg: z.lazy(() => ReportAvgOrderByAggregateInputSchema).optional(), _max: z.lazy(() => ReportMaxOrderByAggregateInputSchema).optional(), @@ -484,6 +489,7 @@ export const ReportScalarWhereWithAggregatesInputSchema: z.ZodType BoolNullableWithAggregatesFilterSchema),z.boolean() ]).optional().nullable(), udap_id: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), redactedById: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + applicantEmail: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), }).strict(); export const Service_instructeursWhereInputSchema: z.ZodType = z.object({ @@ -763,6 +769,7 @@ export const ReportCreateInputSchema: z.ZodType = z.ob disabled: z.boolean().optional().nullable(), udap_id: z.string().optional().nullable(), redactedById: z.string().optional().nullable(), + applicantEmail: z.string().optional().nullable(), user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema) }).strict(); @@ -786,7 +793,8 @@ export const ReportUncheckedCreateInputSchema: z.ZodType = z.object({ @@ -809,6 +817,7 @@ export const ReportUpdateInputSchema: z.ZodType = z.ob 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(), user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional() }).strict(); @@ -833,6 +842,7 @@ export const ReportUncheckedUpdateInputSchema: z.ZodType 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(), }).strict(); export const ReportCreateManyInputSchema: z.ZodType = z.object({ @@ -855,7 +865,8 @@ export const ReportCreateManyInputSchema: z.ZodType = z.object({ @@ -878,6 +889,7 @@ export const ReportUpdateManyMutationInputSchema: z.ZodType 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(), }).strict(); export const ReportUncheckedUpdateManyInputSchema: z.ZodType = z.object({ @@ -901,6 +913,7 @@ export const ReportUncheckedUpdateManyInputSchema: z.ZodType 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(), }).strict(); export const Service_instructeursCreateInputSchema: z.ZodType = z.object({ @@ -1293,7 +1306,8 @@ export const ReportCountOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), disabled: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - redactedById: z.lazy(() => SortOrderSchema).optional() + redactedById: z.lazy(() => SortOrderSchema).optional(), + applicantEmail: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ReportAvgOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -1320,7 +1334,8 @@ export const ReportMaxOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), disabled: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - redactedById: z.lazy(() => SortOrderSchema).optional() + redactedById: z.lazy(() => SortOrderSchema).optional(), + applicantEmail: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ReportMinOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -1343,7 +1358,8 @@ export const ReportMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), disabled: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - redactedById: z.lazy(() => SortOrderSchema).optional() + redactedById: z.lazy(() => SortOrderSchema).optional(), + applicantEmail: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ReportSumOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2276,7 +2292,8 @@ export const ReportCreateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2298,7 +2315,8 @@ export const ReportUncheckedCreateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2428,6 +2446,7 @@ export const ReportScalarWhereInputSchema: z.ZodType BoolNullableFilterSchema),z.boolean() ]).optional().nullable(), udap_id: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), redactedById: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + applicantEmail: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), }).strict(); export const UdapUpsertWithoutUserInputSchema: z.ZodType = z.object({ @@ -2520,7 +2539,8 @@ export const ReportCreateManyUserInputSchema: z.ZodType = z.object({ @@ -2567,6 +2587,7 @@ export const ReportUpdateWithoutUserInputSchema: z.ZodType 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(), }).strict(); export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2589,6 +2610,7 @@ export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType 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(), }).strict(); export const ReportUncheckedUpdateManyWithoutReportInputSchema: z.ZodType = z.object({ @@ -2611,6 +2633,7 @@ export const ReportUncheckedUpdateManyWithoutReportInputSchema: z.ZodType 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(), }).strict(); ///////////////////////////////////////// @@ -3413,6 +3436,10 @@ export const tableSchemas = { [ "redactedById", "TEXT" + ], + [ + "applicantEmail", + "TEXT" ] ]), relations: [ diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index 977ed691..af88632f 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -113,5 +113,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": "9" + }, + { + "statements": [ + "ALTER TABLE \"report\" ADD COLUMN \"applicantEmail\" TEXT;\n", + "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'report', 1);", + "DROP TRIGGER IF EXISTS update_ensure_main_report_primarykey;", + "CREATE TRIGGER update_ensure_main_report_primarykey\n BEFORE UPDATE ON \"main\".\"report\"\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_report_into_oplog;", + "CREATE TRIGGER insert_main_report_into_oplog\n AFTER INSERT ON \"main\".\"report\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'report')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'report', 'INSERT', json_patch('{}', json_object('id', new.\"id\")), json_object('applicantAddress', new.\"applicantAddress\", 'applicantEmail', new.\"applicantEmail\", 'applicantName', new.\"applicantName\", 'contacts', new.\"contacts\", 'createdAt', new.\"createdAt\", 'createdBy', new.\"createdBy\", 'decision', new.\"decision\", 'disabled', new.\"disabled\", 'furtherInformation', new.\"furtherInformation\", 'id', new.\"id\", 'meetDate', new.\"meetDate\", 'pdf', new.\"pdf\", 'precisions', new.\"precisions\", 'projectCadastralRef', new.\"projectCadastralRef\", 'projectDescription', new.\"projectDescription\", 'projectSpaceType', new.\"projectSpaceType\", 'redactedBy', new.\"redactedBy\", 'redactedById', new.\"redactedById\", 'serviceInstructeur', new.\"serviceInstructeur\", 'title', new.\"title\", 'udap_id', new.\"udap_id\"), NULL, NULL);\nEND;", + "DROP TRIGGER IF EXISTS update_main_report_into_oplog;", + "CREATE TRIGGER update_main_report_into_oplog\n AFTER UPDATE ON \"main\".\"report\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'report')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'report', 'UPDATE', json_patch('{}', json_object('id', new.\"id\")), json_object('applicantAddress', new.\"applicantAddress\", 'applicantEmail', new.\"applicantEmail\", 'applicantName', new.\"applicantName\", 'contacts', new.\"contacts\", 'createdAt', new.\"createdAt\", 'createdBy', new.\"createdBy\", 'decision', new.\"decision\", 'disabled', new.\"disabled\", 'furtherInformation', new.\"furtherInformation\", 'id', new.\"id\", 'meetDate', new.\"meetDate\", 'pdf', new.\"pdf\", 'precisions', new.\"precisions\", 'projectCadastralRef', new.\"projectCadastralRef\", 'projectDescription', new.\"projectDescription\", 'projectSpaceType', new.\"projectSpaceType\", 'redactedBy', new.\"redactedBy\", 'redactedById', new.\"redactedById\", 'serviceInstructeur', new.\"serviceInstructeur\", 'title', new.\"title\", 'udap_id', new.\"udap_id\"), json_object('applicantAddress', old.\"applicantAddress\", 'applicantEmail', old.\"applicantEmail\", 'applicantName', old.\"applicantName\", 'contacts', old.\"contacts\", 'createdAt', old.\"createdAt\", 'createdBy', old.\"createdBy\", 'decision', old.\"decision\", 'disabled', old.\"disabled\", 'furtherInformation', old.\"furtherInformation\", 'id', old.\"id\", 'meetDate', old.\"meetDate\", 'pdf', old.\"pdf\", 'precisions', old.\"precisions\", 'projectCadastralRef', old.\"projectCadastralRef\", 'projectDescription', old.\"projectDescription\", 'projectSpaceType', old.\"projectSpaceType\", 'redactedBy', old.\"redactedBy\", 'redactedById', old.\"redactedById\", 'serviceInstructeur', old.\"serviceInstructeur\", 'title', old.\"title\", 'udap_id', old.\"udap_id\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS delete_main_report_into_oplog;", + "CREATE TRIGGER delete_main_report_into_oplog\n AFTER DELETE ON \"main\".\"report\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'report')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'report', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('applicantAddress', old.\"applicantAddress\", 'applicantEmail', old.\"applicantEmail\", 'applicantName', old.\"applicantName\", 'contacts', old.\"contacts\", 'createdAt', old.\"createdAt\", 'createdBy', old.\"createdBy\", 'decision', old.\"decision\", 'disabled', old.\"disabled\", 'furtherInformation', old.\"furtherInformation\", 'id', old.\"id\", 'meetDate', old.\"meetDate\", 'pdf', old.\"pdf\", 'precisions', old.\"precisions\", 'projectCadastralRef', old.\"projectCadastralRef\", 'projectDescription', old.\"projectDescription\", 'projectSpaceType', old.\"projectSpaceType\", 'redactedBy', old.\"redactedBy\", 'redactedById', old.\"redactedById\", 'serviceInstructeur', old.\"serviceInstructeur\", 'title', old.\"title\", 'udap_id', old.\"udap_id\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS compensation_insert_main_report_createdBy_into_oplog;", + "CREATE TRIGGER compensation_insert_main_report_createdBy_into_oplog\n AFTER INSERT 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;", + "DROP TRIGGER IF EXISTS compensation_update_main_report_createdBy_into_oplog;", + "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": "901" } ] \ 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 5674f940..6160fd6a 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -151,5 +151,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": "9" + }, + { + "statements": [ + "ALTER TABLE \"report\" ADD COLUMN \"applicantEmail\" TEXT", + "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'report', 1)\n ON CONFLICT DO NOTHING;", + "DROP TRIGGER IF EXISTS update_ensure_public_report_primarykey ON \"public\".\"report\";", + "CREATE OR REPLACE FUNCTION update_ensure_public_report_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_report_primarykey\n BEFORE UPDATE ON \"public\".\"report\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_report_primarykey_function();", + "DROP TRIGGER IF EXISTS insert_public_report_into_oplog ON \"public\".\"report\";", + " CREATE OR REPLACE FUNCTION insert_public_report_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 = 'report';\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 'report',\n 'INSERT',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('applicantAddress', new.\"applicantAddress\", 'applicantEmail', new.\"applicantEmail\", 'applicantName', new.\"applicantName\", 'contacts', new.\"contacts\", 'createdAt', new.\"createdAt\", 'createdBy', new.\"createdBy\", 'decision', new.\"decision\", 'disabled', new.\"disabled\", 'furtherInformation', new.\"furtherInformation\", 'id', new.\"id\", 'meetDate', new.\"meetDate\", 'pdf', new.\"pdf\", 'precisions', new.\"precisions\", 'projectCadastralRef', new.\"projectCadastralRef\", 'projectDescription', new.\"projectDescription\", 'projectSpaceType', new.\"projectSpaceType\", 'redactedBy', new.\"redactedBy\", 'redactedById', new.\"redactedById\", 'serviceInstructeur', new.\"serviceInstructeur\", 'title', new.\"title\", 'udap_id', new.\"udap_id\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER insert_public_report_into_oplog\n AFTER INSERT ON \"public\".\"report\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_report_into_oplog_function();", + "DROP TRIGGER IF EXISTS update_public_report_into_oplog ON \"public\".\"report\";", + " CREATE OR REPLACE FUNCTION update_public_report_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 = 'report';\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 'report',\n 'UPDATE',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('applicantAddress', new.\"applicantAddress\", 'applicantEmail', new.\"applicantEmail\", 'applicantName', new.\"applicantName\", 'contacts', new.\"contacts\", 'createdAt', new.\"createdAt\", 'createdBy', new.\"createdBy\", 'decision', new.\"decision\", 'disabled', new.\"disabled\", 'furtherInformation', new.\"furtherInformation\", 'id', new.\"id\", 'meetDate', new.\"meetDate\", 'pdf', new.\"pdf\", 'precisions', new.\"precisions\", 'projectCadastralRef', new.\"projectCadastralRef\", 'projectDescription', new.\"projectDescription\", 'projectSpaceType', new.\"projectSpaceType\", 'redactedBy', new.\"redactedBy\", 'redactedById', new.\"redactedById\", 'serviceInstructeur', new.\"serviceInstructeur\", 'title', new.\"title\", 'udap_id', new.\"udap_id\"),\n jsonb_build_object('applicantAddress', old.\"applicantAddress\", 'applicantEmail', old.\"applicantEmail\", 'applicantName', old.\"applicantName\", 'contacts', old.\"contacts\", 'createdAt', old.\"createdAt\", 'createdBy', old.\"createdBy\", 'decision', old.\"decision\", 'disabled', old.\"disabled\", 'furtherInformation', old.\"furtherInformation\", 'id', old.\"id\", 'meetDate', old.\"meetDate\", 'pdf', old.\"pdf\", 'precisions', old.\"precisions\", 'projectCadastralRef', old.\"projectCadastralRef\", 'projectDescription', old.\"projectDescription\", 'projectSpaceType', old.\"projectSpaceType\", 'redactedBy', old.\"redactedBy\", 'redactedById', old.\"redactedById\", 'serviceInstructeur', old.\"serviceInstructeur\", 'title', old.\"title\", 'udap_id', old.\"udap_id\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_public_report_into_oplog\n AFTER UPDATE ON \"public\".\"report\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_report_into_oplog_function();", + "DROP TRIGGER IF EXISTS delete_public_report_into_oplog ON \"public\".\"report\";", + " CREATE OR REPLACE FUNCTION delete_public_report_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 = 'report';\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 'report',\n 'DELETE',\n json_strip_nulls(json_build_object('id', old.\"id\")),\n NULL,\n jsonb_build_object('applicantAddress', old.\"applicantAddress\", 'applicantEmail', old.\"applicantEmail\", 'applicantName', old.\"applicantName\", 'contacts', old.\"contacts\", 'createdAt', old.\"createdAt\", 'createdBy', old.\"createdBy\", 'decision', old.\"decision\", 'disabled', old.\"disabled\", 'furtherInformation', old.\"furtherInformation\", 'id', old.\"id\", 'meetDate', old.\"meetDate\", 'pdf', old.\"pdf\", 'precisions', old.\"precisions\", 'projectCadastralRef', old.\"projectCadastralRef\", 'projectDescription', old.\"projectDescription\", 'projectSpaceType', old.\"projectSpaceType\", 'redactedBy', old.\"redactedBy\", 'redactedById', old.\"redactedById\", 'serviceInstructeur', old.\"serviceInstructeur\", 'title', old.\"title\", 'udap_id', old.\"udap_id\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER delete_public_report_into_oplog\n AFTER DELETE ON \"public\".\"report\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_report_into_oplog_function();", + "DROP TRIGGER IF EXISTS compensation_insert_public_report_createdBy_into_oplog ON \"public\".\"report\";", + " CREATE OR REPLACE FUNCTION compensation_insert_public_report_createdBy_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 = 'report';\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 'user',\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\".\"user\"\n WHERE \"id\" = NEW.\"createdBy\";\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER compensation_insert_public_report_createdBy_into_oplog\n AFTER INSERT ON \"public\".\"report\"\n FOR EACH ROW\n EXECUTE FUNCTION compensation_insert_public_report_createdBy_into_oplog_function();", + "DROP TRIGGER IF EXISTS compensation_update_public_report_createdBy_into_oplog ON \"public\".\"report\";", + " CREATE OR REPLACE FUNCTION compensation_update_public_report_createdBy_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 = 'report';\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 'user',\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\".\"user\"\n WHERE \"id\" = NEW.\"createdBy\";\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "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": "901" } ] \ 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 0b2ee181..fc166f52 100644 --- a/packages/electric-client/src/generated/client/prismaClient.d.ts +++ b/packages/electric-client/src/generated/client/prismaClient.d.ts @@ -76,6 +76,7 @@ export type ReportPayload composites: {} } @@ -3322,6 +3323,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled: boolean | null udap_id: string | null redactedById: string | null + applicantEmail: string | null } export type ReportMaxAggregateOutputType = { @@ -3345,6 +3347,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled: boolean | null udap_id: string | null redactedById: string | null + applicantEmail: string | null } export type ReportCountAggregateOutputType = { @@ -3368,6 +3371,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled: number udap_id: number redactedById: number + applicantEmail: number _all: number } @@ -3401,6 +3405,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: true udap_id?: true redactedById?: true + applicantEmail?: true } export type ReportMaxAggregateInputType = { @@ -3424,6 +3429,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: true udap_id?: true redactedById?: true + applicantEmail?: true } export type ReportCountAggregateInputType = { @@ -3447,6 +3453,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: true udap_id?: true redactedById?: true + applicantEmail?: true _all?: true } @@ -3558,6 +3565,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled: boolean | null udap_id: string | null redactedById: string | null + applicantEmail: string | null _count: ReportCountAggregateOutputType | null _avg: ReportAvgAggregateOutputType | null _sum: ReportSumAggregateOutputType | null @@ -3600,6 +3608,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean udap_id?: boolean redactedById?: boolean + applicantEmail?: boolean user?: boolean | UserArgs }, ExtArgs["result"]["report"]> @@ -3624,6 +3633,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean udap_id?: boolean redactedById?: boolean + applicantEmail?: boolean } export type ReportInclude = { @@ -7348,7 +7358,8 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject pdf: 'pdf', disabled: 'disabled', udap_id: 'udap_id', - redactedById: 'redactedById' + redactedById: 'redactedById', + applicantEmail: 'applicantEmail' }; export type ReportScalarFieldEnum = (typeof ReportScalarFieldEnum)[keyof typeof ReportScalarFieldEnum] @@ -7525,6 +7536,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: BoolNullableFilter | boolean | null udap_id?: StringNullableFilter | string | null redactedById?: StringNullableFilter | string | null + applicantEmail?: StringNullableFilter | string | null user?: XOR } @@ -7549,6 +7561,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: SortOrderInput | SortOrder udap_id?: SortOrderInput | SortOrder redactedById?: SortOrderInput | SortOrder + applicantEmail?: SortOrderInput | SortOrder user?: UserOrderByWithRelationInput } @@ -7577,6 +7590,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: SortOrderInput | SortOrder udap_id?: SortOrderInput | SortOrder redactedById?: SortOrderInput | SortOrder + applicantEmail?: SortOrderInput | SortOrder _count?: ReportCountOrderByAggregateInput _avg?: ReportAvgOrderByAggregateInput _max?: ReportMaxOrderByAggregateInput @@ -7608,6 +7622,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: BoolNullableWithAggregatesFilter | boolean | null udap_id?: StringNullableWithAggregatesFilter | string | null redactedById?: StringNullableWithAggregatesFilter | string | null + applicantEmail?: StringNullableWithAggregatesFilter | string | null } export type Service_instructeursWhereInput = { @@ -7888,6 +7903,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean | null udap_id?: string | null redactedById?: string | null + applicantEmail?: string | null user: UserCreateNestedOneWithoutReportInput } @@ -7912,6 +7928,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean | null udap_id?: string | null redactedById?: string | null + applicantEmail?: string | null } export type ReportUpdateInput = { @@ -7934,6 +7951,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null user?: UserUpdateOneRequiredWithoutReportNestedInput } @@ -7958,6 +7976,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportCreateManyInput = { @@ -7981,6 +8000,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean | null udap_id?: string | null redactedById?: string | null + applicantEmail?: string | null } export type ReportUpdateManyMutationInput = { @@ -8003,6 +8023,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportUncheckedUpdateManyInput = { @@ -8026,6 +8047,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null } export type Service_instructeursCreateInput = { @@ -8424,6 +8446,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: SortOrder udap_id?: SortOrder redactedById?: SortOrder + applicantEmail?: SortOrder } export type ReportAvgOrderByAggregateInput = { @@ -8451,6 +8474,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: SortOrder udap_id?: SortOrder redactedById?: SortOrder + applicantEmail?: SortOrder } export type ReportMinOrderByAggregateInput = { @@ -8474,6 +8498,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: SortOrder udap_id?: SortOrder redactedById?: SortOrder + applicantEmail?: SortOrder } export type ReportSumOrderByAggregateInput = { @@ -9407,6 +9432,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean | null udap_id?: string | null redactedById?: string | null + applicantEmail?: string | null } export type ReportUncheckedCreateWithoutUserInput = { @@ -9429,6 +9455,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean | null udap_id?: string | null redactedById?: string | null + applicantEmail?: string | null } export type ReportCreateOrConnectWithoutUserInput = { @@ -9558,6 +9585,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: BoolNullableFilter | boolean | null udap_id?: StringNullableFilter | string | null redactedById?: StringNullableFilter | string | null + applicantEmail?: StringNullableFilter | string | null } export type UdapUpsertWithoutUserInput = { @@ -9651,6 +9679,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: boolean | null udap_id?: string | null redactedById?: string | null + applicantEmail?: string | null } export type DelegationUpdateWithoutUser_delegation_createdByTouserInput = { @@ -9697,6 +9726,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportUncheckedUpdateWithoutUserInput = { @@ -9719,6 +9749,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportUncheckedUpdateManyWithoutReportInput = { @@ -9741,6 +9772,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject disabled?: NullableBoolFieldUpdateOperationsInput | boolean | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null redactedById?: NullableStringFieldUpdateOperationsInput | string | null + applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null } diff --git a/packages/electric-client/src/generated/typebox/index.ts b/packages/electric-client/src/generated/typebox/index.ts index eba9811c..86e800fc 100644 --- a/packages/electric-client/src/generated/typebox/index.ts +++ b/packages/electric-client/src/generated/typebox/index.ts @@ -16,3 +16,5 @@ export * from './whitelist'; export * from './whitelistInput'; export * from './internal_user'; export * from './internal_userInput'; +export * from './service_instructeurs'; +export * from './service_instructeursInput'; diff --git a/packages/electric-client/src/generated/typebox/report.ts b/packages/electric-client/src/generated/typebox/report.ts index a4c0ead6..3c7277eb 100644 --- a/packages/electric-client/src/generated/typebox/report.ts +++ b/packages/electric-client/src/generated/typebox/report.ts @@ -20,6 +20,8 @@ export const report = Type.Object({ 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()), 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 159bb121..3061e52f 100644 --- a/packages/electric-client/src/generated/typebox/reportInput.ts +++ b/packages/electric-client/src/generated/typebox/reportInput.ts @@ -20,6 +20,8 @@ export const reportInput = Type.Object({ 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()), user: Type.Object({ id: Type.String(), name: Type.String(), diff --git a/packages/electric-client/src/generated/typebox/service_instructeurs.ts b/packages/electric-client/src/generated/typebox/service_instructeurs.ts new file mode 100644 index 00000000..0c5e7960 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/service_instructeurs.ts @@ -0,0 +1,12 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const service_instructeurs = Type.Object({ + id: Type.Number(), + full_name: Type.String(), + short_name: Type.String(), + email: Type.Optional(Type.String()), + tel: Type.Optional(Type.String()), + udap_id: Type.Optional(Type.String()), +}); + +export type service_instructeursType = Static; diff --git a/packages/electric-client/src/generated/typebox/service_instructeursInput.ts b/packages/electric-client/src/generated/typebox/service_instructeursInput.ts new file mode 100644 index 00000000..aa13d295 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/service_instructeursInput.ts @@ -0,0 +1,14 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const service_instructeursInput = Type.Object({ + id: Type.Number(), + full_name: Type.String(), + short_name: Type.String(), + email: Type.Optional(Type.String()), + tel: Type.Optional(Type.String()), + udap_id: Type.Optional(Type.String()), +}); + +export type service_instructeursInputType = Static< + typeof service_instructeursInput +>; diff --git a/packages/electric-client/src/generated/typebox/user.ts b/packages/electric-client/src/generated/typebox/user.ts index 4e03873b..1f150aa9 100644 --- a/packages/electric-client/src/generated/typebox/user.ts +++ b/packages/electric-client/src/generated/typebox/user.ts @@ -48,6 +48,8 @@ export const user = Type.Object({ 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()), }) ), udap: Type.Object({ diff --git a/packages/electric-client/src/generated/typebox/userInput.ts b/packages/electric-client/src/generated/typebox/userInput.ts index 66905d75..669fb214 100644 --- a/packages/electric-client/src/generated/typebox/userInput.ts +++ b/packages/electric-client/src/generated/typebox/userInput.ts @@ -48,6 +48,8 @@ export const userInput = Type.Object({ 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()), }) ), udap: Type.Object({ diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 314ce251..7363043a 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -47,7 +47,7 @@ "@ungap/with-resolvers": "^0.1.0", "@xstate/store": "^0.0.5", "date-fns": "^3.6.0", - "electric-sql": "^0.12.0", + "electric-sql": "^0.12.1", "install": "^0.13.0", "npm": "^10.5.0", "ofetch": "^1.3.4", diff --git a/packages/frontend/src/features/InfoForm.tsx b/packages/frontend/src/features/InfoForm.tsx index 5718fd30..ccb1a60d 100644 --- a/packages/frontend/src/features/InfoForm.tsx +++ b/packages/frontend/src/features/InfoForm.tsx @@ -82,9 +82,9 @@ export const InfoForm = () => { return ( - + - + + + + + { textArea nativeTextAreaProps={{ ...form.register("projectDescription"), rows: 5 }} /> - + { className={css({ flex: { base: "none", - sm: 1, + lg: 1, }, })} > {/* */} - + - + diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index 64928e0a..644a78b2 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -6,7 +6,7 @@ import { css } from "#styled-system/css"; import { Center, Flex, Stack, styled } from "#styled-system/jsx"; import Button from "@codegouvfr/react-dsfr/Button"; import Input from "@codegouvfr/react-dsfr/Input"; -import type { Report, Udap } from "@cr-vif/electric-client/frontend"; +import type { Report, Service_instructeurs, Udap } from "@cr-vif/electric-client/frontend"; import { ReportPDFDocument, ReportPDFDocumentProps, getReportHtmlString } from "@cr-vif/pdf"; import { usePdf } from "@mikecousins/react-pdf"; import { pdf } from "@react-pdf/renderer"; @@ -123,36 +123,39 @@ export const PDF = () => {
); } + return ( - - - {getModeTitle(mode)} - {report?.title ? ` | ${report?.title}` : ""} - - } - reportId={report?.id} - buttons={buttons} - /> -
- - {report && chipOptions?.length && isServiceInstructeurLoaded ? ( - - ) : null} - -
- + {report ? ( + + + {getModeTitle(mode)} + {report?.title ? ` | ${report?.title}` : ""} + + } + reportId={report?.id} + buttons={buttons} + /> +
+ + {report && chipOptions?.length && isServiceInstructeurLoaded ? ( + + ) : null} + +
+
+ ) : null} ); @@ -161,11 +164,22 @@ export const PDF = () => { const SendForm = ({ children, generatePdf, -}: PropsWithChildren<{ generatePdf: (args: { htmlString: string; recipients: string }) => void }>) => { + report, +}: PropsWithChildren<{ report: Report; generatePdf: (args: { htmlString: string; recipients: string }) => void }>) => { const { editor } = useContext(TextEditorContext); const form = useForm({ defaultValues: { recipients: "" } }); + useQuery({ + queryKey: ["service-instructeur", report.serviceInstructeur, report.applicantEmail], + queryFn: async () => { + const recipents = await getBaseRecipients(report); + if (!form.getValues("recipients")) { + form.setValue("recipients", recipents ?? ""); + } + }, + }); + const send = (values: { recipients: string }) => { const recipients = values.recipients .split(/,|\s|;/) @@ -182,6 +196,14 @@ const SendForm = ({ ); }; +const getBaseRecipients = async (report: Report) => { + const serviceEmail = report.serviceInstructeur + ? (await db.service_instructeurs.findFirst({ where: { id: report.serviceInstructeur } }))?.email + : null; + const recipients = [serviceEmail, report.applicantEmail].filter(Boolean).join(", "); + return recipients; +}; + const getModeTitle = (mode: Mode) => { switch (mode) { case "edit": diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7298a4a0..a3ded0e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,8 +29,8 @@ importers: specifier: ^20.11.28 version: 20.12.3 electric-sql: - specifier: ^0.12.0 - version: 0.12.0(pg@8.11.5)(prisma@4.8.1)(zod@3.21.1) + specifier: ^0.12.1 + version: 0.12.1(pg@8.11.5)(prisma@4.8.1)(zod@3.21.1) prettier: specifier: ^3.2.5 version: 3.2.5 @@ -186,8 +186,8 @@ importers: specifier: ^0.32.20 version: 0.32.20 electric-sql: - specifier: ^0.12.0 - version: 0.12.0(pg@8.11.5)(prisma@4.8.1)(react-dom@18.2.0)(react@18.2.0)(vue@2.7.16)(wa-sqlite@0.9.13)(zod@3.22.4) + specifier: ^0.12.1 + version: 0.12.1(pg@8.11.5)(prisma@4.8.1)(react-dom@18.2.0)(react@18.2.0)(vue@2.7.16)(wa-sqlite@0.9.13)(zod@3.22.4) zod: specifier: ^3.22.4 version: 3.22.4 @@ -295,8 +295,8 @@ importers: specifier: ^3.6.0 version: 3.6.0 electric-sql: - specifier: ^0.12.0 - version: 0.12.0(pg@8.11.5)(prisma@4.8.1)(react-dom@18.2.0)(react@18.2.0)(vue@2.7.16)(wa-sqlite@0.9.13)(zod@3.22.4) + specifier: ^0.12.1 + version: 0.12.1(pg@8.11.5)(prisma@4.8.1)(react-dom@18.2.0)(react@18.2.0)(vue@2.7.16)(wa-sqlite@0.9.13)(zod@3.22.4) install: specifier: ^0.13.0 version: 0.13.0 @@ -8615,8 +8615,8 @@ packages: is-windows: 1.0.2 dev: true - /better-sqlite3@8.7.0: - resolution: {integrity: sha512-99jZU4le+f3G6aIl6PmmV0cxUIWqKieHxsiF7G34CVFiE+/UabpYqkU0NJIkY/96mQKikHeBjtR27vFfs5JpEw==} + /better-sqlite3@11.0.0: + resolution: {integrity: sha512-1NnNhmT3EZTsKtofJlMox1jkMxdedILury74PwUbQBjWgo4tL4kf7uTAjU55mgQwjdzqakSTjkf+E1imrFwjnA==} requiresBuild: true dependencies: bindings: 1.5.0 @@ -9907,8 +9907,8 @@ packages: jake: 10.9.1 dev: true - /electric-sql@0.12.0(pg@8.11.5)(prisma@4.8.1)(react-dom@18.2.0)(react@18.2.0)(vue@2.7.16)(wa-sqlite@0.9.13)(zod@3.22.4): - resolution: {integrity: sha512-nM2aHRnsgUgIX885CY6uEUajw1eawxwILLV6taEeWe14ddfkZ6zSaj21KEietp6aSvDXWIpXdyMEP71wg/aDHA==} + /electric-sql@0.12.1(pg@8.11.5)(prisma@4.8.1)(react-dom@18.2.0)(react@18.2.0)(vue@2.7.16)(wa-sqlite@0.9.13)(zod@3.22.4): + resolution: {integrity: sha512-d9THXiZSIX+B255uJwR1HFsD3RjZcQrZHAFdmIQvFSGzIrEXVhreMrrCOB+CcbETFZg1ARdZEhGSe4MBXGC6/g==} hasBin: true peerDependencies: '@capacitor-community/sqlite': '>= 5.6.2' @@ -9960,7 +9960,7 @@ packages: '@prisma/client': 4.8.1(prisma@4.8.1) async-mutex: 0.4.1 base-64: 1.0.0 - better-sqlite3: 8.7.0 + better-sqlite3: 11.0.0 commander: 11.1.0 cross-fetch: 3.1.8 decompress: 4.2.1 @@ -10004,8 +10004,8 @@ packages: - utf-8-validate dev: false - /electric-sql@0.12.0(pg@8.11.5)(prisma@4.8.1)(zod@3.21.1): - resolution: {integrity: sha512-nM2aHRnsgUgIX885CY6uEUajw1eawxwILLV6taEeWe14ddfkZ6zSaj21KEietp6aSvDXWIpXdyMEP71wg/aDHA==} + /electric-sql@0.12.1(pg@8.11.5)(prisma@4.8.1)(zod@3.21.1): + resolution: {integrity: sha512-d9THXiZSIX+B255uJwR1HFsD3RjZcQrZHAFdmIQvFSGzIrEXVhreMrrCOB+CcbETFZg1ARdZEhGSe4MBXGC6/g==} hasBin: true peerDependencies: '@capacitor-community/sqlite': '>= 5.6.2' @@ -10057,7 +10057,7 @@ packages: '@prisma/client': 4.8.1(prisma@4.8.1) async-mutex: 0.4.1 base-64: 1.0.0 - better-sqlite3: 8.7.0 + better-sqlite3: 11.0.0 commander: 11.1.0 cross-fetch: 3.1.8 decompress: 4.2.1 diff --git a/src/generated/client/index.ts b/src/generated/client/index.ts deleted file mode 100644 index ec90a25e..00000000 --- a/src/generated/client/index.ts +++ /dev/null @@ -1,2802 +0,0 @@ -import { z } from 'zod'; -import type { Prisma } from './prismaClient'; -import { type TableSchema, DbSchema, Relation, ElectricClient, type HKT } from 'electric-sql/client/model'; -import migrations from './migrations'; - -///////////////////////////////////////// -// HELPER FUNCTIONS -///////////////////////////////////////// - - -///////////////////////////////////////// -// ENUMS -///////////////////////////////////////// - -export const ChipScalarFieldEnumSchema = z.enum(['id','label','value']); - -export const ClauseScalarFieldEnumSchema = z.enum(['id','label','value']); - -export const QueryModeSchema = z.enum(['default','insensitive']); - -export const ReportScalarFieldEnumSchema = z.enum(['id','title','project_description','redacted_by','meet_date','applicant_name','applicant_address','project_cadastral_ref','project_space_type','decision','precisions','contacts','further_information','created_by_id','created_by_username','created_at','service_instructeur']); - -export const Report_to_chipScalarFieldEnumSchema = z.enum(['id','report_id','chip_id']); - -export const Report_to_clauseScalarFieldEnumSchema = z.enum(['id','report_id','clause_id']); - -export const SortOrderSchema = z.enum(['asc','desc']); - -export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']); -///////////////////////////////////////// -// MODELS -///////////////////////////////////////// - -///////////////////////////////////////// -// CHIP SCHEMA -///////////////////////////////////////// - -export const ChipSchema = z.object({ - id: z.string(), - label: z.string(), - value: z.string(), -}) - -export type Chip = z.infer - -///////////////////////////////////////// -// CLAUSE SCHEMA -///////////////////////////////////////// - -export const ClauseSchema = z.object({ - id: z.string(), - label: z.string(), - value: z.string(), -}) - -export type Clause = z.infer - -///////////////////////////////////////// -// REPORT SCHEMA -///////////////////////////////////////// - -export const ReportSchema = z.object({ - id: z.string(), - title: z.string().nullable(), - project_description: z.string().nullable(), - redacted_by: z.string().nullable(), - meet_date: z.coerce.date().nullable(), - applicant_name: z.string().nullable(), - applicant_address: z.string().nullable(), - project_cadastral_ref: z.string().nullable(), - project_space_type: z.string().nullable(), - decision: z.string().nullable(), - precisions: z.string().nullable(), - contacts: z.string().nullable(), - further_information: z.string().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().nullable(), -}) - -export type Report = z.infer - -///////////////////////////////////////// -// REPORT TO CHIP SCHEMA -///////////////////////////////////////// - -export const Report_to_chipSchema = z.object({ - id: z.string(), - report_id: z.string(), - chip_id: z.string(), -}) - -export type Report_to_chip = z.infer - -///////////////////////////////////////// -// REPORT TO CLAUSE SCHEMA -///////////////////////////////////////// - -export const Report_to_clauseSchema = z.object({ - id: z.string(), - report_id: z.string(), - clause_id: z.string(), -}) - -export type Report_to_clause = z.infer - -///////////////////////////////////////// -// SELECT & INCLUDE -///////////////////////////////////////// - -// CHIP -//------------------------------------------------------ - -export const ChipIncludeSchema: z.ZodType = z.object({ - report_to_chip: z.union([z.boolean(),z.lazy(() => Report_to_chipFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(),z.lazy(() => ChipCountOutputTypeArgsSchema)]).optional(), -}).strict() - -export const ChipArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => ChipSelectSchema).optional(), - include: z.lazy(() => ChipIncludeSchema).optional(), -}).strict(); - -export const ChipCountOutputTypeArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => ChipCountOutputTypeSelectSchema).nullish(), -}).strict(); - -export const ChipCountOutputTypeSelectSchema: z.ZodType = z.object({ - report_to_chip: z.boolean().optional(), -}).strict(); - -export const ChipSelectSchema: z.ZodType = z.object({ - id: z.boolean().optional(), - label: z.boolean().optional(), - value: z.boolean().optional(), - report_to_chip: z.union([z.boolean(),z.lazy(() => Report_to_chipFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(),z.lazy(() => ChipCountOutputTypeArgsSchema)]).optional(), -}).strict() - -// CLAUSE -//------------------------------------------------------ - -export const ClauseIncludeSchema: z.ZodType = z.object({ - report_to_clause: z.union([z.boolean(),z.lazy(() => Report_to_clauseFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(),z.lazy(() => ClauseCountOutputTypeArgsSchema)]).optional(), -}).strict() - -export const ClauseArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => ClauseSelectSchema).optional(), - include: z.lazy(() => ClauseIncludeSchema).optional(), -}).strict(); - -export const ClauseCountOutputTypeArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => ClauseCountOutputTypeSelectSchema).nullish(), -}).strict(); - -export const ClauseCountOutputTypeSelectSchema: z.ZodType = z.object({ - report_to_clause: z.boolean().optional(), -}).strict(); - -export const ClauseSelectSchema: z.ZodType = z.object({ - id: z.boolean().optional(), - label: z.boolean().optional(), - value: z.boolean().optional(), - report_to_clause: z.union([z.boolean(),z.lazy(() => Report_to_clauseFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(),z.lazy(() => ClauseCountOutputTypeArgsSchema)]).optional(), -}).strict() - -// REPORT -//------------------------------------------------------ - -export const ReportIncludeSchema: z.ZodType = z.object({ - report_to_chip: z.union([z.boolean(),z.lazy(() => Report_to_chipFindManyArgsSchema)]).optional(), - report_to_clause: z.union([z.boolean(),z.lazy(() => Report_to_clauseFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(),z.lazy(() => ReportCountOutputTypeArgsSchema)]).optional(), -}).strict() - -export const ReportArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => ReportSelectSchema).optional(), - 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({ - report_to_chip: z.boolean().optional(), - report_to_clause: z.boolean().optional(), -}).strict(); - -export const ReportSelectSchema: z.ZodType = z.object({ - id: z.boolean().optional(), - title: z.boolean().optional(), - project_description: z.boolean().optional(), - redacted_by: z.boolean().optional(), - meet_date: z.boolean().optional(), - applicant_name: z.boolean().optional(), - applicant_address: z.boolean().optional(), - project_cadastral_ref: z.boolean().optional(), - project_space_type: z.boolean().optional(), - decision: z.boolean().optional(), - precisions: z.boolean().optional(), - contacts: z.boolean().optional(), - further_information: z.boolean().optional(), - created_by_id: z.boolean().optional(), - created_by_username: z.boolean().optional(), - created_at: z.boolean().optional(), - service_instructeur: z.boolean().optional(), - report_to_chip: z.union([z.boolean(),z.lazy(() => Report_to_chipFindManyArgsSchema)]).optional(), - report_to_clause: z.union([z.boolean(),z.lazy(() => Report_to_clauseFindManyArgsSchema)]).optional(), - _count: z.union([z.boolean(),z.lazy(() => ReportCountOutputTypeArgsSchema)]).optional(), -}).strict() - -// REPORT TO CHIP -//------------------------------------------------------ - -export const Report_to_chipIncludeSchema: z.ZodType = z.object({ - chip: z.union([z.boolean(),z.lazy(() => ChipArgsSchema)]).optional(), - report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), -}).strict() - -export const Report_to_chipArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => Report_to_chipSelectSchema).optional(), - include: z.lazy(() => Report_to_chipIncludeSchema).optional(), -}).strict(); - -export const Report_to_chipSelectSchema: z.ZodType = z.object({ - id: z.boolean().optional(), - report_id: z.boolean().optional(), - chip_id: z.boolean().optional(), - chip: z.union([z.boolean(),z.lazy(() => ChipArgsSchema)]).optional(), - report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), -}).strict() - -// REPORT TO CLAUSE -//------------------------------------------------------ - -export const Report_to_clauseIncludeSchema: z.ZodType = z.object({ - clause: z.union([z.boolean(),z.lazy(() => ClauseArgsSchema)]).optional(), - report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), -}).strict() - -export const Report_to_clauseArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => Report_to_clauseSelectSchema).optional(), - include: z.lazy(() => Report_to_clauseIncludeSchema).optional(), -}).strict(); - -export const Report_to_clauseSelectSchema: z.ZodType = z.object({ - id: z.boolean().optional(), - report_id: z.boolean().optional(), - clause_id: z.boolean().optional(), - clause: z.union([z.boolean(),z.lazy(() => ClauseArgsSchema)]).optional(), - report: z.union([z.boolean(),z.lazy(() => ReportArgsSchema)]).optional(), -}).strict() - - -///////////////////////////////////////// -// INPUT TYPES -///////////////////////////////////////// - -export const ChipWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ChipWhereInputSchema),z.lazy(() => ChipWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => ChipWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ChipWhereInputSchema),z.lazy(() => ChipWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - label: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - value: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - report_to_chip: z.lazy(() => Report_to_chipListRelationFilterSchema).optional() -}).strict(); - -export const ChipOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional(), - report_to_chip: z.lazy(() => Report_to_chipOrderByRelationAggregateInputSchema).optional() -}).strict(); - -export const ChipWhereUniqueInputSchema: z.ZodType = z.object({ - id: z.string().optional() -}).strict(); - -export const ChipOrderByWithAggregationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => ChipCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => ChipMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => ChipMinOrderByAggregateInputSchema).optional() -}).strict(); - -export const ChipScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ChipScalarWhereWithAggregatesInputSchema),z.lazy(() => ChipScalarWhereWithAggregatesInputSchema).array() ]).optional(), - OR: z.lazy(() => ChipScalarWhereWithAggregatesInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ChipScalarWhereWithAggregatesInputSchema),z.lazy(() => ChipScalarWhereWithAggregatesInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - label: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - value: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), -}).strict(); - -export const ClauseWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ClauseWhereInputSchema),z.lazy(() => ClauseWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => ClauseWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ClauseWhereInputSchema),z.lazy(() => ClauseWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - label: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - value: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - report_to_clause: z.lazy(() => Report_to_clauseListRelationFilterSchema).optional() -}).strict(); - -export const ClauseOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseOrderByRelationAggregateInputSchema).optional() -}).strict(); - -export const ClauseWhereUniqueInputSchema: z.ZodType = z.object({ - id: z.string().optional() -}).strict(); - -export const ClauseOrderByWithAggregationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => ClauseCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => ClauseMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => ClauseMinOrderByAggregateInputSchema).optional() -}).strict(); - -export const ClauseScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ClauseScalarWhereWithAggregatesInputSchema),z.lazy(() => ClauseScalarWhereWithAggregatesInputSchema).array() ]).optional(), - OR: z.lazy(() => ClauseScalarWhereWithAggregatesInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ClauseScalarWhereWithAggregatesInputSchema),z.lazy(() => ClauseScalarWhereWithAggregatesInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - label: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - value: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), -}).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(), - NOT: z.union([ z.lazy(() => ReportWhereInputSchema),z.lazy(() => ReportWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - title: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - project_description: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - redacted_by: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - meet_date: z.union([ z.lazy(() => DateTimeNullableFilterSchema),z.coerce.date() ]).optional().nullable(), - applicant_name: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - applicant_address: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - project_cadastral_ref: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - project_space_type: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - decision: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - precisions: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - contacts: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - further_information: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - created_by_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - created_by_username: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - created_at: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), - service_instructeur: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipListRelationFilterSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseListRelationFilterSchema).optional() -}).strict(); - -export const ReportOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - title: z.lazy(() => SortOrderSchema).optional(), - project_description: z.lazy(() => SortOrderSchema).optional(), - redacted_by: z.lazy(() => SortOrderSchema).optional(), - meet_date: z.lazy(() => SortOrderSchema).optional(), - applicant_name: z.lazy(() => SortOrderSchema).optional(), - applicant_address: z.lazy(() => SortOrderSchema).optional(), - project_cadastral_ref: z.lazy(() => SortOrderSchema).optional(), - project_space_type: z.lazy(() => SortOrderSchema).optional(), - decision: z.lazy(() => SortOrderSchema).optional(), - precisions: z.lazy(() => SortOrderSchema).optional(), - contacts: z.lazy(() => SortOrderSchema).optional(), - further_information: z.lazy(() => SortOrderSchema).optional(), - created_by_id: z.lazy(() => SortOrderSchema).optional(), - created_by_username: z.lazy(() => SortOrderSchema).optional(), - created_at: z.lazy(() => SortOrderSchema).optional(), - service_instructeur: z.lazy(() => SortOrderSchema).optional(), - report_to_chip: z.lazy(() => Report_to_chipOrderByRelationAggregateInputSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseOrderByRelationAggregateInputSchema).optional() -}).strict(); - -export const ReportWhereUniqueInputSchema: z.ZodType = z.object({ - id: z.string().optional() -}).strict(); - -export const ReportOrderByWithAggregationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - title: z.lazy(() => SortOrderSchema).optional(), - project_description: z.lazy(() => SortOrderSchema).optional(), - redacted_by: z.lazy(() => SortOrderSchema).optional(), - meet_date: z.lazy(() => SortOrderSchema).optional(), - applicant_name: z.lazy(() => SortOrderSchema).optional(), - applicant_address: z.lazy(() => SortOrderSchema).optional(), - project_cadastral_ref: z.lazy(() => SortOrderSchema).optional(), - project_space_type: z.lazy(() => SortOrderSchema).optional(), - decision: z.lazy(() => SortOrderSchema).optional(), - precisions: z.lazy(() => SortOrderSchema).optional(), - contacts: z.lazy(() => SortOrderSchema).optional(), - further_information: z.lazy(() => SortOrderSchema).optional(), - created_by_id: z.lazy(() => SortOrderSchema).optional(), - created_by_username: z.lazy(() => SortOrderSchema).optional(), - created_at: z.lazy(() => SortOrderSchema).optional(), - service_instructeur: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => ReportCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => ReportMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => ReportMinOrderByAggregateInputSchema).optional() -}).strict(); - -export const ReportScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ReportScalarWhereWithAggregatesInputSchema),z.lazy(() => ReportScalarWhereWithAggregatesInputSchema).array() ]).optional(), - OR: z.lazy(() => ReportScalarWhereWithAggregatesInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ReportScalarWhereWithAggregatesInputSchema),z.lazy(() => ReportScalarWhereWithAggregatesInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - title: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - project_description: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - redacted_by: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - meet_date: z.union([ z.lazy(() => DateTimeNullableWithAggregatesFilterSchema),z.coerce.date() ]).optional().nullable(), - applicant_name: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - applicant_address: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - project_cadastral_ref: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - project_space_type: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - decision: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - precisions: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - contacts: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - further_information: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), - created_by_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - created_by_username: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - created_at: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), - service_instructeur: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), -}).strict(); - -export const Report_to_chipWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => Report_to_chipWhereInputSchema),z.lazy(() => Report_to_chipWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => Report_to_chipWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => Report_to_chipWhereInputSchema),z.lazy(() => Report_to_chipWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - report_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - chip_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - chip: z.union([ z.lazy(() => ChipRelationFilterSchema),z.lazy(() => ChipWhereInputSchema) ]).optional(), - report: z.union([ z.lazy(() => ReportRelationFilterSchema),z.lazy(() => ReportWhereInputSchema) ]).optional(), -}).strict(); - -export const Report_to_chipOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - chip_id: z.lazy(() => SortOrderSchema).optional(), - chip: z.lazy(() => ChipOrderByWithRelationInputSchema).optional(), - report: z.lazy(() => ReportOrderByWithRelationInputSchema).optional() -}).strict(); - -export const Report_to_chipWhereUniqueInputSchema: z.ZodType = z.object({ - id: z.string().optional() -}).strict(); - -export const Report_to_chipOrderByWithAggregationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - chip_id: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => Report_to_chipCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => Report_to_chipMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => Report_to_chipMinOrderByAggregateInputSchema).optional() -}).strict(); - -export const Report_to_chipScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => Report_to_chipScalarWhereWithAggregatesInputSchema),z.lazy(() => Report_to_chipScalarWhereWithAggregatesInputSchema).array() ]).optional(), - OR: z.lazy(() => Report_to_chipScalarWhereWithAggregatesInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => Report_to_chipScalarWhereWithAggregatesInputSchema),z.lazy(() => Report_to_chipScalarWhereWithAggregatesInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - report_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - chip_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), -}).strict(); - -export const Report_to_clauseWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => Report_to_clauseWhereInputSchema),z.lazy(() => Report_to_clauseWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => Report_to_clauseWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => Report_to_clauseWhereInputSchema),z.lazy(() => Report_to_clauseWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - report_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - clause_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - clause: z.union([ z.lazy(() => ClauseRelationFilterSchema),z.lazy(() => ClauseWhereInputSchema) ]).optional(), - report: z.union([ z.lazy(() => ReportRelationFilterSchema),z.lazy(() => ReportWhereInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - clause_id: z.lazy(() => SortOrderSchema).optional(), - clause: z.lazy(() => ClauseOrderByWithRelationInputSchema).optional(), - report: z.lazy(() => ReportOrderByWithRelationInputSchema).optional() -}).strict(); - -export const Report_to_clauseWhereUniqueInputSchema: z.ZodType = z.object({ - id: z.string().optional() -}).strict(); - -export const Report_to_clauseOrderByWithAggregationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - clause_id: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => Report_to_clauseCountOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => Report_to_clauseMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => Report_to_clauseMinOrderByAggregateInputSchema).optional() -}).strict(); - -export const Report_to_clauseScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => Report_to_clauseScalarWhereWithAggregatesInputSchema),z.lazy(() => Report_to_clauseScalarWhereWithAggregatesInputSchema).array() ]).optional(), - OR: z.lazy(() => Report_to_clauseScalarWhereWithAggregatesInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => Report_to_clauseScalarWhereWithAggregatesInputSchema),z.lazy(() => Report_to_clauseScalarWhereWithAggregatesInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - report_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - clause_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), -}).strict(); - -export const ChipCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string(), - report_to_chip: z.lazy(() => Report_to_chipCreateNestedManyWithoutChipInputSchema).optional() -}).strict(); - -export const ChipUncheckedCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string(), - report_to_chip: z.lazy(() => Report_to_chipUncheckedCreateNestedManyWithoutChipInputSchema).optional() -}).strict(); - -export const ChipUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_to_chip: z.lazy(() => Report_to_chipUpdateManyWithoutChipNestedInputSchema).optional() -}).strict(); - -export const ChipUncheckedUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_to_chip: z.lazy(() => Report_to_chipUncheckedUpdateManyWithoutChipNestedInputSchema).optional() -}).strict(); - -export const ChipCreateManyInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string() -}).strict(); - -export const ChipUpdateManyMutationInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ChipUncheckedUpdateManyInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ClauseCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string(), - report_to_clause: z.lazy(() => Report_to_clauseCreateNestedManyWithoutClauseInputSchema).optional() -}).strict(); - -export const ClauseUncheckedCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string(), - report_to_clause: z.lazy(() => Report_to_clauseUncheckedCreateNestedManyWithoutClauseInputSchema).optional() -}).strict(); - -export const ClauseUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_to_clause: z.lazy(() => Report_to_clauseUpdateManyWithoutClauseNestedInputSchema).optional() -}).strict(); - -export const ClauseUncheckedUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_to_clause: z.lazy(() => Report_to_clauseUncheckedUpdateManyWithoutClauseNestedInputSchema).optional() -}).strict(); - -export const ClauseCreateManyInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string() -}).strict(); - -export const ClauseUpdateManyMutationInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ClauseUncheckedUpdateManyInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ReportCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipCreateNestedManyWithoutReportInputSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseCreateNestedManyWithoutReportInputSchema).optional() -}).strict(); - -export const ReportUncheckedCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipUncheckedCreateNestedManyWithoutReportInputSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseUncheckedCreateNestedManyWithoutReportInputSchema).optional() -}).strict(); - -export const ReportUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipUpdateManyWithoutReportNestedInputSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseUpdateManyWithoutReportNestedInputSchema).optional() -}).strict(); - -export const ReportUncheckedUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipUncheckedUpdateManyWithoutReportNestedInputSchema).optional(), - report_to_clause: z.lazy(() => Report_to_clauseUncheckedUpdateManyWithoutReportNestedInputSchema).optional() -}).strict(); - -export const ReportCreateManyInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable() -}).strict(); - -export const ReportUpdateManyMutationInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), -}).strict(); - -export const ReportUncheckedUpdateManyInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), -}).strict(); - -export const Report_to_chipCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - chip: z.lazy(() => ChipCreateNestedOneWithoutReport_to_chipInputSchema), - report: z.lazy(() => ReportCreateNestedOneWithoutReport_to_chipInputSchema) -}).strict(); - -export const Report_to_chipUncheckedCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string(), - chip_id: z.string() -}).strict(); - -export const Report_to_chipUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - chip: z.lazy(() => ChipUpdateOneRequiredWithoutReport_to_chipNestedInputSchema).optional(), - report: z.lazy(() => ReportUpdateOneRequiredWithoutReport_to_chipNestedInputSchema).optional() -}).strict(); - -export const Report_to_chipUncheckedUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - chip_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_chipCreateManyInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string(), - chip_id: z.string() -}).strict(); - -export const Report_to_chipUpdateManyMutationInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_chipUncheckedUpdateManyInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - chip_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - clause: z.lazy(() => ClauseCreateNestedOneWithoutReport_to_clauseInputSchema), - report: z.lazy(() => ReportCreateNestedOneWithoutReport_to_clauseInputSchema) -}).strict(); - -export const Report_to_clauseUncheckedCreateInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string(), - clause_id: z.string() -}).strict(); - -export const Report_to_clauseUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - clause: z.lazy(() => ClauseUpdateOneRequiredWithoutReport_to_clauseNestedInputSchema).optional(), - report: z.lazy(() => ReportUpdateOneRequiredWithoutReport_to_clauseNestedInputSchema).optional() -}).strict(); - -export const Report_to_clauseUncheckedUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - clause_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseCreateManyInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string(), - clause_id: z.string() -}).strict(); - -export const Report_to_clauseUpdateManyMutationInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseUncheckedUpdateManyInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - clause_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const StringFilterSchema: z.ZodType = z.object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringFilterSchema) ]).optional(), -}).strict(); - -export const Report_to_chipListRelationFilterSchema: z.ZodType = z.object({ - every: z.lazy(() => Report_to_chipWhereInputSchema).optional(), - some: z.lazy(() => Report_to_chipWhereInputSchema).optional(), - none: z.lazy(() => Report_to_chipWhereInputSchema).optional() -}).strict(); - -export const Report_to_chipOrderByRelationAggregateInputSchema: z.ZodType = z.object({ - _count: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ChipCountOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ChipMaxOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ChipMinOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const StringWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedStringFilterSchema).optional(), - _max: z.lazy(() => NestedStringFilterSchema).optional() -}).strict(); - -export const Report_to_clauseListRelationFilterSchema: z.ZodType = z.object({ - every: z.lazy(() => Report_to_clauseWhereInputSchema).optional(), - some: z.lazy(() => Report_to_clauseWhereInputSchema).optional(), - none: z.lazy(() => Report_to_clauseWhereInputSchema).optional() -}).strict(); - -export const Report_to_clauseOrderByRelationAggregateInputSchema: z.ZodType = z.object({ - _count: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ClauseCountOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ClauseMaxOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ClauseMinOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - label: z.lazy(() => SortOrderSchema).optional(), - value: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const StringNullableFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableFilterSchema) ]).optional().nullable(), -}).strict(); - -export const DateTimeNullableFilterSchema: 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(() => NestedDateTimeNullableFilterSchema) ]).optional().nullable(), -}).strict(); - -export const DateTimeFilterSchema: 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 ReportCountOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - title: z.lazy(() => SortOrderSchema).optional(), - project_description: z.lazy(() => SortOrderSchema).optional(), - redacted_by: z.lazy(() => SortOrderSchema).optional(), - meet_date: z.lazy(() => SortOrderSchema).optional(), - applicant_name: z.lazy(() => SortOrderSchema).optional(), - applicant_address: z.lazy(() => SortOrderSchema).optional(), - project_cadastral_ref: z.lazy(() => SortOrderSchema).optional(), - project_space_type: z.lazy(() => SortOrderSchema).optional(), - decision: z.lazy(() => SortOrderSchema).optional(), - precisions: z.lazy(() => SortOrderSchema).optional(), - contacts: z.lazy(() => SortOrderSchema).optional(), - further_information: z.lazy(() => SortOrderSchema).optional(), - created_by_id: z.lazy(() => SortOrderSchema).optional(), - created_by_username: z.lazy(() => SortOrderSchema).optional(), - created_at: z.lazy(() => SortOrderSchema).optional(), - service_instructeur: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ReportMaxOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - title: z.lazy(() => SortOrderSchema).optional(), - project_description: z.lazy(() => SortOrderSchema).optional(), - redacted_by: z.lazy(() => SortOrderSchema).optional(), - meet_date: z.lazy(() => SortOrderSchema).optional(), - applicant_name: z.lazy(() => SortOrderSchema).optional(), - applicant_address: z.lazy(() => SortOrderSchema).optional(), - project_cadastral_ref: z.lazy(() => SortOrderSchema).optional(), - project_space_type: z.lazy(() => SortOrderSchema).optional(), - decision: z.lazy(() => SortOrderSchema).optional(), - precisions: z.lazy(() => SortOrderSchema).optional(), - contacts: z.lazy(() => SortOrderSchema).optional(), - further_information: z.lazy(() => SortOrderSchema).optional(), - created_by_id: z.lazy(() => SortOrderSchema).optional(), - created_by_username: z.lazy(() => SortOrderSchema).optional(), - created_at: z.lazy(() => SortOrderSchema).optional(), - service_instructeur: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ReportMinOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - title: z.lazy(() => SortOrderSchema).optional(), - project_description: z.lazy(() => SortOrderSchema).optional(), - redacted_by: z.lazy(() => SortOrderSchema).optional(), - meet_date: z.lazy(() => SortOrderSchema).optional(), - applicant_name: z.lazy(() => SortOrderSchema).optional(), - applicant_address: z.lazy(() => SortOrderSchema).optional(), - project_cadastral_ref: z.lazy(() => SortOrderSchema).optional(), - project_space_type: z.lazy(() => SortOrderSchema).optional(), - decision: z.lazy(() => SortOrderSchema).optional(), - precisions: z.lazy(() => SortOrderSchema).optional(), - contacts: z.lazy(() => SortOrderSchema).optional(), - further_information: z.lazy(() => SortOrderSchema).optional(), - created_by_id: z.lazy(() => SortOrderSchema).optional(), - created_by_username: z.lazy(() => SortOrderSchema).optional(), - created_at: z.lazy(() => SortOrderSchema).optional(), - service_instructeur: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const StringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), - _max: z.lazy(() => NestedStringNullableFilterSchema).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(), - 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(() => NestedDateTimeWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedDateTimeFilterSchema).optional(), - _max: z.lazy(() => NestedDateTimeFilterSchema).optional() -}).strict(); - -export const ChipRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => ChipWhereInputSchema).optional(), - isNot: z.lazy(() => ChipWhereInputSchema).optional() -}).strict(); - -export const ReportRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => ReportWhereInputSchema).optional(), - isNot: z.lazy(() => ReportWhereInputSchema).optional() -}).strict(); - -export const Report_to_chipCountOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - chip_id: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const Report_to_chipMaxOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - chip_id: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const Report_to_chipMinOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - chip_id: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ClauseRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => ClauseWhereInputSchema).optional(), - isNot: z.lazy(() => ClauseWhereInputSchema).optional() -}).strict(); - -export const Report_to_clauseCountOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - clause_id: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const Report_to_clauseMaxOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - clause_id: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const Report_to_clauseMinOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - report_id: z.lazy(() => SortOrderSchema).optional(), - clause_id: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const Report_to_chipCreateNestedManyWithoutChipInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateWithoutChipInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyChipInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_chipUncheckedCreateNestedManyWithoutChipInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateWithoutChipInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyChipInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const StringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.string().optional() -}).strict(); - -export const Report_to_chipUpdateManyWithoutChipNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateWithoutChipInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutChipInputSchema),z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutChipInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyChipInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutChipInputSchema),z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutChipInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutChipInputSchema),z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutChipInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_chipScalarWhereInputSchema),z.lazy(() => Report_to_chipScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_chipUncheckedUpdateManyWithoutChipNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateWithoutChipInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutChipInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutChipInputSchema),z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutChipInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyChipInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutChipInputSchema),z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutChipInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutChipInputSchema),z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutChipInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_chipScalarWhereInputSchema),z.lazy(() => Report_to_chipScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseCreateNestedManyWithoutClauseInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyClauseInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseUncheckedCreateNestedManyWithoutClauseInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyClauseInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseUpdateManyWithoutClauseNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutClauseInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyClauseInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutClauseInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutClauseInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_clauseScalarWhereInputSchema),z.lazy(() => Report_to_clauseScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseUncheckedUpdateManyWithoutClauseNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutClauseInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutClauseInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyClauseInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutClauseInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutClauseInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_clauseScalarWhereInputSchema),z.lazy(() => Report_to_clauseScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_chipCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyReportInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyReportInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_chipUncheckedCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyReportInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseUncheckedCreateNestedManyWithoutReportInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyReportInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - -export const NullableStringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.string().optional().nullable() -}).strict(); - -export const NullableDateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.coerce.date().optional().nullable() -}).strict(); - -export const DateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.coerce.date().optional() -}).strict(); - -export const Report_to_chipUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyReportInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_chipScalarWhereInputSchema),z.lazy(() => Report_to_chipScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyReportInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_clauseScalarWhereInputSchema),z.lazy(() => Report_to_clauseScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_chipUncheckedUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_chipCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_chipUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_chipCreateManyReportInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_chipWhereUniqueInputSchema),z.lazy(() => Report_to_chipWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_chipUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => Report_to_chipUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_chipScalarWhereInputSchema),z.lazy(() => Report_to_chipScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const Report_to_clauseUncheckedUpdateManyWithoutReportNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema).array(),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema),z.lazy(() => Report_to_clauseCreateOrConnectWithoutReportInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_clauseUpsertWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - createMany: z.lazy(() => Report_to_clauseCreateManyReportInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => Report_to_clauseWhereUniqueInputSchema),z.lazy(() => Report_to_clauseWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutReportInputSchema),z.lazy(() => Report_to_clauseUpdateWithWhereUniqueWithoutReportInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutReportInputSchema),z.lazy(() => Report_to_clauseUpdateManyWithWhereWithoutReportInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => Report_to_clauseScalarWhereInputSchema),z.lazy(() => Report_to_clauseScalarWhereInputSchema).array() ]).optional(), -}).strict(); - -export const ChipCreateNestedOneWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ChipCreateWithoutReport_to_chipInputSchema),z.lazy(() => ChipUncheckedCreateWithoutReport_to_chipInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ChipCreateOrConnectWithoutReport_to_chipInputSchema).optional(), - connect: z.lazy(() => ChipWhereUniqueInputSchema).optional() -}).strict(); - -export const ReportCreateNestedOneWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_chipInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_chipInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutReport_to_chipInputSchema).optional(), - connect: z.lazy(() => ReportWhereUniqueInputSchema).optional() -}).strict(); - -export const ChipUpdateOneRequiredWithoutReport_to_chipNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ChipCreateWithoutReport_to_chipInputSchema),z.lazy(() => ChipUncheckedCreateWithoutReport_to_chipInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ChipCreateOrConnectWithoutReport_to_chipInputSchema).optional(), - upsert: z.lazy(() => ChipUpsertWithoutReport_to_chipInputSchema).optional(), - connect: z.lazy(() => ChipWhereUniqueInputSchema).optional(), - update: z.union([ z.lazy(() => ChipUpdateWithoutReport_to_chipInputSchema),z.lazy(() => ChipUncheckedUpdateWithoutReport_to_chipInputSchema) ]).optional(), -}).strict(); - -export const ReportUpdateOneRequiredWithoutReport_to_chipNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_chipInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_chipInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutReport_to_chipInputSchema).optional(), - upsert: z.lazy(() => ReportUpsertWithoutReport_to_chipInputSchema).optional(), - connect: z.lazy(() => ReportWhereUniqueInputSchema).optional(), - update: z.union([ z.lazy(() => ReportUpdateWithoutReport_to_chipInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutReport_to_chipInputSchema) ]).optional(), -}).strict(); - -export const ClauseCreateNestedOneWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ClauseCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ClauseUncheckedCreateWithoutReport_to_clauseInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ClauseCreateOrConnectWithoutReport_to_clauseInputSchema).optional(), - connect: z.lazy(() => ClauseWhereUniqueInputSchema).optional() -}).strict(); - -export const ReportCreateNestedOneWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_clauseInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutReport_to_clauseInputSchema).optional(), - connect: z.lazy(() => ReportWhereUniqueInputSchema).optional() -}).strict(); - -export const ClauseUpdateOneRequiredWithoutReport_to_clauseNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ClauseCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ClauseUncheckedCreateWithoutReport_to_clauseInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ClauseCreateOrConnectWithoutReport_to_clauseInputSchema).optional(), - upsert: z.lazy(() => ClauseUpsertWithoutReport_to_clauseInputSchema).optional(), - connect: z.lazy(() => ClauseWhereUniqueInputSchema).optional(), - update: z.union([ z.lazy(() => ClauseUpdateWithoutReport_to_clauseInputSchema),z.lazy(() => ClauseUncheckedUpdateWithoutReport_to_clauseInputSchema) ]).optional(), -}).strict(); - -export const ReportUpdateOneRequiredWithoutReport_to_clauseNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_clauseInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => ReportCreateOrConnectWithoutReport_to_clauseInputSchema).optional(), - upsert: z.lazy(() => ReportUpsertWithoutReport_to_clauseInputSchema).optional(), - connect: z.lazy(() => ReportWhereUniqueInputSchema).optional(), - update: z.union([ z.lazy(() => ReportUpdateWithoutReport_to_clauseInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutReport_to_clauseInputSchema) ]).optional(), -}).strict(); - -export const NestedStringFilterSchema: z.ZodType = z.object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringFilterSchema) ]).optional(), -}).strict(); - -export const NestedStringWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.string().optional(), - in: z.string().array().optional(), - notIn: z.string().array().optional(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedStringFilterSchema).optional(), - _max: z.lazy(() => NestedStringFilterSchema).optional() -}).strict(); - -export const NestedIntFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.number().array().optional(), - notIn: z.number().array().optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), -}).strict(); - -export const NestedStringNullableFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableFilterSchema) ]).optional().nullable(), -}).strict(); - -export const NestedDateTimeNullableFilterSchema: 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(() => 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 NestedStringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), - _max: z.lazy(() => NestedStringNullableFilterSchema).optional() -}).strict(); - -export const NestedIntNullableFilterSchema: z.ZodType = z.object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), -}).strict(); - -export const NestedDateTimeNullableWithAggregatesFilterSchema: 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 NestedDateTimeWithAggregatesFilterSchema: 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(() => NestedDateTimeWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedDateTimeFilterSchema).optional(), - _max: z.lazy(() => NestedDateTimeFilterSchema).optional() -}).strict(); - -export const Report_to_chipCreateWithoutChipInputSchema: z.ZodType = z.object({ - id: z.string(), - report: z.lazy(() => ReportCreateNestedOneWithoutReport_to_chipInputSchema) -}).strict(); - -export const Report_to_chipUncheckedCreateWithoutChipInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string() -}).strict(); - -export const Report_to_chipCreateOrConnectWithoutChipInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipWhereUniqueInputSchema), - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema) ]), -}).strict(); - -export const Report_to_chipCreateManyChipInputEnvelopeSchema: z.ZodType = z.object({ - data: z.lazy(() => Report_to_chipCreateManyChipInputSchema).array(), - skipDuplicates: z.boolean().optional() -}).strict(); - -export const Report_to_chipUpsertWithWhereUniqueWithoutChipInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipWhereUniqueInputSchema), - update: z.union([ z.lazy(() => Report_to_chipUpdateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedUpdateWithoutChipInputSchema) ]), - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutChipInputSchema) ]), -}).strict(); - -export const Report_to_chipUpdateWithWhereUniqueWithoutChipInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipWhereUniqueInputSchema), - data: z.union([ z.lazy(() => Report_to_chipUpdateWithoutChipInputSchema),z.lazy(() => Report_to_chipUncheckedUpdateWithoutChipInputSchema) ]), -}).strict(); - -export const Report_to_chipUpdateManyWithWhereWithoutChipInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipScalarWhereInputSchema), - data: z.union([ z.lazy(() => Report_to_chipUpdateManyMutationInputSchema),z.lazy(() => Report_to_chipUncheckedUpdateManyWithoutReport_to_chipInputSchema) ]), -}).strict(); - -export const Report_to_chipScalarWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => Report_to_chipScalarWhereInputSchema),z.lazy(() => Report_to_chipScalarWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => Report_to_chipScalarWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => Report_to_chipScalarWhereInputSchema),z.lazy(() => Report_to_chipScalarWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - report_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - chip_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), -}).strict(); - -export const Report_to_clauseCreateWithoutClauseInputSchema: z.ZodType = z.object({ - id: z.string(), - report: z.lazy(() => ReportCreateNestedOneWithoutReport_to_clauseInputSchema) -}).strict(); - -export const Report_to_clauseUncheckedCreateWithoutClauseInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string() -}).strict(); - -export const Report_to_clauseCreateOrConnectWithoutClauseInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseWhereUniqueInputSchema), - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema) ]), -}).strict(); - -export const Report_to_clauseCreateManyClauseInputEnvelopeSchema: z.ZodType = z.object({ - data: z.lazy(() => Report_to_clauseCreateManyClauseInputSchema).array(), - skipDuplicates: z.boolean().optional() -}).strict(); - -export const Report_to_clauseUpsertWithWhereUniqueWithoutClauseInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseWhereUniqueInputSchema), - update: z.union([ z.lazy(() => Report_to_clauseUpdateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedUpdateWithoutClauseInputSchema) ]), - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutClauseInputSchema) ]), -}).strict(); - -export const Report_to_clauseUpdateWithWhereUniqueWithoutClauseInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseWhereUniqueInputSchema), - data: z.union([ z.lazy(() => Report_to_clauseUpdateWithoutClauseInputSchema),z.lazy(() => Report_to_clauseUncheckedUpdateWithoutClauseInputSchema) ]), -}).strict(); - -export const Report_to_clauseUpdateManyWithWhereWithoutClauseInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseScalarWhereInputSchema), - data: z.union([ z.lazy(() => Report_to_clauseUpdateManyMutationInputSchema),z.lazy(() => Report_to_clauseUncheckedUpdateManyWithoutReport_to_clauseInputSchema) ]), -}).strict(); - -export const Report_to_clauseScalarWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => Report_to_clauseScalarWhereInputSchema),z.lazy(() => Report_to_clauseScalarWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => Report_to_clauseScalarWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => Report_to_clauseScalarWhereInputSchema),z.lazy(() => Report_to_clauseScalarWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - report_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - clause_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), -}).strict(); - -export const Report_to_chipCreateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.string(), - chip: z.lazy(() => ChipCreateNestedOneWithoutReport_to_chipInputSchema) -}).strict(); - -export const Report_to_chipUncheckedCreateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.string(), - chip_id: z.string() -}).strict(); - -export const Report_to_chipCreateOrConnectWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipWhereUniqueInputSchema), - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema) ]), -}).strict(); - -export const Report_to_chipCreateManyReportInputEnvelopeSchema: z.ZodType = z.object({ - data: z.lazy(() => Report_to_chipCreateManyReportInputSchema).array(), - skipDuplicates: z.boolean().optional() -}).strict(); - -export const Report_to_clauseCreateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.string(), - clause: z.lazy(() => ClauseCreateNestedOneWithoutReport_to_clauseInputSchema) -}).strict(); - -export const Report_to_clauseUncheckedCreateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.string(), - clause_id: z.string() -}).strict(); - -export const Report_to_clauseCreateOrConnectWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseWhereUniqueInputSchema), - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema) ]), -}).strict(); - -export const Report_to_clauseCreateManyReportInputEnvelopeSchema: z.ZodType = z.object({ - data: z.lazy(() => Report_to_clauseCreateManyReportInputSchema).array(), - skipDuplicates: z.boolean().optional() -}).strict(); - -export const Report_to_chipUpsertWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipWhereUniqueInputSchema), - update: z.union([ z.lazy(() => Report_to_chipUpdateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedUpdateWithoutReportInputSchema) ]), - create: z.union([ z.lazy(() => Report_to_chipCreateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedCreateWithoutReportInputSchema) ]), -}).strict(); - -export const Report_to_chipUpdateWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipWhereUniqueInputSchema), - data: z.union([ z.lazy(() => Report_to_chipUpdateWithoutReportInputSchema),z.lazy(() => Report_to_chipUncheckedUpdateWithoutReportInputSchema) ]), -}).strict(); - -export const Report_to_chipUpdateManyWithWhereWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_chipScalarWhereInputSchema), - data: z.union([ z.lazy(() => Report_to_chipUpdateManyMutationInputSchema),z.lazy(() => Report_to_chipUncheckedUpdateManyWithoutReport_to_chipInputSchema) ]), -}).strict(); - -export const Report_to_clauseUpsertWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseWhereUniqueInputSchema), - update: z.union([ z.lazy(() => Report_to_clauseUpdateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedUpdateWithoutReportInputSchema) ]), - create: z.union([ z.lazy(() => Report_to_clauseCreateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedCreateWithoutReportInputSchema) ]), -}).strict(); - -export const Report_to_clauseUpdateWithWhereUniqueWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseWhereUniqueInputSchema), - data: z.union([ z.lazy(() => Report_to_clauseUpdateWithoutReportInputSchema),z.lazy(() => Report_to_clauseUncheckedUpdateWithoutReportInputSchema) ]), -}).strict(); - -export const Report_to_clauseUpdateManyWithWhereWithoutReportInputSchema: z.ZodType = z.object({ - where: z.lazy(() => Report_to_clauseScalarWhereInputSchema), - data: z.union([ z.lazy(() => Report_to_clauseUpdateManyMutationInputSchema),z.lazy(() => Report_to_clauseUncheckedUpdateManyWithoutReport_to_clauseInputSchema) ]), -}).strict(); - -export const ChipCreateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string() -}).strict(); - -export const ChipUncheckedCreateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string() -}).strict(); - -export const ChipCreateOrConnectWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ChipWhereUniqueInputSchema), - create: z.union([ z.lazy(() => ChipCreateWithoutReport_to_chipInputSchema),z.lazy(() => ChipUncheckedCreateWithoutReport_to_chipInputSchema) ]), -}).strict(); - -export const ReportCreateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable(), - report_to_clause: z.lazy(() => Report_to_clauseCreateNestedManyWithoutReportInputSchema).optional() -}).strict(); - -export const ReportUncheckedCreateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable(), - report_to_clause: z.lazy(() => Report_to_clauseUncheckedCreateNestedManyWithoutReportInputSchema).optional() -}).strict(); - -export const ReportCreateOrConnectWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ReportWhereUniqueInputSchema), - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_chipInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_chipInputSchema) ]), -}).strict(); - -export const ChipUpsertWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - update: z.union([ z.lazy(() => ChipUpdateWithoutReport_to_chipInputSchema),z.lazy(() => ChipUncheckedUpdateWithoutReport_to_chipInputSchema) ]), - create: z.union([ z.lazy(() => ChipCreateWithoutReport_to_chipInputSchema),z.lazy(() => ChipUncheckedCreateWithoutReport_to_chipInputSchema) ]), -}).strict(); - -export const ChipUpdateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ChipUncheckedUpdateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ReportUpsertWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - update: z.union([ z.lazy(() => ReportUpdateWithoutReport_to_chipInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutReport_to_chipInputSchema) ]), - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_chipInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_chipInputSchema) ]), -}).strict(); - -export const ReportUpdateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - report_to_clause: z.lazy(() => Report_to_clauseUpdateManyWithoutReportNestedInputSchema).optional() -}).strict(); - -export const ReportUncheckedUpdateWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - report_to_clause: z.lazy(() => Report_to_clauseUncheckedUpdateManyWithoutReportNestedInputSchema).optional() -}).strict(); - -export const ClauseCreateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string() -}).strict(); - -export const ClauseUncheckedCreateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.string(), - label: z.string(), - value: z.string() -}).strict(); - -export const ClauseCreateOrConnectWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ClauseWhereUniqueInputSchema), - create: z.union([ z.lazy(() => ClauseCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ClauseUncheckedCreateWithoutReport_to_clauseInputSchema) ]), -}).strict(); - -export const ReportCreateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipCreateNestedManyWithoutReportInputSchema).optional() -}).strict(); - -export const ReportUncheckedCreateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.string(), - title: z.string().optional().nullable(), - project_description: z.string().optional().nullable(), - redacted_by: z.string().optional().nullable(), - meet_date: z.coerce.date().optional().nullable(), - applicant_name: z.string().optional().nullable(), - applicant_address: z.string().optional().nullable(), - project_cadastral_ref: z.string().optional().nullable(), - project_space_type: z.string().optional().nullable(), - decision: z.string().optional().nullable(), - precisions: z.string().optional().nullable(), - contacts: z.string().optional().nullable(), - further_information: z.string().optional().nullable(), - created_by_id: z.string(), - created_by_username: z.string(), - created_at: z.coerce.date(), - service_instructeur: z.string().optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipUncheckedCreateNestedManyWithoutReportInputSchema).optional() -}).strict(); - -export const ReportCreateOrConnectWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ReportWhereUniqueInputSchema), - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_clauseInputSchema) ]), -}).strict(); - -export const ClauseUpsertWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - update: z.union([ z.lazy(() => ClauseUpdateWithoutReport_to_clauseInputSchema),z.lazy(() => ClauseUncheckedUpdateWithoutReport_to_clauseInputSchema) ]), - create: z.union([ z.lazy(() => ClauseCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ClauseUncheckedCreateWithoutReport_to_clauseInputSchema) ]), -}).strict(); - -export const ClauseUpdateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ClauseUncheckedUpdateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - label: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ReportUpsertWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - update: z.union([ z.lazy(() => ReportUpdateWithoutReport_to_clauseInputSchema),z.lazy(() => ReportUncheckedUpdateWithoutReport_to_clauseInputSchema) ]), - create: z.union([ z.lazy(() => ReportCreateWithoutReport_to_clauseInputSchema),z.lazy(() => ReportUncheckedCreateWithoutReport_to_clauseInputSchema) ]), -}).strict(); - -export const ReportUpdateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipUpdateManyWithoutReportNestedInputSchema).optional() -}).strict(); - -export const ReportUncheckedUpdateWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - title: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_description: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - redacted_by: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - meet_date: z.union([ z.coerce.date(),z.lazy(() => NullableDateTimeFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_name: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - applicant_address: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_cadastral_ref: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - project_space_type: 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(), - further_information: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - created_by_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_by_username: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - created_at: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - service_instructeur: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), - report_to_chip: z.lazy(() => Report_to_chipUncheckedUpdateManyWithoutReportNestedInputSchema).optional() -}).strict(); - -export const Report_to_chipCreateManyChipInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string() -}).strict(); - -export const Report_to_chipUpdateWithoutChipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report: z.lazy(() => ReportUpdateOneRequiredWithoutReport_to_chipNestedInputSchema).optional() -}).strict(); - -export const Report_to_chipUncheckedUpdateWithoutChipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_chipUncheckedUpdateManyWithoutReport_to_chipInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseCreateManyClauseInputSchema: z.ZodType = z.object({ - id: z.string(), - report_id: z.string() -}).strict(); - -export const Report_to_clauseUpdateWithoutClauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report: z.lazy(() => ReportUpdateOneRequiredWithoutReport_to_clauseNestedInputSchema).optional() -}).strict(); - -export const Report_to_clauseUncheckedUpdateWithoutClauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseUncheckedUpdateManyWithoutReport_to_clauseInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - report_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_chipCreateManyReportInputSchema: z.ZodType = z.object({ - id: z.string(), - chip_id: z.string() -}).strict(); - -export const Report_to_clauseCreateManyReportInputSchema: z.ZodType = z.object({ - id: z.string(), - clause_id: z.string() -}).strict(); - -export const Report_to_chipUpdateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - chip: z.lazy(() => ChipUpdateOneRequiredWithoutReport_to_chipNestedInputSchema).optional() -}).strict(); - -export const Report_to_chipUncheckedUpdateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - chip_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const Report_to_clauseUpdateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - clause: z.lazy(() => ClauseUpdateOneRequiredWithoutReport_to_clauseNestedInputSchema).optional() -}).strict(); - -export const Report_to_clauseUncheckedUpdateWithoutReportInputSchema: z.ZodType = z.object({ - id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - clause_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -///////////////////////////////////////// -// ARGS -///////////////////////////////////////// - -export const ChipFindFirstArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereInputSchema.optional(), - orderBy: z.union([ ChipOrderByWithRelationInputSchema.array(),ChipOrderByWithRelationInputSchema ]).optional(), - cursor: ChipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ChipScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ChipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereInputSchema.optional(), - orderBy: z.union([ ChipOrderByWithRelationInputSchema.array(),ChipOrderByWithRelationInputSchema ]).optional(), - cursor: ChipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ChipScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ChipFindManyArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereInputSchema.optional(), - orderBy: z.union([ ChipOrderByWithRelationInputSchema.array(),ChipOrderByWithRelationInputSchema ]).optional(), - cursor: ChipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ChipScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ChipAggregateArgsSchema: z.ZodType = z.object({ - where: ChipWhereInputSchema.optional(), - orderBy: z.union([ ChipOrderByWithRelationInputSchema.array(),ChipOrderByWithRelationInputSchema ]).optional(), - cursor: ChipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const ChipGroupByArgsSchema: z.ZodType = z.object({ - where: ChipWhereInputSchema.optional(), - orderBy: z.union([ ChipOrderByWithAggregationInputSchema.array(),ChipOrderByWithAggregationInputSchema ]).optional(), - by: ChipScalarFieldEnumSchema.array(), - having: ChipScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const ChipFindUniqueArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ChipFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ClauseFindFirstArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereInputSchema.optional(), - orderBy: z.union([ ClauseOrderByWithRelationInputSchema.array(),ClauseOrderByWithRelationInputSchema ]).optional(), - cursor: ClauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ClauseScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ClauseFindFirstOrThrowArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereInputSchema.optional(), - orderBy: z.union([ ClauseOrderByWithRelationInputSchema.array(),ClauseOrderByWithRelationInputSchema ]).optional(), - cursor: ClauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ClauseScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ClauseFindManyArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereInputSchema.optional(), - orderBy: z.union([ ClauseOrderByWithRelationInputSchema.array(),ClauseOrderByWithRelationInputSchema ]).optional(), - cursor: ClauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ClauseScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ClauseAggregateArgsSchema: z.ZodType = z.object({ - where: ClauseWhereInputSchema.optional(), - orderBy: z.union([ ClauseOrderByWithRelationInputSchema.array(),ClauseOrderByWithRelationInputSchema ]).optional(), - cursor: ClauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const ClauseGroupByArgsSchema: z.ZodType = z.object({ - where: ClauseWhereInputSchema.optional(), - orderBy: z.union([ ClauseOrderByWithAggregationInputSchema.array(),ClauseOrderByWithAggregationInputSchema ]).optional(), - by: ClauseScalarFieldEnumSchema.array(), - having: ClauseScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const ClauseFindUniqueArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ClauseFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ReportFindFirstArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereInputSchema.optional(), - orderBy: z.union([ ReportOrderByWithRelationInputSchema.array(),ReportOrderByWithRelationInputSchema ]).optional(), - cursor: ReportWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ReportScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ReportFindFirstOrThrowArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereInputSchema.optional(), - orderBy: z.union([ ReportOrderByWithRelationInputSchema.array(),ReportOrderByWithRelationInputSchema ]).optional(), - cursor: ReportWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ReportScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ReportFindManyArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereInputSchema.optional(), - orderBy: z.union([ ReportOrderByWithRelationInputSchema.array(),ReportOrderByWithRelationInputSchema ]).optional(), - cursor: ReportWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ReportScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const ReportAggregateArgsSchema: z.ZodType = z.object({ - where: ReportWhereInputSchema.optional(), - orderBy: z.union([ ReportOrderByWithRelationInputSchema.array(),ReportOrderByWithRelationInputSchema ]).optional(), - cursor: ReportWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const ReportGroupByArgsSchema: z.ZodType = z.object({ - where: ReportWhereInputSchema.optional(), - orderBy: z.union([ ReportOrderByWithAggregationInputSchema.array(),ReportOrderByWithAggregationInputSchema ]).optional(), - by: ReportScalarFieldEnumSchema.array(), - having: ReportScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const ReportFindUniqueArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ReportFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_chipFindFirstArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereInputSchema.optional(), - orderBy: z.union([ Report_to_chipOrderByWithRelationInputSchema.array(),Report_to_chipOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_chipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: Report_to_chipScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const Report_to_chipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereInputSchema.optional(), - orderBy: z.union([ Report_to_chipOrderByWithRelationInputSchema.array(),Report_to_chipOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_chipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: Report_to_chipScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const Report_to_chipFindManyArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereInputSchema.optional(), - orderBy: z.union([ Report_to_chipOrderByWithRelationInputSchema.array(),Report_to_chipOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_chipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: Report_to_chipScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const Report_to_chipAggregateArgsSchema: z.ZodType = z.object({ - where: Report_to_chipWhereInputSchema.optional(), - orderBy: z.union([ Report_to_chipOrderByWithRelationInputSchema.array(),Report_to_chipOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_chipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const Report_to_chipGroupByArgsSchema: z.ZodType = z.object({ - where: Report_to_chipWhereInputSchema.optional(), - orderBy: z.union([ Report_to_chipOrderByWithAggregationInputSchema.array(),Report_to_chipOrderByWithAggregationInputSchema ]).optional(), - by: Report_to_chipScalarFieldEnumSchema.array(), - having: Report_to_chipScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const Report_to_chipFindUniqueArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_chipFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_clauseFindFirstArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereInputSchema.optional(), - orderBy: z.union([ Report_to_clauseOrderByWithRelationInputSchema.array(),Report_to_clauseOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_clauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: Report_to_clauseScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const Report_to_clauseFindFirstOrThrowArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereInputSchema.optional(), - orderBy: z.union([ Report_to_clauseOrderByWithRelationInputSchema.array(),Report_to_clauseOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_clauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: Report_to_clauseScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const Report_to_clauseFindManyArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereInputSchema.optional(), - orderBy: z.union([ Report_to_clauseOrderByWithRelationInputSchema.array(),Report_to_clauseOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_clauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: Report_to_clauseScalarFieldEnumSchema.array().optional(), -}).strict() as z.ZodType - -export const Report_to_clauseAggregateArgsSchema: z.ZodType = z.object({ - where: Report_to_clauseWhereInputSchema.optional(), - orderBy: z.union([ Report_to_clauseOrderByWithRelationInputSchema.array(),Report_to_clauseOrderByWithRelationInputSchema ]).optional(), - cursor: Report_to_clauseWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const Report_to_clauseGroupByArgsSchema: z.ZodType = z.object({ - where: Report_to_clauseWhereInputSchema.optional(), - orderBy: z.union([ Report_to_clauseOrderByWithAggregationInputSchema.array(),Report_to_clauseOrderByWithAggregationInputSchema ]).optional(), - by: Report_to_clauseScalarFieldEnumSchema.array(), - having: Report_to_clauseScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() as z.ZodType - -export const Report_to_clauseFindUniqueArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_clauseFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ChipCreateArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - data: z.union([ ChipCreateInputSchema,ChipUncheckedCreateInputSchema ]), -}).strict() as z.ZodType - -export const ChipUpsertArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereUniqueInputSchema, - create: z.union([ ChipCreateInputSchema,ChipUncheckedCreateInputSchema ]), - update: z.union([ ChipUpdateInputSchema,ChipUncheckedUpdateInputSchema ]), -}).strict() as z.ZodType - -export const ChipCreateManyArgsSchema: z.ZodType = z.object({ - data: ChipCreateManyInputSchema.array(), - skipDuplicates: z.boolean().optional(), -}).strict() as z.ZodType - -export const ChipDeleteArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - where: ChipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ChipUpdateArgsSchema: z.ZodType = z.object({ - select: ChipSelectSchema.optional(), - include: ChipIncludeSchema.optional(), - data: z.union([ ChipUpdateInputSchema,ChipUncheckedUpdateInputSchema ]), - where: ChipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ChipUpdateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ ChipUpdateManyMutationInputSchema,ChipUncheckedUpdateManyInputSchema ]), - where: ChipWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const ChipDeleteManyArgsSchema: z.ZodType = z.object({ - where: ChipWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const ClauseCreateArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - data: z.union([ ClauseCreateInputSchema,ClauseUncheckedCreateInputSchema ]), -}).strict() as z.ZodType - -export const ClauseUpsertArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereUniqueInputSchema, - create: z.union([ ClauseCreateInputSchema,ClauseUncheckedCreateInputSchema ]), - update: z.union([ ClauseUpdateInputSchema,ClauseUncheckedUpdateInputSchema ]), -}).strict() as z.ZodType - -export const ClauseCreateManyArgsSchema: z.ZodType = z.object({ - data: ClauseCreateManyInputSchema.array(), - skipDuplicates: z.boolean().optional(), -}).strict() as z.ZodType - -export const ClauseDeleteArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - where: ClauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ClauseUpdateArgsSchema: z.ZodType = z.object({ - select: ClauseSelectSchema.optional(), - include: ClauseIncludeSchema.optional(), - data: z.union([ ClauseUpdateInputSchema,ClauseUncheckedUpdateInputSchema ]), - where: ClauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ClauseUpdateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ ClauseUpdateManyMutationInputSchema,ClauseUncheckedUpdateManyInputSchema ]), - where: ClauseWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const ClauseDeleteManyArgsSchema: z.ZodType = z.object({ - where: ClauseWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const ReportCreateArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - data: z.union([ ReportCreateInputSchema,ReportUncheckedCreateInputSchema ]), -}).strict() as z.ZodType - -export const ReportUpsertArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereUniqueInputSchema, - create: z.union([ ReportCreateInputSchema,ReportUncheckedCreateInputSchema ]), - update: z.union([ ReportUpdateInputSchema,ReportUncheckedUpdateInputSchema ]), -}).strict() as z.ZodType - -export const ReportCreateManyArgsSchema: z.ZodType = z.object({ - data: ReportCreateManyInputSchema.array(), - skipDuplicates: z.boolean().optional(), -}).strict() as z.ZodType - -export const ReportDeleteArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - where: ReportWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ReportUpdateArgsSchema: z.ZodType = z.object({ - select: ReportSelectSchema.optional(), - include: ReportIncludeSchema.optional(), - data: z.union([ ReportUpdateInputSchema,ReportUncheckedUpdateInputSchema ]), - where: ReportWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const ReportUpdateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ ReportUpdateManyMutationInputSchema,ReportUncheckedUpdateManyInputSchema ]), - where: ReportWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const ReportDeleteManyArgsSchema: z.ZodType = z.object({ - where: ReportWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const Report_to_chipCreateArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - data: z.union([ Report_to_chipCreateInputSchema,Report_to_chipUncheckedCreateInputSchema ]), -}).strict() as z.ZodType - -export const Report_to_chipUpsertArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereUniqueInputSchema, - create: z.union([ Report_to_chipCreateInputSchema,Report_to_chipUncheckedCreateInputSchema ]), - update: z.union([ Report_to_chipUpdateInputSchema,Report_to_chipUncheckedUpdateInputSchema ]), -}).strict() as z.ZodType - -export const Report_to_chipCreateManyArgsSchema: z.ZodType = z.object({ - data: Report_to_chipCreateManyInputSchema.array(), - skipDuplicates: z.boolean().optional(), -}).strict() as z.ZodType - -export const Report_to_chipDeleteArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - where: Report_to_chipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_chipUpdateArgsSchema: z.ZodType = z.object({ - select: Report_to_chipSelectSchema.optional(), - include: Report_to_chipIncludeSchema.optional(), - data: z.union([ Report_to_chipUpdateInputSchema,Report_to_chipUncheckedUpdateInputSchema ]), - where: Report_to_chipWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_chipUpdateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ Report_to_chipUpdateManyMutationInputSchema,Report_to_chipUncheckedUpdateManyInputSchema ]), - where: Report_to_chipWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const Report_to_chipDeleteManyArgsSchema: z.ZodType = z.object({ - where: Report_to_chipWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const Report_to_clauseCreateArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - data: z.union([ Report_to_clauseCreateInputSchema,Report_to_clauseUncheckedCreateInputSchema ]), -}).strict() as z.ZodType - -export const Report_to_clauseUpsertArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereUniqueInputSchema, - create: z.union([ Report_to_clauseCreateInputSchema,Report_to_clauseUncheckedCreateInputSchema ]), - update: z.union([ Report_to_clauseUpdateInputSchema,Report_to_clauseUncheckedUpdateInputSchema ]), -}).strict() as z.ZodType - -export const Report_to_clauseCreateManyArgsSchema: z.ZodType = z.object({ - data: Report_to_clauseCreateManyInputSchema.array(), - skipDuplicates: z.boolean().optional(), -}).strict() as z.ZodType - -export const Report_to_clauseDeleteArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - where: Report_to_clauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_clauseUpdateArgsSchema: z.ZodType = z.object({ - select: Report_to_clauseSelectSchema.optional(), - include: Report_to_clauseIncludeSchema.optional(), - data: z.union([ Report_to_clauseUpdateInputSchema,Report_to_clauseUncheckedUpdateInputSchema ]), - where: Report_to_clauseWhereUniqueInputSchema, -}).strict() as z.ZodType - -export const Report_to_clauseUpdateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ Report_to_clauseUpdateManyMutationInputSchema,Report_to_clauseUncheckedUpdateManyInputSchema ]), - where: Report_to_clauseWhereInputSchema.optional(), -}).strict() as z.ZodType - -export const Report_to_clauseDeleteManyArgsSchema: z.ZodType = z.object({ - where: Report_to_clauseWhereInputSchema.optional(), -}).strict() as z.ZodType - -interface ChipGetPayload extends HKT { - readonly _A?: boolean | null | undefined | Prisma.ChipArgs - readonly type: Prisma.ChipGetPayload -} - -interface ClauseGetPayload extends HKT { - readonly _A?: boolean | null | undefined | Prisma.ClauseArgs - readonly type: Prisma.ClauseGetPayload -} - -interface ReportGetPayload extends HKT { - readonly _A?: boolean | null | undefined | Prisma.ReportArgs - readonly type: Prisma.ReportGetPayload -} - -interface Report_to_chipGetPayload extends HKT { - readonly _A?: boolean | null | undefined | Prisma.Report_to_chipArgs - readonly type: Prisma.Report_to_chipGetPayload -} - -interface Report_to_clauseGetPayload extends HKT { - readonly _A?: boolean | null | undefined | Prisma.Report_to_clauseArgs - readonly type: Prisma.Report_to_clauseGetPayload -} - -export const tableSchemas = { - chip: { - fields: new Map([ - [ - "id", - "TEXT" - ], - [ - "label", - "TEXT" - ], - [ - "value", - "TEXT" - ] - ]), - relations: [ - new Relation("report_to_chip", "", "", "report_to_chip", "ChipToReport_to_chip", "many"), - ], - modelSchema: (ChipCreateInputSchema as any) - .partial() - .or((ChipUncheckedCreateInputSchema as any).partial()), - createSchema: ChipCreateArgsSchema, - createManySchema: ChipCreateManyArgsSchema, - findUniqueSchema: ChipFindUniqueArgsSchema, - findSchema: ChipFindFirstArgsSchema, - updateSchema: ChipUpdateArgsSchema, - updateManySchema: ChipUpdateManyArgsSchema, - upsertSchema: ChipUpsertArgsSchema, - deleteSchema: ChipDeleteArgsSchema, - deleteManySchema: ChipDeleteManyArgsSchema - } as TableSchema< - z.infer, - Prisma.ChipCreateArgs['data'], - Prisma.ChipUpdateArgs['data'], - Prisma.ChipFindFirstArgs['select'], - Prisma.ChipFindFirstArgs['where'], - Prisma.ChipFindUniqueArgs['where'], - Omit, - Prisma.ChipFindFirstArgs['orderBy'], - Prisma.ChipScalarFieldEnum, - ChipGetPayload - >, - clause: { - fields: new Map([ - [ - "id", - "TEXT" - ], - [ - "label", - "TEXT" - ], - [ - "value", - "TEXT" - ] - ]), - relations: [ - new Relation("report_to_clause", "", "", "report_to_clause", "ClauseToReport_to_clause", "many"), - ], - modelSchema: (ClauseCreateInputSchema as any) - .partial() - .or((ClauseUncheckedCreateInputSchema as any).partial()), - createSchema: ClauseCreateArgsSchema, - createManySchema: ClauseCreateManyArgsSchema, - findUniqueSchema: ClauseFindUniqueArgsSchema, - findSchema: ClauseFindFirstArgsSchema, - updateSchema: ClauseUpdateArgsSchema, - updateManySchema: ClauseUpdateManyArgsSchema, - upsertSchema: ClauseUpsertArgsSchema, - deleteSchema: ClauseDeleteArgsSchema, - deleteManySchema: ClauseDeleteManyArgsSchema - } as TableSchema< - z.infer, - Prisma.ClauseCreateArgs['data'], - Prisma.ClauseUpdateArgs['data'], - Prisma.ClauseFindFirstArgs['select'], - Prisma.ClauseFindFirstArgs['where'], - Prisma.ClauseFindUniqueArgs['where'], - Omit, - Prisma.ClauseFindFirstArgs['orderBy'], - Prisma.ClauseScalarFieldEnum, - ClauseGetPayload - >, - report: { - fields: new Map([ - [ - "id", - "TEXT" - ], - [ - "title", - "TEXT" - ], - [ - "project_description", - "TEXT" - ], - [ - "redacted_by", - "TEXT" - ], - [ - "meet_date", - "TIMESTAMP" - ], - [ - "applicant_name", - "TEXT" - ], - [ - "applicant_address", - "TEXT" - ], - [ - "project_cadastral_ref", - "TEXT" - ], - [ - "project_space_type", - "TEXT" - ], - [ - "decision", - "TEXT" - ], - [ - "precisions", - "TEXT" - ], - [ - "contacts", - "TEXT" - ], - [ - "further_information", - "TEXT" - ], - [ - "created_by_id", - "TEXT" - ], - [ - "created_by_username", - "TEXT" - ], - [ - "created_at", - "TIMESTAMP" - ], - [ - "service_instructeur", - "TEXT" - ] - ]), - relations: [ - new Relation("report_to_chip", "", "", "report_to_chip", "ReportToReport_to_chip", "many"), - new Relation("report_to_clause", "", "", "report_to_clause", "ReportToReport_to_clause", "many"), - ], - modelSchema: (ReportCreateInputSchema as any) - .partial() - .or((ReportUncheckedCreateInputSchema as any).partial()), - createSchema: ReportCreateArgsSchema, - createManySchema: ReportCreateManyArgsSchema, - findUniqueSchema: ReportFindUniqueArgsSchema, - findSchema: ReportFindFirstArgsSchema, - updateSchema: ReportUpdateArgsSchema, - updateManySchema: ReportUpdateManyArgsSchema, - upsertSchema: ReportUpsertArgsSchema, - deleteSchema: ReportDeleteArgsSchema, - deleteManySchema: ReportDeleteManyArgsSchema - } as TableSchema< - z.infer, - Prisma.ReportCreateArgs['data'], - Prisma.ReportUpdateArgs['data'], - Prisma.ReportFindFirstArgs['select'], - Prisma.ReportFindFirstArgs['where'], - Prisma.ReportFindUniqueArgs['where'], - Omit, - Prisma.ReportFindFirstArgs['orderBy'], - Prisma.ReportScalarFieldEnum, - ReportGetPayload - >, - report_to_chip: { - fields: new Map([ - [ - "id", - "TEXT" - ], - [ - "report_id", - "TEXT" - ], - [ - "chip_id", - "TEXT" - ] - ]), - relations: [ - new Relation("chip", "chip_id", "id", "chip", "ChipToReport_to_chip", "one"), - new Relation("report", "report_id", "id", "report", "ReportToReport_to_chip", "one"), - ], - modelSchema: (Report_to_chipCreateInputSchema as any) - .partial() - .or((Report_to_chipUncheckedCreateInputSchema as any).partial()), - createSchema: Report_to_chipCreateArgsSchema, - createManySchema: Report_to_chipCreateManyArgsSchema, - findUniqueSchema: Report_to_chipFindUniqueArgsSchema, - findSchema: Report_to_chipFindFirstArgsSchema, - updateSchema: Report_to_chipUpdateArgsSchema, - updateManySchema: Report_to_chipUpdateManyArgsSchema, - upsertSchema: Report_to_chipUpsertArgsSchema, - deleteSchema: Report_to_chipDeleteArgsSchema, - deleteManySchema: Report_to_chipDeleteManyArgsSchema - } as TableSchema< - z.infer, - Prisma.Report_to_chipCreateArgs['data'], - Prisma.Report_to_chipUpdateArgs['data'], - Prisma.Report_to_chipFindFirstArgs['select'], - Prisma.Report_to_chipFindFirstArgs['where'], - Prisma.Report_to_chipFindUniqueArgs['where'], - Omit, - Prisma.Report_to_chipFindFirstArgs['orderBy'], - Prisma.Report_to_chipScalarFieldEnum, - Report_to_chipGetPayload - >, - report_to_clause: { - fields: new Map([ - [ - "id", - "TEXT" - ], - [ - "report_id", - "TEXT" - ], - [ - "clause_id", - "TEXT" - ] - ]), - relations: [ - new Relation("clause", "clause_id", "id", "clause", "ClauseToReport_to_clause", "one"), - new Relation("report", "report_id", "id", "report", "ReportToReport_to_clause", "one"), - ], - modelSchema: (Report_to_clauseCreateInputSchema as any) - .partial() - .or((Report_to_clauseUncheckedCreateInputSchema as any).partial()), - createSchema: Report_to_clauseCreateArgsSchema, - createManySchema: Report_to_clauseCreateManyArgsSchema, - findUniqueSchema: Report_to_clauseFindUniqueArgsSchema, - findSchema: Report_to_clauseFindFirstArgsSchema, - updateSchema: Report_to_clauseUpdateArgsSchema, - updateManySchema: Report_to_clauseUpdateManyArgsSchema, - upsertSchema: Report_to_clauseUpsertArgsSchema, - deleteSchema: Report_to_clauseDeleteArgsSchema, - deleteManySchema: Report_to_clauseDeleteManyArgsSchema - } as TableSchema< - z.infer, - Prisma.Report_to_clauseCreateArgs['data'], - Prisma.Report_to_clauseUpdateArgs['data'], - Prisma.Report_to_clauseFindFirstArgs['select'], - Prisma.Report_to_clauseFindFirstArgs['where'], - Prisma.Report_to_clauseFindUniqueArgs['where'], - Omit, - Prisma.Report_to_clauseFindFirstArgs['orderBy'], - Prisma.Report_to_clauseScalarFieldEnum, - Report_to_clauseGetPayload - >, -} - -export const schema = new DbSchema(tableSchemas, migrations) -export type Electric = ElectricClient From 7b8f19f3227028da07bf201bfa4cd9a32aefee89 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Fri, 28 Jun 2024 11:09:43 +0200 Subject: [PATCH 12/29] feat: set network mode to always --- packages/frontend/src/main.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/main.tsx b/packages/frontend/src/main.tsx index 486b6e75..c8be7108 100644 --- a/packages/frontend/src/main.tsx +++ b/packages/frontend/src/main.tsx @@ -15,7 +15,16 @@ if ("serviceWorker" in navigator) { startReactDsfr({ defaultColorScheme: "system", Link: Link }); -const queryClient = new QueryClient(); +const queryClient = new QueryClient({ + defaultOptions:{ + mutations: { + networkMode: "always" + }, + queries: { + networkMode: "always" + } + } +}); ReactDOM.createRoot(document.getElementById("root")!).render( From 1629ad96c9d48bf81cac543c587a5c2adf0575fc Mon Sep 17 00:00:00 2001 From: ledouxm Date: Tue, 2 Jul 2024 10:06:26 +0200 Subject: [PATCH 13/29] feat: add chips v2 --- db/migrations/04-add_chips_table.sql | 1 + db/migrations/902-rework_clauses.sql | 10 + package.json | 2 +- packages/backend/src/index.ts | 3 +- packages/backend/src/tmp.ts | 23 + packages/electric-client/prisma/schema.prisma | 9 + .../src/generated/client/index.ts | 526 +++++- .../src/generated/client/migrations.ts | 23 +- .../src/generated/client/pg-migrations.ts | 27 +- .../src/generated/client/prismaClient.d.ts | 1675 ++++++++++++++--- .../src/generated/typebox/clause.ts | 1 + .../src/generated/typebox/clauseInput.ts | 1 + .../src/generated/typebox/clause_v2.ts | 11 + .../src/generated/typebox/clause_v2Input.ts | 11 + .../src/generated/typebox/index.ts | 2 + .../frontend/src/contexts/AuthContext.tsx | 2 +- .../src/features/chips/useChipOptions.tsx | 6 +- .../frontend/src/features/menu/ClauseMenu.tsx | 2 +- 18 files changed, 1946 insertions(+), 389 deletions(-) create mode 100644 db/migrations/902-rework_clauses.sql create mode 100644 packages/backend/src/tmp.ts create mode 100644 packages/electric-client/src/generated/typebox/clause_v2.ts create mode 100644 packages/electric-client/src/generated/typebox/clause_v2Input.ts diff --git a/db/migrations/04-add_chips_table.sql b/db/migrations/04-add_chips_table.sql index 02846c34..6736581f 100644 --- a/db/migrations/04-add_chips_table.sql +++ b/db/migrations/04-add_chips_table.sql @@ -4,6 +4,7 @@ CREATE TABLE clause( ,value text NOT NULL ,udap_id text ,text text NOT NULL + ,hidden boolean , PRIMARY KEY (key, value, udap_id) ); diff --git a/db/migrations/902-rework_clauses.sql b/db/migrations/902-rework_clauses.sql new file mode 100644 index 00000000..099c59bf --- /dev/null +++ b/db/migrations/902-rework_clauses.sql @@ -0,0 +1,10 @@ + +CREATE TABLE clause_v2 ( + id text NOT NULL PRIMARY KEY + ,key text NOT NULL + ,value text NOT NULL + ,udap_id text + ,text text NOT NULL +); + +ALTER TABLE clause_v2 ENABLE ELECTRIC; \ No newline at end of file diff --git a/package.json b/package.json index 6b1f39e0..7a29ac5f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "db:migrate": "pnpm db:create", "electric:up": "pnpm electric-sql with-config \"pnpm pg-migrations apply --database {{ELECTRIC_PROXY}} --ignore-error migration_file_edited --directory ./db/migrations\"", "show-config": "pnpm electric-sql show-config", - "electric:migrate": "pnpm electric:up && pnpm electric-client generate:front", + "electric:migrate": "pnpm electric:up && pnpm electric-client generate:front && pnpm electric-client generate:back", "client:json": "pnpm backend dev --create-only", "client:ts": "typed-openapi ./packages/backend/openapi.json --output ./packages/frontend/src/api.gen.ts", "client:generate": "pnpm client:json && pnpm client:ts", diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index e4764eb8..168a9784 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -4,12 +4,13 @@ import { onHmr, registerViteHmrServerRestart } from "./hmr"; import { ENV } from "./envVars"; import { generateOpenApi, initFastify } from "./router"; import { makeDebug } from "./features/debug"; +import { initClauseV2 } from "./tmp"; const debug = makeDebug("index"); const start = async () => { await registerViteHmrServerRestart(); - + await initClauseV2(); debug("Starting fastify server in", ENV.NODE_ENV, "mode"); const fastifyInstance = await initFastify(); diff --git a/packages/backend/src/tmp.ts b/packages/backend/src/tmp.ts new file mode 100644 index 00000000..6b11a666 --- /dev/null +++ b/packages/backend/src/tmp.ts @@ -0,0 +1,23 @@ +import { db } from "./db/db"; +import { v4 } from "uuid"; + +export const initClauseV2 = async () => { + const nbClausesV2 = await db.clause_v2.count(); + if (nbClausesV2 > 0) return; + + const clauses = await db.clause.findMany(); + + for (const clause of clauses) { + await db.clause_v2.create({ + data: { + id: v4(), + key: clause.key, + text: clause.text, + value: clause.value, + udap_id: clause.udap_id, + }, + }); + } + + return "done"; +}; diff --git a/packages/electric-client/prisma/schema.prisma b/packages/electric-client/prisma/schema.prisma index 43b797d3..c9f446e1 100644 --- a/packages/electric-client/prisma/schema.prisma +++ b/packages/electric-client/prisma/schema.prisma @@ -32,6 +32,7 @@ model clause { value String udap_id String text String + hidden Boolean? @@id([key, value, udap_id]) } @@ -121,3 +122,11 @@ model service_instructeurs { tel String? udap_id String? } + +model clause_v2 { + id String @id + key String + value String + udap_id String? + text String +} diff --git a/packages/electric-client/src/generated/client/index.ts b/packages/electric-client/src/generated/client/index.ts index dbe2e856..7309176e 100644 --- a/packages/electric-client/src/generated/client/index.ts +++ b/packages/electric-client/src/generated/client/index.ts @@ -13,7 +13,9 @@ import pgMigrations from './pg-migrations'; // ENUMS ///////////////////////////////////////// -export const ClauseScalarFieldEnumSchema = z.enum(['key','value','udap_id','text']); +export const ClauseScalarFieldEnumSchema = z.enum(['key','value','udap_id','text','hidden']); + +export const Clause_v2ScalarFieldEnumSchema = z.enum(['id','key','value','udap_id','text']); export const DelegationScalarFieldEnumSchema = z.enum(['createdBy','delegatedTo']); @@ -43,10 +45,25 @@ export const ClauseSchema = z.object({ value: z.string(), udap_id: z.string(), text: z.string(), + hidden: z.boolean().nullable(), }) export type Clause = z.infer +///////////////////////////////////////// +// CLAUSE V 2 SCHEMA +///////////////////////////////////////// + +export const Clause_v2Schema = z.object({ + id: z.string(), + key: z.string(), + value: z.string(), + udap_id: z.string().nullable(), + text: z.string(), +}) + +export type Clause_v2 = z.infer + ///////////////////////////////////////// // DELEGATION SCHEMA ///////////////////////////////////////// @@ -149,6 +166,18 @@ export const ClauseSelectSchema: z.ZodType = z.object({ value: z.boolean().optional(), udap_id: z.boolean().optional(), text: z.boolean().optional(), + hidden: z.boolean().optional(), +}).strict() + +// CLAUSE V 2 +//------------------------------------------------------ + +export const Clause_v2SelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + key: z.boolean().optional(), + value: z.boolean().optional(), + udap_id: z.boolean().optional(), + text: z.boolean().optional(), }).strict() // DELEGATION @@ -309,13 +338,15 @@ export const ClauseWhereInputSchema: z.ZodType = z.obje value: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), udap_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), text: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + hidden: z.union([ z.lazy(() => BoolNullableFilterSchema),z.boolean() ]).optional().nullable(), }).strict(); export const ClauseOrderByWithRelationInputSchema: z.ZodType = z.object({ key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - text: z.lazy(() => SortOrderSchema).optional() + text: z.lazy(() => SortOrderSchema).optional(), + hidden: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ClauseWhereUniqueInputSchema: z.ZodType = z.object({ @@ -327,6 +358,7 @@ export const ClauseOrderByWithAggregationInputSchema: z.ZodType SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), text: z.lazy(() => SortOrderSchema).optional(), + hidden: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => ClauseCountOrderByAggregateInputSchema).optional(), _max: z.lazy(() => ClauseMaxOrderByAggregateInputSchema).optional(), _min: z.lazy(() => ClauseMinOrderByAggregateInputSchema).optional() @@ -340,6 +372,52 @@ export const ClauseScalarWhereWithAggregatesInputSchema: z.ZodType StringWithAggregatesFilterSchema),z.string() ]).optional(), udap_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), text: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + hidden: z.union([ z.lazy(() => BoolNullableWithAggregatesFilterSchema),z.boolean() ]).optional().nullable(), +}).strict(); + +export const Clause_v2WhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => Clause_v2WhereInputSchema),z.lazy(() => Clause_v2WhereInputSchema).array() ]).optional(), + OR: z.lazy(() => Clause_v2WhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => Clause_v2WhereInputSchema),z.lazy(() => Clause_v2WhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + key: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + value: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + udap_id: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + text: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), +}).strict(); + +export const Clause_v2OrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + key: z.lazy(() => SortOrderSchema).optional(), + value: z.lazy(() => SortOrderSchema).optional(), + udap_id: z.lazy(() => SortOrderSchema).optional(), + text: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const Clause_v2WhereUniqueInputSchema: z.ZodType = z.object({ + id: z.string().optional() +}).strict(); + +export const Clause_v2OrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + key: z.lazy(() => SortOrderSchema).optional(), + value: z.lazy(() => SortOrderSchema).optional(), + udap_id: z.lazy(() => SortOrderSchema).optional(), + text: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => Clause_v2CountOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => Clause_v2MaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => Clause_v2MinOrderByAggregateInputSchema).optional() +}).strict(); + +export const Clause_v2ScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => Clause_v2ScalarWhereWithAggregatesInputSchema),z.lazy(() => Clause_v2ScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => Clause_v2ScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => Clause_v2ScalarWhereWithAggregatesInputSchema),z.lazy(() => Clause_v2ScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + key: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + value: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + udap_id: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + text: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), }).strict(); export const DelegationWhereInputSchema: z.ZodType = z.object({ @@ -671,14 +749,16 @@ export const ClauseCreateInputSchema: z.ZodType = z.ob key: z.string(), value: z.string(), udap_id: z.string(), - text: z.string() + text: z.string(), + hidden: z.boolean().optional().nullable() }).strict(); export const ClauseUncheckedCreateInputSchema: z.ZodType = z.object({ key: z.string(), value: z.string(), udap_id: z.string(), - text: z.string() + text: z.string(), + hidden: z.boolean().optional().nullable() }).strict(); export const ClauseUpdateInputSchema: z.ZodType = z.object({ @@ -686,6 +766,7 @@ export const ClauseUpdateInputSchema: z.ZodType = z.ob value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), udap_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + hidden: z.union([ z.boolean(),z.lazy(() => NullableBoolFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ClauseUncheckedUpdateInputSchema: z.ZodType = z.object({ @@ -693,13 +774,15 @@ export const ClauseUncheckedUpdateInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), udap_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + hidden: z.union([ z.boolean(),z.lazy(() => NullableBoolFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ClauseCreateManyInputSchema: z.ZodType = z.object({ key: z.string(), value: z.string(), udap_id: z.string(), - text: z.string() + text: z.string(), + hidden: z.boolean().optional().nullable() }).strict(); export const ClauseUpdateManyMutationInputSchema: z.ZodType = z.object({ @@ -707,6 +790,7 @@ export const ClauseUpdateManyMutationInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), udap_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + hidden: z.union([ z.boolean(),z.lazy(() => NullableBoolFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ClauseUncheckedUpdateManyInputSchema: z.ZodType = z.object({ @@ -714,6 +798,63 @@ export const ClauseUncheckedUpdateManyInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), udap_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + hidden: z.union([ z.boolean(),z.lazy(() => NullableBoolFieldUpdateOperationsInputSchema) ]).optional().nullable(), +}).strict(); + +export const Clause_v2CreateInputSchema: z.ZodType = z.object({ + id: z.string(), + key: z.string(), + value: z.string(), + udap_id: z.string().optional().nullable(), + text: z.string() +}).strict(); + +export const Clause_v2UncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string(), + key: z.string(), + value: z.string(), + udap_id: z.string().optional().nullable(), + text: z.string() +}).strict(); + +export const Clause_v2UpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const Clause_v2UncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const Clause_v2CreateManyInputSchema: z.ZodType = z.object({ + id: z.string(), + key: z.string(), + value: z.string(), + udap_id: z.string().optional().nullable(), + text: z.string() +}).strict(); + +export const Clause_v2UpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const Clause_v2UncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const DelegationCreateInputSchema: z.ZodType = z.object({ @@ -1163,6 +1304,11 @@ export const StringFilterSchema: z.ZodType = z.object({ not: z.union([ z.string(),z.lazy(() => NestedStringFilterSchema) ]).optional(), }).strict(); +export const BoolNullableFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional().nullable(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableFilterSchema) ]).optional().nullable(), +}).strict(); + export const ClauseKeyValueUdap_idCompoundUniqueInputSchema: z.ZodType = z.object({ key: z.string(), value: z.string(), @@ -1173,21 +1319,24 @@ export const ClauseCountOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - text: z.lazy(() => SortOrderSchema).optional() + text: z.lazy(() => SortOrderSchema).optional(), + hidden: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ClauseMaxOrderByAggregateInputSchema: z.ZodType = z.object({ key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - text: z.lazy(() => SortOrderSchema).optional() + text: z.lazy(() => SortOrderSchema).optional(), + hidden: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ClauseMinOrderByAggregateInputSchema: z.ZodType = z.object({ key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), - text: z.lazy(() => SortOrderSchema).optional() + text: z.lazy(() => SortOrderSchema).optional(), + hidden: z.lazy(() => SortOrderSchema).optional() }).strict(); export const StringWithAggregatesFilterSchema: z.ZodType = z.object({ @@ -1208,6 +1357,71 @@ export const StringWithAggregatesFilterSchema: z.ZodType NestedStringFilterSchema).optional() }).strict(); +export const BoolNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional().nullable(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedBoolNullableFilterSchema).optional(), + _max: z.lazy(() => NestedBoolNullableFilterSchema).optional() +}).strict(); + +export const StringNullableFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableFilterSchema) ]).optional().nullable(), +}).strict(); + +export const Clause_v2CountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + key: z.lazy(() => SortOrderSchema).optional(), + value: z.lazy(() => SortOrderSchema).optional(), + udap_id: z.lazy(() => SortOrderSchema).optional(), + text: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const Clause_v2MaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + key: z.lazy(() => SortOrderSchema).optional(), + value: z.lazy(() => SortOrderSchema).optional(), + udap_id: z.lazy(() => SortOrderSchema).optional(), + text: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const Clause_v2MinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + key: z.lazy(() => SortOrderSchema).optional(), + value: z.lazy(() => SortOrderSchema).optional(), + udap_id: z.lazy(() => SortOrderSchema).optional(), + text: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const StringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + mode: z.lazy(() => QueryModeSchema).optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), + _max: z.lazy(() => NestedStringNullableFilterSchema).optional() +}).strict(); + export const UserRelationFilterSchema: z.ZodType = z.object({ is: z.lazy(() => UserWhereInputSchema).optional(), isNot: z.lazy(() => UserWhereInputSchema).optional() @@ -1233,21 +1447,6 @@ export const DelegationMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); -export const StringNullableFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableFilterSchema) ]).optional().nullable(), -}).strict(); - export const DateTimeNullableFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional().nullable(), in: z.coerce.date().array().optional().nullable(), @@ -1281,11 +1480,6 @@ export const IntNullableFilterSchema: z.ZodType = z.ob not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), }).strict(); -export const BoolNullableFilterSchema: z.ZodType = z.object({ - equals: z.boolean().optional().nullable(), - not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableFilterSchema) ]).optional().nullable(), -}).strict(); - export const ReportCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), title: z.lazy(() => SortOrderSchema).optional(), @@ -1366,24 +1560,6 @@ export const ReportSumOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); -export const StringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - mode: z.lazy(() => QueryModeSchema).optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), - _max: z.lazy(() => NestedStringNullableFilterSchema).optional() -}).strict(); - export const DateTimeNullableWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional().nullable(), in: z.coerce.date().array().optional().nullable(), @@ -1428,14 +1604,6 @@ export const IntNullableWithAggregatesFilterSchema: z.ZodType NestedIntNullableFilterSchema).optional() }).strict(); -export const BoolNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.boolean().optional().nullable(), - not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedBoolNullableFilterSchema).optional(), - _max: z.lazy(() => NestedBoolNullableFilterSchema).optional() -}).strict(); - export const IntFilterSchema: z.ZodType = z.object({ equals: z.number().optional(), in: z.number().array().optional(), @@ -1603,6 +1771,14 @@ export const StringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.boolean().optional().nullable() +}).strict(); + +export const NullableStringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.string().optional().nullable() +}).strict(); + export const UserCreateNestedOneWithoutDelegation_delegation_createdByTouserInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutDelegation_delegation_createdByTouserInputSchema),z.lazy(() => UserUncheckedCreateWithoutDelegation_delegation_createdByTouserInputSchema) ]).optional(), connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutDelegation_delegation_createdByTouserInputSchema).optional(), @@ -1637,10 +1813,6 @@ export const UserCreateNestedOneWithoutReportInputSchema: z.ZodType UserWhereUniqueInputSchema).optional() }).strict(); -export const NullableStringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.string().optional().nullable() -}).strict(); - export const NullableDateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.coerce.date().optional().nullable() }).strict(); @@ -1657,10 +1829,6 @@ export const NullableIntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.boolean().optional().nullable() -}).strict(); - export const UserUpdateOneRequiredWithoutReportNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]).optional(), connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutReportInputSchema).optional(), @@ -1873,6 +2041,11 @@ export const NestedStringFilterSchema: z.ZodType = z. not: z.union([ z.string(),z.lazy(() => NestedStringFilterSchema) ]).optional(), }).strict(); +export const NestedBoolNullableFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional().nullable(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableFilterSchema) ]).optional().nullable(), +}).strict(); + export const NestedStringWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.string().optional(), in: z.string().array().optional(), @@ -1901,6 +2074,25 @@ export const NestedIntFilterSchema: z.ZodType = z.object not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), }).strict(); +export const NestedBoolNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional().nullable(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedBoolNullableFilterSchema).optional(), + _max: z.lazy(() => NestedBoolNullableFilterSchema).optional() +}).strict(); + +export const NestedIntNullableFilterSchema: z.ZodType = z.object({ + equals: z.number().optional().nullable(), + in: z.number().array().optional().nullable(), + notIn: z.number().array().optional().nullable(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), +}).strict(); + export const NestedStringNullableFilterSchema: z.ZodType = z.object({ equals: z.string().optional().nullable(), in: z.string().array().optional().nullable(), @@ -1915,6 +2107,23 @@ export const NestedStringNullableFilterSchema: z.ZodType NestedStringNullableFilterSchema) ]).optional().nullable(), }).strict(); +export const NestedStringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.string().optional().nullable(), + in: z.string().array().optional().nullable(), + notIn: z.string().array().optional().nullable(), + lt: z.string().optional(), + lte: z.string().optional(), + gt: z.string().optional(), + gte: z.string().optional(), + contains: z.string().optional(), + startsWith: z.string().optional(), + endsWith: z.string().optional(), + not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), + _max: z.lazy(() => NestedStringNullableFilterSchema).optional() +}).strict(); + export const NestedDateTimeNullableFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional().nullable(), in: z.coerce.date().array().optional().nullable(), @@ -1937,39 +2146,6 @@ export const NestedDateTimeFilterSchema: z.ZodType not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), }).strict(); -export const NestedIntNullableFilterSchema: z.ZodType = z.object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), -}).strict(); - -export const NestedBoolNullableFilterSchema: z.ZodType = z.object({ - equals: z.boolean().optional().nullable(), - not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableFilterSchema) ]).optional().nullable(), -}).strict(); - -export const NestedStringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.string().optional().nullable(), - in: z.string().array().optional().nullable(), - notIn: z.string().array().optional().nullable(), - lt: z.string().optional(), - lte: z.string().optional(), - gt: z.string().optional(), - gte: z.string().optional(), - contains: z.string().optional(), - startsWith: z.string().optional(), - endsWith: z.string().optional(), - not: z.union([ z.string(),z.lazy(() => NestedStringNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedStringNullableFilterSchema).optional(), - _max: z.lazy(() => NestedStringNullableFilterSchema).optional() -}).strict(); - export const NestedDateTimeNullableWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.coerce.date().optional().nullable(), in: z.coerce.date().array().optional().nullable(), @@ -2025,14 +2201,6 @@ export const NestedFloatNullableFilterSchema: z.ZodType NestedFloatNullableFilterSchema) ]).optional().nullable(), }).strict(); -export const NestedBoolNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.boolean().optional().nullable(), - not: z.union([ z.boolean(),z.lazy(() => NestedBoolNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedBoolNullableFilterSchema).optional(), - _max: z.lazy(() => NestedBoolNullableFilterSchema).optional() -}).strict(); - export const NestedIntWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.number().optional(), in: z.number().array().optional(), @@ -2697,6 +2865,63 @@ export const ClauseFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereInputSchema.optional(), + orderBy: z.union([ Clause_v2OrderByWithRelationInputSchema.array(),Clause_v2OrderByWithRelationInputSchema ]).optional(), + cursor: Clause_v2WhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: Clause_v2ScalarFieldEnumSchema.array().optional(), +}).strict() + +export const Clause_v2FindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereInputSchema.optional(), + orderBy: z.union([ Clause_v2OrderByWithRelationInputSchema.array(),Clause_v2OrderByWithRelationInputSchema ]).optional(), + cursor: Clause_v2WhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: Clause_v2ScalarFieldEnumSchema.array().optional(), +}).strict() + +export const Clause_v2FindManyArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereInputSchema.optional(), + orderBy: z.union([ Clause_v2OrderByWithRelationInputSchema.array(),Clause_v2OrderByWithRelationInputSchema ]).optional(), + cursor: Clause_v2WhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: Clause_v2ScalarFieldEnumSchema.array().optional(), +}).strict() + +export const Clause_v2AggregateArgsSchema: z.ZodType = z.object({ + where: Clause_v2WhereInputSchema.optional(), + orderBy: z.union([ Clause_v2OrderByWithRelationInputSchema.array(),Clause_v2OrderByWithRelationInputSchema ]).optional(), + cursor: Clause_v2WhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const Clause_v2GroupByArgsSchema: z.ZodType = z.object({ + where: Clause_v2WhereInputSchema.optional(), + orderBy: z.union([ Clause_v2OrderByWithAggregationInputSchema.array(),Clause_v2OrderByWithAggregationInputSchema ]).optional(), + by: Clause_v2ScalarFieldEnumSchema.array(), + having: Clause_v2ScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const Clause_v2FindUniqueArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereUniqueInputSchema, +}).strict() + +export const Clause_v2FindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereUniqueInputSchema, +}).strict() + export const DelegationFindFirstArgsSchema: z.ZodType = z.object({ select: DelegationSelectSchema.optional(), include: DelegationIncludeSchema.optional(), @@ -3039,6 +3264,43 @@ export const ClauseDeleteManyArgsSchema: z.ZodType where: ClauseWhereInputSchema.optional(), }).strict() +export const Clause_v2CreateArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + data: z.union([ Clause_v2CreateInputSchema,Clause_v2UncheckedCreateInputSchema ]), +}).strict() + +export const Clause_v2UpsertArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereUniqueInputSchema, + create: z.union([ Clause_v2CreateInputSchema,Clause_v2UncheckedCreateInputSchema ]), + update: z.union([ Clause_v2UpdateInputSchema,Clause_v2UncheckedUpdateInputSchema ]), +}).strict() + +export const Clause_v2CreateManyArgsSchema: z.ZodType = z.object({ + data: Clause_v2CreateManyInputSchema.array(), + skipDuplicates: z.boolean().optional(), +}).strict() + +export const Clause_v2DeleteArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + where: Clause_v2WhereUniqueInputSchema, +}).strict() + +export const Clause_v2UpdateArgsSchema: z.ZodType = z.object({ + select: Clause_v2SelectSchema.optional(), + data: z.union([ Clause_v2UpdateInputSchema,Clause_v2UncheckedUpdateInputSchema ]), + where: Clause_v2WhereUniqueInputSchema, +}).strict() + +export const Clause_v2UpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ Clause_v2UpdateManyMutationInputSchema,Clause_v2UncheckedUpdateManyInputSchema ]), + where: Clause_v2WhereInputSchema.optional(), +}).strict() + +export const Clause_v2DeleteManyArgsSchema: z.ZodType = z.object({ + where: Clause_v2WhereInputSchema.optional(), +}).strict() + export const DelegationCreateArgsSchema: z.ZodType = z.object({ select: DelegationSelectSchema.optional(), include: DelegationIncludeSchema.optional(), @@ -3245,6 +3507,11 @@ interface ClauseGetPayload extends HKT { readonly type: Omit, "Please either choose `select` or `include`"> } +interface Clause_v2GetPayload extends HKT { + readonly _A?: boolean | null | undefined | Prisma.Clause_v2Args + readonly type: Omit, "Please either choose `select` or `include`"> +} + interface DelegationGetPayload extends HKT { readonly _A?: boolean | null | undefined | Prisma.DelegationArgs readonly type: Omit, "Please either choose `select` or `include`"> @@ -3288,6 +3555,10 @@ export const tableSchemas = { [ "text", "TEXT" + ], + [ + "hidden", + "BOOL" ] ]), relations: [ @@ -3316,6 +3587,55 @@ export const tableSchemas = { Prisma.ClauseScalarFieldEnum, ClauseGetPayload >, + clause_v2: { + fields: new Map([ + [ + "id", + "TEXT" + ], + [ + "key", + "TEXT" + ], + [ + "value", + "TEXT" + ], + [ + "udap_id", + "TEXT" + ], + [ + "text", + "TEXT" + ] + ]), + relations: [ + ], + modelSchema: (Clause_v2CreateInputSchema as any) + .partial() + .or((Clause_v2UncheckedCreateInputSchema as any).partial()), + createSchema: Clause_v2CreateArgsSchema, + createManySchema: Clause_v2CreateManyArgsSchema, + findUniqueSchema: Clause_v2FindUniqueArgsSchema, + findSchema: Clause_v2FindFirstArgsSchema, + updateSchema: Clause_v2UpdateArgsSchema, + updateManySchema: Clause_v2UpdateManyArgsSchema, + upsertSchema: Clause_v2UpsertArgsSchema, + deleteSchema: Clause_v2DeleteArgsSchema, + deleteManySchema: Clause_v2DeleteManyArgsSchema + } as TableSchema< + z.infer, + Prisma.Clause_v2CreateArgs['data'], + Prisma.Clause_v2UpdateArgs['data'], + Prisma.Clause_v2FindFirstArgs['select'], + Prisma.Clause_v2FindFirstArgs['where'], + Prisma.Clause_v2FindUniqueArgs['where'], + never, + Prisma.Clause_v2FindFirstArgs['orderBy'], + Prisma.Clause_v2ScalarFieldEnum, + Clause_v2GetPayload + >, delegation: { fields: new Map([ [ diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index af88632f..720ae3a1 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -67,16 +67,16 @@ export default [ }, { "statements": [ - "CREATE TABLE \"clause\" (\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"udap_id\" TEXT NOT NULL,\n \"text\" TEXT NOT NULL,\n CONSTRAINT \"clause_pkey\" PRIMARY KEY (\"key\", \"value\", \"udap_id\")\n) WITHOUT ROWID;\n", + "CREATE TABLE \"clause\" (\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"udap_id\" TEXT NOT NULL,\n \"text\" TEXT NOT NULL,\n \"hidden\" INTEGER,\n CONSTRAINT \"clause_pkey\" PRIMARY KEY (\"key\", \"value\", \"udap_id\")\n) WITHOUT ROWID;\n", "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'clause', 1);", "DROP TRIGGER IF EXISTS update_ensure_main_clause_primarykey;", "CREATE TRIGGER update_ensure_main_clause_primarykey\n BEFORE UPDATE ON \"main\".\"clause\"\nBEGIN\n SELECT\n CASE\n WHEN old.\"key\" != new.\"key\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column key as it belongs to the primary key')\n WHEN old.\"udap_id\" != new.\"udap_id\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column udap_id as it belongs to the primary key')\n WHEN old.\"value\" != new.\"value\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column value as it belongs to the primary key')\n END;\nEND;", "DROP TRIGGER IF EXISTS insert_main_clause_into_oplog;", - "CREATE TRIGGER insert_main_clause_into_oplog\n AFTER INSERT ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'INSERT', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", + "CREATE TRIGGER insert_main_clause_into_oplog\n AFTER INSERT ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'INSERT', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", "DROP TRIGGER IF EXISTS update_main_clause_into_oplog;", - "CREATE TRIGGER update_main_clause_into_oplog\n AFTER UPDATE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'UPDATE', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", + "CREATE TRIGGER update_main_clause_into_oplog\n AFTER UPDATE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'UPDATE', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", "DROP TRIGGER IF EXISTS delete_main_clause_into_oplog;", - "CREATE TRIGGER delete_main_clause_into_oplog\n AFTER DELETE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'DELETE', json_patch('{}', json_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")), NULL, json_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" + "CREATE TRIGGER delete_main_clause_into_oplog\n AFTER DELETE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'DELETE', json_patch('{}', json_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")), NULL, json_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" ], "version": "4" }, @@ -132,5 +132,20 @@ 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": "901" + }, + { + "statements": [ + "CREATE TABLE \"clause_v2\" (\n \"id\" TEXT NOT NULL,\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"udap_id\" TEXT,\n \"text\" TEXT NOT NULL,\n CONSTRAINT \"clause_v2_pkey\" PRIMARY KEY (\"id\")\n) WITHOUT ROWID;\n", + "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'clause_v2', 1);", + "DROP TRIGGER IF EXISTS update_ensure_main_clause_v2_primarykey;", + "CREATE TRIGGER update_ensure_main_clause_v2_primarykey\n BEFORE UPDATE ON \"main\".\"clause_v2\"\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_clause_v2_into_oplog;", + "CREATE TRIGGER insert_main_clause_v2_into_oplog\n AFTER INSERT ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'INSERT', json_patch('{}', json_object('id', new.\"id\")), json_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", + "DROP TRIGGER IF EXISTS update_main_clause_v2_into_oplog;", + "CREATE TRIGGER update_main_clause_v2_into_oplog\n AFTER UPDATE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'UPDATE', json_patch('{}', json_object('id', new.\"id\")), json_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS delete_main_clause_v2_into_oplog;", + "CREATE TRIGGER delete_main_clause_v2_into_oplog\n AFTER DELETE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" + ], + "version": "902" } ] \ 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 6160fd6a..ddbe24c5 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -91,19 +91,19 @@ export default [ }, { "statements": [ - "CREATE TABLE clause (\n key text NOT NULL,\n value text NOT NULL,\n udap_id text NOT NULL,\n text text NOT NULL,\n CONSTRAINT clause_pkey PRIMARY KEY (key, value, udap_id)\n)", + "CREATE TABLE clause (\n key text NOT NULL,\n value text NOT NULL,\n udap_id text NOT NULL,\n text text NOT NULL,\n hidden boolean,\n CONSTRAINT clause_pkey PRIMARY KEY (key, value, udap_id)\n)", "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'clause', 1)\n ON CONFLICT DO NOTHING;", "DROP TRIGGER IF EXISTS update_ensure_public_clause_primarykey ON \"public\".\"clause\";", "CREATE OR REPLACE FUNCTION update_ensure_public_clause_primarykey_function()\nRETURNS TRIGGER AS $$\nBEGIN\n IF OLD.\"key\" IS DISTINCT FROM NEW.\"key\" THEN\n RAISE EXCEPTION 'Cannot change the value of column key as it belongs to the primary key';\n END IF;\n IF OLD.\"udap_id\" IS DISTINCT FROM NEW.\"udap_id\" THEN\n RAISE EXCEPTION 'Cannot change the value of column udap_id as it belongs to the primary key';\n END IF;\n IF OLD.\"value\" IS DISTINCT FROM NEW.\"value\" THEN\n RAISE EXCEPTION 'Cannot change the value of column value as it belongs to the primary key';\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;", "CREATE TRIGGER update_ensure_public_clause_primarykey\n BEFORE UPDATE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_clause_primarykey_function();", "DROP TRIGGER IF EXISTS insert_public_clause_into_oplog ON \"public\".\"clause\";", - " CREATE OR REPLACE FUNCTION insert_public_clause_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 = 'clause';\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 'clause',\n 'INSERT',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION insert_public_clause_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 = 'clause';\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 'clause',\n 'INSERT',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER insert_public_clause_into_oplog\n AFTER INSERT ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_clause_into_oplog_function();", "DROP TRIGGER IF EXISTS update_public_clause_into_oplog ON \"public\".\"clause\";", - " CREATE OR REPLACE FUNCTION update_public_clause_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 = 'clause';\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 'clause',\n 'UPDATE',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION update_public_clause_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 = 'clause';\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 'clause',\n 'UPDATE',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER update_public_clause_into_oplog\n AFTER UPDATE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_clause_into_oplog_function();", "DROP TRIGGER IF EXISTS delete_public_clause_into_oplog ON \"public\".\"clause\";", - " CREATE OR REPLACE FUNCTION delete_public_clause_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 = 'clause';\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 'clause',\n 'DELETE',\n json_strip_nulls(json_build_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")),\n NULL,\n jsonb_build_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION delete_public_clause_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 = 'clause';\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 'clause',\n 'DELETE',\n json_strip_nulls(json_build_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")),\n NULL,\n jsonb_build_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER delete_public_clause_into_oplog\n AFTER DELETE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_clause_into_oplog_function();" ], "version": "4" @@ -176,5 +176,24 @@ 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": "901" + }, + { + "statements": [ + "CREATE TABLE clause_v2 (\n id text NOT NULL,\n key text NOT NULL,\n value text NOT NULL,\n udap_id text,\n text text NOT NULL,\n CONSTRAINT clause_v2_pkey PRIMARY KEY (id)\n)", + "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'clause_v2', 1)\n ON CONFLICT DO NOTHING;", + "DROP TRIGGER IF EXISTS update_ensure_public_clause_v2_primarykey ON \"public\".\"clause_v2\";", + "CREATE OR REPLACE FUNCTION update_ensure_public_clause_v2_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_clause_v2_primarykey\n BEFORE UPDATE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_clause_v2_primarykey_function();", + "DROP TRIGGER IF EXISTS insert_public_clause_v2_into_oplog ON \"public\".\"clause_v2\";", + " CREATE OR REPLACE FUNCTION insert_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'INSERT',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER insert_public_clause_v2_into_oplog\n AFTER INSERT ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_clause_v2_into_oplog_function();", + "DROP TRIGGER IF EXISTS update_public_clause_v2_into_oplog ON \"public\".\"clause_v2\";", + " CREATE OR REPLACE FUNCTION update_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'UPDATE',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_public_clause_v2_into_oplog\n AFTER UPDATE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_clause_v2_into_oplog_function();", + "DROP TRIGGER IF EXISTS delete_public_clause_v2_into_oplog ON \"public\".\"clause_v2\";", + " CREATE OR REPLACE FUNCTION delete_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'DELETE',\n json_strip_nulls(json_build_object('id', old.\"id\")),\n NULL,\n jsonb_build_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER delete_public_clause_v2_into_oplog\n AFTER DELETE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_clause_v2_into_oplog_function();" + ], + "version": "902" } ] \ 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 fc166f52..3c8504d4 100644 --- a/packages/electric-client/src/generated/client/prismaClient.d.ts +++ b/packages/electric-client/src/generated/client/prismaClient.d.ts @@ -20,6 +20,7 @@ export type ClausePayload composites: {} } @@ -29,6 +30,24 @@ export type ClausePayload +export type Clause_v2Payload = { + name: "Clause_v2" + objects: {} + scalars: $Extensions.GetResult<{ + id: string + key: string + value: string + udap_id: string | null + text: string + }, ExtArgs["result"]["clause_v2"]> + composites: {} +} + +/** + * Model Clause_v2 + * + */ +export type Clause_v2 = runtime.Types.DefaultSelection export type DelegationPayload = { name: "Delegation" objects: { @@ -293,6 +312,16 @@ export class PrismaClient< */ get clause(): Prisma.ClauseDelegate; + /** + * `prisma.clause_v2`: Exposes CRUD operations for the **Clause_v2** model. + * Example usage: + * ```ts + * // Fetch zero or more Clause_v2s + * const clause_v2s = await prisma.clause_v2.findMany() + * ``` + */ + get clause_v2(): Prisma.Clause_v2Delegate; + /** * `prisma.delegation`: Exposes CRUD operations for the **Delegation** model. * Example usage: @@ -826,6 +855,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export const ModelName: { Clause: 'Clause', + Clause_v2: 'Clause_v2', Delegation: 'Delegation', Report: 'Report', Service_instructeurs: 'Service_instructeurs', @@ -847,7 +877,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type TypeMap = { meta: { - modelProps: 'clause' | 'delegation' | 'report' | 'service_instructeurs' | 'udap' | 'user' + modelProps: 'clause' | 'clause_v2' | 'delegation' | 'report' | 'service_instructeurs' | 'udap' | 'user' txIsolationLevel: Prisma.TransactionIsolationLevel }, model: { @@ -916,6 +946,71 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject } } } + Clause_v2: { + payload: Clause_v2Payload + operations: { + findUnique: { + args: Prisma.Clause_v2FindUniqueArgs, + result: $Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.Clause_v2FindUniqueOrThrowArgs, + result: $Utils.PayloadToResult + } + findFirst: { + args: Prisma.Clause_v2FindFirstArgs, + result: $Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.Clause_v2FindFirstOrThrowArgs, + result: $Utils.PayloadToResult + } + findMany: { + args: Prisma.Clause_v2FindManyArgs, + result: $Utils.PayloadToResult[] + } + create: { + args: Prisma.Clause_v2CreateArgs, + result: $Utils.PayloadToResult + } + createMany: { + args: Prisma.Clause_v2CreateManyArgs, + result: Prisma.BatchPayload + } + delete: { + args: Prisma.Clause_v2DeleteArgs, + result: $Utils.PayloadToResult + } + update: { + args: Prisma.Clause_v2UpdateArgs, + result: $Utils.PayloadToResult + } + deleteMany: { + args: Prisma.Clause_v2DeleteManyArgs, + result: Prisma.BatchPayload + } + updateMany: { + args: Prisma.Clause_v2UpdateManyArgs, + result: Prisma.BatchPayload + } + upsert: { + args: Prisma.Clause_v2UpsertArgs, + result: $Utils.PayloadToResult + } + aggregate: { + args: Prisma.Clause_v2AggregateArgs, + result: $Utils.Optional + } + groupBy: { + args: Prisma.Clause_v2GroupByArgs, + result: $Utils.Optional[] + } + count: { + args: Prisma.Clause_v2CountArgs, + result: $Utils.Optional | number + } + } + } Delegation: { payload: DelegationPayload operations: { @@ -1527,6 +1622,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value: string | null udap_id: string | null text: string | null + hidden: boolean | null } export type ClauseMaxAggregateOutputType = { @@ -1534,6 +1630,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value: string | null udap_id: string | null text: string | null + hidden: boolean | null } export type ClauseCountAggregateOutputType = { @@ -1541,6 +1638,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value: number udap_id: number text: number + hidden: number _all: number } @@ -1550,6 +1648,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: true udap_id?: true text?: true + hidden?: true } export type ClauseMaxAggregateInputType = { @@ -1557,6 +1656,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: true udap_id?: true text?: true + hidden?: true } export type ClauseCountAggregateInputType = { @@ -1564,6 +1664,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: true udap_id?: true text?: true + hidden?: true _all?: true } @@ -1645,6 +1746,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value: string udap_id: string text: string + hidden: boolean | null _count: ClauseCountAggregateOutputType | null _min: ClauseMinAggregateOutputType | null _max: ClauseMaxAggregateOutputType | null @@ -1669,6 +1771,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: boolean udap_id?: boolean text?: boolean + hidden?: boolean }, ExtArgs["result"]["clause"]> export type ClauseSelectScalar = { @@ -1676,6 +1779,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: boolean udap_id?: boolean text?: boolean + hidden?: boolean } @@ -2381,311 +2485,331 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject /** - * Model Delegation + * Model Clause_v2 */ - export type AggregateDelegation = { - _count: DelegationCountAggregateOutputType | null - _min: DelegationMinAggregateOutputType | null - _max: DelegationMaxAggregateOutputType | null + export type AggregateClause_v2 = { + _count: Clause_v2CountAggregateOutputType | null + _min: Clause_v2MinAggregateOutputType | null + _max: Clause_v2MaxAggregateOutputType | null } - export type DelegationMinAggregateOutputType = { - createdBy: string | null - delegatedTo: string | null + export type Clause_v2MinAggregateOutputType = { + id: string | null + key: string | null + value: string | null + udap_id: string | null + text: string | null } - export type DelegationMaxAggregateOutputType = { - createdBy: string | null - delegatedTo: string | null + export type Clause_v2MaxAggregateOutputType = { + id: string | null + key: string | null + value: string | null + udap_id: string | null + text: string | null } - export type DelegationCountAggregateOutputType = { - createdBy: number - delegatedTo: number + export type Clause_v2CountAggregateOutputType = { + id: number + key: number + value: number + udap_id: number + text: number _all: number } - export type DelegationMinAggregateInputType = { - createdBy?: true - delegatedTo?: true + export type Clause_v2MinAggregateInputType = { + id?: true + key?: true + value?: true + udap_id?: true + text?: true } - export type DelegationMaxAggregateInputType = { - createdBy?: true - delegatedTo?: true + export type Clause_v2MaxAggregateInputType = { + id?: true + key?: true + value?: true + udap_id?: true + text?: true } - export type DelegationCountAggregateInputType = { - createdBy?: true - delegatedTo?: true + export type Clause_v2CountAggregateInputType = { + id?: true + key?: true + value?: true + udap_id?: true + text?: true _all?: true } - export type DelegationAggregateArgs = { + export type Clause_v2AggregateArgs = { /** - * Filter which Delegation to aggregate. + * Filter which Clause_v2 to aggregate. */ - where?: DelegationWhereInput + where?: Clause_v2WhereInput /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} * - * Determine the order of Delegations to fetch. + * Determine the order of Clause_v2s 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?: DelegationWhereUniqueInput + cursor?: Clause_v2WhereUniqueInput /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} * - * Take `±n` Delegations from the position of the cursor. + * Take `±n` Clause_v2s 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` Delegations. + * Skip the first `n` Clause_v2s. */ skip?: number /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * - * Count returned Delegations + * Count returned Clause_v2s **/ - _count?: true | DelegationCountAggregateInputType + _count?: true | Clause_v2CountAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * * Select which fields to find the minimum value **/ - _min?: DelegationMinAggregateInputType + _min?: Clause_v2MinAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * * Select which fields to find the maximum value **/ - _max?: DelegationMaxAggregateInputType + _max?: Clause_v2MaxAggregateInputType } - export type GetDelegationAggregateType = { - [P in keyof T & keyof AggregateDelegation]: P extends '_count' | 'count' + export type GetClause_v2AggregateType = { + [P in keyof T & keyof AggregateClause_v2]: P extends '_count' | 'count' ? T[P] extends true ? number - : GetScalarType - : GetScalarType + : GetScalarType + : GetScalarType } - export type DelegationGroupByArgs = { - where?: DelegationWhereInput - orderBy?: Enumerable - by: DelegationScalarFieldEnum[] - having?: DelegationScalarWhereWithAggregatesInput + export type Clause_v2GroupByArgs = { + where?: Clause_v2WhereInput + orderBy?: Enumerable + by: Clause_v2ScalarFieldEnum[] + having?: Clause_v2ScalarWhereWithAggregatesInput take?: number skip?: number - _count?: DelegationCountAggregateInputType | true - _min?: DelegationMinAggregateInputType - _max?: DelegationMaxAggregateInputType + _count?: Clause_v2CountAggregateInputType | true + _min?: Clause_v2MinAggregateInputType + _max?: Clause_v2MaxAggregateInputType } - export type DelegationGroupByOutputType = { - createdBy: string - delegatedTo: string - _count: DelegationCountAggregateOutputType | null - _min: DelegationMinAggregateOutputType | null - _max: DelegationMaxAggregateOutputType | null + export type Clause_v2GroupByOutputType = { + id: string + key: string + value: string + udap_id: string | null + text: string + _count: Clause_v2CountAggregateOutputType | null + _min: Clause_v2MinAggregateOutputType | null + _max: Clause_v2MaxAggregateOutputType | null } - type GetDelegationGroupByPayload = Prisma.PrismaPromise< + type GetClause_v2GroupByPayload = Prisma.PrismaPromise< Array< - PickArray & + PickArray & { - [P in ((keyof T) & (keyof DelegationGroupByOutputType))]: P extends '_count' + [P in ((keyof T) & (keyof Clause_v2GroupByOutputType))]: P extends '_count' ? T[P] extends boolean ? number - : GetScalarType - : GetScalarType + : GetScalarType + : GetScalarType } > > - export type DelegationSelect = $Extensions.GetSelect<{ - createdBy?: boolean - delegatedTo?: boolean - user_delegation_createdByTouser?: boolean | UserArgs - user_delegation_delegatedToTouser?: boolean | UserArgs - }, ExtArgs["result"]["delegation"]> - - export type DelegationSelectScalar = { - createdBy?: boolean - delegatedTo?: boolean - } + export type Clause_v2Select = $Extensions.GetSelect<{ + id?: boolean + key?: boolean + value?: boolean + udap_id?: boolean + text?: boolean + }, ExtArgs["result"]["clause_v2"]> - export type DelegationInclude = { - user_delegation_createdByTouser?: boolean | UserArgs - user_delegation_delegatedToTouser?: boolean | UserArgs + export type Clause_v2SelectScalar = { + id?: boolean + key?: boolean + value?: boolean + udap_id?: boolean + text?: boolean } - type DelegationGetPayload = $Types.GetResult + type Clause_v2GetPayload = $Types.GetResult - type DelegationCountArgs = - Omit & { - select?: DelegationCountAggregateInputType | true + type Clause_v2CountArgs = + Omit & { + select?: Clause_v2CountAggregateInputType | true } - export interface DelegationDelegate { - [K: symbol]: { types: Prisma.TypeMap['model']['Delegation'], meta: { name: 'Delegation' } } + export interface Clause_v2Delegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Clause_v2'], meta: { name: 'Clause_v2' } } /** - * Find zero or one Delegation that matches the filter. - * @param {DelegationFindUniqueArgs} args - Arguments to find a Delegation + * Find zero or one Clause_v2 that matches the filter. + * @param {Clause_v2FindUniqueArgs} args - Arguments to find a Clause_v2 * @example - * // Get one Delegation - * const delegation = await prisma.delegation.findUnique({ + * // Get one Clause_v2 + * const clause_v2 = await prisma.clause_v2.findUnique({ * where: { * // ... provide filter here * } * }) **/ - findUnique, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( - args: SelectSubset> - ): HasReject extends True ? Prisma__DelegationClient<$Types.GetResult, T, 'findUnique', never>, never, ExtArgs> : Prisma__DelegationClient<$Types.GetResult, T, 'findUnique', never> | null, null, ExtArgs> + findUnique, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args: SelectSubset> + ): HasReject extends True ? Prisma__Clause_v2Client<$Types.GetResult, T, 'findUnique', never>, never, ExtArgs> : Prisma__Clause_v2Client<$Types.GetResult, T, 'findUnique', never> | null, null, ExtArgs> /** - * Find one Delegation that matches the filter or throw an error with `error.code='P2025'` + * Find one Clause_v2 that matches the filter or throw an error with `error.code='P2025'` * if no matches were found. - * @param {DelegationFindUniqueOrThrowArgs} args - Arguments to find a Delegation + * @param {Clause_v2FindUniqueOrThrowArgs} args - Arguments to find a Clause_v2 * @example - * // Get one Delegation - * const delegation = await prisma.delegation.findUniqueOrThrow({ + * // Get one Clause_v2 + * const clause_v2 = await prisma.clause_v2.findUniqueOrThrow({ * where: { * // ... provide filter here * } * }) **/ - findUniqueOrThrow>( - args?: SelectSubset> - ): Prisma__DelegationClient<$Types.GetResult, T, 'findUniqueOrThrow', never>, never, ExtArgs> + findUniqueOrThrow>( + args?: SelectSubset> + ): Prisma__Clause_v2Client<$Types.GetResult, T, 'findUniqueOrThrow', never>, never, ExtArgs> /** - * Find the first Delegation that matches the filter. + * Find the first Clause_v2 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 {DelegationFindFirstArgs} args - Arguments to find a Delegation + * @param {Clause_v2FindFirstArgs} args - Arguments to find a Clause_v2 * @example - * // Get one Delegation - * const delegation = await prisma.delegation.findFirst({ + * // Get one Clause_v2 + * const clause_v2 = await prisma.clause_v2.findFirst({ * where: { * // ... provide filter here * } * }) **/ - findFirst, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( - args?: SelectSubset> - ): HasReject extends True ? Prisma__DelegationClient<$Types.GetResult, T, 'findFirst', never>, never, ExtArgs> : Prisma__DelegationClient<$Types.GetResult, T, 'findFirst', never> | null, null, ExtArgs> + findFirst, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args?: SelectSubset> + ): HasReject extends True ? Prisma__Clause_v2Client<$Types.GetResult, T, 'findFirst', never>, never, ExtArgs> : Prisma__Clause_v2Client<$Types.GetResult, T, 'findFirst', never> | null, null, ExtArgs> /** - * Find the first Delegation that matches the filter or + * Find the first Clause_v2 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 {DelegationFindFirstOrThrowArgs} args - Arguments to find a Delegation + * @param {Clause_v2FindFirstOrThrowArgs} args - Arguments to find a Clause_v2 * @example - * // Get one Delegation - * const delegation = await prisma.delegation.findFirstOrThrow({ + * // Get one Clause_v2 + * const clause_v2 = await prisma.clause_v2.findFirstOrThrow({ * where: { * // ... provide filter here * } * }) **/ - findFirstOrThrow>( - args?: SelectSubset> - ): Prisma__DelegationClient<$Types.GetResult, T, 'findFirstOrThrow', never>, never, ExtArgs> + findFirstOrThrow>( + args?: SelectSubset> + ): Prisma__Clause_v2Client<$Types.GetResult, T, 'findFirstOrThrow', never>, never, ExtArgs> /** - * Find zero or more Delegations that matches the filter. + * Find zero or more Clause_v2s 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 {DelegationFindManyArgs=} args - Arguments to filter and select certain fields only. + * @param {Clause_v2FindManyArgs=} args - Arguments to filter and select certain fields only. * @example - * // Get all Delegations - * const delegations = await prisma.delegation.findMany() + * // Get all Clause_v2s + * const clause_v2s = await prisma.clause_v2.findMany() * - * // Get first 10 Delegations - * const delegations = await prisma.delegation.findMany({ take: 10 }) + * // Get first 10 Clause_v2s + * const clause_v2s = await prisma.clause_v2.findMany({ take: 10 }) * - * // Only select the `createdBy` - * const delegationWithCreatedByOnly = await prisma.delegation.findMany({ select: { createdBy: true } }) + * // Only select the `id` + * const clause_v2WithIdOnly = await prisma.clause_v2.findMany({ select: { id: true } }) * **/ - findMany>( - args?: SelectSubset> - ): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>> + findMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>> /** - * Create a Delegation. - * @param {DelegationCreateArgs} args - Arguments to create a Delegation. + * Create a Clause_v2. + * @param {Clause_v2CreateArgs} args - Arguments to create a Clause_v2. * @example - * // Create one Delegation - * const Delegation = await prisma.delegation.create({ + * // Create one Clause_v2 + * const Clause_v2 = await prisma.clause_v2.create({ * data: { - * // ... data to create a Delegation + * // ... data to create a Clause_v2 * } * }) * **/ - create>( - args: SelectSubset> - ): Prisma__DelegationClient<$Types.GetResult, T, 'create', never>, never, ExtArgs> + create>( + args: SelectSubset> + ): Prisma__Clause_v2Client<$Types.GetResult, T, 'create', never>, never, ExtArgs> /** - * Create many Delegations. - * @param {DelegationCreateManyArgs} args - Arguments to create many Delegations. + * Create many Clause_v2s. + * @param {Clause_v2CreateManyArgs} args - Arguments to create many Clause_v2s. * @example - * // Create many Delegations - * const delegation = await prisma.delegation.createMany({ + * // Create many Clause_v2s + * const clause_v2 = await prisma.clause_v2.createMany({ * data: { * // ... provide data here * } * }) * **/ - createMany>( - args?: SelectSubset> + createMany>( + args?: SelectSubset> ): Prisma.PrismaPromise /** - * Delete a Delegation. - * @param {DelegationDeleteArgs} args - Arguments to delete one Delegation. + * Delete a Clause_v2. + * @param {Clause_v2DeleteArgs} args - Arguments to delete one Clause_v2. * @example - * // Delete one Delegation - * const Delegation = await prisma.delegation.delete({ + * // Delete one Clause_v2 + * const Clause_v2 = await prisma.clause_v2.delete({ * where: { - * // ... filter to delete one Delegation + * // ... filter to delete one Clause_v2 * } * }) * **/ - delete>( - args: SelectSubset> - ): Prisma__DelegationClient<$Types.GetResult, T, 'delete', never>, never, ExtArgs> + delete>( + args: SelectSubset> + ): Prisma__Clause_v2Client<$Types.GetResult, T, 'delete', never>, never, ExtArgs> /** - * Update one Delegation. - * @param {DelegationUpdateArgs} args - Arguments to update one Delegation. + * Update one Clause_v2. + * @param {Clause_v2UpdateArgs} args - Arguments to update one Clause_v2. * @example - * // Update one Delegation - * const delegation = await prisma.delegation.update({ + * // Update one Clause_v2 + * const clause_v2 = await prisma.clause_v2.update({ * where: { * // ... provide filter here * }, @@ -2695,33 +2819,891 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject * }) * **/ - update>( - args: SelectSubset> - ): Prisma__DelegationClient<$Types.GetResult, T, 'update', never>, never, ExtArgs> + update>( + args: SelectSubset> + ): Prisma__Clause_v2Client<$Types.GetResult, T, 'update', never>, never, ExtArgs> /** - * Delete zero or more Delegations. - * @param {DelegationDeleteManyArgs} args - Arguments to filter Delegations to delete. + * Delete zero or more Clause_v2s. + * @param {Clause_v2DeleteManyArgs} args - Arguments to filter Clause_v2s to delete. * @example - * // Delete a few Delegations - * const { count } = await prisma.delegation.deleteMany({ + * // Delete a few Clause_v2s + * const { count } = await prisma.clause_v2.deleteMany({ * where: { * // ... provide filter here * } * }) * **/ - deleteMany>( - args?: SelectSubset> + deleteMany>( + args?: SelectSubset> ): Prisma.PrismaPromise /** - * Update zero or more Delegations. + * Update zero or more Clause_v2s. * Note, that providing `undefined` is treated as the value not being there. * Read more here: https://pris.ly/d/null-undefined - * @param {DelegationUpdateManyArgs} args - Arguments to update one or more rows. + * @param {Clause_v2UpdateManyArgs} args - Arguments to update one or more rows. * @example - * // Update many Delegations + * // Update many Clause_v2s + * const clause_v2 = await prisma.clause_v2.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + **/ + updateMany>( + args: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Create or update one Clause_v2. + * @param {Clause_v2UpsertArgs} args - Arguments to update or create a Clause_v2. + * @example + * // Update or create a Clause_v2 + * const clause_v2 = await prisma.clause_v2.upsert({ + * create: { + * // ... data to create a Clause_v2 + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Clause_v2 we want to update + * } + * }) + **/ + upsert>( + args: SelectSubset> + ): Prisma__Clause_v2Client<$Types.GetResult, T, 'upsert', never>, never, ExtArgs> + + /** + * Count the number of Clause_v2s. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Clause_v2CountArgs} args - Arguments to filter Clause_v2s to count. + * @example + * // Count the number of Clause_v2s + * const count = await prisma.clause_v2.count({ + * where: { + * // ... the filter for the Clause_v2s 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 Clause_v2. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Clause_v2AggregateArgs} 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 Clause_v2. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {Clause_v2GroupByArgs} 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 Clause_v2GroupByArgs, + HasSelectOrTake extends Or< + Extends<'skip', Keys>, + Extends<'take', Keys> + >, + OrderByArg extends True extends HasSelectOrTake + ? { orderBy: Clause_v2GroupByArgs['orderBy'] } + : { orderBy?: Clause_v2GroupByArgs['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 ? GetClause_v2GroupByPayload : Prisma.PrismaPromise + + } + + /** + * The delegate class that acts as a "Promise-like" for Clause_v2. + * 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__Clause_v2Client 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); + + + 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 + + /** + * Clause_v2 base type for findUnique actions + */ + export type Clause_v2FindUniqueArgsBase = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * Filter, which Clause_v2 to fetch. + */ + where: Clause_v2WhereUniqueInput + } + + /** + * Clause_v2 findUnique + */ + export interface Clause_v2FindUniqueArgs extends Clause_v2FindUniqueArgsBase { + /** + * Throw an Error if query returns no results + * @deprecated since 4.0.0: use `findUniqueOrThrow` method instead + */ + rejectOnNotFound?: RejectOnNotFound + } + + + /** + * Clause_v2 findUniqueOrThrow + */ + export type Clause_v2FindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * Filter, which Clause_v2 to fetch. + */ + where: Clause_v2WhereUniqueInput + } + + + /** + * Clause_v2 base type for findFirst actions + */ + export type Clause_v2FindFirstArgsBase = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * Filter, which Clause_v2 to fetch. + */ + where?: Clause_v2WhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Clause_v2s 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 Clause_v2s. + */ + cursor?: Clause_v2WhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Clause_v2s 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` Clause_v2s. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Clause_v2s. + */ + distinct?: Enumerable + } + + /** + * Clause_v2 findFirst + */ + export interface Clause_v2FindFirstArgs extends Clause_v2FindFirstArgsBase { + /** + * Throw an Error if query returns no results + * @deprecated since 4.0.0: use `findFirstOrThrow` method instead + */ + rejectOnNotFound?: RejectOnNotFound + } + + + /** + * Clause_v2 findFirstOrThrow + */ + export type Clause_v2FindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * Filter, which Clause_v2 to fetch. + */ + where?: Clause_v2WhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Clause_v2s 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 Clause_v2s. + */ + cursor?: Clause_v2WhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Clause_v2s 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` Clause_v2s. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Clause_v2s. + */ + distinct?: Enumerable + } + + + /** + * Clause_v2 findMany + */ + export type Clause_v2FindManyArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * Filter, which Clause_v2s to fetch. + */ + where?: Clause_v2WhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Clause_v2s 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 Clause_v2s. + */ + cursor?: Clause_v2WhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Clause_v2s 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` Clause_v2s. + */ + skip?: number + distinct?: Enumerable + } + + + /** + * Clause_v2 create + */ + export type Clause_v2CreateArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * The data needed to create a Clause_v2. + */ + data: XOR + } + + + /** + * Clause_v2 createMany + */ + export type Clause_v2CreateManyArgs = { + /** + * The data used to create many Clause_v2s. + */ + data: Enumerable + skipDuplicates?: boolean + } + + + /** + * Clause_v2 update + */ + export type Clause_v2UpdateArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * The data needed to update a Clause_v2. + */ + data: XOR + /** + * Choose, which Clause_v2 to update. + */ + where: Clause_v2WhereUniqueInput + } + + + /** + * Clause_v2 updateMany + */ + export type Clause_v2UpdateManyArgs = { + /** + * The data used to update Clause_v2s. + */ + data: XOR + /** + * Filter which Clause_v2s to update + */ + where?: Clause_v2WhereInput + } + + + /** + * Clause_v2 upsert + */ + export type Clause_v2UpsertArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * The filter to search for the Clause_v2 to update in case it exists. + */ + where: Clause_v2WhereUniqueInput + /** + * In case the Clause_v2 found by the `where` argument doesn't exist, create a new Clause_v2 with this data. + */ + create: XOR + /** + * In case the Clause_v2 was found with the provided `where` argument, update it with this data. + */ + update: XOR + } + + + /** + * Clause_v2 delete + */ + export type Clause_v2DeleteArgs = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + /** + * Filter which Clause_v2 to delete. + */ + where: Clause_v2WhereUniqueInput + } + + + /** + * Clause_v2 deleteMany + */ + export type Clause_v2DeleteManyArgs = { + /** + * Filter which Clause_v2s to delete + */ + where?: Clause_v2WhereInput + } + + + /** + * Clause_v2 without action + */ + export type Clause_v2Args = { + /** + * Select specific fields to fetch from the Clause_v2 + */ + select?: Clause_v2Select | null + } + + + + /** + * Model Delegation + */ + + + export type AggregateDelegation = { + _count: DelegationCountAggregateOutputType | null + _min: DelegationMinAggregateOutputType | null + _max: DelegationMaxAggregateOutputType | null + } + + export type DelegationMinAggregateOutputType = { + createdBy: string | null + delegatedTo: string | null + } + + export type DelegationMaxAggregateOutputType = { + createdBy: string | null + delegatedTo: string | null + } + + export type DelegationCountAggregateOutputType = { + createdBy: number + delegatedTo: number + _all: number + } + + + export type DelegationMinAggregateInputType = { + createdBy?: true + delegatedTo?: true + } + + export type DelegationMaxAggregateInputType = { + createdBy?: true + delegatedTo?: true + } + + export type DelegationCountAggregateInputType = { + createdBy?: true + delegatedTo?: true + _all?: true + } + + export type DelegationAggregateArgs = { + /** + * Filter which Delegation to aggregate. + */ + where?: DelegationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Delegations 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?: DelegationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Delegations 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` Delegations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Delegations + **/ + _count?: true | DelegationCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: DelegationMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: DelegationMaxAggregateInputType + } + + export type GetDelegationAggregateType = { + [P in keyof T & keyof AggregateDelegation]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : GetScalarType + : GetScalarType + } + + + + + export type DelegationGroupByArgs = { + where?: DelegationWhereInput + orderBy?: Enumerable + by: DelegationScalarFieldEnum[] + having?: DelegationScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: DelegationCountAggregateInputType | true + _min?: DelegationMinAggregateInputType + _max?: DelegationMaxAggregateInputType + } + + + export type DelegationGroupByOutputType = { + createdBy: string + delegatedTo: string + _count: DelegationCountAggregateOutputType | null + _min: DelegationMinAggregateOutputType | null + _max: DelegationMaxAggregateOutputType | null + } + + type GetDelegationGroupByPayload = Prisma.PrismaPromise< + Array< + PickArray & + { + [P in ((keyof T) & (keyof DelegationGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : GetScalarType + : GetScalarType + } + > + > + + + export type DelegationSelect = $Extensions.GetSelect<{ + createdBy?: boolean + delegatedTo?: boolean + user_delegation_createdByTouser?: boolean | UserArgs + user_delegation_delegatedToTouser?: boolean | UserArgs + }, ExtArgs["result"]["delegation"]> + + export type DelegationSelectScalar = { + createdBy?: boolean + delegatedTo?: boolean + } + + export type DelegationInclude = { + user_delegation_createdByTouser?: boolean | UserArgs + user_delegation_delegatedToTouser?: boolean | UserArgs + } + + + type DelegationGetPayload = $Types.GetResult + + type DelegationCountArgs = + Omit & { + select?: DelegationCountAggregateInputType | true + } + + export interface DelegationDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Delegation'], meta: { name: 'Delegation' } } + /** + * Find zero or one Delegation that matches the filter. + * @param {DelegationFindUniqueArgs} args - Arguments to find a Delegation + * @example + * // Get one Delegation + * const delegation = await prisma.delegation.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findUnique, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args: SelectSubset> + ): HasReject extends True ? Prisma__DelegationClient<$Types.GetResult, T, 'findUnique', never>, never, ExtArgs> : Prisma__DelegationClient<$Types.GetResult, T, 'findUnique', never> | null, null, ExtArgs> + + /** + * Find one Delegation that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {DelegationFindUniqueOrThrowArgs} args - Arguments to find a Delegation + * @example + * // Get one Delegation + * const delegation = await prisma.delegation.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findUniqueOrThrow>( + args?: SelectSubset> + ): Prisma__DelegationClient<$Types.GetResult, T, 'findUniqueOrThrow', never>, never, ExtArgs> + + /** + * Find the first Delegation 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 {DelegationFindFirstArgs} args - Arguments to find a Delegation + * @example + * // Get one Delegation + * const delegation = await prisma.delegation.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findFirst, LocalRejectSettings = T["rejectOnNotFound"] extends RejectOnNotFound ? T['rejectOnNotFound'] : undefined>( + args?: SelectSubset> + ): HasReject extends True ? Prisma__DelegationClient<$Types.GetResult, T, 'findFirst', never>, never, ExtArgs> : Prisma__DelegationClient<$Types.GetResult, T, 'findFirst', never> | null, null, ExtArgs> + + /** + * Find the first Delegation 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 {DelegationFindFirstOrThrowArgs} args - Arguments to find a Delegation + * @example + * // Get one Delegation + * const delegation = await prisma.delegation.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + **/ + findFirstOrThrow>( + args?: SelectSubset> + ): Prisma__DelegationClient<$Types.GetResult, T, 'findFirstOrThrow', never>, never, ExtArgs> + + /** + * Find zero or more Delegations 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 {DelegationFindManyArgs=} args - Arguments to filter and select certain fields only. + * @example + * // Get all Delegations + * const delegations = await prisma.delegation.findMany() + * + * // Get first 10 Delegations + * const delegations = await prisma.delegation.findMany({ take: 10 }) + * + * // Only select the `createdBy` + * const delegationWithCreatedByOnly = await prisma.delegation.findMany({ select: { createdBy: true } }) + * + **/ + findMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise<$Types.GetResult, T, 'findMany', never>> + + /** + * Create a Delegation. + * @param {DelegationCreateArgs} args - Arguments to create a Delegation. + * @example + * // Create one Delegation + * const Delegation = await prisma.delegation.create({ + * data: { + * // ... data to create a Delegation + * } + * }) + * + **/ + create>( + args: SelectSubset> + ): Prisma__DelegationClient<$Types.GetResult, T, 'create', never>, never, ExtArgs> + + /** + * Create many Delegations. + * @param {DelegationCreateManyArgs} args - Arguments to create many Delegations. + * @example + * // Create many Delegations + * const delegation = await prisma.delegation.createMany({ + * data: { + * // ... provide data here + * } + * }) + * + **/ + createMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Delete a Delegation. + * @param {DelegationDeleteArgs} args - Arguments to delete one Delegation. + * @example + * // Delete one Delegation + * const Delegation = await prisma.delegation.delete({ + * where: { + * // ... filter to delete one Delegation + * } + * }) + * + **/ + delete>( + args: SelectSubset> + ): Prisma__DelegationClient<$Types.GetResult, T, 'delete', never>, never, ExtArgs> + + /** + * Update one Delegation. + * @param {DelegationUpdateArgs} args - Arguments to update one Delegation. + * @example + * // Update one Delegation + * const delegation = await prisma.delegation.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + **/ + update>( + args: SelectSubset> + ): Prisma__DelegationClient<$Types.GetResult, T, 'update', never>, never, ExtArgs> + + /** + * Delete zero or more Delegations. + * @param {DelegationDeleteManyArgs} args - Arguments to filter Delegations to delete. + * @example + * // Delete a few Delegations + * const { count } = await prisma.delegation.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + **/ + deleteMany>( + args?: SelectSubset> + ): Prisma.PrismaPromise + + /** + * Update zero or more Delegations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {DelegationUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Delegations * const delegation = await prisma.delegation.updateMany({ * where: { * // ... provide filter here @@ -7324,12 +8306,24 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject key: 'key', value: 'value', udap_id: 'udap_id', - text: 'text' + text: 'text', + hidden: 'hidden' }; export type ClauseScalarFieldEnum = (typeof ClauseScalarFieldEnum)[keyof typeof ClauseScalarFieldEnum] + export const Clause_v2ScalarFieldEnum: { + id: 'id', + key: 'key', + value: 'value', + udap_id: 'udap_id', + text: 'text' + }; + + export type Clause_v2ScalarFieldEnum = (typeof Clause_v2ScalarFieldEnum)[keyof typeof Clause_v2ScalarFieldEnum] + + export const DelegationScalarFieldEnum: { createdBy: 'createdBy', delegatedTo: 'delegatedTo' @@ -7442,6 +8436,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: StringFilter | string udap_id?: StringFilter | string text?: StringFilter | string + hidden?: BoolNullableFilter | boolean | null } export type ClauseOrderByWithRelationInput = { @@ -7449,6 +8444,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: SortOrder udap_id?: SortOrder text?: SortOrder + hidden?: SortOrderInput | SortOrder } export type ClauseWhereUniqueInput = { @@ -7460,6 +8456,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: SortOrder udap_id?: SortOrder text?: SortOrder + hidden?: SortOrderInput | SortOrder _count?: ClauseCountOrderByAggregateInput _max?: ClauseMaxOrderByAggregateInput _min?: ClauseMinOrderByAggregateInput @@ -7473,6 +8470,52 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: StringWithAggregatesFilter | string udap_id?: StringWithAggregatesFilter | string text?: StringWithAggregatesFilter | string + hidden?: BoolNullableWithAggregatesFilter | boolean | null + } + + export type Clause_v2WhereInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringFilter | string + key?: StringFilter | string + value?: StringFilter | string + udap_id?: StringNullableFilter | string | null + text?: StringFilter | string + } + + export type Clause_v2OrderByWithRelationInput = { + id?: SortOrder + key?: SortOrder + value?: SortOrder + udap_id?: SortOrderInput | SortOrder + text?: SortOrder + } + + export type Clause_v2WhereUniqueInput = { + id?: string + } + + export type Clause_v2OrderByWithAggregationInput = { + id?: SortOrder + key?: SortOrder + value?: SortOrder + udap_id?: SortOrderInput | SortOrder + text?: SortOrder + _count?: Clause_v2CountOrderByAggregateInput + _max?: Clause_v2MaxOrderByAggregateInput + _min?: Clause_v2MinOrderByAggregateInput + } + + export type Clause_v2ScalarWhereWithAggregatesInput = { + AND?: Enumerable + OR?: Enumerable + NOT?: Enumerable + id?: StringWithAggregatesFilter | string + key?: StringWithAggregatesFilter | string + value?: StringWithAggregatesFilter | string + udap_id?: StringNullableWithAggregatesFilter | string | null + text?: StringWithAggregatesFilter | string } export type DelegationWhereInput = { @@ -7800,52 +8843,115 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject udap_id?: StringWithAggregatesFilter | string } - export type ClauseCreateInput = { + export type ClauseCreateInput = { + key: string + value: string + udap_id: string + text: string + hidden?: boolean | null + } + + export type ClauseUncheckedCreateInput = { + key: string + value: string + udap_id: string + text: string + hidden?: boolean | null + } + + export type ClauseUpdateInput = { + key?: StringFieldUpdateOperationsInput | string + value?: StringFieldUpdateOperationsInput | string + udap_id?: StringFieldUpdateOperationsInput | string + text?: StringFieldUpdateOperationsInput | string + hidden?: NullableBoolFieldUpdateOperationsInput | boolean | null + } + + export type ClauseUncheckedUpdateInput = { + key?: StringFieldUpdateOperationsInput | string + value?: StringFieldUpdateOperationsInput | string + udap_id?: StringFieldUpdateOperationsInput | string + text?: StringFieldUpdateOperationsInput | string + hidden?: NullableBoolFieldUpdateOperationsInput | boolean | null + } + + export type ClauseCreateManyInput = { + key: string + value: string + udap_id: string + text: string + hidden?: boolean | null + } + + export type ClauseUpdateManyMutationInput = { + key?: StringFieldUpdateOperationsInput | string + value?: StringFieldUpdateOperationsInput | string + udap_id?: StringFieldUpdateOperationsInput | string + text?: StringFieldUpdateOperationsInput | string + hidden?: NullableBoolFieldUpdateOperationsInput | boolean | null + } + + export type ClauseUncheckedUpdateManyInput = { + key?: StringFieldUpdateOperationsInput | string + value?: StringFieldUpdateOperationsInput | string + udap_id?: StringFieldUpdateOperationsInput | string + text?: StringFieldUpdateOperationsInput | string + hidden?: NullableBoolFieldUpdateOperationsInput | boolean | null + } + + export type Clause_v2CreateInput = { + id: string key: string value: string - udap_id: string + udap_id?: string | null text: string } - export type ClauseUncheckedCreateInput = { + export type Clause_v2UncheckedCreateInput = { + id: string key: string value: string - udap_id: string + udap_id?: string | null text: string } - export type ClauseUpdateInput = { + export type Clause_v2UpdateInput = { + id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string - udap_id?: StringFieldUpdateOperationsInput | string + udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } - export type ClauseUncheckedUpdateInput = { + export type Clause_v2UncheckedUpdateInput = { + id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string - udap_id?: StringFieldUpdateOperationsInput | string + udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } - export type ClauseCreateManyInput = { + export type Clause_v2CreateManyInput = { + id: string key: string value: string - udap_id: string + udap_id?: string | null text: string } - export type ClauseUpdateManyMutationInput = { + export type Clause_v2UpdateManyMutationInput = { + id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string - udap_id?: StringFieldUpdateOperationsInput | string + udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } - export type ClauseUncheckedUpdateManyInput = { + export type Clause_v2UncheckedUpdateManyInput = { + id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string - udap_id?: StringFieldUpdateOperationsInput | string + udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } @@ -8297,6 +9403,16 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedStringFilter | string } + export type BoolNullableFilter = { + equals?: boolean | null + not?: NestedBoolNullableFilter | boolean | null + } + + export type SortOrderInput = { + sort: SortOrder + nulls?: NullsOrder + } + export type ClauseKeyValueUdap_idCompoundUniqueInput = { key: string value: string @@ -8308,6 +9424,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: SortOrder udap_id?: SortOrder text?: SortOrder + hidden?: SortOrder } export type ClauseMaxOrderByAggregateInput = { @@ -8315,6 +9432,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: SortOrder udap_id?: SortOrder text?: SortOrder + hidden?: SortOrder } export type ClauseMinOrderByAggregateInput = { @@ -8322,6 +9440,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject value?: SortOrder udap_id?: SortOrder text?: SortOrder + hidden?: SortOrder } export type StringWithAggregatesFilter = { @@ -8342,6 +9461,71 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedStringFilter } + export type BoolNullableWithAggregatesFilter = { + equals?: boolean | null + not?: NestedBoolNullableWithAggregatesFilter | boolean | null + _count?: NestedIntNullableFilter + _min?: NestedBoolNullableFilter + _max?: NestedBoolNullableFilter + } + + export type StringNullableFilter = { + equals?: string | null + in?: Enumerable | string | null + notIn?: Enumerable | string | null + lt?: string + lte?: string + gt?: string + gte?: string + contains?: string + startsWith?: string + endsWith?: string + mode?: QueryMode + not?: NestedStringNullableFilter | string | null + } + + export type Clause_v2CountOrderByAggregateInput = { + id?: SortOrder + key?: SortOrder + value?: SortOrder + udap_id?: SortOrder + text?: SortOrder + } + + export type Clause_v2MaxOrderByAggregateInput = { + id?: SortOrder + key?: SortOrder + value?: SortOrder + udap_id?: SortOrder + text?: SortOrder + } + + export type Clause_v2MinOrderByAggregateInput = { + id?: SortOrder + key?: SortOrder + value?: SortOrder + udap_id?: SortOrder + text?: SortOrder + } + + export type StringNullableWithAggregatesFilter = { + equals?: string | null + in?: Enumerable | string | null + notIn?: Enumerable | string | null + lt?: string + lte?: string + gt?: string + gte?: string + contains?: string + startsWith?: string + endsWith?: string + mode?: QueryMode + not?: NestedStringNullableWithAggregatesFilter | string | null + _count?: NestedIntNullableFilter + _min?: NestedStringNullableFilter + _max?: NestedStringNullableFilter + } + export type UserRelationFilter = { is?: UserWhereInput | null isNot?: UserWhereInput | null @@ -8367,21 +9551,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject delegatedTo?: SortOrder } - export type StringNullableFilter = { - equals?: string | null - in?: Enumerable | string | null - notIn?: Enumerable | string | null - lt?: string - lte?: string - gt?: string - gte?: string - contains?: string - startsWith?: string - endsWith?: string - mode?: QueryMode - not?: NestedStringNullableFilter | string | null - } - export type DateTimeNullableFilter = { equals?: Date | string | null in?: Enumerable | Enumerable | Date | string | null @@ -8415,16 +9584,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedIntNullableFilter | number | null } - export type BoolNullableFilter = { - equals?: boolean | null - not?: NestedBoolNullableFilter | boolean | null - } - - export type SortOrderInput = { - sort: SortOrder - nulls?: NullsOrder - } - export type ReportCountOrderByAggregateInput = { id?: SortOrder title?: SortOrder @@ -8505,24 +9664,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject serviceInstructeur?: SortOrder } - export type StringNullableWithAggregatesFilter = { - equals?: string | null - in?: Enumerable | string | null - notIn?: Enumerable | string | null - lt?: string - lte?: string - gt?: string - gte?: string - contains?: string - startsWith?: string - endsWith?: string - mode?: QueryMode - not?: NestedStringNullableWithAggregatesFilter | string | null - _count?: NestedIntNullableFilter - _min?: NestedStringNullableFilter - _max?: NestedStringNullableFilter - } - export type DateTimeNullableWithAggregatesFilter = { equals?: Date | string | null in?: Enumerable | Enumerable | Date | string | null @@ -8567,14 +9708,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedIntNullableFilter } - export type BoolNullableWithAggregatesFilter = { - equals?: boolean | null - not?: NestedBoolNullableWithAggregatesFilter | boolean | null - _count?: NestedIntNullableFilter - _min?: NestedBoolNullableFilter - _max?: NestedBoolNullableFilter - } - export type IntFilter = { equals?: number in?: Enumerable | number @@ -8742,6 +9875,14 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject set?: string } + export type NullableBoolFieldUpdateOperationsInput = { + set?: boolean | null + } + + export type NullableStringFieldUpdateOperationsInput = { + set?: string | null + } + export type UserCreateNestedOneWithoutDelegation_delegation_createdByTouserInput = { create?: XOR connectOrCreate?: UserCreateOrConnectWithoutDelegation_delegation_createdByTouserInput @@ -8776,10 +9917,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject connect?: UserWhereUniqueInput } - export type NullableStringFieldUpdateOperationsInput = { - set?: string | null - } - export type NullableDateTimeFieldUpdateOperationsInput = { set?: Date | string | null } @@ -8796,10 +9933,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject divide?: number } - export type NullableBoolFieldUpdateOperationsInput = { - set?: boolean | null - } - export type UserUpdateOneRequiredWithoutReportNestedInput = { create?: XOR connectOrCreate?: UserCreateOrConnectWithoutReportInput @@ -9012,6 +10145,11 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedStringFilter | string } + export type NestedBoolNullableFilter = { + equals?: boolean | null + not?: NestedBoolNullableFilter | boolean | null + } + export type NestedStringWithAggregatesFilter = { equals?: string in?: Enumerable | string @@ -9040,6 +10178,25 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedIntFilter | number } + export type NestedBoolNullableWithAggregatesFilter = { + equals?: boolean | null + not?: NestedBoolNullableWithAggregatesFilter | boolean | null + _count?: NestedIntNullableFilter + _min?: NestedBoolNullableFilter + _max?: NestedBoolNullableFilter + } + + export type NestedIntNullableFilter = { + equals?: number | null + in?: Enumerable | number | null + notIn?: Enumerable | number | null + lt?: number + lte?: number + gt?: number + gte?: number + not?: NestedIntNullableFilter | number | null + } + export type NestedStringNullableFilter = { equals?: string | null in?: Enumerable | string | null @@ -9054,6 +10211,23 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedStringNullableFilter | string | null } + export type NestedStringNullableWithAggregatesFilter = { + equals?: string | null + in?: Enumerable | string | null + notIn?: Enumerable | string | null + lt?: string + lte?: string + gt?: string + gte?: string + contains?: string + startsWith?: string + endsWith?: string + not?: NestedStringNullableWithAggregatesFilter | string | null + _count?: NestedIntNullableFilter + _min?: NestedStringNullableFilter + _max?: NestedStringNullableFilter + } + export type NestedDateTimeNullableFilter = { equals?: Date | string | null in?: Enumerable | Enumerable | Date | string | null @@ -9076,39 +10250,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedDateTimeFilter | Date | string } - export type NestedIntNullableFilter = { - equals?: number | null - in?: Enumerable | number | null - notIn?: Enumerable | number | null - lt?: number - lte?: number - gt?: number - gte?: number - not?: NestedIntNullableFilter | number | null - } - - export type NestedBoolNullableFilter = { - equals?: boolean | null - not?: NestedBoolNullableFilter | boolean | null - } - - export type NestedStringNullableWithAggregatesFilter = { - equals?: string | null - in?: Enumerable | string | null - notIn?: Enumerable | string | null - lt?: string - lte?: string - gt?: string - gte?: string - contains?: string - startsWith?: string - endsWith?: string - not?: NestedStringNullableWithAggregatesFilter | string | null - _count?: NestedIntNullableFilter - _min?: NestedStringNullableFilter - _max?: NestedStringNullableFilter - } - export type NestedDateTimeNullableWithAggregatesFilter = { equals?: Date | string | null in?: Enumerable | Enumerable | Date | string | null @@ -9164,14 +10305,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedFloatNullableFilter | number | null } - export type NestedBoolNullableWithAggregatesFilter = { - equals?: boolean | null - not?: NestedBoolNullableWithAggregatesFilter | boolean | null - _count?: NestedIntNullableFilter - _min?: NestedBoolNullableFilter - _max?: NestedBoolNullableFilter - } - export type NestedIntWithAggregatesFilter = { equals?: number in?: Enumerable | number diff --git a/packages/electric-client/src/generated/typebox/clause.ts b/packages/electric-client/src/generated/typebox/clause.ts index 0acd8be1..b323e6fc 100644 --- a/packages/electric-client/src/generated/typebox/clause.ts +++ b/packages/electric-client/src/generated/typebox/clause.ts @@ -5,6 +5,7 @@ export const clause = Type.Object({ value: Type.String(), udap_id: Type.String(), text: Type.String(), + hidden: Type.Optional(Type.Boolean()), }); export type clauseType = Static; diff --git a/packages/electric-client/src/generated/typebox/clauseInput.ts b/packages/electric-client/src/generated/typebox/clauseInput.ts index a65a8988..bf8c3d2b 100644 --- a/packages/electric-client/src/generated/typebox/clauseInput.ts +++ b/packages/electric-client/src/generated/typebox/clauseInput.ts @@ -5,6 +5,7 @@ export const clauseInput = Type.Object({ value: Type.String(), udap_id: Type.String(), text: Type.String(), + hidden: Type.Optional(Type.Boolean()), }); export type clauseInputType = Static; diff --git a/packages/electric-client/src/generated/typebox/clause_v2.ts b/packages/electric-client/src/generated/typebox/clause_v2.ts new file mode 100644 index 00000000..2661453a --- /dev/null +++ b/packages/electric-client/src/generated/typebox/clause_v2.ts @@ -0,0 +1,11 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const clause_v2 = Type.Object({ + id: Type.String(), + key: Type.String(), + value: Type.String(), + udap_id: Type.Optional(Type.String()), + text: Type.String(), +}); + +export type clause_v2Type = Static; diff --git a/packages/electric-client/src/generated/typebox/clause_v2Input.ts b/packages/electric-client/src/generated/typebox/clause_v2Input.ts new file mode 100644 index 00000000..816c4c51 --- /dev/null +++ b/packages/electric-client/src/generated/typebox/clause_v2Input.ts @@ -0,0 +1,11 @@ +import { Type, Static } from "@sinclair/typebox"; + +export const clause_v2Input = Type.Object({ + id: Type.String(), + key: Type.String(), + value: Type.String(), + udap_id: Type.Optional(Type.String()), + text: Type.String(), +}); + +export type clause_v2InputType = Static; diff --git a/packages/electric-client/src/generated/typebox/index.ts b/packages/electric-client/src/generated/typebox/index.ts index 86e800fc..bef68661 100644 --- a/packages/electric-client/src/generated/typebox/index.ts +++ b/packages/electric-client/src/generated/typebox/index.ts @@ -18,3 +18,5 @@ export * from './internal_user'; export * from './internal_userInput'; export * from './service_instructeurs'; export * from './service_instructeursInput'; +export * from './clause_v2'; +export * from './clause_v2Input'; diff --git a/packages/frontend/src/contexts/AuthContext.tsx b/packages/frontend/src/contexts/AuthContext.tsx index 35902c1c..652a3bd9 100644 --- a/packages/frontend/src/contexts/AuthContext.tsx +++ b/packages/frontend/src/contexts/AuthContext.tsx @@ -61,7 +61,7 @@ export const AuthProvider = ({ children }: PropsWithChildren) => { if (electric.isConnected) electric.disconnect(); await electric.connect(data!.token); - await electric.db.clause.sync({ where: { udap_id: { in: ["ALL", data!.user!.udap_id!] } } }); + await electric.db.clause_v2.sync({ where: { udap_id: { in: ["ALL", data!.user!.udap_id!] } } }); await electric.db.user.sync({ where: { udap_id: data!.user!.udap_id } }); await electric.db.report.sync({ where: { diff --git a/packages/frontend/src/features/chips/useChipOptions.tsx b/packages/frontend/src/features/chips/useChipOptions.tsx index 67b2cbad..8bcebabc 100644 --- a/packages/frontend/src/features/chips/useChipOptions.tsx +++ b/packages/frontend/src/features/chips/useChipOptions.tsx @@ -3,14 +3,14 @@ import { useUser } from "../../contexts/AuthContext"; import { useLiveQuery } from "electric-sql/react"; import { db } from "../../db"; import { groupBy } from "pastable"; -import { Clause } from "@cr-vif/electric-client/frontend"; +import { Clause_v2 } from "@cr-vif/electric-client/frontend"; export const useChipOptions = (key?: string) => { const user = useUser()!; // retrieve all chips with the given key const decisionsChipsQuery = useLiveQuery( - db.clause.liveMany({ + db.clause_v2.liveMany({ where: { ...(key ? { key } : {}), udap_id: { in: ["ALL", user.udap.id] }, @@ -29,7 +29,7 @@ export const useChipOptions = (key?: string) => { return chips.map(transformChip); }; -const transformChip = (chip: Clause) => { +const transformChip = (chip: Clause_v2) => { return { ...chip, text: chip.text?.replaceAll("\\n", "
"), diff --git a/packages/frontend/src/features/menu/ClauseMenu.tsx b/packages/frontend/src/features/menu/ClauseMenu.tsx index 7f2d8af0..a6c9a66c 100644 --- a/packages/frontend/src/features/menu/ClauseMenu.tsx +++ b/packages/frontend/src/features/menu/ClauseMenu.tsx @@ -10,7 +10,7 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => { const user = useUser()!; const clausesQuery = useLiveQuery( - db.clause.liveMany({ + db.clause_v2.liveMany({ where: { key: { in: isNational ? ["type-espace", "decision"] : ["contacts-utiles", "bonnes-pratiques"], From 5ef49c57207b520914c2274946a042d7ea25d42e Mon Sep 17 00:00:00 2001 From: ledouxm Date: Thu, 4 Jul 2024 10:22:06 +0200 Subject: [PATCH 14/29] feat: keep on with electric --- db/migrations/902-rework_clauses.sql | 1 + packages/backend/src/tmp.ts | 27 ++- packages/electric-client/prisma/schema.prisma | 11 +- .../src/generated/client/index.ts | 158 ++++++++------ .../src/generated/client/migrations.ts | 8 +- .../src/generated/client/pg-migrations.ts | 8 +- .../src/generated/client/prismaClient.d.ts | 196 ++++++++++++------ .../src/generated/typebox/clause_v2.ts | 1 + .../src/generated/typebox/clause_v2Input.ts | 1 + 9 files changed, 262 insertions(+), 149 deletions(-) diff --git a/db/migrations/902-rework_clauses.sql b/db/migrations/902-rework_clauses.sql index 099c59bf..85611459 100644 --- a/db/migrations/902-rework_clauses.sql +++ b/db/migrations/902-rework_clauses.sql @@ -3,6 +3,7 @@ CREATE TABLE clause_v2 ( id text NOT NULL PRIMARY KEY ,key text NOT NULL ,value text NOT NULL + ,position int ,udap_id text ,text text NOT NULL ); diff --git a/packages/backend/src/tmp.ts b/packages/backend/src/tmp.ts index 6b11a666..c5772b36 100644 --- a/packages/backend/src/tmp.ts +++ b/packages/backend/src/tmp.ts @@ -1,5 +1,6 @@ import { db } from "./db/db"; import { v4 } from "uuid"; +import { groupBy } from "pastable"; export const initClauseV2 = async () => { const nbClausesV2 = await db.clause_v2.count(); @@ -7,16 +8,22 @@ export const initClauseV2 = async () => { const clauses = await db.clause.findMany(); - for (const clause of clauses) { - await db.clause_v2.create({ - data: { - id: v4(), - key: clause.key, - text: clause.text, - value: clause.value, - udap_id: clause.udap_id, - }, - }); + const grouped = groupBy(clauses, (clause) => `${clause.udap_id}-${clause.key}`); + + for (const clausesToAdd of Object.values(grouped)) { + for (let i = 0; i < clausesToAdd.length; i++) { + const clause = clausesToAdd[i]!; + await db.clause_v2.create({ + data: { + id: v4(), + key: clause.key, + text: clause.text, + value: clause.value, + position: i, + udap_id: clause.udap_id, + }, + }); + } } return "done"; diff --git a/packages/electric-client/prisma/schema.prisma b/packages/electric-client/prisma/schema.prisma index c9f446e1..6fa911b2 100644 --- a/packages/electric-client/prisma/schema.prisma +++ b/packages/electric-client/prisma/schema.prisma @@ -124,9 +124,10 @@ model service_instructeurs { } model clause_v2 { - id String @id - key String - value String - udap_id String? - text String + id String @id + key String + value String + position Int? + udap_id String? + text String } diff --git a/packages/electric-client/src/generated/client/index.ts b/packages/electric-client/src/generated/client/index.ts index 7309176e..d98678e8 100644 --- a/packages/electric-client/src/generated/client/index.ts +++ b/packages/electric-client/src/generated/client/index.ts @@ -15,7 +15,7 @@ import pgMigrations from './pg-migrations'; export const ClauseScalarFieldEnumSchema = z.enum(['key','value','udap_id','text','hidden']); -export const Clause_v2ScalarFieldEnumSchema = z.enum(['id','key','value','udap_id','text']); +export const Clause_v2ScalarFieldEnumSchema = z.enum(['id','key','value','position','udap_id','text']); export const DelegationScalarFieldEnumSchema = z.enum(['createdBy','delegatedTo']); @@ -58,6 +58,7 @@ export const Clause_v2Schema = z.object({ id: z.string(), key: z.string(), value: z.string(), + position: z.number().int().gte(-2147483648).lte(2147483647).nullable(), udap_id: z.string().nullable(), text: z.string(), }) @@ -176,6 +177,7 @@ export const Clause_v2SelectSchema: z.ZodType = z.object id: z.boolean().optional(), key: z.boolean().optional(), value: z.boolean().optional(), + position: z.boolean().optional(), udap_id: z.boolean().optional(), text: z.boolean().optional(), }).strict() @@ -382,6 +384,7 @@ export const Clause_v2WhereInputSchema: z.ZodType = id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), key: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), value: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + position: z.union([ z.lazy(() => IntNullableFilterSchema),z.number() ]).optional().nullable(), udap_id: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), text: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), }).strict(); @@ -390,6 +393,7 @@ export const Clause_v2OrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), + position: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), text: z.lazy(() => SortOrderSchema).optional() }).strict(); @@ -402,11 +406,14 @@ export const Clause_v2OrderByWithAggregationInputSchema: z.ZodType SortOrderSchema).optional(), key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), + position: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), text: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => Clause_v2CountOrderByAggregateInputSchema).optional(), + _avg: z.lazy(() => Clause_v2AvgOrderByAggregateInputSchema).optional(), _max: z.lazy(() => Clause_v2MaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => Clause_v2MinOrderByAggregateInputSchema).optional() + _min: z.lazy(() => Clause_v2MinOrderByAggregateInputSchema).optional(), + _sum: z.lazy(() => Clause_v2SumOrderByAggregateInputSchema).optional() }).strict(); export const Clause_v2ScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ @@ -416,6 +423,7 @@ export const Clause_v2ScalarWhereWithAggregatesInputSchema: z.ZodType StringWithAggregatesFilterSchema),z.string() ]).optional(), key: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), value: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + position: z.union([ z.lazy(() => IntNullableWithAggregatesFilterSchema),z.number() ]).optional().nullable(), udap_id: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), text: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), }).strict(); @@ -805,6 +813,7 @@ export const Clause_v2CreateInputSchema: z.ZodType id: z.string(), key: z.string(), value: z.string(), + position: z.number().int().gte(-2147483648).lte(2147483647).optional().nullable(), udap_id: z.string().optional().nullable(), text: z.string() }).strict(); @@ -813,6 +822,7 @@ export const Clause_v2UncheckedCreateInputSchema: z.ZodType id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + position: z.union([ z.number().int().gte(-2147483648).lte(2147483647),z.lazy(() => NullableIntFieldUpdateOperationsInputSchema) ]).optional().nullable(), udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); @@ -829,6 +840,7 @@ export const Clause_v2UncheckedUpdateInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + position: z.union([ z.number().int().gte(-2147483648).lte(2147483647),z.lazy(() => NullableIntFieldUpdateOperationsInputSchema) ]).optional().nullable(), udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); @@ -837,6 +849,7 @@ export const Clause_v2CreateManyInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + position: z.union([ z.number().int().gte(-2147483648).lte(2147483647),z.lazy(() => NullableIntFieldUpdateOperationsInputSchema) ]).optional().nullable(), udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); @@ -853,6 +867,7 @@ export const Clause_v2UncheckedUpdateManyInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), key: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), value: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + position: z.union([ z.number().int().gte(-2147483648).lte(2147483647),z.lazy(() => NullableIntFieldUpdateOperationsInputSchema) ]).optional().nullable(), udap_id: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), text: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); @@ -1365,6 +1380,17 @@ export const BoolNullableWithAggregatesFilterSchema: z.ZodType NestedBoolNullableFilterSchema).optional() }).strict(); +export const IntNullableFilterSchema: z.ZodType = z.object({ + equals: z.number().optional().nullable(), + in: z.number().array().optional().nullable(), + notIn: z.number().array().optional().nullable(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), +}).strict(); + export const StringNullableFilterSchema: z.ZodType = z.object({ equals: z.string().optional().nullable(), in: z.string().array().optional().nullable(), @@ -1384,14 +1410,20 @@ export const Clause_v2CountOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), + position: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), text: z.lazy(() => SortOrderSchema).optional() }).strict(); +export const Clause_v2AvgOrderByAggregateInputSchema: z.ZodType = z.object({ + position: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const Clause_v2MaxOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), + position: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), text: z.lazy(() => SortOrderSchema).optional() }).strict(); @@ -1400,10 +1432,31 @@ export const Clause_v2MinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), key: z.lazy(() => SortOrderSchema).optional(), value: z.lazy(() => SortOrderSchema).optional(), + position: z.lazy(() => SortOrderSchema).optional(), udap_id: z.lazy(() => SortOrderSchema).optional(), text: z.lazy(() => SortOrderSchema).optional() }).strict(); +export const Clause_v2SumOrderByAggregateInputSchema: z.ZodType = z.object({ + position: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const IntNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.number().optional().nullable(), + in: z.number().array().optional().nullable(), + notIn: z.number().array().optional().nullable(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _avg: z.lazy(() => NestedFloatNullableFilterSchema).optional(), + _sum: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _max: z.lazy(() => NestedIntNullableFilterSchema).optional() +}).strict(); + export const StringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.string().optional().nullable(), in: z.string().array().optional().nullable(), @@ -1469,17 +1522,6 @@ export const DateTimeFilterSchema: z.ZodType = z.object({ not: z.union([ z.coerce.date(),z.lazy(() => NestedDateTimeFilterSchema) ]).optional(), }).strict(); -export const IntNullableFilterSchema: z.ZodType = z.object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntNullableFilterSchema) ]).optional().nullable(), -}).strict(); - export const ReportCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), title: z.lazy(() => SortOrderSchema).optional(), @@ -1588,22 +1630,6 @@ export const DateTimeWithAggregatesFilterSchema: z.ZodType NestedDateTimeFilterSchema).optional() }).strict(); -export const IntNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _avg: z.lazy(() => NestedFloatNullableFilterSchema).optional(), - _sum: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _max: z.lazy(() => NestedIntNullableFilterSchema).optional() -}).strict(); - export const IntFilterSchema: z.ZodType = z.object({ equals: z.number().optional(), in: z.number().array().optional(), @@ -1775,6 +1801,14 @@ export const NullableBoolFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.number().optional().nullable(), + increment: z.number().optional(), + decrement: z.number().optional(), + multiply: z.number().optional(), + divide: z.number().optional() +}).strict(); + export const NullableStringFieldUpdateOperationsInputSchema: z.ZodType = z.object({ set: z.string().optional().nullable() }).strict(); @@ -1821,14 +1855,6 @@ export const DateTimeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.number().optional().nullable(), - increment: z.number().optional(), - decrement: z.number().optional(), - multiply: z.number().optional(), - divide: z.number().optional() -}).strict(); - export const UserUpdateOneRequiredWithoutReportNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => UserCreateWithoutReportInputSchema),z.lazy(() => UserUncheckedCreateWithoutReportInputSchema) ]).optional(), connectOrCreate: z.lazy(() => UserCreateOrConnectWithoutReportInputSchema).optional(), @@ -2107,6 +2133,33 @@ export const NestedStringNullableFilterSchema: z.ZodType NestedStringNullableFilterSchema) ]).optional().nullable(), }).strict(); +export const NestedIntNullableWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.number().optional().nullable(), + in: z.number().array().optional().nullable(), + notIn: z.number().array().optional().nullable(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntNullableWithAggregatesFilterSchema) ]).optional().nullable(), + _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _avg: z.lazy(() => NestedFloatNullableFilterSchema).optional(), + _sum: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _min: z.lazy(() => NestedIntNullableFilterSchema).optional(), + _max: z.lazy(() => NestedIntNullableFilterSchema).optional() +}).strict(); + +export const NestedFloatNullableFilterSchema: z.ZodType = z.object({ + equals: z.number().optional().nullable(), + in: z.number().array().optional().nullable(), + notIn: z.number().array().optional().nullable(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedFloatNullableFilterSchema) ]).optional().nullable(), +}).strict(); + export const NestedStringNullableWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.string().optional().nullable(), in: z.string().array().optional().nullable(), @@ -2174,33 +2227,6 @@ export const NestedDateTimeWithAggregatesFilterSchema: z.ZodType NestedDateTimeFilterSchema).optional() }).strict(); -export const NestedIntNullableWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntNullableWithAggregatesFilterSchema) ]).optional().nullable(), - _count: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _avg: z.lazy(() => NestedFloatNullableFilterSchema).optional(), - _sum: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _min: z.lazy(() => NestedIntNullableFilterSchema).optional(), - _max: z.lazy(() => NestedIntNullableFilterSchema).optional() -}).strict(); - -export const NestedFloatNullableFilterSchema: z.ZodType = z.object({ - equals: z.number().optional().nullable(), - in: z.number().array().optional().nullable(), - notIn: z.number().array().optional().nullable(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedFloatNullableFilterSchema) ]).optional().nullable(), -}).strict(); - export const NestedIntWithAggregatesFilterSchema: z.ZodType = z.object({ equals: z.number().optional(), in: z.number().array().optional(), @@ -3601,6 +3627,10 @@ export const tableSchemas = { "value", "TEXT" ], + [ + "position", + "INT4" + ], [ "udap_id", "TEXT" diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index 720ae3a1..a72a1516 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -135,16 +135,16 @@ export default [ }, { "statements": [ - "CREATE TABLE \"clause_v2\" (\n \"id\" TEXT NOT NULL,\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"udap_id\" TEXT,\n \"text\" TEXT NOT NULL,\n CONSTRAINT \"clause_v2_pkey\" PRIMARY KEY (\"id\")\n) WITHOUT ROWID;\n", + "CREATE TABLE \"clause_v2\" (\n \"id\" TEXT NOT NULL,\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"position\" INTEGER,\n \"udap_id\" TEXT,\n \"text\" TEXT NOT NULL,\n CONSTRAINT \"clause_v2_pkey\" PRIMARY KEY (\"id\")\n) WITHOUT ROWID;\n", "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'clause_v2', 1);", "DROP TRIGGER IF EXISTS update_ensure_main_clause_v2_primarykey;", "CREATE TRIGGER update_ensure_main_clause_v2_primarykey\n BEFORE UPDATE ON \"main\".\"clause_v2\"\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_clause_v2_into_oplog;", - "CREATE TRIGGER insert_main_clause_v2_into_oplog\n AFTER INSERT ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'INSERT', json_patch('{}', json_object('id', new.\"id\")), json_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", + "CREATE TRIGGER insert_main_clause_v2_into_oplog\n AFTER INSERT ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'INSERT', json_patch('{}', json_object('id', new.\"id\")), json_object('id', new.\"id\", 'key', new.\"key\", 'position', new.\"position\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", "DROP TRIGGER IF EXISTS update_main_clause_v2_into_oplog;", - "CREATE TRIGGER update_main_clause_v2_into_oplog\n AFTER UPDATE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'UPDATE', json_patch('{}', json_object('id', new.\"id\")), json_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", + "CREATE TRIGGER update_main_clause_v2_into_oplog\n AFTER UPDATE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'UPDATE', json_patch('{}', json_object('id', new.\"id\")), json_object('id', new.\"id\", 'key', new.\"key\", 'position', new.\"position\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('id', old.\"id\", 'key', old.\"key\", 'position', old.\"position\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", "DROP TRIGGER IF EXISTS delete_main_clause_v2_into_oplog;", - "CREATE TRIGGER delete_main_clause_v2_into_oplog\n AFTER DELETE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" + "CREATE TRIGGER delete_main_clause_v2_into_oplog\n AFTER DELETE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('id', old.\"id\", 'key', old.\"key\", 'position', old.\"position\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" ], "version": "902" } diff --git a/packages/electric-client/src/generated/client/pg-migrations.ts b/packages/electric-client/src/generated/client/pg-migrations.ts index ddbe24c5..dfba45ec 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -179,19 +179,19 @@ export default [ }, { "statements": [ - "CREATE TABLE clause_v2 (\n id text NOT NULL,\n key text NOT NULL,\n value text NOT NULL,\n udap_id text,\n text text NOT NULL,\n CONSTRAINT clause_v2_pkey PRIMARY KEY (id)\n)", + "CREATE TABLE clause_v2 (\n id text NOT NULL,\n key text NOT NULL,\n value text NOT NULL,\n \"position\" integer,\n udap_id text,\n text text NOT NULL,\n CONSTRAINT clause_v2_pkey PRIMARY KEY (id)\n)", "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'clause_v2', 1)\n ON CONFLICT DO NOTHING;", "DROP TRIGGER IF EXISTS update_ensure_public_clause_v2_primarykey ON \"public\".\"clause_v2\";", "CREATE OR REPLACE FUNCTION update_ensure_public_clause_v2_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_clause_v2_primarykey\n BEFORE UPDATE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_clause_v2_primarykey_function();", "DROP TRIGGER IF EXISTS insert_public_clause_v2_into_oplog ON \"public\".\"clause_v2\";", - " CREATE OR REPLACE FUNCTION insert_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'INSERT',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION insert_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'INSERT',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('id', new.\"id\", 'key', new.\"key\", 'position', new.\"position\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER insert_public_clause_v2_into_oplog\n AFTER INSERT ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_clause_v2_into_oplog_function();", "DROP TRIGGER IF EXISTS update_public_clause_v2_into_oplog ON \"public\".\"clause_v2\";", - " CREATE OR REPLACE FUNCTION update_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'UPDATE',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('id', new.\"id\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION update_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'UPDATE',\n json_strip_nulls(json_build_object('id', new.\"id\")),\n jsonb_build_object('id', new.\"id\", 'key', new.\"key\", 'position', new.\"position\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('id', old.\"id\", 'key', old.\"key\", 'position', old.\"position\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER update_public_clause_v2_into_oplog\n AFTER UPDATE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_clause_v2_into_oplog_function();", "DROP TRIGGER IF EXISTS delete_public_clause_v2_into_oplog ON \"public\".\"clause_v2\";", - " CREATE OR REPLACE FUNCTION delete_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'DELETE',\n json_strip_nulls(json_build_object('id', old.\"id\")),\n NULL,\n jsonb_build_object('id', old.\"id\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION delete_public_clause_v2_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 = 'clause_v2';\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 'clause_v2',\n 'DELETE',\n json_strip_nulls(json_build_object('id', old.\"id\")),\n NULL,\n jsonb_build_object('id', old.\"id\", 'key', old.\"key\", 'position', old.\"position\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER delete_public_clause_v2_into_oplog\n AFTER DELETE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_clause_v2_into_oplog_function();" ], "version": "902" diff --git a/packages/electric-client/src/generated/client/prismaClient.d.ts b/packages/electric-client/src/generated/client/prismaClient.d.ts index 3c8504d4..4a14a404 100644 --- a/packages/electric-client/src/generated/client/prismaClient.d.ts +++ b/packages/electric-client/src/generated/client/prismaClient.d.ts @@ -37,6 +37,10 @@ export type Clause_v2Payload @@ -2491,14 +2495,25 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject export type AggregateClause_v2 = { _count: Clause_v2CountAggregateOutputType | null + _avg: Clause_v2AvgAggregateOutputType | null + _sum: Clause_v2SumAggregateOutputType | null _min: Clause_v2MinAggregateOutputType | null _max: Clause_v2MaxAggregateOutputType | null } + export type Clause_v2AvgAggregateOutputType = { + position: number | null + } + + export type Clause_v2SumAggregateOutputType = { + position: number | null + } + export type Clause_v2MinAggregateOutputType = { id: string | null key: string | null value: string | null + position: number | null udap_id: string | null text: string | null } @@ -2507,6 +2522,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: string | null key: string | null value: string | null + position: number | null udap_id: string | null text: string | null } @@ -2515,16 +2531,26 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: number key: number value: number + position: number udap_id: number text: number _all: number } + export type Clause_v2AvgAggregateInputType = { + position?: true + } + + export type Clause_v2SumAggregateInputType = { + position?: true + } + export type Clause_v2MinAggregateInputType = { id?: true key?: true value?: true + position?: true udap_id?: true text?: true } @@ -2533,6 +2559,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: true key?: true value?: true + position?: true udap_id?: true text?: true } @@ -2541,6 +2568,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: true key?: true value?: true + position?: true udap_id?: true text?: true _all?: true @@ -2581,6 +2609,18 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject * Count returned Clause_v2s **/ _count?: true | Clause_v2CountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: Clause_v2AvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: Clause_v2SumAggregateInputType /** * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} * @@ -2614,6 +2654,8 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject take?: number skip?: number _count?: Clause_v2CountAggregateInputType | true + _avg?: Clause_v2AvgAggregateInputType + _sum?: Clause_v2SumAggregateInputType _min?: Clause_v2MinAggregateInputType _max?: Clause_v2MaxAggregateInputType } @@ -2623,9 +2665,12 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: string key: string value: string + position: number | null udap_id: string | null text: string _count: Clause_v2CountAggregateOutputType | null + _avg: Clause_v2AvgAggregateOutputType | null + _sum: Clause_v2SumAggregateOutputType | null _min: Clause_v2MinAggregateOutputType | null _max: Clause_v2MaxAggregateOutputType | null } @@ -2648,6 +2693,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: boolean key?: boolean value?: boolean + position?: boolean udap_id?: boolean text?: boolean }, ExtArgs["result"]["clause_v2"]> @@ -2656,6 +2702,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: boolean key?: boolean value?: boolean + position?: boolean udap_id?: boolean text?: boolean } @@ -8317,6 +8364,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: 'id', key: 'key', value: 'value', + position: 'position', udap_id: 'udap_id', text: 'text' }; @@ -8480,6 +8528,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: StringFilter | string key?: StringFilter | string value?: StringFilter | string + position?: IntNullableFilter | number | null udap_id?: StringNullableFilter | string | null text?: StringFilter | string } @@ -8488,6 +8537,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: SortOrder key?: SortOrder value?: SortOrder + position?: SortOrderInput | SortOrder udap_id?: SortOrderInput | SortOrder text?: SortOrder } @@ -8500,11 +8550,14 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: SortOrder key?: SortOrder value?: SortOrder + position?: SortOrderInput | SortOrder udap_id?: SortOrderInput | SortOrder text?: SortOrder _count?: Clause_v2CountOrderByAggregateInput + _avg?: Clause_v2AvgOrderByAggregateInput _max?: Clause_v2MaxOrderByAggregateInput _min?: Clause_v2MinOrderByAggregateInput + _sum?: Clause_v2SumOrderByAggregateInput } export type Clause_v2ScalarWhereWithAggregatesInput = { @@ -8514,6 +8567,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: StringWithAggregatesFilter | string key?: StringWithAggregatesFilter | string value?: StringWithAggregatesFilter | string + position?: IntNullableWithAggregatesFilter | number | null udap_id?: StringNullableWithAggregatesFilter | string | null text?: StringWithAggregatesFilter | string } @@ -8903,6 +8957,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: string key: string value: string + position?: number | null udap_id?: string | null text: string } @@ -8911,6 +8966,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: string key: string value: string + position?: number | null udap_id?: string | null text: string } @@ -8919,6 +8975,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string + position?: NullableIntFieldUpdateOperationsInput | number | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } @@ -8927,6 +8984,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string + position?: NullableIntFieldUpdateOperationsInput | number | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } @@ -8935,6 +8993,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id: string key: string value: string + position?: number | null udap_id?: string | null text: string } @@ -8943,6 +9002,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string + position?: NullableIntFieldUpdateOperationsInput | number | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } @@ -8951,6 +9011,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: StringFieldUpdateOperationsInput | string key?: StringFieldUpdateOperationsInput | string value?: StringFieldUpdateOperationsInput | string + position?: NullableIntFieldUpdateOperationsInput | number | null udap_id?: NullableStringFieldUpdateOperationsInput | string | null text?: StringFieldUpdateOperationsInput | string } @@ -9469,6 +9530,17 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedBoolNullableFilter } + export type IntNullableFilter = { + equals?: number | null + in?: Enumerable | number | null + notIn?: Enumerable | number | null + lt?: number + lte?: number + gt?: number + gte?: number + not?: NestedIntNullableFilter | number | null + } + export type StringNullableFilter = { equals?: string | null in?: Enumerable | string | null @@ -9488,14 +9560,20 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: SortOrder key?: SortOrder value?: SortOrder + position?: SortOrder udap_id?: SortOrder text?: SortOrder } + export type Clause_v2AvgOrderByAggregateInput = { + position?: SortOrder + } + export type Clause_v2MaxOrderByAggregateInput = { id?: SortOrder key?: SortOrder value?: SortOrder + position?: SortOrder udap_id?: SortOrder text?: SortOrder } @@ -9504,10 +9582,31 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject id?: SortOrder key?: SortOrder value?: SortOrder + position?: SortOrder udap_id?: SortOrder text?: SortOrder } + export type Clause_v2SumOrderByAggregateInput = { + position?: SortOrder + } + + export type IntNullableWithAggregatesFilter = { + equals?: number | null + in?: Enumerable | number | null + notIn?: Enumerable | number | null + lt?: number + lte?: number + gt?: number + gte?: number + not?: NestedIntNullableWithAggregatesFilter | number | null + _count?: NestedIntNullableFilter + _avg?: NestedFloatNullableFilter + _sum?: NestedIntNullableFilter + _min?: NestedIntNullableFilter + _max?: NestedIntNullableFilter + } + export type StringNullableWithAggregatesFilter = { equals?: string | null in?: Enumerable | string | null @@ -9573,17 +9672,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedDateTimeFilter | Date | string } - export type IntNullableFilter = { - equals?: number | null - in?: Enumerable | number | null - notIn?: Enumerable | number | null - lt?: number - lte?: number - gt?: number - gte?: number - not?: NestedIntNullableFilter | number | null - } - export type ReportCountOrderByAggregateInput = { id?: SortOrder title?: SortOrder @@ -9692,22 +9780,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedDateTimeFilter } - export type IntNullableWithAggregatesFilter = { - equals?: number | null - in?: Enumerable | number | null - notIn?: Enumerable | number | null - lt?: number - lte?: number - gt?: number - gte?: number - not?: NestedIntNullableWithAggregatesFilter | number | null - _count?: NestedIntNullableFilter - _avg?: NestedFloatNullableFilter - _sum?: NestedIntNullableFilter - _min?: NestedIntNullableFilter - _max?: NestedIntNullableFilter - } - export type IntFilter = { equals?: number in?: Enumerable | number @@ -9879,6 +9951,14 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject set?: boolean | null } + export type NullableIntFieldUpdateOperationsInput = { + set?: number | null + increment?: number + decrement?: number + multiply?: number + divide?: number + } + export type NullableStringFieldUpdateOperationsInput = { set?: string | null } @@ -9925,14 +10005,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject set?: Date | string } - export type NullableIntFieldUpdateOperationsInput = { - set?: number | null - increment?: number - decrement?: number - multiply?: number - divide?: number - } - export type UserUpdateOneRequiredWithoutReportNestedInput = { create?: XOR connectOrCreate?: UserCreateOrConnectWithoutReportInput @@ -10211,6 +10283,33 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject not?: NestedStringNullableFilter | string | null } + export type NestedIntNullableWithAggregatesFilter = { + equals?: number | null + in?: Enumerable | number | null + notIn?: Enumerable | number | null + lt?: number + lte?: number + gt?: number + gte?: number + not?: NestedIntNullableWithAggregatesFilter | number | null + _count?: NestedIntNullableFilter + _avg?: NestedFloatNullableFilter + _sum?: NestedIntNullableFilter + _min?: NestedIntNullableFilter + _max?: NestedIntNullableFilter + } + + export type NestedFloatNullableFilter = { + equals?: number | null + in?: Enumerable | number | null + notIn?: Enumerable | number | null + lt?: number + lte?: number + gt?: number + gte?: number + not?: NestedFloatNullableFilter | number | null + } + export type NestedStringNullableWithAggregatesFilter = { equals?: string | null in?: Enumerable | string | null @@ -10278,33 +10377,6 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject _max?: NestedDateTimeFilter } - export type NestedIntNullableWithAggregatesFilter = { - equals?: number | null - in?: Enumerable | number | null - notIn?: Enumerable | number | null - lt?: number - lte?: number - gt?: number - gte?: number - not?: NestedIntNullableWithAggregatesFilter | number | null - _count?: NestedIntNullableFilter - _avg?: NestedFloatNullableFilter - _sum?: NestedIntNullableFilter - _min?: NestedIntNullableFilter - _max?: NestedIntNullableFilter - } - - export type NestedFloatNullableFilter = { - equals?: number | null - in?: Enumerable | number | null - notIn?: Enumerable | number | null - lt?: number - lte?: number - gt?: number - gte?: number - not?: NestedFloatNullableFilter | number | null - } - export type NestedIntWithAggregatesFilter = { equals?: number in?: Enumerable | number diff --git a/packages/electric-client/src/generated/typebox/clause_v2.ts b/packages/electric-client/src/generated/typebox/clause_v2.ts index 2661453a..4cbb381d 100644 --- a/packages/electric-client/src/generated/typebox/clause_v2.ts +++ b/packages/electric-client/src/generated/typebox/clause_v2.ts @@ -4,6 +4,7 @@ export const clause_v2 = Type.Object({ id: Type.String(), key: Type.String(), value: Type.String(), + position: Type.Optional(Type.Number()), udap_id: Type.Optional(Type.String()), text: Type.String(), }); diff --git a/packages/electric-client/src/generated/typebox/clause_v2Input.ts b/packages/electric-client/src/generated/typebox/clause_v2Input.ts index 816c4c51..09c23d9f 100644 --- a/packages/electric-client/src/generated/typebox/clause_v2Input.ts +++ b/packages/electric-client/src/generated/typebox/clause_v2Input.ts @@ -4,6 +4,7 @@ export const clause_v2Input = Type.Object({ id: Type.String(), key: Type.String(), value: Type.String(), + position: Type.Optional(Type.Number()), udap_id: Type.Optional(Type.String()), text: Type.String(), }); From 44b15608b53ec5008ddefa38ba1a5343e245799f Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 11:38:12 +0200 Subject: [PATCH 15/29] feat: edit clauses --- packages/frontend/src/features/ReportList.tsx | 4 +- .../frontend/src/features/menu/ClauseMenu.tsx | 202 +++++++++++++++--- .../frontend/src/features/menu/HelpMenu.tsx | 2 + .../src/features/menu/MenuActions.tsx | 80 +++---- .../frontend/src/features/menu/MenuButton.tsx | 63 ++---- .../frontend/src/features/menu/MenuTitle.tsx | 59 +++++ packages/frontend/src/features/menu/Share.tsx | 2 + 7 files changed, 301 insertions(+), 111 deletions(-) create mode 100644 packages/frontend/src/features/menu/MenuTitle.tsx diff --git a/packages/frontend/src/features/ReportList.tsx b/packages/frontend/src/features/ReportList.tsx index 0d90f592..9f493146 100644 --- a/packages/frontend/src/features/ReportList.tsx +++ b/packages/frontend/src/features/ReportList.tsx @@ -143,9 +143,9 @@ export const ReportList = ({ error ) : ( - {columns.slice(0, 2).map((reports) => { + {columns.slice(0, 2).map((reports, index) => { return ( - + {reports.map((report, index) => ( { +export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & ModalContentProps) => { const user = useUser()!; const clausesQuery = useLiveQuery( @@ -22,39 +31,172 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => { if (!clausesQuery.updatedAt) return ; - const groupedByKey = groupBy(clausesQuery.results ?? [], "key"); - return ( + ({ ...c, text: c.text?.replaceAll("\\n", "\n") ?? "" })) ?? []} + {...props} + isNational={isNational} + /> + ); +}; + +type Form = { + clauses: Clause_v2[]; +}; + +const getDiff = (baseClauses: Clause_v2[], modifiedClauses: Clause_v2[]) => { + const newClauses = modifiedClauses.filter((c) => !baseClauses.find((bc) => bc.id === c.id)); + const updatedClauses = modifiedClauses.filter((c) => { + const baseClause = baseClauses.find((bc) => bc.id === c.id); + return baseClause && baseClause.text !== c.text; + }); + const deletedClauses = baseClauses.filter((bc) => !modifiedClauses.find((c) => bc.id === c.id)); + + return { newClauses, updatedClauses, deletedClauses }; +}; + +const ClauseForm = ({ + clauses, + isNational, + ...props +}: { clauses: Clause_v2[]; isNational: boolean } & ModalContentProps) => { + const [isEditing, setIsEditing] = useState(false); + + const form = useForm
({ + defaultValues: { + clauses: clauses, + }, + }); + + const { fields } = useFieldArray({ + name: "clauses", + control: form.control, + }); + + const applyDiffMutation = useMutation( + async (diff: { updatedClauses: Clause_v2[]; newClauses: Clause_v2[]; deletedClauses: Clause_v2[] }) => { + for (const clause of diff.updatedClauses) { + await db.clause_v2.update({ + where: { id: clause.id }, + data: { text: clause.text }, + }); + } + }, + ); + + const onSubmit = (data: Form) => { + const diff = getDiff(clauses, data.clauses); + applyDiffMutation.mutate(diff); + }; + + const fieldsWithIndex = fields.map((field, index) => ({ ...field, _index: index })); + const groupedByKey = groupBy(fieldsWithIndex, "key"); + + const buttons = isEditing ? ( + <> + + + ) : ( <> - - - {Object.entries(groupedByKey).map(([key, clauses], index) => ( - - - - {(clauseNameMap as any)[key] ?? key} - - {clauses.map((clause) => ( - - - {clause.value} - - {clause.text.split("\\n").map((text, i) => { - return ( - - {text} - - ); - })} - - ))} - - {index < Object.keys(groupedByKey).length - 1 && } - - ))} - + ); + + return ( + + + {buttons}}> + Clauses {isNational ? "nationales" : "départementales"} + + + {Object.entries(groupedByKey).map(([key, clauses], index) => ( + + + + {(clauseNameMap as any)[key] ?? key} + + {clauses.map((clause) => ( + + ))} + + {index < Object.keys(groupedByKey).length - 1 && } + + ))} + + + + ); +}; + +type ClauseWithIndex = Clause_v2 & { _index: number }; + +const DivOrTextarea = ({ clause, isEditing }: { clause: ClauseWithIndex; isEditing: boolean }) => { + if (!isEditing) return ; + return ; +}; + +const ClauseView = ({ clause }: { clause: ClauseWithIndex }) => { + return ( + + + {clause.value} + + {clause.text.split("\\n").map((text, i) => { + return ( + + {text} + + ); + })} + + ); +}; + +const ClauseEdit = ({ clause }: { clause: ClauseWithIndex }) => { + const form = useFormContext
(); + + return ( + + + {clause.value} + + + + + ); }; const clauseNameMap = { diff --git a/packages/frontend/src/features/menu/HelpMenu.tsx b/packages/frontend/src/features/menu/HelpMenu.tsx index d2de7666..bd9846ed 100644 --- a/packages/frontend/src/features/menu/HelpMenu.tsx +++ b/packages/frontend/src/features/menu/HelpMenu.tsx @@ -1,6 +1,7 @@ import { Divider, Stack, styled } from "#styled-system/jsx"; import Button from "@codegouvfr/react-dsfr/Button"; import { electric } from "../../db"; +import { MenuTitle } from "./MenuTitle"; export const HelpMenu = () => { const deleteLocalData = () => { @@ -11,6 +12,7 @@ export const HelpMenu = () => { }; return ( <> + Assistance technique diff --git a/packages/frontend/src/features/menu/MenuActions.tsx b/packages/frontend/src/features/menu/MenuActions.tsx index ad38f815..08044da7 100644 --- a/packages/frontend/src/features/menu/MenuActions.tsx +++ b/packages/frontend/src/features/menu/MenuActions.tsx @@ -1,4 +1,4 @@ -import { Center, Divider, Stack } from "#styled-system/jsx"; +import { Center, Divider, Stack, styled } from "#styled-system/jsx"; import { css } from "#styled-system/css"; import Button from "@codegouvfr/react-dsfr/Button"; import { useLogout } from "../../contexts/AuthContext"; @@ -6,8 +6,9 @@ import { electric } from "../../db"; import { NestedMenu } from "./MenuButton"; import { menuStore } from "./menuStore"; import { Fragment } from "react/jsx-runtime"; +import { MenuTitle } from "./MenuTitle"; -export const MenuActions = () => { +export const MenuActions = ({ menu }: { menu: NestedMenu | null }) => { const setMenu = (menu: NestedMenu) => { menuStore.send({ type: "setMenu", menu }); }; @@ -23,41 +24,46 @@ export const MenuActions = () => { ]; return ( - button": { - h: "48px", - m: 0, - px: "16px !important", - color: "black", - fontSize: "14px", - "&:disabled": { - color: "text-disabled-grey", + <> + + Mon compte + + button": { + h: "48px", + m: 0, + px: "16px !important", + color: "black", + fontSize: "14px", + "&:disabled": { + color: "text-disabled-grey", + }, }, - }, - })} - > - {actions.map(({ text, onClick }, index) => ( - - - {index < actions.length - 1 && ( -
- -
- )} -
- ))} -
+ })} + > + {actions.map(({ text, onClick }, index) => ( + + + {index < actions.length - 1 && ( +
+ +
+ )} +
+ ))} +
+ ); }; diff --git a/packages/frontend/src/features/menu/MenuButton.tsx b/packages/frontend/src/features/menu/MenuButton.tsx index 285708a5..08c837c7 100644 --- a/packages/frontend/src/features/menu/MenuButton.tsx +++ b/packages/frontend/src/features/menu/MenuButton.tsx @@ -45,7 +45,7 @@ export const MenuButton = ({ headerRef }: { headerRef: any }) => { - {}}> + - ) : null} - - - {children} - - - -); diff --git a/packages/frontend/src/features/menu/MenuTitle.tsx b/packages/frontend/src/features/menu/MenuTitle.tsx new file mode 100644 index 00000000..e70769e5 --- /dev/null +++ b/packages/frontend/src/features/menu/MenuTitle.tsx @@ -0,0 +1,59 @@ +import { Divider, Flex, styled } from "#styled-system/jsx"; +import Button from "@codegouvfr/react-dsfr/Button"; +import { ReactNode } from "react"; +import { menuStore } from "./menuStore"; + +export const MenuTitle = ({ + children, + backButtonOnClick, + buttons, + hideDivider, +}: { + children: ReactNode; + backButtonOnClick?: () => void; + buttons?: ReactNode; + hideDivider?: boolean; +}) => ( + <> + + + {backButtonOnClick ? ( + // @ts-ignore + + ) : null} + + + {children} + + + {buttons} + + + + {!hideDivider ? ( + <> + + {buttons ? ( + + {children} + + ) : null} + + ) : null} + +); diff --git a/packages/frontend/src/features/menu/Share.tsx b/packages/frontend/src/features/menu/Share.tsx index 8fbfb17e..135f391f 100644 --- a/packages/frontend/src/features/menu/Share.tsx +++ b/packages/frontend/src/features/menu/Share.tsx @@ -6,6 +6,7 @@ import { Delegation, User } from "@cr-vif/electric-client/frontend"; import { ToggleSwitch } from "@codegouvfr/react-dsfr/ToggleSwitch"; import { useMutation } from "@tanstack/react-query"; import { css } from "#styled-system/css"; +import { MenuTitle } from "./MenuTitle"; export const ShareReport = () => { const user = useUser()!; @@ -40,6 +41,7 @@ export const ShareReport = () => { return ( <> + Partage des CR From df4251508e8b7ec9112883b11f3ca9ece3ee7d10 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 12:01:31 +0200 Subject: [PATCH 16/29] fix: carriage return issue --- .../src/features/chips/useChipOptions.tsx | 2 +- .../frontend/src/features/menu/ClauseMenu.tsx | 25 +++++++++++++++---- packages/pdf/src/report.tsx | 6 ++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/features/chips/useChipOptions.tsx b/packages/frontend/src/features/chips/useChipOptions.tsx index 8bcebabc..589f9d02 100644 --- a/packages/frontend/src/features/chips/useChipOptions.tsx +++ b/packages/frontend/src/features/chips/useChipOptions.tsx @@ -32,6 +32,6 @@ export const useChipOptions = (key?: string) => { const transformChip = (chip: Clause_v2) => { return { ...chip, - text: chip.text?.replaceAll("\\n", "
"), + text: chip.text?.replaceAll("\\n", "
").replace(/\n/g, "
"), }; }; diff --git a/packages/frontend/src/features/menu/ClauseMenu.tsx b/packages/frontend/src/features/menu/ClauseMenu.tsx index aeede14c..c6325eb4 100644 --- a/packages/frontend/src/features/menu/ClauseMenu.tsx +++ b/packages/frontend/src/features/menu/ClauseMenu.tsx @@ -7,7 +7,7 @@ import { Divider, Flex, Stack, styled } from "#styled-system/jsx"; import { Fragment } from "react/jsx-runtime"; import { MenuTitle } from "./MenuTitle"; import type { ModalContentProps } from "./MenuButton"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import Button from "@codegouvfr/react-dsfr/Button"; import { css } from "#styled-system/css"; import { Clause_v2 } from "@cr-vif/electric-client/frontend"; @@ -18,6 +18,12 @@ import { useMutation } from "@tanstack/react-query"; export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & ModalContentProps) => { const user = useUser()!; + useEffect(() => { + db.clause_v2 + .findFirst({ where: { value: "Lacanal" } }) + .then((clause) => console.log(clause!.text.replace(/\n/g, "\\n"))); + }, []); + const clausesQuery = useLiveQuery( db.clause_v2.liveMany({ where: { @@ -33,7 +39,7 @@ export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & M return ( ({ ...c, text: c.text?.replaceAll("\\n", "\n") ?? "" })) ?? []} + clauses={clausesQuery.results?.map((c) => ({ ...c, text: c.text?.replaceAll("\n", "\\n") ?? "" })) ?? []} {...props} isNational={isNational} /> @@ -52,7 +58,10 @@ const getDiff = (baseClauses: Clause_v2[], modifiedClauses: Clause_v2[]) => { }); const deletedClauses = baseClauses.filter((bc) => !modifiedClauses.find((c) => bc.id === c.id)); - return { newClauses, updatedClauses, deletedClauses }; + const formatClause = (clause: Clause_v2) => ({ ...clause, text: clause.text.replaceAll("\n", "\n") }); + + console.log(updatedClauses[0].text, updatedClauses.map(formatClause)[0].text); + return { newClauses: newClauses.map(formatClause), updatedClauses: updatedClauses.map(formatClause), deletedClauses }; }; const ClauseForm = ({ @@ -82,6 +91,9 @@ const ClauseForm = ({ }); } }, + { + onSuccess: () => setIsEditing(false), + }, ); const onSubmit = (data: Form) => { @@ -118,10 +130,13 @@ const ClauseForm = ({ mr: { base: "0 !important", lg: "8px !important" }, }, })} + nativeButtonProps={{ type: "button" }} iconId="ri-pencil-fill" priority="secondary" - type="button" - onClick={() => setIsEditing(!isEditing)} + onClick={(e) => { + e.preventDefault(); + setIsEditing((isEditing) => !isEditing); + }} > Modifier diff --git a/packages/pdf/src/report.tsx b/packages/pdf/src/report.tsx index 0adb3ce9..27dbcbdf 100644 --- a/packages/pdf/src/report.tsx +++ b/packages/pdf/src/report.tsx @@ -1,7 +1,7 @@ import { Document, PDFViewer, Page } from "@react-pdf/renderer"; import { Html } from "react-pdf-html"; import React from "react"; -import type { Udap, Report, Clause, Service_instructeurs } from "@cr-vif/electric-client/frontend"; +import type { Udap, Report, Service_instructeurs, Clause_v2 } from "@cr-vif/electric-client/frontend"; export const ReportPDFDocument = ({ udap, htmlString, images }: ReportPDFDocumentProps) => { return ( @@ -145,7 +145,7 @@ export type ReportWithUser = Report & { user?: { email: string; name: string } } export const getReportHtmlString = ( report: ReportWithUser, - chipOptions: Clause[], + chipOptions: Clause_v2[], udap: Udap, serviceInstructeur?: Service_instructeurs, ) => { @@ -250,7 +250,7 @@ const formatPhoneNumber = (phoneNumber: string) => { )} ${phoneNumber.slice(7, 9)}`; }; -const getMultipleChips = (chipOptions: Clause[], key: string, values: string) => { +const getMultipleChips = (chipOptions: Clause_v2[], key: string, values: string) => { return values .split(",") .map((value) => { From 81ebe7283ff7df55564d6dbdd4c0f3b336db9e8a Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 12:05:28 +0200 Subject: [PATCH 17/29] fix: refresh clauses after editing --- .../frontend/src/features/menu/ClauseMenu.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/packages/frontend/src/features/menu/ClauseMenu.tsx b/packages/frontend/src/features/menu/ClauseMenu.tsx index c6325eb4..eeec2809 100644 --- a/packages/frontend/src/features/menu/ClauseMenu.tsx +++ b/packages/frontend/src/features/menu/ClauseMenu.tsx @@ -18,12 +18,6 @@ import { useMutation } from "@tanstack/react-query"; export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & ModalContentProps) => { const user = useUser()!; - useEffect(() => { - db.clause_v2 - .findFirst({ where: { value: "Lacanal" } }) - .then((clause) => console.log(clause!.text.replace(/\n/g, "\\n"))); - }, []); - const clausesQuery = useLiveQuery( db.clause_v2.liveMany({ where: { @@ -39,7 +33,7 @@ export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & M return ( ({ ...c, text: c.text?.replaceAll("\n", "\\n") ?? "" })) ?? []} + clauses={clausesQuery.results?.map((c) => ({ ...c, text: c.text?.replaceAll("\\n", "\n") ?? "" })) ?? []} {...props} isNational={isNational} /> @@ -58,10 +52,7 @@ const getDiff = (baseClauses: Clause_v2[], modifiedClauses: Clause_v2[]) => { }); const deletedClauses = baseClauses.filter((bc) => !modifiedClauses.find((c) => bc.id === c.id)); - const formatClause = (clause: Clause_v2) => ({ ...clause, text: clause.text.replaceAll("\n", "\n") }); - - console.log(updatedClauses[0].text, updatedClauses.map(formatClause)[0].text); - return { newClauses: newClauses.map(formatClause), updatedClauses: updatedClauses.map(formatClause), deletedClauses }; + return { newClauses: newClauses, updatedClauses: updatedClauses, deletedClauses }; }; const ClauseForm = ({ @@ -77,6 +68,10 @@ const ClauseForm = ({ }, }); + useEffect(() => { + form.setValue("clauses", clauses); + }, [clauses]); + const { fields } = useFieldArray({ name: "clauses", control: form.control, From af64a6729cff93910eb92bf26c9157db093bf515 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 12:53:54 +0200 Subject: [PATCH 18/29] feat: disable edit on national clauses + remove clause --- .../frontend/src/features/menu/ClauseMenu.tsx | 243 +++++++++++++----- .../frontend/src/features/menu/MenuTitle.tsx | 4 +- 2 files changed, 181 insertions(+), 66 deletions(-) diff --git a/packages/frontend/src/features/menu/ClauseMenu.tsx b/packages/frontend/src/features/menu/ClauseMenu.tsx index eeec2809..4034068c 100644 --- a/packages/frontend/src/features/menu/ClauseMenu.tsx +++ b/packages/frontend/src/features/menu/ClauseMenu.tsx @@ -7,13 +7,15 @@ import { Divider, Flex, Stack, styled } from "#styled-system/jsx"; import { Fragment } from "react/jsx-runtime"; import { MenuTitle } from "./MenuTitle"; import type { ModalContentProps } from "./MenuButton"; -import { useEffect, useState } from "react"; +import { ReactNode, useEffect, useState } from "react"; import Button from "@codegouvfr/react-dsfr/Button"; import { css } from "#styled-system/css"; import { Clause_v2 } from "@cr-vif/electric-client/frontend"; import Input from "@codegouvfr/react-dsfr/Input"; import { FormProvider, useFieldArray, useForm, useFormContext } from "react-hook-form"; import { useMutation } from "@tanstack/react-query"; +import Select from "@codegouvfr/react-dsfr/Select"; +import { v4 } from "uuid"; export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & ModalContentProps) => { const user = useUser()!; @@ -31,6 +33,14 @@ export const ClauseMenu = ({ isNational, ...props }: { isNational: boolean } & M if (!clausesQuery.updatedAt) return ; + if (isNational) + return ( + <> + + + + ); + return ( ({ ...c, text: c.text?.replaceAll("\\n", "\n") ?? "" })) ?? []} @@ -54,13 +64,17 @@ const getDiff = (baseClauses: Clause_v2[], modifiedClauses: Clause_v2[]) => { return { newClauses: newClauses, updatedClauses: updatedClauses, deletedClauses }; }; +type Mode = "view" | "add" | "edit"; const ClauseForm = ({ clauses, isNational, ...props }: { clauses: Clause_v2[]; isNational: boolean } & ModalContentProps) => { - const [isEditing, setIsEditing] = useState(false); + const [mode, setMode] = useState("view"); + + const isEditing = mode === "edit"; + const isAdding = mode === "add"; const form = useForm({ defaultValues: { @@ -75,6 +89,7 @@ const ClauseForm = ({ const { fields } = useFieldArray({ name: "clauses", control: form.control, + keyName: "_id", }); const applyDiffMutation = useMutation( @@ -87,7 +102,7 @@ const ClauseForm = ({ } }, { - onSuccess: () => setIsEditing(false), + onSuccess: () => setMode("view"), }, ); @@ -97,70 +112,107 @@ const ClauseForm = ({ }; const fieldsWithIndex = fields.map((field, index) => ({ ...field, _index: index })); - const groupedByKey = groupBy(fieldsWithIndex, "key"); - const buttons = isEditing ? ( - <> - - - ) : ( + const buttons = + isEditing || isAdding ? ( + <> + + + ) : ( + <> + + + + ); + + return ( <> - + + {isAdding ? setMode("view")} isNational={isNational} /> : null} + + + + + ); +}; + +const ClauseTitle = ({ + isNational, + buttons, + ...props +}: { isNational: boolean; buttons?: ReactNode; isEditing?: boolean } & ModalContentProps) => ( + + Clauses {isNational ? "nationales" : "départementales"} + +); + +const ClauseList = ({ clauses, isEditing }: { clauses: ClauseWithIndex[]; isEditing: boolean }) => { + const groupedByKey = groupBy(clauses, "key"); return ( - -
- {buttons}}> - Clauses {isNational ? "nationales" : "départementales"} - - - {Object.entries(groupedByKey).map(([key, clauses], index) => ( - - - - {(clauseNameMap as any)[key] ?? key} - - {clauses.map((clause) => ( - - ))} - - {index < Object.keys(groupedByKey).length - 1 && } - - ))} - -
-
+ + {Object.entries(groupedByKey).map(([key, clauses], index) => ( + + + {(clauseNameMap as any)[key] ?? key} + {clauses.map((clause) => ( + + ))} + + {index < Object.keys(groupedByKey).length - 1 && } + + ))} + ); }; @@ -191,11 +243,32 @@ const ClauseView = ({ clause }: { clause: ClauseWithIndex }) => { const ClauseEdit = ({ clause }: { clause: ClauseWithIndex }) => { const form = useFormContext
(); + const deleteClauseMutation = useMutation( + async () => { + await db.clause_v2.delete({ where: { id: clause.id } }); + }, + { + onSuccess: () => {}, + }, + ); + return ( - - {clause.value} - + + + {clause.value} + + + { ); }; +const ClauseAdd = ({ onSuccess, isNational }: { onSuccess: () => void; isNational: boolean }) => { + const user = useUser()!; + const form = useForm({ + defaultValues: { key: "", value: "", text: "", id: v4(), udap_id: isNational ? "ALL" : user.udap_id }, + }); + const keyOptions = Object.entries(clauseNameMap) + .map(([key, label]) => ({ value: key, label })) + .filter(({ value }) => { + const isNationalClause = nationalClauses.includes(value); + return isNational ? isNationalClause : !isNationalClause; + }); + + const addClauseMutation = useMutation( + async (clause: Clause_v2) => { + await db.clause_v2.create({ data: clause }); + }, + { + onSuccess, + }, + ); + + return ( + addClauseMutation.mutate(data))} id="add-form"> + + + + + + + + + ); +}; + +const nationalClauses = ["type-espace", "decision"]; + const clauseNameMap = { "type-espace": "Type d'espace", decision: "Décision", diff --git a/packages/frontend/src/features/menu/MenuTitle.tsx b/packages/frontend/src/features/menu/MenuTitle.tsx index e70769e5..4c62675c 100644 --- a/packages/frontend/src/features/menu/MenuTitle.tsx +++ b/packages/frontend/src/features/menu/MenuTitle.tsx @@ -31,9 +31,9 @@ export const MenuTitle = ({ > {children} - + {buttons} - +
@@ -143,13 +151,12 @@ export const PDF = () => { {report && chipOptions?.length && isServiceInstructeurLoaded ? ( ) : null} @@ -161,6 +168,20 @@ export const PDF = () => { ); }; +const getStoredHtmlString = (report: Report) => { + const reportSnapshotRaw = localStorage.getItem("report-" + report.id); + if (!reportSnapshotRaw) return null; + + const reportSnapshot = JSON.parse(reportSnapshotRaw); + const diff = getDiff(reportSnapshot, { ...report, createdAt: report.createdAt.toISOString() }); + + if (Object.keys(diff).length) return null; + + const htmlString = localStorage.getItem("report-html-" + report.id); + + return htmlString; +}; + const SendForm = ({ children, generatePdf, @@ -279,7 +300,15 @@ const EditBanner = ({ title, buttons, reportId }: { title: ReactNode; buttons: R ); }; -export const WithReport = ({ initialHtmlString, mode }: { initialHtmlString: string; mode: Mode }) => { +export const WithReport = ({ + initialHtmlString, + mode, + report, +}: { + initialHtmlString: string; + mode: Mode; + report: Report; +}) => { const { editor } = useContext(TextEditorContext); const [htmlString] = useState(initialHtmlString); @@ -289,6 +318,11 @@ export const WithReport = ({ initialHtmlString, mode }: { initialHtmlString: str editor.commands.setContent(htmlString); }, [editor]); + useEffect(() => { + localStorage.setItem("report-html-" + report!.id, editor?.getHTML() ?? ""); + localStorage.setItem("report-" + report!.id, JSON.stringify(report)); + }, [mode]); + const { udap } = useUser()!; const ViewDocument = ( From 85fec2c37e454f0ab98deeba5b563a78543bb48a Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 14:33:35 +0200 Subject: [PATCH 21/29] fix: "clause"."hidden" --- db/migrations/04-add_chips_table.sql | 1 - db/migrations/903-fix_clausev1.sql | 1 + .../src/generated/client/migrations.ts | 23 +++++++++++++--- .../src/generated/client/pg-migrations.ts | 27 ++++++++++++++++--- 4 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 db/migrations/903-fix_clausev1.sql diff --git a/db/migrations/04-add_chips_table.sql b/db/migrations/04-add_chips_table.sql index 6736581f..02846c34 100644 --- a/db/migrations/04-add_chips_table.sql +++ b/db/migrations/04-add_chips_table.sql @@ -4,7 +4,6 @@ CREATE TABLE clause( ,value text NOT NULL ,udap_id text ,text text NOT NULL - ,hidden boolean , PRIMARY KEY (key, value, udap_id) ); diff --git a/db/migrations/903-fix_clausev1.sql b/db/migrations/903-fix_clausev1.sql new file mode 100644 index 00000000..497e12de --- /dev/null +++ b/db/migrations/903-fix_clausev1.sql @@ -0,0 +1 @@ +ALTER TABLE clause ADD COLUMN "hidden" BOOLEAN; \ No newline at end of file diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index a72a1516..4c7f04b8 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -67,16 +67,16 @@ export default [ }, { "statements": [ - "CREATE TABLE \"clause\" (\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"udap_id\" TEXT NOT NULL,\n \"text\" TEXT NOT NULL,\n \"hidden\" INTEGER,\n CONSTRAINT \"clause_pkey\" PRIMARY KEY (\"key\", \"value\", \"udap_id\")\n) WITHOUT ROWID;\n", + "CREATE TABLE \"clause\" (\n \"key\" TEXT NOT NULL,\n \"value\" TEXT NOT NULL,\n \"udap_id\" TEXT NOT NULL,\n \"text\" TEXT NOT NULL,\n CONSTRAINT \"clause_pkey\" PRIMARY KEY (\"key\", \"value\", \"udap_id\")\n) WITHOUT ROWID;\n", "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'clause', 1);", "DROP TRIGGER IF EXISTS update_ensure_main_clause_primarykey;", "CREATE TRIGGER update_ensure_main_clause_primarykey\n BEFORE UPDATE ON \"main\".\"clause\"\nBEGIN\n SELECT\n CASE\n WHEN old.\"key\" != new.\"key\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column key as it belongs to the primary key')\n WHEN old.\"udap_id\" != new.\"udap_id\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column udap_id as it belongs to the primary key')\n WHEN old.\"value\" != new.\"value\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column value as it belongs to the primary key')\n END;\nEND;", "DROP TRIGGER IF EXISTS insert_main_clause_into_oplog;", - "CREATE TRIGGER insert_main_clause_into_oplog\n AFTER INSERT ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'INSERT', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", + "CREATE TRIGGER insert_main_clause_into_oplog\n AFTER INSERT ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'INSERT', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", "DROP TRIGGER IF EXISTS update_main_clause_into_oplog;", - "CREATE TRIGGER update_main_clause_into_oplog\n AFTER UPDATE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'UPDATE', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", + "CREATE TRIGGER update_main_clause_into_oplog\n AFTER UPDATE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'UPDATE', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", "DROP TRIGGER IF EXISTS delete_main_clause_into_oplog;", - "CREATE TRIGGER delete_main_clause_into_oplog\n AFTER DELETE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'DELETE', json_patch('{}', json_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")), NULL, json_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" + "CREATE TRIGGER delete_main_clause_into_oplog\n AFTER DELETE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'DELETE', json_patch('{}', json_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")), NULL, json_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" ], "version": "4" }, @@ -147,5 +147,20 @@ export default [ "CREATE TRIGGER delete_main_clause_v2_into_oplog\n AFTER DELETE ON \"main\".\"clause_v2\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause_v2')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause_v2', 'DELETE', json_patch('{}', json_object('id', old.\"id\")), NULL, json_object('id', old.\"id\", 'key', old.\"key\", 'position', old.\"position\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" ], "version": "902" + }, + { + "statements": [ + "ALTER TABLE \"clause\" ADD COLUMN \"hidden\" INTEGER;\n", + "INSERT OR IGNORE INTO _electric_trigger_settings (namespace, tablename, flag) VALUES ('main', 'clause', 1);", + "DROP TRIGGER IF EXISTS update_ensure_main_clause_primarykey;", + "CREATE TRIGGER update_ensure_main_clause_primarykey\n BEFORE UPDATE ON \"main\".\"clause\"\nBEGIN\n SELECT\n CASE\n WHEN old.\"key\" != new.\"key\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column key as it belongs to the primary key')\n WHEN old.\"udap_id\" != new.\"udap_id\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column udap_id as it belongs to the primary key')\n WHEN old.\"value\" != new.\"value\" THEN\n \t\tRAISE (ABORT, 'cannot change the value of column value as it belongs to the primary key')\n END;\nEND;", + "DROP TRIGGER IF EXISTS insert_main_clause_into_oplog;", + "CREATE TRIGGER insert_main_clause_into_oplog\n AFTER INSERT ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'INSERT', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), NULL, NULL);\nEND;", + "DROP TRIGGER IF EXISTS update_main_clause_into_oplog;", + "CREATE TRIGGER update_main_clause_into_oplog\n AFTER UPDATE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'UPDATE', json_patch('{}', json_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")), json_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"), json_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;", + "DROP TRIGGER IF EXISTS delete_main_clause_into_oplog;", + "CREATE TRIGGER delete_main_clause_into_oplog\n AFTER DELETE ON \"main\".\"clause\"\n WHEN 1 = (SELECT flag from _electric_trigger_settings WHERE namespace = 'main' AND tablename = 'clause')\nBEGIN\n INSERT INTO _electric_oplog (namespace, tablename, optype, primaryKey, newRow, oldRow, timestamp)\n VALUES ('main', 'clause', 'DELETE', json_patch('{}', json_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")), NULL, json_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"), NULL);\nEND;" + ], + "version": "903" } ] \ 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 dfba45ec..953e0545 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -91,19 +91,19 @@ export default [ }, { "statements": [ - "CREATE TABLE clause (\n key text NOT NULL,\n value text NOT NULL,\n udap_id text NOT NULL,\n text text NOT NULL,\n hidden boolean,\n CONSTRAINT clause_pkey PRIMARY KEY (key, value, udap_id)\n)", + "CREATE TABLE clause (\n key text NOT NULL,\n value text NOT NULL,\n udap_id text NOT NULL,\n text text NOT NULL,\n CONSTRAINT clause_pkey PRIMARY KEY (key, value, udap_id)\n)", "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'clause', 1)\n ON CONFLICT DO NOTHING;", "DROP TRIGGER IF EXISTS update_ensure_public_clause_primarykey ON \"public\".\"clause\";", "CREATE OR REPLACE FUNCTION update_ensure_public_clause_primarykey_function()\nRETURNS TRIGGER AS $$\nBEGIN\n IF OLD.\"key\" IS DISTINCT FROM NEW.\"key\" THEN\n RAISE EXCEPTION 'Cannot change the value of column key as it belongs to the primary key';\n END IF;\n IF OLD.\"udap_id\" IS DISTINCT FROM NEW.\"udap_id\" THEN\n RAISE EXCEPTION 'Cannot change the value of column udap_id as it belongs to the primary key';\n END IF;\n IF OLD.\"value\" IS DISTINCT FROM NEW.\"value\" THEN\n RAISE EXCEPTION 'Cannot change the value of column value as it belongs to the primary key';\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;", "CREATE TRIGGER update_ensure_public_clause_primarykey\n BEFORE UPDATE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_clause_primarykey_function();", "DROP TRIGGER IF EXISTS insert_public_clause_into_oplog ON \"public\".\"clause\";", - " CREATE OR REPLACE FUNCTION insert_public_clause_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 = 'clause';\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 'clause',\n 'INSERT',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION insert_public_clause_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 = 'clause';\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 'clause',\n 'INSERT',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER insert_public_clause_into_oplog\n AFTER INSERT ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_clause_into_oplog_function();", "DROP TRIGGER IF EXISTS update_public_clause_into_oplog ON \"public\".\"clause\";", - " CREATE OR REPLACE FUNCTION update_public_clause_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 = 'clause';\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 'clause',\n 'UPDATE',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION update_public_clause_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 = 'clause';\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 'clause',\n 'UPDATE',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER update_public_clause_into_oplog\n AFTER UPDATE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_clause_into_oplog_function();", "DROP TRIGGER IF EXISTS delete_public_clause_into_oplog ON \"public\".\"clause\";", - " CREATE OR REPLACE FUNCTION delete_public_clause_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 = 'clause';\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 'clause',\n 'DELETE',\n json_strip_nulls(json_build_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")),\n NULL,\n jsonb_build_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + " CREATE OR REPLACE FUNCTION delete_public_clause_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 = 'clause';\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 'clause',\n 'DELETE',\n json_strip_nulls(json_build_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")),\n NULL,\n jsonb_build_object('key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", "CREATE TRIGGER delete_public_clause_into_oplog\n AFTER DELETE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_clause_into_oplog_function();" ], "version": "4" @@ -195,5 +195,24 @@ export default [ "CREATE TRIGGER delete_public_clause_v2_into_oplog\n AFTER DELETE ON \"public\".\"clause_v2\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_clause_v2_into_oplog_function();" ], "version": "902" + }, + { + "statements": [ + "ALTER TABLE clause ADD COLUMN \"hidden\" BOOLEAN", + "INSERT INTO \"public\".\"_electric_trigger_settings\" (\"namespace\", \"tablename\", \"flag\")\n VALUES ('public', 'clause', 1)\n ON CONFLICT DO NOTHING;", + "DROP TRIGGER IF EXISTS update_ensure_public_clause_primarykey ON \"public\".\"clause\";", + "CREATE OR REPLACE FUNCTION update_ensure_public_clause_primarykey_function()\nRETURNS TRIGGER AS $$\nBEGIN\n IF OLD.\"key\" IS DISTINCT FROM NEW.\"key\" THEN\n RAISE EXCEPTION 'Cannot change the value of column key as it belongs to the primary key';\n END IF;\n IF OLD.\"udap_id\" IS DISTINCT FROM NEW.\"udap_id\" THEN\n RAISE EXCEPTION 'Cannot change the value of column udap_id as it belongs to the primary key';\n END IF;\n IF OLD.\"value\" IS DISTINCT FROM NEW.\"value\" THEN\n RAISE EXCEPTION 'Cannot change the value of column value as it belongs to the primary key';\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_ensure_public_clause_primarykey\n BEFORE UPDATE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION update_ensure_public_clause_primarykey_function();", + "DROP TRIGGER IF EXISTS insert_public_clause_into_oplog ON \"public\".\"clause\";", + " CREATE OR REPLACE FUNCTION insert_public_clause_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 = 'clause';\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 'clause',\n 'INSERT',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n NULL,\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER insert_public_clause_into_oplog\n AFTER INSERT ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION insert_public_clause_into_oplog_function();", + "DROP TRIGGER IF EXISTS update_public_clause_into_oplog ON \"public\".\"clause\";", + " CREATE OR REPLACE FUNCTION update_public_clause_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 = 'clause';\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 'clause',\n 'UPDATE',\n json_strip_nulls(json_build_object('key', new.\"key\", 'udap_id', new.\"udap_id\", 'value', new.\"value\")),\n jsonb_build_object('hidden', new.\"hidden\", 'key', new.\"key\", 'text', new.\"text\", 'udap_id', new.\"udap_id\", 'value', new.\"value\"),\n jsonb_build_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER update_public_clause_into_oplog\n AFTER UPDATE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION update_public_clause_into_oplog_function();", + "DROP TRIGGER IF EXISTS delete_public_clause_into_oplog ON \"public\".\"clause\";", + " CREATE OR REPLACE FUNCTION delete_public_clause_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 = 'clause';\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 'clause',\n 'DELETE',\n json_strip_nulls(json_build_object('key', old.\"key\", 'udap_id', old.\"udap_id\", 'value', old.\"value\")),\n NULL,\n jsonb_build_object('hidden', old.\"hidden\", 'key', old.\"key\", 'text', old.\"text\", 'udap_id', old.\"udap_id\", 'value', old.\"value\"),\n NULL\n );\n END IF;\n\n RETURN NEW;\n END;\n END;\n $$ LANGUAGE plpgsql;", + "CREATE TRIGGER delete_public_clause_into_oplog\n AFTER DELETE ON \"public\".\"clause\"\n FOR EACH ROW\n EXECUTE FUNCTION delete_public_clause_into_oplog_function();" + ], + "version": "903" } ] \ No newline at end of file From 461d22f3f7f6f470192b54cfdf52cc1be7b63bb0 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 15:48:47 +0200 Subject: [PATCH 22/29] fix: update pwa cache if needed --- packages/frontend/src/main.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/main.tsx b/packages/frontend/src/main.tsx index c8be7108..5857800b 100644 --- a/packages/frontend/src/main.tsx +++ b/packages/frontend/src/main.tsx @@ -9,21 +9,26 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ErrorBoundary } from "react-error-boundary"; import { registerSW } from "virtual:pwa-register"; +const ref = {} as any; + if ("serviceWorker" in navigator) { - registerSW({}); + registerSW({ + onRegistered: (r) => (ref.current = r), + onNeedRefresh: () => ref.current?.update(), + }); } startReactDsfr({ defaultColorScheme: "system", Link: Link }); const queryClient = new QueryClient({ - defaultOptions:{ + defaultOptions: { mutations: { - networkMode: "always" + networkMode: "always", }, queries: { - networkMode: "always" - } - } + networkMode: "always", + }, + }, }); ReactDOM.createRoot(document.getElementById("root")!).render( From 04f9fec842eab1df639d3404d51bc4e4e70dca38 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 8 Jul 2024 16:33:57 +0200 Subject: [PATCH 23/29] fix: update pwa cache if needed --- packages/frontend/package.json | 1 + packages/frontend/src/main.tsx | 7 +------ packages/frontend/vite.config.ts | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 7363043a..eaf0242a 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "pnpm icons && vite build", + "build:only": "vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "pnpm env:gen && vite preview --host", "env:gen": "vite-node ./scripts/createEnvFile.ts", diff --git a/packages/frontend/src/main.tsx b/packages/frontend/src/main.tsx index 5857800b..3aba228c 100644 --- a/packages/frontend/src/main.tsx +++ b/packages/frontend/src/main.tsx @@ -9,13 +9,8 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ErrorBoundary } from "react-error-boundary"; import { registerSW } from "virtual:pwa-register"; -const ref = {} as any; - if ("serviceWorker" in navigator) { - registerSW({ - onRegistered: (r) => (ref.current = r), - onNeedRefresh: () => ref.current?.update(), - }); + registerSW({}); } startReactDsfr({ defaultColorScheme: "system", Link: Link }); diff --git a/packages/frontend/vite.config.ts b/packages/frontend/vite.config.ts index a8cad405..2aa45a5d 100644 --- a/packages/frontend/vite.config.ts +++ b/packages/frontend/vite.config.ts @@ -11,6 +11,7 @@ export default defineConfig({ wasm(), VitePWA({ devOptions: { enabled: true }, + registerType: "autoUpdate", manifest: { id: "gouv.beta.compte-rendu-vif", orientation: "portrait", From f1728b9e49e7b0eab15d5e4dcf6d99b6da44d3d3 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Tue, 9 Jul 2024 10:57:53 +0200 Subject: [PATCH 24/29] feat: make clause.value editable aswell --- .../frontend/src/features/menu/ClauseMenu.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/features/menu/ClauseMenu.tsx b/packages/frontend/src/features/menu/ClauseMenu.tsx index 8b1c36f6..335cbf2b 100644 --- a/packages/frontend/src/features/menu/ClauseMenu.tsx +++ b/packages/frontend/src/features/menu/ClauseMenu.tsx @@ -56,14 +56,12 @@ type Form = { }; const getDiff = (baseClauses: Clause_v2[], modifiedClauses: Clause_v2[]) => { - const newClauses = modifiedClauses.filter((c) => !baseClauses.find((bc) => bc.id === c.id)); const updatedClauses = modifiedClauses.filter((c) => { const baseClause = baseClauses.find((bc) => bc.id === c.id); - return baseClause && baseClause.text !== c.text; + return baseClause && (baseClause.text !== c.text || baseClause.value !== c.value); }); - const deletedClauses = baseClauses.filter((bc) => !modifiedClauses.find((c) => bc.id === c.id)); - return { newClauses: newClauses, updatedClauses: updatedClauses, deletedClauses }; + return { updatedClauses }; }; type Mode = "view" | "add" | "edit"; @@ -100,11 +98,11 @@ const ClauseForm = ({ }); const applyDiffMutation = useMutation( - async (diff: { updatedClauses: Clause_v2[]; newClauses: Clause_v2[]; deletedClauses: Clause_v2[] }) => { + async (diff: { updatedClauses: Clause_v2[] }) => { for (const clause of diff.updatedClauses) { await db.clause_v2.update({ where: { id: clause.id }, - data: { text: clause.text }, + data: { text: clause.text, value: clause.value }, }); } }, @@ -122,6 +120,7 @@ const ClauseForm = ({ const onSubmit = (data: Form) => { const diff = getDiff(clauses, data.clauses); + console.log(clauses, data.clauses, diff); applyDiffMutation.mutate(diff); }; @@ -317,9 +316,10 @@ const ClauseEdit = ({ clause }: { clause: ClauseWithIndex }) => { return ( - - {clause.value} - + @@ -149,12 +199,12 @@ export const PDF = () => { />
- {report && chipOptions?.length && isServiceInstructeurLoaded ? ( + {report && snapshotQuery.isSuccess && chipOptions?.length && isServiceInstructeurLoaded ? ( @@ -168,19 +218,19 @@ export const PDF = () => { ); }; -const getStoredHtmlString = (report: Report) => { - const reportSnapshotRaw = localStorage.getItem("report-" + report.id); - if (!reportSnapshotRaw) return null; +// const getStoredHtmlString = (report: Report) => { +// const reportSnapshotRaw = localStorage.getItem("report-" + report.id); +// if (!reportSnapshotRaw) return null; - const reportSnapshot = JSON.parse(reportSnapshotRaw); - const diff = getDiff(reportSnapshot, { ...report, createdAt: report.createdAt.toISOString() }); +// const reportSnapshot = JSON.parse(reportSnapshotRaw); +// const diff = getDiff(reportSnapshot, { ...report, createdAt: report.createdAt.toISOString() }); - if (Object.keys(diff).length) return null; +// if (Object.keys(diff).length) return null; - const htmlString = localStorage.getItem("report-html-" + report.id); +// const htmlString = localStorage.getItem("report-html-" + report.id); - return htmlString; -}; +// return htmlString; +// }; const SendForm = ({ children, @@ -318,11 +368,6 @@ export const WithReport = ({ editor.commands.setContent(htmlString); }, [editor]); - useEffect(() => { - localStorage.setItem("report-html-" + report!.id, editor?.getHTML() ?? ""); - localStorage.setItem("report-" + report!.id, JSON.stringify(report)); - }, [mode]); - const { udap } = useUser()!; const ViewDocument = ( From 215087bb813f9119778cb0bfe51f101b91f48e92 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 10 Jul 2024 09:49:34 +0200 Subject: [PATCH 26/29] fix: error in console --- packages/frontend/src/routes/pdf.$reportId.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index 37573c2c..2d29fed1 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -248,6 +248,7 @@ const SendForm = ({ if (!form.getValues("recipients")) { form.setValue("recipients", recipents ?? ""); } + return null; }, }); From f281d05625da04fe663ceaa1ac78226d010e1056 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 10 Jul 2024 10:28:23 +0200 Subject: [PATCH 27/29] add logs --- packages/frontend/src/routes/pdf.$reportId.tsx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index 2d29fed1..80d3f388 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -71,6 +71,8 @@ export const PDF = () => { createdAt: reportQuery.results!.createdAt.toISOString(), }); + console.log({ snapshotReport, report: reportQuery.results, diff }); + if (Object.keys(diff).length) return null; return snapshot.html!; @@ -218,20 +220,6 @@ export const PDF = () => { ); }; -// const getStoredHtmlString = (report: Report) => { -// const reportSnapshotRaw = localStorage.getItem("report-" + report.id); -// if (!reportSnapshotRaw) return null; - -// const reportSnapshot = JSON.parse(reportSnapshotRaw); -// const diff = getDiff(reportSnapshot, { ...report, createdAt: report.createdAt.toISOString() }); - -// if (Object.keys(diff).length) return null; - -// const htmlString = localStorage.getItem("report-html-" + report.id); - -// return htmlString; -// }; - const SendForm = ({ children, generatePdf, From a8765dc1d3163ce1bd6523c5d360e95f53607c0d Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 10 Jul 2024 10:38:57 +0200 Subject: [PATCH 28/29] fix: convert meetdate to string before comparing --- packages/frontend/src/routes/pdf.$reportId.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/routes/pdf.$reportId.tsx b/packages/frontend/src/routes/pdf.$reportId.tsx index 80d3f388..9b15c212 100644 --- a/packages/frontend/src/routes/pdf.$reportId.tsx +++ b/packages/frontend/src/routes/pdf.$reportId.tsx @@ -68,7 +68,8 @@ export const PDF = () => { const snapshotReport = JSON.parse(snapshot.report); const diff = getDiff(snapshotReport, { ...reportQuery.results!, - createdAt: reportQuery.results!.createdAt.toISOString(), + createdAt: reportQuery.results!.createdAt?.toISOString(), + meetDate: reportQuery.results!.meetDate?.toISOString(), }); console.log({ snapshotReport, report: reportQuery.results, diff }); From 83db85b7c05f6d5504cb7518aab9a140d1462253 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Wed, 10 Jul 2024 14:37:04 +0200 Subject: [PATCH 29/29] fix: display redactedBy instead of createdBy --- packages/frontend/src/features/ReportList.tsx | 4 ++-- packages/pdf/src/report.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/features/ReportList.tsx b/packages/frontend/src/features/ReportList.tsx index 9f493146..70e326e6 100644 --- a/packages/frontend/src/features/ReportList.tsx +++ b/packages/frontend/src/features/ReportList.tsx @@ -145,7 +145,7 @@ export const ReportList = ({ {columns.slice(0, 2).map((reports, index) => { return ( - + {reports.map((report, index) => ( {report.applicantName ? <>Pour {report.applicantName} : null} - {report.applicantName ? "p" : "P"}ar {report.user?.name ?? ""} + {report.applicantName ? "p" : "P"}ar {report.redactedBy ?? report.user?.name ?? ""} diff --git a/packages/pdf/src/report.tsx b/packages/pdf/src/report.tsx index 27dbcbdf..d7b0dce1 100644 --- a/packages/pdf/src/report.tsx +++ b/packages/pdf/src/report.tsx @@ -172,7 +172,7 @@ export const getReportHtmlString = (

` : "" } - Votre interlocuteur : ${report.user?.name ?? ""}
+ Votre interlocuteur : ${report.redactedBy ?? report.user?.name ?? ""}
Demandeur : ${report.applicantName ?? ""}
Adresse du projet : ${report.applicantAddress ?? ""}
Ref cadastrale : ${report.projectCadastralRef ?? ""}