diff --git a/db/migrations/906-add_report_zipcode.sql b/db/migrations/906-add_report_zipcode.sql new file mode 100644 index 00000000..2a5ebc7c --- /dev/null +++ b/db/migrations/906-add_report_zipcode.sql @@ -0,0 +1 @@ +ALTER TABLE "report" ADD COLUMN "zipCode" TEXT; \ No newline at end of file diff --git a/packages/electric-client/src/generated/client/index.ts b/packages/electric-client/src/generated/client/index.ts index 3a118115..fee2901b 100644 --- a/packages/electric-client/src/generated/client/index.ts +++ b/packages/electric-client/src/generated/client/index.ts @@ -23,7 +23,7 @@ export const Pdf_snapshotScalarFieldEnumSchema = z.enum(['id','report_id','html' export const QueryModeSchema = z.enum(['default','insensitive']); -export const ReportScalarFieldEnumSchema = z.enum(['id','title','projectDescription','redactedBy','meetDate','applicantName','applicantAddress','projectCadastralRef','projectSpaceType','decision','precisions','contacts','furtherInformation','createdBy','createdAt','serviceInstructeur','pdf','disabled','udap_id','redactedById','applicantEmail','city']); +export const ReportScalarFieldEnumSchema = z.enum(['id','title','projectDescription','redactedBy','meetDate','applicantName','applicantAddress','projectCadastralRef','projectSpaceType','decision','precisions','contacts','furtherInformation','createdBy','createdAt','serviceInstructeur','pdf','disabled','udap_id','redactedById','applicantEmail','city','zipCode']); export const Service_instructeursScalarFieldEnumSchema = z.enum(['id','full_name','short_name','email','tel','udap_id']); @@ -119,6 +119,7 @@ export const ReportSchema = z.object({ redactedById: z.string().nullable(), applicantEmail: z.string().nullable(), city: z.string().nullable(), + zipCode: z.string().nullable(), }) export type Report = z.infer @@ -265,6 +266,7 @@ export const ReportSelectSchema: z.ZodType = z.object({ redactedById: z.boolean().optional(), applicantEmail: z.boolean().optional(), city: z.boolean().optional(), + zipCode: z.boolean().optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), }).strict() @@ -565,6 +567,7 @@ export const ReportWhereInputSchema: z.ZodType = z.obje redactedById: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), applicantEmail: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), city: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + zipCode: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), user: z.union([ z.lazy(() => UserRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), }).strict(); @@ -591,6 +594,7 @@ export const ReportOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), applicantEmail: z.lazy(() => SortOrderSchema).optional(), city: z.lazy(() => SortOrderSchema).optional(), + zipCode: z.lazy(() => SortOrderSchema).optional(), user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() }).strict(); @@ -621,6 +625,7 @@ export const ReportOrderByWithAggregationInputSchema: z.ZodType SortOrderSchema).optional(), applicantEmail: z.lazy(() => SortOrderSchema).optional(), city: z.lazy(() => SortOrderSchema).optional(), + zipCode: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => ReportCountOrderByAggregateInputSchema).optional(), _avg: z.lazy(() => ReportAvgOrderByAggregateInputSchema).optional(), _max: z.lazy(() => ReportMaxOrderByAggregateInputSchema).optional(), @@ -654,6 +659,7 @@ export const ReportScalarWhereWithAggregatesInputSchema: z.ZodType StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), applicantEmail: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), city: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), + zipCode: z.union([ z.lazy(() => StringNullableWithAggregatesFilterSchema),z.string() ]).optional().nullable(), }).strict(); export const Service_instructeursWhereInputSchema: z.ZodType = z.object({ @@ -1061,6 +1067,7 @@ export const ReportCreateInputSchema: z.ZodType = z.ob redactedById: z.string().optional().nullable(), applicantEmail: z.string().optional().nullable(), city: z.string().optional().nullable(), + zipCode: z.string().optional().nullable(), user: z.lazy(() => UserCreateNestedOneWithoutReportInputSchema) }).strict(); @@ -1086,7 +1093,8 @@ export const ReportUncheckedCreateInputSchema: z.ZodType = z.object({ @@ -1111,6 +1119,7 @@ export const ReportUpdateInputSchema: z.ZodType = z.ob redactedById: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), user: z.lazy(() => UserUpdateOneRequiredWithoutReportNestedInputSchema).optional() }).strict(); @@ -1137,6 +1146,7 @@ export const ReportUncheckedUpdateInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ReportCreateManyInputSchema: z.ZodType = z.object({ @@ -1161,7 +1171,8 @@ export const ReportCreateManyInputSchema: z.ZodType = z.object({ @@ -1186,6 +1197,7 @@ export const ReportUpdateManyMutationInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ReportUncheckedUpdateManyInputSchema: z.ZodType = z.object({ @@ -1211,6 +1223,7 @@ export const ReportUncheckedUpdateManyInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const Service_instructeursCreateInputSchema: z.ZodType = z.object({ @@ -1709,7 +1722,8 @@ export const ReportCountOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), redactedById: z.lazy(() => SortOrderSchema).optional(), applicantEmail: z.lazy(() => SortOrderSchema).optional(), - city: z.lazy(() => SortOrderSchema).optional() + city: z.lazy(() => SortOrderSchema).optional(), + zipCode: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ReportAvgOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -1738,7 +1752,8 @@ export const ReportMaxOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), redactedById: z.lazy(() => SortOrderSchema).optional(), applicantEmail: z.lazy(() => SortOrderSchema).optional(), - city: z.lazy(() => SortOrderSchema).optional() + city: z.lazy(() => SortOrderSchema).optional(), + zipCode: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ReportMinOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -1763,7 +1778,8 @@ export const ReportMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), redactedById: z.lazy(() => SortOrderSchema).optional(), applicantEmail: z.lazy(() => SortOrderSchema).optional(), - city: z.lazy(() => SortOrderSchema).optional() + city: z.lazy(() => SortOrderSchema).optional(), + zipCode: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ReportSumOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2656,7 +2672,8 @@ export const ReportCreateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2680,7 +2697,8 @@ export const ReportUncheckedCreateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2812,6 +2830,7 @@ export const ReportScalarWhereInputSchema: z.ZodType StringNullableFilterSchema),z.string() ]).optional().nullable(), applicantEmail: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), city: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), + zipCode: z.union([ z.lazy(() => StringNullableFilterSchema),z.string() ]).optional().nullable(), }).strict(); export const UdapUpsertWithoutUserInputSchema: z.ZodType = z.object({ @@ -2906,7 +2925,8 @@ export const ReportCreateManyUserInputSchema: z.ZodType = z.object({ @@ -2955,6 +2975,7 @@ export const ReportUpdateWithoutUserInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType = z.object({ @@ -2979,6 +3000,7 @@ export const ReportUncheckedUpdateWithoutUserInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); export const ReportUncheckedUpdateManyWithoutReportInputSchema: z.ZodType = z.object({ @@ -3003,6 +3025,7 @@ export const ReportUncheckedUpdateManyWithoutReportInputSchema: z.ZodType NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), applicantEmail: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), city: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), + zipCode: z.union([ z.string(),z.lazy(() => NullableStringFieldUpdateOperationsInputSchema) ]).optional().nullable(), }).strict(); ///////////////////////////////////////// @@ -4117,6 +4140,10 @@ export const tableSchemas = { [ "city", "TEXT" + ], + [ + "zipCode", + "TEXT" ] ]), relations: [ diff --git a/packages/electric-client/src/generated/client/migrations.ts b/packages/electric-client/src/generated/client/migrations.ts index 499a34d3..78b43583 100644 --- a/packages/electric-client/src/generated/client/migrations.ts +++ b/packages/electric-client/src/generated/client/migrations.ts @@ -196,5 +196,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": "905" + }, + { + "statements": [ + "ALTER TABLE \"report\" ADD COLUMN \"zipCode\" 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\", 'city', new.\"city\", '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\", 'zipCode', new.\"zipCode\"), 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\", 'city', new.\"city\", '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\", 'zipCode', new.\"zipCode\"), json_object('applicantAddress', old.\"applicantAddress\", 'applicantEmail', old.\"applicantEmail\", 'applicantName', old.\"applicantName\", 'city', old.\"city\", '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\", 'zipCode', old.\"zipCode\"), 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\", 'city', old.\"city\", '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\", 'zipCode', old.\"zipCode\"), 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": "906" } ] \ 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 a6486df7..3421aa67 100644 --- a/packages/electric-client/src/generated/client/pg-migrations.ts +++ b/packages/electric-client/src/generated/client/pg-migrations.ts @@ -258,5 +258,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": "905" + }, + { + "statements": [ + "ALTER TABLE \"report\" ADD COLUMN \"zipCode\" 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\", 'city', new.\"city\", '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\", 'zipCode', new.\"zipCode\"),\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\", 'city', new.\"city\", '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\", 'zipCode', new.\"zipCode\"),\n jsonb_build_object('applicantAddress', old.\"applicantAddress\", 'applicantEmail', old.\"applicantEmail\", 'applicantName', old.\"applicantName\", 'city', old.\"city\", '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\", 'zipCode', old.\"zipCode\"),\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\", 'city', old.\"city\", '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\", 'zipCode', old.\"zipCode\"),\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": "906" } ] \ 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 38acaf24..0c0d095d 100644 --- a/packages/electric-client/src/generated/client/prismaClient.d.ts +++ b/packages/electric-client/src/generated/client/prismaClient.d.ts @@ -119,6 +119,7 @@ export type ReportPayload composites: {} } @@ -5327,6 +5328,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById: string | null applicantEmail: string | null city: string | null + zipCode: string | null } export type ReportMaxAggregateOutputType = { @@ -5352,6 +5354,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById: string | null applicantEmail: string | null city: string | null + zipCode: string | null } export type ReportCountAggregateOutputType = { @@ -5377,6 +5380,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById: number applicantEmail: number city: number + zipCode: number _all: number } @@ -5412,6 +5416,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: true applicantEmail?: true city?: true + zipCode?: true } export type ReportMaxAggregateInputType = { @@ -5437,6 +5442,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: true applicantEmail?: true city?: true + zipCode?: true } export type ReportCountAggregateInputType = { @@ -5462,6 +5468,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: true applicantEmail?: true city?: true + zipCode?: true _all?: true } @@ -5575,6 +5582,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById: string | null applicantEmail: string | null city: string | null + zipCode: string | null _count: ReportCountAggregateOutputType | null _avg: ReportAvgAggregateOutputType | null _sum: ReportSumAggregateOutputType | null @@ -5619,6 +5627,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: boolean applicantEmail?: boolean city?: boolean + zipCode?: boolean user?: boolean | UserArgs }, ExtArgs["result"]["report"]> @@ -5645,6 +5654,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: boolean applicantEmail?: boolean city?: boolean + zipCode?: boolean } export type ReportInclude = { @@ -9395,7 +9405,8 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject udap_id: 'udap_id', redactedById: 'redactedById', applicantEmail: 'applicantEmail', - city: 'city' + city: 'city', + zipCode: 'zipCode' }; export type ReportScalarFieldEnum = (typeof ReportScalarFieldEnum)[keyof typeof ReportScalarFieldEnum] @@ -9674,6 +9685,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: StringNullableFilter | string | null applicantEmail?: StringNullableFilter | string | null city?: StringNullableFilter | string | null + zipCode?: StringNullableFilter | string | null user?: XOR } @@ -9700,6 +9712,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: SortOrderInput | SortOrder applicantEmail?: SortOrderInput | SortOrder city?: SortOrderInput | SortOrder + zipCode?: SortOrderInput | SortOrder user?: UserOrderByWithRelationInput } @@ -9730,6 +9743,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: SortOrderInput | SortOrder applicantEmail?: SortOrderInput | SortOrder city?: SortOrderInput | SortOrder + zipCode?: SortOrderInput | SortOrder _count?: ReportCountOrderByAggregateInput _avg?: ReportAvgOrderByAggregateInput _max?: ReportMaxOrderByAggregateInput @@ -9763,6 +9777,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: StringNullableWithAggregatesFilter | string | null applicantEmail?: StringNullableWithAggregatesFilter | string | null city?: StringNullableWithAggregatesFilter | string | null + zipCode?: StringNullableWithAggregatesFilter | string | null } export type Service_instructeursWhereInput = { @@ -10171,6 +10186,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: string | null applicantEmail?: string | null city?: string | null + zipCode?: string | null user: UserCreateNestedOneWithoutReportInput } @@ -10197,6 +10213,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: string | null applicantEmail?: string | null city?: string | null + zipCode?: string | null } export type ReportUpdateInput = { @@ -10221,6 +10238,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null user?: UserUpdateOneRequiredWithoutReportNestedInput } @@ -10247,6 +10265,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportCreateManyInput = { @@ -10272,6 +10291,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: string | null applicantEmail?: string | null city?: string | null + zipCode?: string | null } export type ReportUpdateManyMutationInput = { @@ -10296,6 +10316,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportUncheckedUpdateManyInput = { @@ -10321,6 +10342,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null } export type Service_instructeursCreateInput = { @@ -10825,6 +10847,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: SortOrder applicantEmail?: SortOrder city?: SortOrder + zipCode?: SortOrder } export type ReportAvgOrderByAggregateInput = { @@ -10854,6 +10877,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: SortOrder applicantEmail?: SortOrder city?: SortOrder + zipCode?: SortOrder } export type ReportMinOrderByAggregateInput = { @@ -10879,6 +10903,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: SortOrder applicantEmail?: SortOrder city?: SortOrder + zipCode?: SortOrder } export type ReportSumOrderByAggregateInput = { @@ -11772,6 +11797,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: string | null applicantEmail?: string | null city?: string | null + zipCode?: string | null } export type ReportUncheckedCreateWithoutUserInput = { @@ -11796,6 +11822,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: string | null applicantEmail?: string | null city?: string | null + zipCode?: string | null } export type ReportCreateOrConnectWithoutUserInput = { @@ -11927,6 +11954,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: StringNullableFilter | string | null applicantEmail?: StringNullableFilter | string | null city?: StringNullableFilter | string | null + zipCode?: StringNullableFilter | string | null } export type UdapUpsertWithoutUserInput = { @@ -12022,6 +12050,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: string | null applicantEmail?: string | null city?: string | null + zipCode?: string | null } export type DelegationUpdateWithoutUser_delegation_createdByTouserInput = { @@ -12070,6 +12099,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportUncheckedUpdateWithoutUserInput = { @@ -12094,6 +12124,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null } export type ReportUncheckedUpdateManyWithoutReportInput = { @@ -12118,6 +12149,7 @@ export type InputJsonValue = null | string | number | boolean | InputJsonObject redactedById?: NullableStringFieldUpdateOperationsInput | string | null applicantEmail?: NullableStringFieldUpdateOperationsInput | string | null city?: NullableStringFieldUpdateOperationsInput | string | null + zipCode?: NullableStringFieldUpdateOperationsInput | string | null } diff --git a/packages/electric-client/src/generated/typebox/index.ts b/packages/electric-client/src/generated/typebox/index.ts index 1b8d5910..102a354f 100644 --- a/packages/electric-client/src/generated/typebox/index.ts +++ b/packages/electric-client/src/generated/typebox/index.ts @@ -1,7 +1,7 @@ export * from './atdatabases_migrations_applied'; export * from './atdatabases_migrations_appliedInput'; -export * from './atdatabases_migrations_version'; export * from './atdatabases_migrations_versionInput'; +export * from './atdatabases_migrations_version'; export * from './clause'; export * from './clauseInput'; export * from './report'; @@ -12,11 +12,11 @@ export * from './udap'; export * from './udapInput'; export * from './user'; export * from './userInput'; -export * from './whitelist'; export * from './whitelistInput'; +export * from './whitelist'; export * from './internal_user'; export * from './internal_userInput'; export * from './service_instructeurs'; export * from './service_instructeursInput'; -export * from './clause_v2Input'; export * from './clause_v2'; +export * from './clause_v2Input'; diff --git a/packages/frontend/src/features/InfoForm.tsx b/packages/frontend/src/features/InfoForm.tsx index 454ea949..2838a07c 100644 --- a/packages/frontend/src/features/InfoForm.tsx +++ b/packages/frontend/src/features/InfoForm.tsx @@ -84,7 +84,7 @@ export const InfoForm = () => { { /> - + { + + + { > - - +
diff --git a/packages/pdf/src/report.tsx b/packages/pdf/src/report.tsx index 465dca21..1feee68f 100644 --- a/packages/pdf/src/report.tsx +++ b/packages/pdf/src/report.tsx @@ -6,13 +6,19 @@ import type { Udap, Report, Service_instructeurs, Clause_v2 } from "@cr-vif/elec export const ReportPDFDocument = ({ udap, htmlString, images }: ReportPDFDocumentProps) => { return ( - + {` @@ -66,6 +72,7 @@ export const ReportPDFDocument = ({ udap, htmlString, images }: ReportPDFDocumen } .right-texts { + margin-top: 13px; display: flex; align-items: flex-end; flex-direction: column; @@ -75,7 +82,7 @@ export const ReportPDFDocument = ({ udap, htmlString, images }: ReportPDFDocumen .right-texts > div { text-align: right; - font-size: 16px; + font-size: 14px; font-family: Helvetica-Bold; }