diff --git a/webapp/src/pages/dashboard/test-sync.tsx b/webapp/src/pages/dashboard/test-sync.tsx new file mode 100644 index 00000000..4650dc29 --- /dev/null +++ b/webapp/src/pages/dashboard/test-sync.tsx @@ -0,0 +1,23 @@ +import { Button, Center } from "@chakra-ui/react"; +import { api } from "~/utils/api"; + +export default function TextSync() { + const { mutateAsync: mutateOrderSync } = + api.order.synchronizeOrder.useMutation({}); + + return ( +
+ +
+ ); +} diff --git a/webapp/src/payload/collections/Order.ts b/webapp/src/payload/collections/Order.ts index c80777c8..3d3fd8f1 100644 --- a/webapp/src/payload/collections/Order.ts +++ b/webapp/src/payload/collections/Order.ts @@ -37,9 +37,19 @@ export const Orders: CollectionConfig = { { label: "En attente de paiement", value: "awaiting_payment" }, { label: "Payée", value: "payment_completed" }, { label: "Livrée", value: "delivered" }, + { label: "Archivée", value: "archived" }, ], required: true, }, + { + name: "obiz_status", + type: "text", + label: "État Obiz", + admin: { + condition: (_, siblingData) => + !!siblingData.status && siblingData.status === "archived", + }, + }, { name: "payment_url", type: "text", diff --git a/webapp/src/payload/migrations/20241106_103729.json b/webapp/src/payload/migrations/20241106_103729.json new file mode 100644 index 00000000..4416241a --- /dev/null +++ b/webapp/src/payload/migrations/20241106_103729.json @@ -0,0 +1,4144 @@ +{ + "id": "20e3317f-9705-4f4d-8239-a7c646c945a5", + "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": {} + }, + "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": {} + }, + "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": {} + }, + "media": { + "name": "media", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "alt": { + "name": "alt", + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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 + } + }, + "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 + }, + "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 + }, + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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 + } + }, + "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 + }, + "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_number_idx": { + "name": "orders_number_idx", + "columns": [ + "number" + ], + "isUnique": true + }, + "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 + } + }, + "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" + } + }, + "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": { + "awaiting_payment": "awaiting_payment", + "payment_completed": "payment_completed", + "delivered": "delivered", + "archived": "archived" + } + } + }, + "schemas": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} \ No newline at end of file diff --git a/webapp/src/payload/migrations/20241106_103729.ts b/webapp/src/payload/migrations/20241106_103729.ts new file mode 100644 index 00000000..7422dc19 --- /dev/null +++ b/webapp/src/payload/migrations/20241106_103729.ts @@ -0,0 +1,13 @@ +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 TYPE "enum_orders_status" ADD VALUE 'archived';`); + +}; + +export async function down({ payload }: MigrateDownArgs): Promise { +// Migration code +}; diff --git a/webapp/src/payload/migrations/20241106_104233.json b/webapp/src/payload/migrations/20241106_104233.json new file mode 100644 index 00000000..f5f5299d --- /dev/null +++ b/webapp/src/payload/migrations/20241106_104233.json @@ -0,0 +1,4150 @@ +{ + "id": "134de294-b671-4bff-b320-a75e459535d0", + "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": {} + }, + "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": {} + }, + "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": {} + }, + "media": { + "name": "media", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "alt": { + "name": "alt", + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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 + } + }, + "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 + }, + "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 + }, + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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": {} + }, + "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 + } + }, + "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_number_idx": { + "name": "orders_number_idx", + "columns": [ + "number" + ], + "isUnique": true + }, + "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 + } + }, + "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" + } + }, + "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": { + "awaiting_payment": "awaiting_payment", + "payment_completed": "payment_completed", + "delivered": "delivered", + "archived": "archived" + } + } + }, + "schemas": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} \ No newline at end of file diff --git a/webapp/src/payload/migrations/20241106_104233.ts b/webapp/src/payload/migrations/20241106_104233.ts new file mode 100644 index 00000000..31eaa6ce --- /dev/null +++ b/webapp/src/payload/migrations/20241106_104233.ts @@ -0,0 +1,16 @@ +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 "orders" ADD COLUMN "obiz_status" varchar;`); + +}; + +export async function down({ payload }: MigrateDownArgs): Promise { +await payload.db.drizzle.execute(sql` + +ALTER TABLE "orders" DROP COLUMN IF EXISTS "obiz_status";`); + +}; diff --git a/webapp/src/payload/payload-types.ts b/webapp/src/payload/payload-types.ts index 28799598..1ee0d761 100644 --- a/webapp/src/payload/payload-types.ts +++ b/webapp/src/payload/payload-types.ts @@ -364,7 +364,8 @@ export interface Order { id: number; number: number; user: number | User; - status: "awaiting_payment" | "payment_completed" | "delivered"; + status: "awaiting_payment" | "payment_completed" | "delivered" | "archived"; + obiz_status?: string | null; payment_url?: string | null; articles?: | { diff --git a/webapp/src/server/api/routers/order.ts b/webapp/src/server/api/routers/order.ts index 2e752be4..ab400be3 100644 --- a/webapp/src/server/api/routers/order.ts +++ b/webapp/src/server/api/routers/order.ts @@ -106,4 +106,86 @@ export const orderRouter = createTRPCRouter({ }); } }), + + synchronizeOrder: userProtectedProcedure + .input( + z.object({ + order_id: z.number(), + }) + ) + .mutation(async ({ ctx, input }) => { + const { order_id } = input; + + let order = await ctx.payload.findByID({ + collection: "orders", + id: order_id, + depth: 0, + }); + + if (order.user !== ctx.session.id) { + throw new TRPCError({ + code: "FORBIDDEN", + message: `Your are not able to synchronize this order`, + }); + } + + try { + const [resultOrderStatus] = + await ctx.soapObizClient.ETATS_COMMANDES_ARRAYAsync({ + CE_ID: process.env.OBIZ_PARTNER_ID, + TABLE_COMMANDES: { + string: [order.number], + }, + }); + const resultOrderStatusObject = + resultOrderStatus.ETATS_COMMANDES_ARRAYResult.diffgram.NewDataSet + .Commande; + + let newStatus = order.status; + switch (resultOrderStatusObject.etats_statut) { + case "NON FINALISEE": + case "EN ATTENTE": + newStatus = "awaiting_payment"; + break; + + case "PREPARATION": + newStatus = "payment_completed"; + break; + + case "ENVOYEE": + case "CONFIRMEE": + newStatus = "delivered"; + break; + + case "ANNULEE": + case "BLOQUEE": + case "ERREUR": + case "TEST": + case "RESTOCKING": + newStatus = "archived"; + break; + } + + if (newStatus !== order.status) { + order = await ctx.payload.update({ + id: order_id, + collection: "orders", + data: { + status: newStatus, + obiz_status: resultOrderStatusObject.etats_statut, + }, + }); + } + + return { data: order }; + } catch (error) { + console.error(error); + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: "An error occurred while synchronizing the order", + }); + } + + return {}; + }), });