From e907cf2593c482a4fcf6e0564cdf0824767b675b Mon Sep 17 00:00:00 2001 From: felipe torres Date: Tue, 27 Aug 2024 12:44:59 -0400 Subject: [PATCH] Adding images New Migration --- drizzle/migrations/0029_tearful_roulette.sql | 45 + .../migrations/0030_needy_bill_hollister.sql | 1 + drizzle/migrations/meta/0029_snapshot.json | 3136 +++++++++++++++++ drizzle/migrations/meta/0030_snapshot.json | 3127 ++++++++++++++++ drizzle/migrations/meta/_journal.json | 14 + src/datasources/db/eventsTags.ts | 4 +- src/datasources/db/galleries.ts | 32 + src/datasources/db/images.ts | 48 + src/datasources/db/schema.ts | 4 + src/generated/schema.gql | 27 + src/generated/types.ts | 25 + src/schema/events/types.ts | 12 + src/schema/gallery/types.ts | 54 + src/schema/image/types.ts | 46 + src/schema/index.ts | 4 +- 15 files changed, 6576 insertions(+), 3 deletions(-) create mode 100644 drizzle/migrations/0029_tearful_roulette.sql create mode 100644 drizzle/migrations/0030_needy_bill_hollister.sql create mode 100644 drizzle/migrations/meta/0029_snapshot.json create mode 100644 drizzle/migrations/meta/0030_snapshot.json create mode 100644 src/datasources/db/galleries.ts create mode 100644 src/datasources/db/images.ts create mode 100644 src/schema/gallery/types.ts create mode 100644 src/schema/image/types.ts diff --git a/drizzle/migrations/0029_tearful_roulette.sql b/drizzle/migrations/0029_tearful_roulette.sql new file mode 100644 index 00000000..0e81881f --- /dev/null +++ b/drizzle/migrations/0029_tearful_roulette.sql @@ -0,0 +1,45 @@ +CREATE TABLE IF NOT EXISTS "galleries" ( + "id" uuid DEFAULT gen_random_uuid() NOT NULL, + "name" text NOT NULL, + "description" text, + "event_id" uuid, + "slug" text NOT NULL, + "created_at" timestamp (6) DEFAULT now() NOT NULL, + "updated_at" timestamp (6), + "deleted_at" timestamp (6), + CONSTRAINT "galleries_id_unique" UNIQUE("id"), + CONSTRAINT "galleries_slug_unique" UNIQUE("slug") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "images" ( + "id" uuid DEFAULT gen_random_uuid() NOT NULL, + "image_url" text NOT NULL, + "hosting" text NOT NULL, + "gallery_id" uuid, + "tags" text[] DEFAULT ARRAY[]::text[] NOT NULL, + "created_at" timestamp (6) DEFAULT now() NOT NULL, + "updated_at" timestamp (6), + "deleted_at" timestamp (6), + CONSTRAINT "images_id_unique" UNIQUE("id") +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "galleries" ADD CONSTRAINT "galleries_event_id_events_id_fk" FOREIGN KEY ("event_id") REFERENCES "public"."events"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "galleries" ADD CONSTRAINT "galleries_slug_tags_id_fk" FOREIGN KEY ("slug") REFERENCES "public"."tags"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "images" ADD CONSTRAINT "images_gallery_id_galleries_id_fk" FOREIGN KEY ("gallery_id") REFERENCES "public"."galleries"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "gallery_slug_index" ON "galleries" USING btree ("slug");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "images_tags_index" ON "images" USING btree ("tags"); \ No newline at end of file diff --git a/drizzle/migrations/0030_needy_bill_hollister.sql b/drizzle/migrations/0030_needy_bill_hollister.sql new file mode 100644 index 00000000..0a31e69c --- /dev/null +++ b/drizzle/migrations/0030_needy_bill_hollister.sql @@ -0,0 +1 @@ +ALTER TABLE "galleries" DROP CONSTRAINT "galleries_slug_tags_id_fk"; diff --git a/drizzle/migrations/meta/0029_snapshot.json b/drizzle/migrations/meta/0029_snapshot.json new file mode 100644 index 00000000..853435b7 --- /dev/null +++ b/drizzle/migrations/meta/0029_snapshot.json @@ -0,0 +1,3136 @@ +{ + "id": "c470a52c-2759-4700-96e6-044be91f7ab9", + "prevId": "cd365ea7-9b09-42bc-9d69-0538fd83a948", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.allowed_currencies": { + "name": "allowed_currencies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payment_methods": { + "name": "payment_methods", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "allowed_currencies_currency_unique": { + "name": "allowed_currencies_currency_unique", + "nullsNotDistinct": false, + "columns": ["currency"] + } + } + }, + "public.communities": { + "name": "communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logo_image_sanity_ref": { + "name": "logo_image_sanity_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banner_image_sanity_ref": { + "name": "banner_image_sanity_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_success_redirect_url": { + "name": "payment_success_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_cancel_redirect_url": { + "name": "payment_cancel_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inactive'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "communities_slug_unique": { + "name": "communities_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.confirmation_token": { + "name": "confirmation_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "source_id": { + "name": "source_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'pending'" + }, + "valid_until": { + "name": "valid_until", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "confirmation_date": { + "name": "confirmation_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "confirmation_token_user_id_users_id_fk": { + "name": "confirmation_token_user_id_users_id_fk", + "tableFrom": "confirmation_token", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "confirmation_token_token_unique": { + "name": "confirmation_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + } + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inactive'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unlisted'" + }, + "start_date_time": { + "name": "start_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end_date_time": { + "name": "end_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geo_latitude": { + "name": "geo_latitude", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geo_longitude": { + "name": "geo_longitude", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geo_address_json": { + "name": "geo_address_json", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_descriptive_name": { + "name": "address_descriptive_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "meeting_url": { + "name": "meeting_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sanity_event_id": { + "name": "sanity_event_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banner_image_sanity_ref": { + "name": "banner_image_sanity_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logo_id": { + "name": "logo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "events_name_unique": { + "name": "events_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.events_communities": { + "name": "events_communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "community_id": { + "name": "community_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "payment_success_redirect_url": { + "name": "payment_success_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_cancel_redirect_url": { + "name": "payment_cancel_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_communities_event_id_events_id_fk": { + "name": "events_communities_event_id_events_id_fk", + "tableFrom": "events_communities", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_communities_community_id_communities_id_fk": { + "name": "events_communities_community_id_communities_id_fk", + "tableFrom": "events_communities", + "tableTo": "communities", + "columnsFrom": ["community_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "events_communities_event_id_community_id_pk": { + "name": "events_communities_event_id_community_id_pk", + "columns": ["event_id", "community_id"] + } + }, + "uniqueConstraints": { + "events_communities_id_unique": { + "name": "events_communities_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.events_tags": { + "name": "events_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag_id": { + "name": "tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_tags_event_id_events_id_fk": { + "name": "events_tags_event_id_events_id_fk", + "tableFrom": "events_tags", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_tags_tag_id_tags_id_fk": { + "name": "events_tags_tag_id_tags_id_fk", + "tableFrom": "events_tags", + "tableTo": "tags", + "columnsFrom": ["tag_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "events_tags_event_id_tag_id_pk": { + "name": "events_tags_event_id_tag_id_pk", + "columns": ["event_id", "tag_id"] + } + }, + "uniqueConstraints": { + "events_tags_id_unique": { + "name": "events_tags_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.events_users": { + "name": "events_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'member'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_users_event_id_events_id_fk": { + "name": "events_users_event_id_events_id_fk", + "tableFrom": "events_users", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_users_user_id_users_id_fk": { + "name": "events_users_user_id_users_id_fk", + "tableFrom": "events_users", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.galleries": { + "name": "galleries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "gallery_slug_index": { + "name": "gallery_slug_index", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "galleries_event_id_events_id_fk": { + "name": "galleries_event_id_events_id_fk", + "tableFrom": "galleries", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "galleries_slug_tags_id_fk": { + "name": "galleries_slug_tags_id_fk", + "tableFrom": "galleries", + "tableTo": "tags", + "columnsFrom": ["slug"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "galleries_id_unique": { + "name": "galleries_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + }, + "galleries_slug_unique": { + "name": "galleries_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.images": { + "name": "images", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hosting": { + "name": "hosting", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gallery_id": { + "name": "gallery_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::text[]" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "images_tags_index": { + "name": "images_tags_index", + "columns": [ + { + "expression": "tags", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "images_gallery_id_galleries_id_fk": { + "name": "images_gallery_id_galleries_id_fk", + "tableFrom": "images", + "tableTo": "galleries", + "columnsFrom": ["gallery_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "images_id_unique": { + "name": "images_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.payments_logs": { + "name": "payments_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_product_reference": { + "name": "external_product_reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "platform": { + "name": "platform", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "transaction_amount": { + "name": "transaction_amount", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "external_creation_date": { + "name": "external_creation_date", + "type": "timestamp (6) with time zone", + "primaryKey": false, + "notNull": false + }, + "currency_id": { + "name": "currency_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "original_response_blob": { + "name": "original_response_blob", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "payments_logs_external_id_platform_unique": { + "name": "payments_logs_external_id_platform_unique", + "nullsNotDistinct": false, + "columns": ["external_id", "platform"] + } + } + }, + "public.prices": { + "name": "prices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "price": { + "name": "price", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "currency_id": { + "name": "currency_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "prices_currency_id_allowed_currencies_id_fk": { + "name": "prices_currency_id_allowed_currencies_id_fk", + "tableFrom": "prices", + "tableTo": "allowed_currencies", + "columnsFrom": ["currency_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.purchase_orders": { + "name": "purchase_orders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idempotency_uuid_key": { + "name": "idempotency_uuid_key", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "payment_platform": { + "name": "payment_platform", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "currency_id": { + "name": "currency_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payment_platform_payment_link": { + "name": "payment_platform_payment_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_platform_expiration_date": { + "name": "payment_platform_expiration_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "payment_platform_reference_id": { + "name": "payment_platform_reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_platform_status": { + "name": "payment_platform_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_platform_metadata": { + "name": "payment_platform_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "purchase_order_payment_status": { + "name": "purchase_order_payment_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unpaid'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "purchase_orders_user_id_users_id_fk": { + "name": "purchase_orders_user_id_users_id_fk", + "tableFrom": "purchase_orders", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "purchase_orders_currency_id_allowed_currencies_id_fk": { + "name": "purchase_orders_currency_id_allowed_currencies_id_fk", + "tableFrom": "purchase_orders", + "tableTo": "allowed_currencies", + "columnsFrom": ["currency_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "purchase_orders_idempotency_uuid_key_unique": { + "name": "purchase_orders_idempotency_uuid_key_unique", + "nullsNotDistinct": false, + "columns": ["idempotency_uuid_key"] + } + } + }, + "public.salaries": { + "name": "salaries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "currency_code": { + "name": "currency_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "work_seniority_and_role_id": { + "name": "work_seniority_and_role_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "work_email_id": { + "name": "work_email_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "years_of_experience": { + "name": "years_of_experience", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "gender": { + "name": "gender", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gender_other_text": { + "name": "gender_other_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type_of_employment": { + "name": "type_of_employment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "work_metodology": { + "name": "work_metodology", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "salaries_user_id_users_id_fk": { + "name": "salaries_user_id_users_id_fk", + "tableFrom": "salaries", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "salaries_company_id_companies_id_fk": { + "name": "salaries_company_id_companies_id_fk", + "tableFrom": "salaries", + "tableTo": "companies", + "columnsFrom": ["company_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "salaries_work_seniority_and_role_id_work_seniority_and_role_id_fk": { + "name": "salaries_work_seniority_and_role_id_work_seniority_and_role_id_fk", + "tableFrom": "salaries", + "tableTo": "work_seniority_and_role", + "columnsFrom": ["work_seniority_and_role_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "salaries_work_email_id_work_email_id_fk": { + "name": "salaries_work_email_id_work_email_id_fk", + "tableFrom": "salaries", + "tableTo": "work_email", + "columnsFrom": ["work_email_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.schedule": { + "name": "schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "end_at": { + "name": "end_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_event_id_events_id_fk": { + "name": "schedule_event_id_events_id_fk", + "tableFrom": "schedule", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "schedule_id_unique": { + "name": "schedule_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schedule_id": { + "name": "schedule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "end_at": { + "name": "end_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "sessions_schedule_id_schedule_id_fk": { + "name": "sessions_schedule_id_schedule_id_fk", + "tableFrom": "sessions", + "tableTo": "schedule", + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sessions_id_unique": { + "name": "sessions_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.session_to_speakers": { + "name": "session_to_speakers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "speaker_id": { + "name": "speaker_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_to_speakers_session_id_sessions_id_fk": { + "name": "session_to_speakers_session_id_sessions_id_fk", + "tableFrom": "session_to_speakers", + "tableTo": "sessions", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "session_to_speakers_speaker_id_speakers_id_fk": { + "name": "session_to_speakers_speaker_id_speakers_id_fk", + "tableFrom": "session_to_speakers", + "tableTo": "speakers", + "columnsFrom": ["speaker_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_to_speakers_id_unique": { + "name": "session_to_speakers_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.speakers": { + "name": "speakers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "company": { + "name": "company", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "social_links": { + "name": "social_links", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::text[]" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "speakers_event_id_events_id_fk": { + "name": "speakers_event_id_events_id_fk", + "tableFrom": "speakers", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "speakers_id_unique": { + "name": "speakers_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tags_name_unique": { + "name": "tags_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.tags_communities": { + "name": "tags_communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tag_id": { + "name": "tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "community_id": { + "name": "community_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tags_communities_tag_id_tags_id_fk": { + "name": "tags_communities_tag_id_tags_id_fk", + "tableFrom": "tags_communities", + "tableTo": "tags", + "columnsFrom": ["tag_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tags_communities_community_id_communities_id_fk": { + "name": "tags_communities_community_id_communities_id_fk", + "tableFrom": "tags_communities", + "tableTo": "communities", + "columnsFrom": ["community_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tags_communities_tag_id_community_id_pk": { + "name": "tags_communities_tag_id_community_id_pk", + "columns": ["tag_id", "community_id"] + } + }, + "uniqueConstraints": { + "tags_communities_id_unique": { + "name": "tags_communities_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.teams": { + "name": "teams", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "limit": { + "name": "limit", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 5 + }, + "team_status": { + "name": "team_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'waiting_resolution'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "teams_event_id_events_id_fk": { + "name": "teams_event_id_events_id_fk", + "tableFrom": "teams", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.tickets_prices": { + "name": "tickets_prices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "ticket_id": { + "name": "ticket_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "price_id": { + "name": "price_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tickets_prices_ticket_id_tickets_id_fk": { + "name": "tickets_prices_ticket_id_tickets_id_fk", + "tableFrom": "tickets_prices", + "tableTo": "tickets", + "columnsFrom": ["ticket_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tickets_prices_price_id_prices_id_fk": { + "name": "tickets_prices_price_id_prices_id_fk", + "tableFrom": "tickets_prices", + "tableTo": "prices", + "columnsFrom": ["price_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.tickets": { + "name": "tickets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inactive'" + }, + "tags": { + "name": "tags", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::text[]" + }, + "external_link": { + "name": "external_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_tickets_per_user": { + "name": "max_tickets_per_user", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "image_link": { + "name": "image_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unlisted'" + }, + "start_date_time": { + "name": "start_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end_date_time": { + "name": "end_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requires_approval": { + "name": "requires_approval", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_unlimited": { + "name": "is_unlimited", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_free": { + "name": "is_free", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "stripe_product_id": { + "name": "stripe_product_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mercado_pago_product_id": { + "name": "mercado_pago_product_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tickets_event_id_events_id_fk": { + "name": "tickets_event_id_events_id_fk", + "tableFrom": "tickets", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tickets_name_unique": { + "name": "tickets_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lastName": { + "name": "lastName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gender": { + "name": "gender", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pronouns": { + "name": "pronouns", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'inactive'" + }, + "gender_other_text": { + "name": "gender_other_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isSuperAdmin": { + "name": "isSuperAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "emailVerified": { + "name": "emailVerified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "publicMetadata": { + "name": "publicMetadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_email_index": { + "name": "users_email_index", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "users_name_index": { + "name": "users_name_index", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "users_last_name_index": { + "name": "users_last_name_index", + "columns": [ + { + "expression": "lastName", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "users_username_index": { + "name": "users_username_index", + "columns": [ + { + "expression": "username", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + }, + "users_username_unique": { + "name": "users_username_unique", + "nullsNotDistinct": false, + "columns": ["username"] + } + } + }, + "public.users_communities": { + "name": "users_communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "community_id": { + "name": "community_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'member'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "users_communities_user_id_users_id_fk": { + "name": "users_communities_user_id_users_id_fk", + "tableFrom": "users_communities", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "users_communities_community_id_communities_id_fk": { + "name": "users_communities_community_id_communities_id_fk", + "tableFrom": "users_communities", + "tableTo": "communities", + "columnsFrom": ["community_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_data": { + "name": "user_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "country_of_residence": { + "name": "country_of_residence", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "city": { + "name": "city", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "works_in_organization": { + "name": "works_in_organization", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "organization_name": { + "name": "organization_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role_in_organization": { + "name": "role_in_organization", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rut": { + "name": "rut", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "food_allergies": { + "name": "food_allergies", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "emergency_phone_number": { + "name": "emergency_phone_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_id_index": { + "name": "user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_data_user_id_users_id_fk": { + "name": "user_data_user_id_users_id_fk", + "tableFrom": "user_data", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.users_tags": { + "name": "users_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tag_id": { + "name": "tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "users_tags_tag_id_tags_id_fk": { + "name": "users_tags_tag_id_tags_id_fk", + "tableFrom": "users_tags", + "tableTo": "tags", + "columnsFrom": ["tag_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "users_tags_user_id_users_id_fk": { + "name": "users_tags_user_id_users_id_fk", + "tableFrom": "users_tags", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "users_tags_tag_id_user_id_pk": { + "name": "users_tags_tag_id_user_id_pk", + "columns": ["tag_id", "user_id"] + } + }, + "uniqueConstraints": { + "users_tags_id_unique": { + "name": "users_tags_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.user_teams": { + "name": "user_teams", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'leader'" + }, + "discipline": { + "name": "discipline", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_participation_status": { + "name": "user_participation_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'waiting_resolution'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_teams_user_id_users_id_fk": { + "name": "user_teams_user_id_users_id_fk", + "tableFrom": "user_teams", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_teams_team_id_teams_id_fk": { + "name": "user_teams_team_id_teams_id_fk", + "tableFrom": "user_teams", + "tableTo": "teams", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_tickets": { + "name": "user_tickets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "public_id": { + "name": "public_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ticket_template_id": { + "name": "ticket_template_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "purchase_order_id": { + "name": "purchase_order_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "approval_status": { + "name": "approval_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "redemption_status": { + "name": "redemption_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_tickets_public_id_index": { + "name": "user_tickets_public_id_index", + "columns": [ + { + "expression": "public_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_tickets_user_id_users_id_fk": { + "name": "user_tickets_user_id_users_id_fk", + "tableFrom": "user_tickets", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tickets_ticket_template_id_tickets_id_fk": { + "name": "user_tickets_ticket_template_id_tickets_id_fk", + "tableFrom": "user_tickets", + "tableTo": "tickets", + "columnsFrom": ["ticket_template_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tickets_purchase_order_id_purchase_orders_id_fk": { + "name": "user_tickets_purchase_order_id_purchase_orders_id_fk", + "tableFrom": "user_tickets", + "tableTo": "purchase_orders", + "columnsFrom": ["purchase_order_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_tickets_email_logs": { + "name": "user_tickets_email_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_ticket_id": { + "name": "user_ticket_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "email_type": { + "name": "email_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_tickets_email_logs_email_type_index": { + "name": "user_tickets_email_logs_email_type_index", + "columns": [ + { + "expression": "email_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_tickets_email_logs_user_ticket_id_user_tickets_id_fk": { + "name": "user_tickets_email_logs_user_ticket_id_user_tickets_id_fk", + "tableFrom": "user_tickets_email_logs", + "tableTo": "user_tickets", + "columnsFrom": ["user_ticket_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tickets_email_logs_user_id_users_id_fk": { + "name": "user_tickets_email_logs_user_id_users_id_fk", + "tableFrom": "user_tickets_email_logs", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_tickets_email_logs_id_unique": { + "name": "user_tickets_email_logs_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.work_email": { + "name": "work_email", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "work_email": { + "name": "work_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "confirmation_token_id": { + "name": "confirmation_token_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'pending'" + }, + "confirmation_date": { + "name": "confirmation_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "company_id": { + "name": "company_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "work_email_user_id_users_id_fk": { + "name": "work_email_user_id_users_id_fk", + "tableFrom": "work_email", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "work_email_confirmation_token_id_confirmation_token_id_fk": { + "name": "work_email_confirmation_token_id_confirmation_token_id_fk", + "tableFrom": "work_email", + "tableTo": "confirmation_token", + "columnsFrom": ["confirmation_token_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "work_email_company_id_companies_id_fk": { + "name": "work_email_company_id_companies_id_fk", + "tableFrom": "work_email", + "tableTo": "companies", + "columnsFrom": ["company_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.work_role": { + "name": "work_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.work_seniority": { + "name": "work_seniority", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.work_seniority_and_role": { + "name": "work_seniority_and_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "work_role_id": { + "name": "work_role_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "work_seniority_id": { + "name": "work_seniority_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "work_seniority_and_role_work_role_id_work_role_id_fk": { + "name": "work_seniority_and_role_work_role_id_work_role_id_fk", + "tableFrom": "work_seniority_and_role", + "tableTo": "work_role", + "columnsFrom": ["work_role_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "work_seniority_and_role_work_seniority_id_work_seniority_id_fk": { + "name": "work_seniority_and_role_work_seniority_id_work_seniority_id_fk", + "tableFrom": "work_seniority_and_role", + "tableTo": "work_seniority", + "columnsFrom": ["work_seniority_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/migrations/meta/0030_snapshot.json b/drizzle/migrations/meta/0030_snapshot.json new file mode 100644 index 00000000..54cd3a06 --- /dev/null +++ b/drizzle/migrations/meta/0030_snapshot.json @@ -0,0 +1,3127 @@ +{ + "id": "4917fc7f-8e63-4862-a924-07516fc14ea2", + "prevId": "c470a52c-2759-4700-96e6-044be91f7ab9", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.allowed_currencies": { + "name": "allowed_currencies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payment_methods": { + "name": "payment_methods", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "allowed_currencies_currency_unique": { + "name": "allowed_currencies_currency_unique", + "nullsNotDistinct": false, + "columns": ["currency"] + } + } + }, + "public.communities": { + "name": "communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logo_image_sanity_ref": { + "name": "logo_image_sanity_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banner_image_sanity_ref": { + "name": "banner_image_sanity_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_success_redirect_url": { + "name": "payment_success_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_cancel_redirect_url": { + "name": "payment_cancel_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inactive'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "communities_slug_unique": { + "name": "communities_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.companies": { + "name": "companies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.confirmation_token": { + "name": "confirmation_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "source_id": { + "name": "source_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'pending'" + }, + "valid_until": { + "name": "valid_until", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "confirmation_date": { + "name": "confirmation_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "confirmation_token_user_id_users_id_fk": { + "name": "confirmation_token_user_id_users_id_fk", + "tableFrom": "confirmation_token", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "confirmation_token_token_unique": { + "name": "confirmation_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + } + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inactive'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unlisted'" + }, + "start_date_time": { + "name": "start_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end_date_time": { + "name": "end_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geo_latitude": { + "name": "geo_latitude", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geo_longitude": { + "name": "geo_longitude", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geo_address_json": { + "name": "geo_address_json", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_descriptive_name": { + "name": "address_descriptive_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "meeting_url": { + "name": "meeting_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sanity_event_id": { + "name": "sanity_event_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banner_image_sanity_ref": { + "name": "banner_image_sanity_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logo_id": { + "name": "logo_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "events_name_unique": { + "name": "events_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.events_communities": { + "name": "events_communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "community_id": { + "name": "community_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "payment_success_redirect_url": { + "name": "payment_success_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_cancel_redirect_url": { + "name": "payment_cancel_redirect_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_communities_event_id_events_id_fk": { + "name": "events_communities_event_id_events_id_fk", + "tableFrom": "events_communities", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_communities_community_id_communities_id_fk": { + "name": "events_communities_community_id_communities_id_fk", + "tableFrom": "events_communities", + "tableTo": "communities", + "columnsFrom": ["community_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "events_communities_event_id_community_id_pk": { + "name": "events_communities_event_id_community_id_pk", + "columns": ["event_id", "community_id"] + } + }, + "uniqueConstraints": { + "events_communities_id_unique": { + "name": "events_communities_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.events_tags": { + "name": "events_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag_id": { + "name": "tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_tags_event_id_events_id_fk": { + "name": "events_tags_event_id_events_id_fk", + "tableFrom": "events_tags", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_tags_tag_id_tags_id_fk": { + "name": "events_tags_tag_id_tags_id_fk", + "tableFrom": "events_tags", + "tableTo": "tags", + "columnsFrom": ["tag_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "events_tags_event_id_tag_id_pk": { + "name": "events_tags_event_id_tag_id_pk", + "columns": ["event_id", "tag_id"] + } + }, + "uniqueConstraints": { + "events_tags_id_unique": { + "name": "events_tags_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.events_users": { + "name": "events_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'member'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_users_event_id_events_id_fk": { + "name": "events_users_event_id_events_id_fk", + "tableFrom": "events_users", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_users_user_id_users_id_fk": { + "name": "events_users_user_id_users_id_fk", + "tableFrom": "events_users", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.galleries": { + "name": "galleries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "gallery_slug_index": { + "name": "gallery_slug_index", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "galleries_event_id_events_id_fk": { + "name": "galleries_event_id_events_id_fk", + "tableFrom": "galleries", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "galleries_id_unique": { + "name": "galleries_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + }, + "galleries_slug_unique": { + "name": "galleries_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.images": { + "name": "images", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hosting": { + "name": "hosting", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gallery_id": { + "name": "gallery_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::text[]" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "images_tags_index": { + "name": "images_tags_index", + "columns": [ + { + "expression": "tags", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "images_gallery_id_galleries_id_fk": { + "name": "images_gallery_id_galleries_id_fk", + "tableFrom": "images", + "tableTo": "galleries", + "columnsFrom": ["gallery_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "images_id_unique": { + "name": "images_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.payments_logs": { + "name": "payments_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "external_product_reference": { + "name": "external_product_reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "platform": { + "name": "platform", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "transaction_amount": { + "name": "transaction_amount", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "external_creation_date": { + "name": "external_creation_date", + "type": "timestamp (6) with time zone", + "primaryKey": false, + "notNull": false + }, + "currency_id": { + "name": "currency_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "original_response_blob": { + "name": "original_response_blob", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "payments_logs_external_id_platform_unique": { + "name": "payments_logs_external_id_platform_unique", + "nullsNotDistinct": false, + "columns": ["external_id", "platform"] + } + } + }, + "public.prices": { + "name": "prices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "price": { + "name": "price", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "currency_id": { + "name": "currency_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "prices_currency_id_allowed_currencies_id_fk": { + "name": "prices_currency_id_allowed_currencies_id_fk", + "tableFrom": "prices", + "tableTo": "allowed_currencies", + "columnsFrom": ["currency_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.purchase_orders": { + "name": "purchase_orders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "idempotency_uuid_key": { + "name": "idempotency_uuid_key", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "payment_platform": { + "name": "payment_platform", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "total_price": { + "name": "total_price", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "currency_id": { + "name": "currency_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payment_platform_payment_link": { + "name": "payment_platform_payment_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_platform_expiration_date": { + "name": "payment_platform_expiration_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "payment_platform_reference_id": { + "name": "payment_platform_reference_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_platform_status": { + "name": "payment_platform_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_platform_metadata": { + "name": "payment_platform_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "purchase_order_payment_status": { + "name": "purchase_order_payment_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unpaid'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "purchase_orders_user_id_users_id_fk": { + "name": "purchase_orders_user_id_users_id_fk", + "tableFrom": "purchase_orders", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "purchase_orders_currency_id_allowed_currencies_id_fk": { + "name": "purchase_orders_currency_id_allowed_currencies_id_fk", + "tableFrom": "purchase_orders", + "tableTo": "allowed_currencies", + "columnsFrom": ["currency_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "purchase_orders_idempotency_uuid_key_unique": { + "name": "purchase_orders_idempotency_uuid_key_unique", + "nullsNotDistinct": false, + "columns": ["idempotency_uuid_key"] + } + } + }, + "public.salaries": { + "name": "salaries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "company_id": { + "name": "company_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "currency_code": { + "name": "currency_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "work_seniority_and_role_id": { + "name": "work_seniority_and_role_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "work_email_id": { + "name": "work_email_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "years_of_experience": { + "name": "years_of_experience", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "gender": { + "name": "gender", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gender_other_text": { + "name": "gender_other_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type_of_employment": { + "name": "type_of_employment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "work_metodology": { + "name": "work_metodology", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "salaries_user_id_users_id_fk": { + "name": "salaries_user_id_users_id_fk", + "tableFrom": "salaries", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "salaries_company_id_companies_id_fk": { + "name": "salaries_company_id_companies_id_fk", + "tableFrom": "salaries", + "tableTo": "companies", + "columnsFrom": ["company_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "salaries_work_seniority_and_role_id_work_seniority_and_role_id_fk": { + "name": "salaries_work_seniority_and_role_id_work_seniority_and_role_id_fk", + "tableFrom": "salaries", + "tableTo": "work_seniority_and_role", + "columnsFrom": ["work_seniority_and_role_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "salaries_work_email_id_work_email_id_fk": { + "name": "salaries_work_email_id_work_email_id_fk", + "tableFrom": "salaries", + "tableTo": "work_email", + "columnsFrom": ["work_email_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.schedule": { + "name": "schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "end_at": { + "name": "end_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "schedule_event_id_events_id_fk": { + "name": "schedule_event_id_events_id_fk", + "tableFrom": "schedule", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "schedule_id_unique": { + "name": "schedule_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schedule_id": { + "name": "schedule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "end_at": { + "name": "end_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "sessions_schedule_id_schedule_id_fk": { + "name": "sessions_schedule_id_schedule_id_fk", + "tableFrom": "sessions", + "tableTo": "schedule", + "columnsFrom": ["schedule_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sessions_id_unique": { + "name": "sessions_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.session_to_speakers": { + "name": "session_to_speakers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "speaker_id": { + "name": "speaker_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_to_speakers_session_id_sessions_id_fk": { + "name": "session_to_speakers_session_id_sessions_id_fk", + "tableFrom": "session_to_speakers", + "tableTo": "sessions", + "columnsFrom": ["session_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "session_to_speakers_speaker_id_speakers_id_fk": { + "name": "session_to_speakers_speaker_id_speakers_id_fk", + "tableFrom": "session_to_speakers", + "tableTo": "speakers", + "columnsFrom": ["speaker_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_to_speakers_id_unique": { + "name": "session_to_speakers_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.speakers": { + "name": "speakers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rol": { + "name": "rol", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "company": { + "name": "company", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "social_links": { + "name": "social_links", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::text[]" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "speakers_event_id_events_id_fk": { + "name": "speakers_event_id_events_id_fk", + "tableFrom": "speakers", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "speakers_id_unique": { + "name": "speakers_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tags_name_unique": { + "name": "tags_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.tags_communities": { + "name": "tags_communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tag_id": { + "name": "tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "community_id": { + "name": "community_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tags_communities_tag_id_tags_id_fk": { + "name": "tags_communities_tag_id_tags_id_fk", + "tableFrom": "tags_communities", + "tableTo": "tags", + "columnsFrom": ["tag_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tags_communities_community_id_communities_id_fk": { + "name": "tags_communities_community_id_communities_id_fk", + "tableFrom": "tags_communities", + "tableTo": "communities", + "columnsFrom": ["community_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "tags_communities_tag_id_community_id_pk": { + "name": "tags_communities_tag_id_community_id_pk", + "columns": ["tag_id", "community_id"] + } + }, + "uniqueConstraints": { + "tags_communities_id_unique": { + "name": "tags_communities_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.teams": { + "name": "teams", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "limit": { + "name": "limit", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 5 + }, + "team_status": { + "name": "team_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'waiting_resolution'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "teams_event_id_events_id_fk": { + "name": "teams_event_id_events_id_fk", + "tableFrom": "teams", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.tickets_prices": { + "name": "tickets_prices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "ticket_id": { + "name": "ticket_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "price_id": { + "name": "price_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tickets_prices_ticket_id_tickets_id_fk": { + "name": "tickets_prices_ticket_id_tickets_id_fk", + "tableFrom": "tickets_prices", + "tableTo": "tickets", + "columnsFrom": ["ticket_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tickets_prices_price_id_prices_id_fk": { + "name": "tickets_prices_price_id_prices_id_fk", + "tableFrom": "tickets_prices", + "tableTo": "prices", + "columnsFrom": ["price_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.tickets": { + "name": "tickets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'inactive'" + }, + "tags": { + "name": "tags", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "ARRAY[]::text[]" + }, + "external_link": { + "name": "external_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_tickets_per_user": { + "name": "max_tickets_per_user", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "image_link": { + "name": "image_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unlisted'" + }, + "start_date_time": { + "name": "start_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "end_date_time": { + "name": "end_date_time", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "requires_approval": { + "name": "requires_approval", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_unlimited": { + "name": "is_unlimited", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_free": { + "name": "is_free", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "stripe_product_id": { + "name": "stripe_product_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mercado_pago_product_id": { + "name": "mercado_pago_product_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tickets_event_id_events_id_fk": { + "name": "tickets_event_id_events_id_fk", + "tableFrom": "tickets", + "tableTo": "events", + "columnsFrom": ["event_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tickets_name_unique": { + "name": "tickets_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lastName": { + "name": "lastName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gender": { + "name": "gender", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "pronouns": { + "name": "pronouns", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'inactive'" + }, + "gender_other_text": { + "name": "gender_other_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isSuperAdmin": { + "name": "isSuperAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "emailVerified": { + "name": "emailVerified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "imageUrl": { + "name": "imageUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "publicMetadata": { + "name": "publicMetadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "users_email_index": { + "name": "users_email_index", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "users_name_index": { + "name": "users_name_index", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "users_last_name_index": { + "name": "users_last_name_index", + "columns": [ + { + "expression": "lastName", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + }, + "users_username_index": { + "name": "users_username_index", + "columns": [ + { + "expression": "username", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + }, + "users_username_unique": { + "name": "users_username_unique", + "nullsNotDistinct": false, + "columns": ["username"] + } + } + }, + "public.users_communities": { + "name": "users_communities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "community_id": { + "name": "community_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'member'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "users_communities_user_id_users_id_fk": { + "name": "users_communities_user_id_users_id_fk", + "tableFrom": "users_communities", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "users_communities_community_id_communities_id_fk": { + "name": "users_communities_community_id_communities_id_fk", + "tableFrom": "users_communities", + "tableTo": "communities", + "columnsFrom": ["community_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_data": { + "name": "user_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "country_of_residence": { + "name": "country_of_residence", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "city": { + "name": "city", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "works_in_organization": { + "name": "works_in_organization", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "organization_name": { + "name": "organization_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role_in_organization": { + "name": "role_in_organization", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rut": { + "name": "rut", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "food_allergies": { + "name": "food_allergies", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "emergency_phone_number": { + "name": "emergency_phone_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_id_index": { + "name": "user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_data_user_id_users_id_fk": { + "name": "user_data_user_id_users_id_fk", + "tableFrom": "user_data", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.users_tags": { + "name": "users_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tag_id": { + "name": "tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "users_tags_tag_id_tags_id_fk": { + "name": "users_tags_tag_id_tags_id_fk", + "tableFrom": "users_tags", + "tableTo": "tags", + "columnsFrom": ["tag_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "users_tags_user_id_users_id_fk": { + "name": "users_tags_user_id_users_id_fk", + "tableFrom": "users_tags", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "users_tags_tag_id_user_id_pk": { + "name": "users_tags_tag_id_user_id_pk", + "columns": ["tag_id", "user_id"] + } + }, + "uniqueConstraints": { + "users_tags_id_unique": { + "name": "users_tags_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.user_teams": { + "name": "user_teams", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'leader'" + }, + "discipline": { + "name": "discipline", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_participation_status": { + "name": "user_participation_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'waiting_resolution'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_teams_user_id_users_id_fk": { + "name": "user_teams_user_id_users_id_fk", + "tableFrom": "user_teams", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_teams_team_id_teams_id_fk": { + "name": "user_teams_team_id_teams_id_fk", + "tableFrom": "user_teams", + "tableTo": "teams", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_tickets": { + "name": "user_tickets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "public_id": { + "name": "public_id", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ticket_template_id": { + "name": "ticket_template_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "purchase_order_id": { + "name": "purchase_order_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "approval_status": { + "name": "approval_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "redemption_status": { + "name": "redemption_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_tickets_public_id_index": { + "name": "user_tickets_public_id_index", + "columns": [ + { + "expression": "public_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_tickets_user_id_users_id_fk": { + "name": "user_tickets_user_id_users_id_fk", + "tableFrom": "user_tickets", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tickets_ticket_template_id_tickets_id_fk": { + "name": "user_tickets_ticket_template_id_tickets_id_fk", + "tableFrom": "user_tickets", + "tableTo": "tickets", + "columnsFrom": ["ticket_template_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tickets_purchase_order_id_purchase_orders_id_fk": { + "name": "user_tickets_purchase_order_id_purchase_orders_id_fk", + "tableFrom": "user_tickets", + "tableTo": "purchase_orders", + "columnsFrom": ["purchase_order_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_tickets_email_logs": { + "name": "user_tickets_email_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_ticket_id": { + "name": "user_ticket_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "email_type": { + "name": "email_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_tickets_email_logs_email_type_index": { + "name": "user_tickets_email_logs_email_type_index", + "columns": [ + { + "expression": "email_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_tickets_email_logs_user_ticket_id_user_tickets_id_fk": { + "name": "user_tickets_email_logs_user_ticket_id_user_tickets_id_fk", + "tableFrom": "user_tickets_email_logs", + "tableTo": "user_tickets", + "columnsFrom": ["user_ticket_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tickets_email_logs_user_id_users_id_fk": { + "name": "user_tickets_email_logs_user_id_users_id_fk", + "tableFrom": "user_tickets_email_logs", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_tickets_email_logs_id_unique": { + "name": "user_tickets_email_logs_id_unique", + "nullsNotDistinct": false, + "columns": ["id"] + } + } + }, + "public.work_email": { + "name": "work_email", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "work_email": { + "name": "work_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "confirmation_token_id": { + "name": "confirmation_token_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'pending'" + }, + "confirmation_date": { + "name": "confirmation_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "company_id": { + "name": "company_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "work_email_user_id_users_id_fk": { + "name": "work_email_user_id_users_id_fk", + "tableFrom": "work_email", + "tableTo": "users", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "work_email_confirmation_token_id_confirmation_token_id_fk": { + "name": "work_email_confirmation_token_id_confirmation_token_id_fk", + "tableFrom": "work_email", + "tableTo": "confirmation_token", + "columnsFrom": ["confirmation_token_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "work_email_company_id_companies_id_fk": { + "name": "work_email_company_id_companies_id_fk", + "tableFrom": "work_email", + "tableTo": "companies", + "columnsFrom": ["company_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.work_role": { + "name": "work_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.work_seniority": { + "name": "work_seniority", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.work_seniority_and_role": { + "name": "work_seniority_and_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "work_role_id": { + "name": "work_role_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "work_seniority_id": { + "name": "work_seniority_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp (6)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "work_seniority_and_role_work_role_id_work_role_id_fk": { + "name": "work_seniority_and_role_work_role_id_work_role_id_fk", + "tableFrom": "work_seniority_and_role", + "tableTo": "work_role", + "columnsFrom": ["work_role_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "work_seniority_and_role_work_seniority_id_work_seniority_id_fk": { + "name": "work_seniority_and_role_work_seniority_id_work_seniority_id_fk", + "tableFrom": "work_seniority_and_role", + "tableTo": "work_seniority", + "columnsFrom": ["work_seniority_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/migrations/meta/_journal.json b/drizzle/migrations/meta/_journal.json index a2d8f6b9..33761d40 100644 --- a/drizzle/migrations/meta/_journal.json +++ b/drizzle/migrations/meta/_journal.json @@ -204,6 +204,20 @@ "when": 1724128521361, "tag": "0028_chunky_mattie_franklin", "breakpoints": true + }, + { + "idx": 29, + "version": "7", + "when": 1724778143093, + "tag": "0029_tearful_roulette", + "breakpoints": true + }, + { + "idx": 30, + "version": "7", + "when": 1724778435349, + "tag": "0030_needy_bill_hollister", + "breakpoints": true } ] } diff --git a/src/datasources/db/eventsTags.ts b/src/datasources/db/eventsTags.ts index 64a481b6..8de5ac76 100644 --- a/src/datasources/db/eventsTags.ts +++ b/src/datasources/db/eventsTags.ts @@ -2,8 +2,8 @@ import { relations } from "drizzle-orm"; import { primaryKey, pgTable, uuid } from "drizzle-orm/pg-core"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; -import { eventsSchema, tagsSchema } from "./schema"; -import { createdAndUpdatedAtFields } from "./shared"; +import { eventsSchema, tagsSchema } from "~/datasources/db/schema"; +import { createdAndUpdatedAtFields } from "~/datasources/db/shared"; // EVENTS—TAGS-TABLE export const eventsToTagsSchema = pgTable( diff --git a/src/datasources/db/galleries.ts b/src/datasources/db/galleries.ts new file mode 100644 index 00000000..63915be8 --- /dev/null +++ b/src/datasources/db/galleries.ts @@ -0,0 +1,32 @@ +import { relations } from "drizzle-orm"; +import { pgTable, uuid, text, index } from "drizzle-orm/pg-core"; +import { createInsertSchema, createSelectSchema } from "drizzle-zod"; + +import { imagesSchema } from "~/datasources/db/images"; + +import { eventsSchema } from "./schema"; +import { createdAndUpdatedAtFields } from "./shared"; + +// EVENTS—TAGS-TABLE +export const galleriesSchema = pgTable( + "galleries", + { + id: uuid("id").notNull().defaultRandom().unique(), + name: text("name").notNull(), + description: text("description"), + eventId: uuid("event_id").references(() => eventsSchema.id), + slug: text("slug").unique().notNull(), + ...createdAndUpdatedAtFields, + }, + (table) => ({ + slugIndex: index("gallery_slug_index").on(table.slug), + }), +); + +export const galleriesRelations = relations(galleriesSchema, ({ many }) => ({ + images: many(imagesSchema), +})); + +export const selectGalleriesSchema = createSelectSchema(galleriesSchema); + +export const insertGalleriesSchema = createInsertSchema(galleriesSchema); diff --git a/src/datasources/db/images.ts b/src/datasources/db/images.ts new file mode 100644 index 00000000..779c6d81 --- /dev/null +++ b/src/datasources/db/images.ts @@ -0,0 +1,48 @@ +import { relations, sql } from "drizzle-orm"; +import { index, pgTable, uuid, text } from "drizzle-orm/pg-core"; +import { createInsertSchema, createSelectSchema } from "drizzle-zod"; + +import { galleriesSchema } from "~/datasources/db/schema"; + +import { + createdAndUpdatedAtFields, + TypescriptEnumAsDBEnumOptions, +} from "./shared"; + +export enum imageHostingEnum { + cloudflare = "cloudflare", + sanity = "sanity", +} + +// EVENTS—TAGS-TABLE +export const imagesSchema = pgTable( + "images", + { + id: uuid("id").notNull().defaultRandom().unique(), + url: text("image_url").notNull(), + hosting: text("hosting", { + enum: TypescriptEnumAsDBEnumOptions(imageHostingEnum), + }).notNull(), + galleryId: uuid("gallery_id").references(() => galleriesSchema.id), + tags: text("tags") + .$type() + .array() + .notNull() + .default(sql`ARRAY[]::text[]`), + ...createdAndUpdatedAtFields, + }, + (table) => ({ + tagsIndex: index("images_tags_index").on(table.tags), + }), +); + +export const imagesRelations = relations(imagesSchema, ({ one }) => ({ + gallery: one(galleriesSchema, { + fields: [imagesSchema.galleryId], + references: [galleriesSchema.id], + }), +})); + +export const selectImagesSchema = createSelectSchema(imagesSchema); + +export const insertImagesSchema = createInsertSchema(imagesSchema); diff --git a/src/datasources/db/schema.ts b/src/datasources/db/schema.ts index 7f280601..e59c65c6 100644 --- a/src/datasources/db/schema.ts +++ b/src/datasources/db/schema.ts @@ -14,6 +14,10 @@ export * from "~/datasources/db/eventsTags"; export * from "~/datasources/db/eventsUsers"; +export * from "~/datasources/db/galleries"; + +export * from "~/datasources/db/images"; + export * from "~/datasources/db/paymentLogs"; export * from "~/datasources/db/prices"; diff --git a/src/generated/schema.gql b/src/generated/schema.gql index a9065bf0..332522ed 100644 --- a/src/generated/schema.gql +++ b/src/generated/schema.gql @@ -150,6 +150,7 @@ type Event { community: Community description: String endDateTime: DateTime + galleries: [Gallery!]! id: ID! images: [SanityAssetRef!]! latitude: String @@ -256,6 +257,17 @@ input FindUserTicketSearchInput { userTicketIds: [String!] } +""" +Representation of a Gallery, usually associated to an event +""" +type Gallery { + description: String + event: Event + id: ID! + images: [Image!]! + name: String! +} + enum Gender { Agender Female @@ -283,6 +295,21 @@ input GiftTicketsToUserInput { userIds: [String!]! } +""" +An image, usually associated to a gallery +""" +type Image { + gallery: Gallery + hosting: ImageHostingEnum! + id: ID! + url: String! +} + +enum ImageHostingEnum { + cloudflare + sanity +} + type Mutation { acceptGiftedTicket(userTicketId: String!): UserTicket! diff --git a/src/generated/types.ts b/src/generated/types.ts index aa41c094..5080faa1 100644 --- a/src/generated/types.ts +++ b/src/generated/types.ts @@ -166,6 +166,7 @@ export type Event = { community?: Maybe; description?: Maybe; endDateTime?: Maybe; + galleries: Array; id: Scalars["ID"]["output"]; images: Array; latitude?: Maybe; @@ -274,6 +275,16 @@ export type FindUserTicketSearchInput = { userTicketIds?: InputMaybe>; }; +/** Representation of a Gallery, usually associated to an event */ +export type Gallery = { + __typename?: "Gallery"; + description?: Maybe; + event?: Maybe; + id: Scalars["ID"]["output"]; + images: Array; + name: Scalars["String"]["output"]; +}; + export enum Gender { Agender = "Agender", Female = "Female", @@ -301,6 +312,20 @@ export type GiftTicketsToUserInput = { userIds: Array; }; +/** An image, usually associated to a gallery */ +export type Image = { + __typename?: "Image"; + gallery?: Maybe; + hosting: ImageHostingEnum; + id: Scalars["ID"]["output"]; + url: Scalars["String"]["output"]; +}; + +export enum ImageHostingEnum { + Cloudflare = "cloudflare", + Sanity = "sanity", +} + export type Mutation = { __typename?: "Mutation"; acceptGiftedTicket: UserTicket; diff --git a/src/schema/events/types.ts b/src/schema/events/types.ts index 0108c827..f0448031 100644 --- a/src/schema/events/types.ts +++ b/src/schema/events/types.ts @@ -5,6 +5,7 @@ import { builder } from "~/builder"; import { ScheduleStatus, selectCommunitySchema, + selectGalleriesSchema, selectScheduleSchema, selectSpeakerSchema, selectTagsSchema, @@ -19,6 +20,7 @@ import { } from "~/datasources/db/schema"; import { getImagesBySanityEventId } from "~/datasources/sanity/images"; import { eventsFetcher } from "~/schema/events/eventsFetcher"; +import { GalleryRef } from "~/schema/gallery/types"; import { schedulesFetcher } from "~/schema/schedules/schedulesFetcher"; import { ScheduleRef } from "~/schema/schedules/types"; import { @@ -124,6 +126,16 @@ export const EventLoadable = builder.loadableObject(EventRef, { nullable: true, resolve: (root) => (root.endDateTime ? new Date(root.endDateTime) : null), }), + galleries: t.field({ + type: [GalleryRef], + resolve: async ({ id }, args, ctx) => { + const galleries = await ctx.DB.query.galleriesSchema.findMany({ + where: (g, { eq }) => eq(g.eventId, id), + }); + + return galleries.map((g) => selectGalleriesSchema.parse(g)); + }, + }), images: t.field({ type: [SanityAssetRef], resolve: async ({ sanityEventId }, args, ctx) => { diff --git a/src/schema/gallery/types.ts b/src/schema/gallery/types.ts new file mode 100644 index 00000000..6dfae88f --- /dev/null +++ b/src/schema/gallery/types.ts @@ -0,0 +1,54 @@ +import { builder } from "~/builder"; +import { + selectEventsSchema, + selectGalleriesSchema, + selectImagesSchema, +} from "~/datasources/db/schema"; +import { ImageRef } from "~/schema/image/types"; +import { EventRef } from "~/schema/shared/refs"; + +type GalleryGraphqlSchema = typeof selectGalleriesSchema._type; + +export const GalleryRef = builder.objectRef("Gallery"); + +builder.objectType(GalleryRef, { + description: "Representation of a Gallery, usually associated to an event", + fields: (t) => ({ + id: t.exposeID("id", { nullable: false }), + name: t.exposeString("name"), + description: t.exposeString("description", { nullable: true }), + event: t.field({ + type: EventRef, + nullable: true, + resolve: async ({ eventId }, args, { DB }) => { + if (!eventId) { + return null; + } + + const event = await DB.query.eventsSchema.findFirst({ + where: (e, { eq }) => eq(e.id, eventId), + }); + + if (!event) { + return null; + } + + return selectEventsSchema.parse(event); + }, + }), + images: t.field({ + type: [ImageRef], + resolve: async ({ id }, args, { DB }) => { + const images = await DB.query.imagesSchema.findMany({ + where: (i, { eq }) => eq(i.galleryId, id), + }); + + if (!images || images.length === 0) { + return []; + } + + return images.map((image) => selectImagesSchema.parse(image)); + }, + }), + }), +}); diff --git a/src/schema/image/types.ts b/src/schema/image/types.ts new file mode 100644 index 00000000..0b9cbc99 --- /dev/null +++ b/src/schema/image/types.ts @@ -0,0 +1,46 @@ +import { builder } from "~/builder"; +import { + imageHostingEnum, + selectGalleriesSchema, + selectImagesSchema, +} from "~/datasources/db/schema"; +import { GalleryRef } from "~/schema/gallery/types"; + +type ImageGraphqlSchema = typeof selectImagesSchema._type; + +export const ImageRef = builder.objectRef("Image"); + +export const publicImageHostingEnum = builder.enumType(imageHostingEnum, { + name: "ImageHostingEnum", +}); + +builder.objectType(ImageRef, { + description: "An image, usually associated to a gallery", + fields: (t) => ({ + id: t.exposeID("id", { nullable: false }), + url: t.exposeString("url"), + hosting: t.field({ + type: publicImageHostingEnum, + resolve: (root) => root.hosting, + }), + gallery: t.field({ + type: GalleryRef, + nullable: true, + resolve: async ({ galleryId }, args, { DB }) => { + if (!galleryId) { + return null; + } + + const gallery = await DB.query.galleriesSchema.findFirst({ + where: (g, { eq }) => eq(g.id, galleryId), + }); + + if (!gallery) { + return null; + } + + return selectGalleriesSchema.parse(gallery); + }, + }), + }), +}); diff --git a/src/schema/index.ts b/src/schema/index.ts index ff47c61b..06a7889f 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -19,6 +19,8 @@ import "./eventImages/types"; import "./events/mutations"; import "./events/queries"; import "./events/types"; +import "./gallery/types"; +import "./image/types"; import "./invitations/mutations"; import "./money/mutations"; import "./money/queries"; @@ -29,8 +31,8 @@ import "./purchaseOrder/types"; import "./salary/mutations"; import "./salary/queries"; import "./salary/types"; -import "./schedules/types"; import "./schedules/queries"; +import "./schedules/types"; import "./sessions/types"; import "./speakers/types"; import "./status/types";