From b56c08a36b575a16846854ab883212e859dd4474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Fri, 29 Nov 2024 14:42:49 +0100 Subject: [PATCH] feat: obiz hook article update integration --- webapp/CHANGELOG.md | 3 +- webapp/src/pages/api/obizSync.ts | 53 +- webapp/src/payload/collections/Offer.ts | 8 + .../payload/migrations/20241129_102054.json | 5080 +++++++++++++++++ .../src/payload/migrations/20241129_102054.ts | 17 + webapp/src/payload/payload-types.ts | 82 +- webapp/src/server/api/routers/offer.ts | 70 + 7 files changed, 5221 insertions(+), 92 deletions(-) create mode 100644 webapp/src/payload/migrations/20241129_102054.json create mode 100644 webapp/src/payload/migrations/20241129_102054.ts diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index aac50131..921bd9d1 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,9 +1,8 @@ ## [0.71.2](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.71.1...v0.71.2) (2024-11-29) - ### Bug Fixes -* add missing migrations ([827a31e](https://github.com/SocialGouv/carte-jeune-engage/commit/827a31ece7352ae9ca7c057c9f42858e7a4dd089)) +- add missing migrations ([827a31e](https://github.com/SocialGouv/carte-jeune-engage/commit/827a31ece7352ae9ca7c057c9f42858e7a4dd089)) ## [0.71.1](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.71.0...v0.71.1) (2024-11-29) diff --git a/webapp/src/pages/api/obizSync.ts b/webapp/src/pages/api/obizSync.ts index 37aaafc7..56b85639 100644 --- a/webapp/src/pages/api/obizSync.ts +++ b/webapp/src/pages/api/obizSync.ts @@ -13,12 +13,11 @@ const ObizSync = async (req: NextApiRequest, res: NextApiResponse) => { return res.status(405).send("Invalid request method."); } - const { numero } = req.query as { - numero: string; + const { numero, article_id } = req.query as { + numero?: string; + article_id?: string; }; - console.log("obiz synchronizing order", numero); - try { const payload = await getPayloadClient({ seed: false }); const createCaller = createCallerFactory(appRouter); @@ -35,19 +34,43 @@ const ObizSync = async (req: NextApiRequest, res: NextApiResponse) => { req, }); - const orderId = await caller.order.getIdByNumber({ - number: parseInt(numero), - }); + if (numero) { + console.log("obiz synchronizing order", numero); + + const orderId = await caller.order.getIdByNumber({ + number: parseInt(numero), + }); - caller.order - .synchronizeOrder({ - order_id: orderId.data, - }) - .then((order) => { - console.log( - `Finish synchronizing obiz order : [numero: ${numero} / obiz status : ${order.data.obiz_status} / cje status : ${order.data.status}]` - ); + caller.order + .synchronizeOrder({ + order_id: orderId.data, + }) + .then((order) => { + console.log( + `Finish synchronizing obiz order : [numero: ${numero} / obiz status : ${order.data.obiz_status} / cje status : ${order.data.status}]` + ); + }); + } else if (article_id) { + console.log("obiz synchronizing article", article_id); + caller.offer + .synchronizeObizOffer({ + article_id, + }) + .then(({ offer, updateArticles, article_actif }) => { + if (updateArticles) { + console.log( + `Finish synchronizing obiz offer : [${offer.formatedTitle} : article ${article_actif ? "listed" : "delisted"} (${article_id})]` + ); + } else { + console.log(`Nothing to synchronize`); + } + }); + } else { + throw new TRPCError({ + code: "BAD_REQUEST", + message: `No order number or article_id provided`, }); + } return res.status(200).json({ data: "ok" }); } catch (error) { diff --git a/webapp/src/payload/collections/Offer.ts b/webapp/src/payload/collections/Offer.ts index 7c8fa76f..d21e7ddc 100644 --- a/webapp/src/payload/collections/Offer.ts +++ b/webapp/src/payload/collections/Offer.ts @@ -337,6 +337,14 @@ export const Offers: CollectionConfig = { }, }, fields: [ + { + name: "obiz_id", + type: "text", + label: "Identifiant Obiz", + admin: { + readOnly: true, + }, + }, { name: "available", label: "Disponible", diff --git a/webapp/src/payload/migrations/20241129_102054.json b/webapp/src/payload/migrations/20241129_102054.json new file mode 100644 index 00000000..79615385 --- /dev/null +++ b/webapp/src/payload/migrations/20241129_102054.json @@ -0,0 +1,5080 @@ +{ + "id": "6a3c438b-6970-41a2-88bc-b8ae6de1025f", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "5", + "dialect": "pg", + "tables": { + "admins": { + "name": "admins", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "reset_password_token": { + "name": "reset_password_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reset_password_expiration": { + "name": "reset_password_expiration", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "salt": { + "name": "salt", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "hash": { + "name": "hash", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "login_attempts": { + "name": "login_attempts", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "admins_created_at_idx": { + "name": "admins_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "admins_email_idx": { + "name": "admins_email_idx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "phone_number": { + "name": "phone_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "civility": { + "name": "civility", + "type": "enum_users_civility", + "primaryKey": false, + "notNull": false + }, + "birth_date": { + "name": "birth_date", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "first_name": { + "name": "first_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "user_email": { + "name": "user_email", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "cejFrom": { + "name": "cejFrom", + "type": "enum_users_cej_from", + "primaryKey": false, + "notNull": false + }, + "timeAtCEJ": { + "name": "timeAtCEJ", + "type": "enum_users_time_at_c_e_j", + "primaryKey": false, + "notNull": false + }, + "hasAJobIdea": { + "name": "hasAJobIdea", + "type": "enum_users_has_a_job_idea", + "primaryKey": false, + "notNull": false + }, + "project_title": { + "name": "project_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "project_description": { + "name": "project_description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "status_image": { + "name": "status_image", + "type": "enum_users_status_image", + "primaryKey": false, + "notNull": false + }, + "notification_status": { + "name": "notification_status", + "type": "enum_users_notification_status", + "primaryKey": false, + "notNull": false + }, + "notification_subscription": { + "name": "notification_subscription", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "otp_request_token": { + "name": "otp_request_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "cej_id": { + "name": "cej_id", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "reset_password_token": { + "name": "reset_password_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reset_password_expiration": { + "name": "reset_password_expiration", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "salt": { + "name": "salt", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "hash": { + "name": "hash", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "login_attempts": { + "name": "login_attempts", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_phone_number_idx": { + "name": "users_phone_number_idx", + "columns": [ + "phone_number" + ], + "isUnique": true + }, + "users_cej_id_idx": { + "name": "users_cej_id_idx", + "columns": [ + "cej_id" + ], + "isUnique": true + }, + "users_created_at_idx": { + "name": "users_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "users_email_idx": { + "name": "users_email_idx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users_rels": { + "name": "users_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tags_id": { + "name": "tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_rels_order_idx": { + "name": "users_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "users_rels_parent_idx": { + "name": "users_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "users_rels_path_idx": { + "name": "users_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "users_rels_parent_id_users_id_fk": { + "name": "users_rels_parent_id_users_id_fk", + "tableFrom": "users_rels", + "tableTo": "users", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "users_rels_media_id_media_id_fk": { + "name": "users_rels_media_id_media_id_fk", + "tableFrom": "users_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "users_rels_tags_id_tags_id_fk": { + "name": "users_rels_tags_id_tags_id_fk", + "tableFrom": "users_rels", + "tableTo": "tags", + "columnsFrom": [ + "tags_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "supervisors": { + "name": "supervisors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "cgu": { + "name": "cgu", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "enum_supervisors_kind", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "email": { + "name": "email", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "reset_password_token": { + "name": "reset_password_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reset_password_expiration": { + "name": "reset_password_expiration", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "salt": { + "name": "salt", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "hash": { + "name": "hash", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "login_attempts": { + "name": "login_attempts", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "lock_until": { + "name": "lock_until", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "supervisors_created_at_idx": { + "name": "supervisors_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "supervisors_email_idx": { + "name": "supervisors_email_idx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "permissions": { + "name": "permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "phone_number": { + "name": "phone_number", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "supervisorKind": { + "name": "supervisorKind", + "type": "enum_permissions_supervisor_kind", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "permissions_phone_number_idx": { + "name": "permissions_phone_number_idx", + "columns": [ + "phone_number" + ], + "isUnique": true + }, + "permissions_created_at_idx": { + "name": "permissions_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "permissions_rels": { + "name": "permissions_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "supervisors_id": { + "name": "supervisors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "permissions_rels_order_idx": { + "name": "permissions_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "permissions_rels_parent_idx": { + "name": "permissions_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "permissions_rels_path_idx": { + "name": "permissions_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "permissions_rels_parent_id_permissions_id_fk": { + "name": "permissions_rels_parent_id_permissions_id_fk", + "tableFrom": "permissions_rels", + "tableTo": "permissions", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "permissions_rels_supervisors_id_supervisors_id_fk": { + "name": "permissions_rels_supervisors_id_supervisors_id_fk", + "tableFrom": "permissions_rels", + "tableTo": "supervisors", + "columnsFrom": [ + "supervisors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "apikeys": { + "name": "apikeys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "apikeys_key_idx": { + "name": "apikeys_key_idx", + "columns": [ + "key" + ], + "isUnique": true + }, + "apikeys_created_at_idx": { + "name": "apikeys_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories": { + "name": "categories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "text_white": { + "name": "text_white", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "categories_slug_idx": { + "name": "categories_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "categories_created_at_idx": { + "name": "categories_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_rels": { + "name": "categories_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "categories_rels_order_idx": { + "name": "categories_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "categories_rels_parent_idx": { + "name": "categories_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "categories_rels_path_idx": { + "name": "categories_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "categories_rels_parent_id_categories_id_fk": { + "name": "categories_rels_parent_id_categories_id_fk", + "tableFrom": "categories_rels", + "tableTo": "categories", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "categories_rels_media_id_media_id_fk": { + "name": "categories_rels_media_id_media_id_fk", + "tableFrom": "categories_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "tags_slug_idx": { + "name": "tags_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "tags_created_at_idx": { + "name": "tags_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_rels": { + "name": "tags_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "tags_rels_order_idx": { + "name": "tags_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "tags_rels_parent_idx": { + "name": "tags_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "tags_rels_path_idx": { + "name": "tags_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "tags_rels_parent_id_tags_id_fk": { + "name": "tags_rels_parent_id_tags_id_fk", + "tableFrom": "tags_rels", + "tableTo": "tags", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_rels_media_id_media_id_fk": { + "name": "tags_rels_media_id_media_id_fk", + "tableFrom": "tags_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "partners": { + "name": "partners", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "stared": { + "name": "stared", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "partners_name_idx": { + "name": "partners_name_idx", + "columns": [ + "name" + ], + "isUnique": true + }, + "partners_created_at_idx": { + "name": "partners_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "partners_rels": { + "name": "partners_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "partners_rels_order_idx": { + "name": "partners_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "partners_rels_parent_idx": { + "name": "partners_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "partners_rels_path_idx": { + "name": "partners_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "partners_rels_parent_id_partners_id_fk": { + "name": "partners_rels_parent_id_partners_id_fk", + "tableFrom": "partners_rels", + "tableTo": "partners", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "partners_rels_media_id_media_id_fk": { + "name": "partners_rels_media_id_media_id_fk", + "tableFrom": "partners_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "media": { + "name": "media", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "prefix": { + "name": "prefix", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "filename": { + "name": "filename", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "filesize": { + "name": "filesize", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "focal_x": { + "name": "focal_x", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "focal_y": { + "name": "focal_y", + "type": "numeric", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "media_created_at_idx": { + "name": "media_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "media_filename_idx": { + "name": "media_filename_idx", + "columns": [ + "filename" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_terms_of_use": { + "name": "offers_terms_of_use", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_highlighted": { + "name": "is_highlighted", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_terms_of_use_order_idx": { + "name": "offers_terms_of_use_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_terms_of_use_parent_id_idx": { + "name": "offers_terms_of_use_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_terms_of_use__parent_id_offers_id_fk": { + "name": "offers_terms_of_use__parent_id_offers_id_fk", + "tableFrom": "offers_terms_of_use", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_conditions": { + "name": "offers_conditions", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "text": { + "name": "text", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_conditions_order_idx": { + "name": "offers_conditions_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_conditions_parent_id_idx": { + "name": "offers_conditions_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_conditions__parent_id_offers_id_fk": { + "name": "offers_conditions__parent_id_offers_id_fk", + "tableFrom": "offers_conditions", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_condition_blocks": { + "name": "offers_condition_blocks", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "is_crossed": { + "name": "is_crossed", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_condition_blocks_order_idx": { + "name": "offers_condition_blocks_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_condition_blocks_parent_id_idx": { + "name": "offers_condition_blocks_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_condition_blocks__parent_id_offers_id_fk": { + "name": "offers_condition_blocks__parent_id_offers_id_fk", + "tableFrom": "offers_condition_blocks", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_articles": { + "name": "offers_articles", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "obiz_id": { + "name": "obiz_id", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "available": { + "name": "available", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reference": { + "name": "reference", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reduction_percentage": { + "name": "reduction_percentage", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "validity_to": { + "name": "validity_to", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "enum_offers_articles_kind", + "primaryKey": false, + "notNull": false + }, + "minimum_price": { + "name": "minimum_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "maximum_price": { + "name": "maximum_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "public_price": { + "name": "public_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "price": { + "name": "price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "obiz_json": { + "name": "obiz_json", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_articles_order_idx": { + "name": "offers_articles_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "offers_articles_parent_id_idx": { + "name": "offers_articles_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + }, + "offers_articles_reference_idx": { + "name": "offers_articles_reference_idx", + "columns": [ + "reference" + ], + "isUnique": true + } + }, + "foreignKeys": { + "offers_articles__parent_id_offers_id_fk": { + "name": "offers_articles__parent_id_offers_id_fk", + "tableFrom": "offers_articles", + "tableTo": "offers", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers": { + "name": "offers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "formated_title": { + "name": "formated_title", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "subtitle": { + "name": "subtitle", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "validity_from": { + "name": "validity_from", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "validity_to": { + "name": "validity_to", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true + }, + "published": { + "name": "published", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "enum_offers_source", + "primaryKey": false, + "notNull": true + }, + "obiz_id": { + "name": "obiz_id", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "cumulative": { + "name": "cumulative", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "nb_of_eligible_stores": { + "name": "nb_of_eligible_stores", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "link_of_eligible_stores": { + "name": "link_of_eligible_stores", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "barcodeFormat": { + "name": "barcodeFormat", + "type": "enum_offers_barcode_format", + "primaryKey": false, + "notNull": false + }, + "nb_seen": { + "name": "nb_seen", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "offers_created_at_idx": { + "name": "offers_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "offers_rels": { + "name": "offers_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "partners_id": { + "name": "partners_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "categories_id": { + "name": "categories_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tags_id": { + "name": "tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "offers_rels_order_idx": { + "name": "offers_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "offers_rels_parent_idx": { + "name": "offers_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "offers_rels_path_idx": { + "name": "offers_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "offers_rels_parent_id_offers_id_fk": { + "name": "offers_rels_parent_id_offers_id_fk", + "tableFrom": "offers_rels", + "tableTo": "offers", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_partners_id_partners_id_fk": { + "name": "offers_rels_partners_id_partners_id_fk", + "tableFrom": "offers_rels", + "tableTo": "partners", + "columnsFrom": [ + "partners_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_categories_id_categories_id_fk": { + "name": "offers_rels_categories_id_categories_id_fk", + "tableFrom": "offers_rels", + "tableTo": "categories", + "columnsFrom": [ + "categories_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_tags_id_tags_id_fk": { + "name": "offers_rels_tags_id_tags_id_fk", + "tableFrom": "offers_rels", + "tableTo": "tags", + "columnsFrom": [ + "tags_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "offers_rels_media_id_media_id_fk": { + "name": "offers_rels_media_id_media_id_fk", + "tableFrom": "offers_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "coupons": { + "name": "coupons", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "used": { + "name": "used", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "used_at": { + "name": "used_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "assign_user_at": { + "name": "assign_user_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "coupons_created_at_idx": { + "name": "coupons_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "coupons_rels": { + "name": "coupons_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "coupons_rels_order_idx": { + "name": "coupons_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "coupons_rels_parent_idx": { + "name": "coupons_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "coupons_rels_path_idx": { + "name": "coupons_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "coupons_rels_parent_id_coupons_id_fk": { + "name": "coupons_rels_parent_id_coupons_id_fk", + "tableFrom": "coupons_rels", + "tableTo": "coupons", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "coupons_rels_users_id_users_id_fk": { + "name": "coupons_rels_users_id_users_id_fk", + "tableFrom": "coupons_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "coupons_rels_offers_id_offers_id_fk": { + "name": "coupons_rels_offers_id_offers_id_fk", + "tableFrom": "coupons_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "orders_articles": { + "name": "orders_articles", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "article_reference": { + "name": "article_reference", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "article_quantity": { + "name": "article_quantity", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "article_montant": { + "name": "article_montant", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "article_montant_discounted": { + "name": "article_montant_discounted", + "type": "numeric", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "orders_articles_order_idx": { + "name": "orders_articles_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "orders_articles_parent_id_idx": { + "name": "orders_articles_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "orders_articles__parent_id_orders_id_fk": { + "name": "orders_articles__parent_id_orders_id_fk", + "tableFrom": "orders_articles", + "tableTo": "orders", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "orders": { + "name": "orders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "number": { + "name": "number", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "enum_orders_status", + "primaryKey": false, + "notNull": true + }, + "obiz_status": { + "name": "obiz_status", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "payment_url": { + "name": "payment_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "orders_created_at_idx": { + "name": "orders_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "orders_rels": { + "name": "orders_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "orders_rels_order_idx": { + "name": "orders_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "orders_rels_parent_idx": { + "name": "orders_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "orders_rels_path_idx": { + "name": "orders_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "orders_rels_parent_id_orders_id_fk": { + "name": "orders_rels_parent_id_orders_id_fk", + "tableFrom": "orders_rels", + "tableTo": "orders", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "orders_rels_users_id_users_id_fk": { + "name": "orders_rels_users_id_users_id_fk", + "tableFrom": "orders_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "orders_rels_offers_id_offers_id_fk": { + "name": "orders_rels_offers_id_offers_id_fk", + "tableFrom": "orders_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "orders_rels_media_id_media_id_fk": { + "name": "orders_rels_media_id_media_id_fk", + "tableFrom": "orders_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "savings": { + "name": "savings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "savings_created_at_idx": { + "name": "savings_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "savings_rels": { + "name": "savings_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "coupons_id": { + "name": "coupons_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "savings_rels_order_idx": { + "name": "savings_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "savings_rels_parent_idx": { + "name": "savings_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "savings_rels_path_idx": { + "name": "savings_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "savings_rels_parent_id_savings_id_fk": { + "name": "savings_rels_parent_id_savings_id_fk", + "tableFrom": "savings_rels", + "tableTo": "savings", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "savings_rels_coupons_id_coupons_id_fk": { + "name": "savings_rels_coupons_id_coupons_id_fk", + "tableFrom": "savings_rels", + "tableTo": "coupons", + "columnsFrom": [ + "coupons_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ordersignals": { + "name": "ordersignals", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "ordersignals_created_at_idx": { + "name": "ordersignals_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ordersignals_rels": { + "name": "ordersignals_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "orders_id": { + "name": "orders_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "ordersignals_rels_order_idx": { + "name": "ordersignals_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "ordersignals_rels_parent_idx": { + "name": "ordersignals_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "ordersignals_rels_path_idx": { + "name": "ordersignals_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "ordersignals_rels_parent_id_ordersignals_id_fk": { + "name": "ordersignals_rels_parent_id_ordersignals_id_fk", + "tableFrom": "ordersignals_rels", + "tableTo": "ordersignals", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "ordersignals_rels_orders_id_orders_id_fk": { + "name": "ordersignals_rels_orders_id_orders_id_fk", + "tableFrom": "ordersignals_rels", + "tableTo": "orders", + "columnsFrom": [ + "orders_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "notifications": { + "name": "notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "app_version": { + "name": "app_version", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "notifications_created_at_idx": { + "name": "notifications_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "notifications_rels": { + "name": "notifications_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "notifications_rels_order_idx": { + "name": "notifications_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "notifications_rels_parent_idx": { + "name": "notifications_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "notifications_rels_path_idx": { + "name": "notifications_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "notifications_rels_parent_id_notifications_id_fk": { + "name": "notifications_rels_parent_id_notifications_id_fk", + "tableFrom": "notifications_rels", + "tableTo": "notifications", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notifications_rels_users_id_users_id_fk": { + "name": "notifications_rels_users_id_users_id_fk", + "tableFrom": "notifications_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notifications_rels_offers_id_offers_id_fk": { + "name": "notifications_rels_offers_id_offers_id_fk", + "tableFrom": "notifications_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "search_requests": { + "name": "search_requests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "search_requests_name_idx": { + "name": "search_requests_name_idx", + "columns": [ + "name" + ], + "isUnique": true + }, + "search_requests_created_at_idx": { + "name": "search_requests_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "email_auth_tokens": { + "name": "email_auth_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "expiration": { + "name": "expiration", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "email_auth_tokens_created_at_idx": { + "name": "email_auth_tokens_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "email_auth_tokens_rels": { + "name": "email_auth_tokens_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "email_auth_tokens_rels_order_idx": { + "name": "email_auth_tokens_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "email_auth_tokens_rels_parent_idx": { + "name": "email_auth_tokens_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "email_auth_tokens_rels_path_idx": { + "name": "email_auth_tokens_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "email_auth_tokens_rels_parent_id_email_auth_tokens_id_fk": { + "name": "email_auth_tokens_rels_parent_id_email_auth_tokens_id_fk", + "tableFrom": "email_auth_tokens_rels", + "tableTo": "email_auth_tokens", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "email_auth_tokens_rels_users_id_users_id_fk": { + "name": "email_auth_tokens_rels_users_id_users_id_fk", + "tableFrom": "email_auth_tokens_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "forms_blocks_country_text_legend": { + "name": "forms_blocks_country_text_legend", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "forms_blocks_country_text_legend_order_idx": { + "name": "forms_blocks_country_text_legend_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "forms_blocks_country_text_legend_parent_id_idx": { + "name": "forms_blocks_country_text_legend_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "forms_blocks_country_text_legend__parent_id_forms_blocks_country_id_fk": { + "name": "forms_blocks_country_text_legend__parent_id_forms_blocks_country_id_fk", + "tableFrom": "forms_blocks_country_text_legend", + "tableTo": "forms_blocks_country", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "forms_blocks_country": { + "name": "forms_blocks_country", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_path": { + "name": "_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "min": { + "name": "min", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "max": { + "name": "max", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "block_name": { + "name": "block_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "forms_blocks_country_order_idx": { + "name": "forms_blocks_country_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "forms_blocks_country_parent_id_idx": { + "name": "forms_blocks_country_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + }, + "forms_blocks_country_path_idx": { + "name": "forms_blocks_country_path_idx", + "columns": [ + "_path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "forms_blocks_country__parent_id_forms_id_fk": { + "name": "forms_blocks_country__parent_id_forms_id_fk", + "tableFrom": "forms_blocks_country", + "tableTo": "forms", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "forms_blocks_textarea": { + "name": "forms_blocks_textarea", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_path": { + "name": "_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "placeholder": { + "name": "placeholder", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "block_name": { + "name": "block_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "forms_blocks_textarea_order_idx": { + "name": "forms_blocks_textarea_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "forms_blocks_textarea_parent_id_idx": { + "name": "forms_blocks_textarea_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + }, + "forms_blocks_textarea_path_idx": { + "name": "forms_blocks_textarea_path_idx", + "columns": [ + "_path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "forms_blocks_textarea__parent_id_forms_id_fk": { + "name": "forms_blocks_textarea__parent_id_forms_id_fk", + "tableFrom": "forms_blocks_textarea", + "tableTo": "forms", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "forms_emails": { + "name": "forms_emails", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "email_to": { + "name": "email_to", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "cc": { + "name": "cc", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "bcc": { + "name": "bcc", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "reply_to": { + "name": "reply_to", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "email_from": { + "name": "email_from", + "type": "varchar", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "forms_emails_order_idx": { + "name": "forms_emails_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "forms_emails_parent_id_idx": { + "name": "forms_emails_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "forms_emails__parent_id_forms_id_fk": { + "name": "forms_emails__parent_id_forms_id_fk", + "tableFrom": "forms_emails", + "tableTo": "forms", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "forms_emails_locales": { + "name": "forms_emails_locales", + "schema": "", + "columns": { + "subject": { + "name": "subject", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "forms_emails_locales__parent_id_forms_emails_id_fk": { + "name": "forms_emails_locales__parent_id_forms_emails_id_fk", + "tableFrom": "forms_emails_locales", + "tableTo": "forms_emails", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "forms_emails_locales_locale_parent_id_unique": { + "name": "forms_emails_locales_locale_parent_id_unique", + "nullsNotDistinct": false, + "columns": [ + "_locale", + "_parent_id" + ] + } + } + }, + "forms": { + "name": "forms", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "confirmationType": { + "name": "confirmationType", + "type": "enum_forms_confirmation_type", + "primaryKey": false, + "notNull": false + }, + "redirect_url": { + "name": "redirect_url", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "forms_created_at_idx": { + "name": "forms_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "forms_locales": { + "name": "forms_locales", + "schema": "", + "columns": { + "submit_button_label": { + "name": "submit_button_label", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "confirmation_message": { + "name": "confirmation_message", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "_locale": { + "name": "_locale", + "type": "_locales", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "forms_locales__parent_id_forms_id_fk": { + "name": "forms_locales__parent_id_forms_id_fk", + "tableFrom": "forms_locales", + "tableTo": "forms", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "forms_locales_locale_parent_id_unique": { + "name": "forms_locales_locale_parent_id_unique", + "nullsNotDistinct": false, + "columns": [ + "_locale", + "_parent_id" + ] + } + } + }, + "form_submissions_submission_data": { + "name": "form_submissions_submission_data", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "field": { + "name": "field", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "form_submissions_submission_data_order_idx": { + "name": "form_submissions_submission_data_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "form_submissions_submission_data_parent_id_idx": { + "name": "form_submissions_submission_data_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "form_submissions_submission_data__parent_id_form_submissions_id_fk": { + "name": "form_submissions_submission_data__parent_id_form_submissions_id_fk", + "tableFrom": "form_submissions_submission_data", + "tableTo": "form_submissions", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "form_submissions": { + "name": "form_submissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "form_submissions_created_at_idx": { + "name": "form_submissions_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "form_submissions_rels": { + "name": "form_submissions_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "forms_id": { + "name": "forms_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "form_submissions_rels_order_idx": { + "name": "form_submissions_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "form_submissions_rels_parent_idx": { + "name": "form_submissions_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "form_submissions_rels_path_idx": { + "name": "form_submissions_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "form_submissions_rels_parent_id_form_submissions_id_fk": { + "name": "form_submissions_rels_parent_id_form_submissions_id_fk", + "tableFrom": "form_submissions_rels", + "tableTo": "form_submissions", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "form_submissions_rels_forms_id_forms_id_fk": { + "name": "form_submissions_rels_forms_id_forms_id_fk", + "tableFrom": "form_submissions_rels", + "tableTo": "forms", + "columnsFrom": [ + "forms_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "payload_preferences": { + "name": "payload_preferences", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "payload_preferences_key_idx": { + "name": "payload_preferences_key_idx", + "columns": [ + "key" + ], + "isUnique": false + }, + "payload_preferences_created_at_idx": { + "name": "payload_preferences_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "payload_preferences_rels": { + "name": "payload_preferences_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "admins_id": { + "name": "admins_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "users_id": { + "name": "users_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "supervisors_id": { + "name": "supervisors_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "payload_preferences_rels_order_idx": { + "name": "payload_preferences_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "payload_preferences_rels_parent_idx": { + "name": "payload_preferences_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "payload_preferences_rels_path_idx": { + "name": "payload_preferences_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "payload_preferences_rels_parent_id_payload_preferences_id_fk": { + "name": "payload_preferences_rels_parent_id_payload_preferences_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "payload_preferences", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_admins_id_admins_id_fk": { + "name": "payload_preferences_rels_admins_id_admins_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "admins", + "columnsFrom": [ + "admins_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_users_id_users_id_fk": { + "name": "payload_preferences_rels_users_id_users_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "users", + "columnsFrom": [ + "users_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "payload_preferences_rels_supervisors_id_supervisors_id_fk": { + "name": "payload_preferences_rels_supervisors_id_supervisors_id_fk", + "tableFrom": "payload_preferences_rels", + "tableTo": "supervisors", + "columnsFrom": [ + "supervisors_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "payload_migrations": { + "name": "payload_migrations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "batch": { + "name": "batch", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "payload_migrations_created_at_idx": { + "name": "payload_migrations_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "quick_access_items": { + "name": "quick_access_items", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + } + }, + "indexes": { + "quick_access_items_order_idx": { + "name": "quick_access_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "quick_access_items_parent_id_idx": { + "name": "quick_access_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "quick_access_items__parent_id_quick_access_id_fk": { + "name": "quick_access_items__parent_id_quick_access_id_fk", + "tableFrom": "quick_access_items", + "tableTo": "quick_access", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "quick_access": { + "name": "quick_access", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "quick_access_rels": { + "name": "quick_access_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "partners_id": { + "name": "partners_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "quick_access_rels_order_idx": { + "name": "quick_access_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "quick_access_rels_parent_idx": { + "name": "quick_access_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "quick_access_rels_path_idx": { + "name": "quick_access_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "quick_access_rels_parent_id_quick_access_id_fk": { + "name": "quick_access_rels_parent_id_quick_access_id_fk", + "tableFrom": "quick_access_rels", + "tableTo": "quick_access", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "quick_access_rels_partners_id_partners_id_fk": { + "name": "quick_access_rels_partners_id_partners_id_fk", + "tableFrom": "quick_access_rels", + "tableTo": "partners", + "columnsFrom": [ + "partners_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "quick_access_rels_offers_id_offers_id_fk": { + "name": "quick_access_rels_offers_id_offers_id_fk", + "tableFrom": "quick_access_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_partners_items": { + "name": "landing_partners_items", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + } + }, + "indexes": { + "landing_partners_items_order_idx": { + "name": "landing_partners_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "landing_partners_items_parent_id_idx": { + "name": "landing_partners_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "landing_partners_items__parent_id_landing_partners_id_fk": { + "name": "landing_partners_items__parent_id_landing_partners_id_fk", + "tableFrom": "landing_partners_items", + "tableTo": "landing_partners", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_partners": { + "name": "landing_partners", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_partners_rels": { + "name": "landing_partners_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "partners_id": { + "name": "partners_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "landing_partners_rels_order_idx": { + "name": "landing_partners_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "landing_partners_rels_parent_idx": { + "name": "landing_partners_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "landing_partners_rels_path_idx": { + "name": "landing_partners_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "landing_partners_rels_parent_id_landing_partners_id_fk": { + "name": "landing_partners_rels_parent_id_landing_partners_id_fk", + "tableFrom": "landing_partners_rels", + "tableTo": "landing_partners", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "landing_partners_rels_partners_id_partners_id_fk": { + "name": "landing_partners_rels_partners_id_partners_id_fk", + "tableFrom": "landing_partners_rels", + "tableTo": "partners", + "columnsFrom": [ + "partners_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_f_a_q_items": { + "name": "landing_f_a_q_items", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "varchar", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "landing_f_a_q_items_order_idx": { + "name": "landing_f_a_q_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "landing_f_a_q_items_parent_id_idx": { + "name": "landing_f_a_q_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "landing_f_a_q_items__parent_id_landing_f_a_q_id_fk": { + "name": "landing_f_a_q_items__parent_id_landing_f_a_q_id_fk", + "tableFrom": "landing_f_a_q_items", + "tableTo": "landing_f_a_q", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "landing_f_a_q": { + "name": "landing_f_a_q", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "new_category_items": { + "name": "new_category_items", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + } + }, + "indexes": { + "new_category_items_order_idx": { + "name": "new_category_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "new_category_items_parent_id_idx": { + "name": "new_category_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "new_category_items__parent_id_new_category_id_fk": { + "name": "new_category_items__parent_id_new_category_id_fk", + "tableFrom": "new_category_items", + "tableTo": "new_category", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "new_category": { + "name": "new_category", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "new_category_rels": { + "name": "new_category_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "media_id": { + "name": "media_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "offers_id": { + "name": "offers_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "new_category_rels_order_idx": { + "name": "new_category_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "new_category_rels_parent_idx": { + "name": "new_category_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "new_category_rels_path_idx": { + "name": "new_category_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "new_category_rels_parent_id_new_category_id_fk": { + "name": "new_category_rels_parent_id_new_category_id_fk", + "tableFrom": "new_category_rels", + "tableTo": "new_category", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "new_category_rels_media_id_media_id_fk": { + "name": "new_category_rels_media_id_media_id_fk", + "tableFrom": "new_category_rels", + "tableTo": "media", + "columnsFrom": [ + "media_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "new_category_rels_offers_id_offers_id_fk": { + "name": "new_category_rels_offers_id_offers_id_fk", + "tableFrom": "new_category_rels", + "tableTo": "offers", + "columnsFrom": [ + "offers_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_list_items": { + "name": "categories_list_items", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + } + }, + "indexes": { + "categories_list_items_order_idx": { + "name": "categories_list_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "categories_list_items_parent_id_idx": { + "name": "categories_list_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "categories_list_items__parent_id_categories_list_id_fk": { + "name": "categories_list_items__parent_id_categories_list_id_fk", + "tableFrom": "categories_list_items", + "tableTo": "categories_list", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_list": { + "name": "categories_list", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "categories_list_rels": { + "name": "categories_list_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "categories_id": { + "name": "categories_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "categories_list_rels_order_idx": { + "name": "categories_list_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "categories_list_rels_parent_idx": { + "name": "categories_list_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "categories_list_rels_path_idx": { + "name": "categories_list_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "categories_list_rels_parent_id_categories_list_id_fk": { + "name": "categories_list_rels_parent_id_categories_list_id_fk", + "tableFrom": "categories_list_rels", + "tableTo": "categories_list", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "categories_list_rels_categories_id_categories_id_fk": { + "name": "categories_list_rels_categories_id_categories_id_fk", + "tableFrom": "categories_list_rels", + "tableTo": "categories", + "columnsFrom": [ + "categories_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_list_items": { + "name": "tags_list_items", + "schema": "", + "columns": { + "_order": { + "name": "_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "_parent_id": { + "name": "_parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + } + }, + "indexes": { + "tags_list_items_order_idx": { + "name": "tags_list_items_order_idx", + "columns": [ + "_order" + ], + "isUnique": false + }, + "tags_list_items_parent_id_idx": { + "name": "tags_list_items_parent_id_idx", + "columns": [ + "_parent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "tags_list_items__parent_id_tags_list_id_fk": { + "name": "tags_list_items__parent_id_tags_list_id_fk", + "tableFrom": "tags_list_items", + "tableTo": "tags_list", + "columnsFrom": [ + "_parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_list": { + "name": "tags_list", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3) with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "tags_list_rels": { + "name": "tags_list_rels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order": { + "name": "order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "parent_id": { + "name": "parent_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "tags_id": { + "name": "tags_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "tags_list_rels_order_idx": { + "name": "tags_list_rels_order_idx", + "columns": [ + "order" + ], + "isUnique": false + }, + "tags_list_rels_parent_idx": { + "name": "tags_list_rels_parent_idx", + "columns": [ + "parent_id" + ], + "isUnique": false + }, + "tags_list_rels_path_idx": { + "name": "tags_list_rels_path_idx", + "columns": [ + "path" + ], + "isUnique": false + } + }, + "foreignKeys": { + "tags_list_rels_parent_id_tags_list_id_fk": { + "name": "tags_list_rels_parent_id_tags_list_id_fk", + "tableFrom": "tags_list_rels", + "tableTo": "tags_list", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_list_rels_tags_id_tags_id_fk": { + "name": "tags_list_rels_tags_id_tags_id_fk", + "tableFrom": "tags_list_rels", + "tableTo": "tags", + "columnsFrom": [ + "tags_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "_locales": { + "name": "_locales", + "values": { + "fr": "fr" + } + }, + "enum_users_civility": { + "name": "enum_users_civility", + "values": { + "man": "man", + "woman": "woman" + } + }, + "enum_users_cej_from": { + "name": "enum_users_cej_from", + "values": { + "franceTravail": "franceTravail", + "missionLocale": "missionLocale", + "serviceCivique": "serviceCivique", + "ecole2ndeChance": "ecole2ndeChance", + "epide": "epide" + } + }, + "enum_users_time_at_c_e_j": { + "name": "enum_users_time_at_c_e_j", + "values": { + "started": "started", + "lessThan3Months": "lessThan3Months", + "moreThan3Months": "moreThan3Months" + } + }, + "enum_users_has_a_job_idea": { + "name": "enum_users_has_a_job_idea", + "values": { + "yes": "yes", + "no": "no" + } + }, + "enum_users_status_image": { + "name": "enum_users_status_image", + "values": { + "pending": "pending", + "approved": "approved" + } + }, + "enum_users_notification_status": { + "name": "enum_users_notification_status", + "values": { + "enabled": "enabled", + "disabled": "disabled" + } + }, + "enum_supervisors_kind": { + "name": "enum_supervisors_kind", + "values": { + "ML": "ML", + "SC": "SC", + "FT": "FT" + } + }, + "enum_permissions_supervisor_kind": { + "name": "enum_permissions_supervisor_kind", + "values": { + "ML": "ML", + "SC": "SC", + "FT": "FT" + } + }, + "enum_offers_source": { + "name": "enum_offers_source", + "values": { + "cje": "cje", + "obiz": "obiz" + } + }, + "enum_offers_barcode_format": { + "name": "enum_offers_barcode_format", + "values": { + "CODE39": "CODE39", + "EAN13": "EAN13", + "ITF14": "ITF14", + "MSI": "MSI", + "pharmacode": "pharmacode", + "codabar": "codabar", + "upc": "upc" + } + }, + "enum_offers_articles_kind": { + "name": "enum_offers_articles_kind", + "values": { + "variable_price": "variable_price", + "fixed_price": "fixed_price" + } + }, + "enum_orders_status": { + "name": "enum_orders_status", + "values": { + "init": "init", + "awaiting_payment": "awaiting_payment", + "payment_completed": "payment_completed", + "delivered": "delivered", + "archived": "archived" + } + }, + "enum_forms_confirmation_type": { + "name": "enum_forms_confirmation_type", + "values": { + "message": "message", + "redirect": "redirect" + } + } + }, + "schemas": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} \ No newline at end of file diff --git a/webapp/src/payload/migrations/20241129_102054.ts b/webapp/src/payload/migrations/20241129_102054.ts new file mode 100644 index 00000000..2ebd0069 --- /dev/null +++ b/webapp/src/payload/migrations/20241129_102054.ts @@ -0,0 +1,17 @@ +import { MigrateUpArgs, MigrateDownArgs } from "@payloadcms/db-postgres"; +import { sql } from "drizzle-orm"; + +export async function up({ payload }: MigrateUpArgs): Promise { + await payload.db.drizzle.execute(sql` + ALTER TABLE "offers_articles" ADD COLUMN "obiz_id" text; + + UPDATE "offers_articles" + SET "obiz_id" = CAST("obiz_json"->>'articles_id' AS text); + `); +} + +export async function down({ payload }: MigrateDownArgs): Promise { + await payload.db.drizzle.execute(sql` + ALTER TABLE "offers_articles" DROP COLUMN IF EXISTS "obiz_id"; + `); +} \ No newline at end of file diff --git a/webapp/src/payload/payload-types.ts b/webapp/src/payload/payload-types.ts index f5d334c6..da49ad3b 100644 --- a/webapp/src/payload/payload-types.ts +++ b/webapp/src/payload/payload-types.ts @@ -260,6 +260,7 @@ export interface Offer { | null; articles?: | { + obiz_id?: string | null; available: boolean; image?: number | Media | null; name: string; @@ -414,93 +415,24 @@ export interface Form { | { name: string; label?: string | null; - width?: number | null; required?: boolean | null; - defaultValue?: boolean | null; - id?: string | null; - blockName?: string | null; - blockType: "checkbox"; - } - | { - name: string; - label?: string | null; - width?: number | null; - required?: boolean | null; - id?: string | null; - blockName?: string | null; - blockType: "country"; - } - | { - name: string; - label?: string | null; - width?: number | null; - required?: boolean | null; - id?: string | null; - blockName?: string | null; - blockType: "email"; - } - | { - message?: + min?: number | null; + max?: number | null; + textLegend?: | { - [k: string]: unknown; - }[] - | null; - id?: string | null; - blockName?: string | null; - blockType: "message"; - } - | { - name: string; - label?: string | null; - width?: number | null; - defaultValue?: number | null; - required?: boolean | null; - id?: string | null; - blockName?: string | null; - blockType: "number"; - } - | { - name: string; - label?: string | null; - width?: number | null; - defaultValue?: string | null; - options?: - | { - label: string; - value: string; + label?: string | null; id?: string | null; }[] | null; - required?: boolean | null; id?: string | null; blockName?: string | null; - blockType: "select"; - } - | { - name: string; - label?: string | null; - width?: number | null; - required?: boolean | null; - id?: string | null; - blockName?: string | null; - blockType: "state"; - } - | { - name: string; - label?: string | null; - width?: number | null; - defaultValue?: string | null; - required?: boolean | null; - id?: string | null; - blockName?: string | null; - blockType: "text"; + blockType: "country"; } | { name: string; label?: string | null; - width?: number | null; - defaultValue?: string | null; required?: boolean | null; + placeholder?: string | null; id?: string | null; blockName?: string | null; blockType: "textarea"; diff --git a/webapp/src/server/api/routers/offer.ts b/webapp/src/server/api/routers/offer.ts index d1f550f2..c15d627f 100644 --- a/webapp/src/server/api/routers/offer.ts +++ b/webapp/src/server/api/routers/offer.ts @@ -605,4 +605,74 @@ export const offerRouter = createTRPCRouter({ updated_offers, }; }), + + synchronizeObizOffer: publicProcedure + .input( + z.object({ + article_id: z.string(), + }) + ) + .mutation(async ({ ctx, input }) => { + const { article_id } = input; + + const offers = await ctx.payload.find({ + collection: "offers", + where: { + "articles.obiz_id": { equals: article_id }, + }, + depth: 0, + }); + let offer = offers.docs[0]; + + if (!offer) { + throw new TRPCError({ + code: "NOT_FOUND", + message: `Offer for this article not found.`, + }); + } + + try { + let updateArticles = false; + const [resultGetArticle] = await ctx.soapObizClient.GET_ARTICLEAsync({ + partenaire_id: process.env.OBIZ_PARTNER_ID, + articles_id: article_id, + }); + + const article_actif = + resultGetArticle?.GET_ARTICLEResult?.diffgram?.NewDataSet?.Articles + ?.articles_actif === "true"; + + if (article_actif !== undefined) { + offer.articles = (offer.articles || []).map((article) => { + if ( + article.obiz_id === article_id && + article.available !== article_actif + ) { + article.available = article_actif; + updateArticles = true; + } + return article; + }); + + if (updateArticles) { + offer = await ctx.payload.update({ + collection: "offers", + id: offer.id, + data: { + articles: (offer.articles as any) || [], + }, + depth: 0, + }); + } + } + + return { offer, updateArticles, article_actif }; + } catch (error) { + console.log(error); + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: `An error occurred while synchronizing the offer with article ${article_id}`, + }); + } + }), });