diff --git a/apps/admin/src/lib/domains/customerinfo/router.ts b/apps/admin/src/lib/domains/customerinfo/router.ts index a9ea1fe..2ad9489 100644 --- a/apps/admin/src/lib/domains/customerinfo/router.ts +++ b/apps/admin/src/lib/domains/customerinfo/router.ts @@ -17,13 +17,6 @@ export const customerInfoRouter = createTRPCRouter({ return controller.getCustomerInfoById(input.id); }), - getCustomerInfoByOrderId: protectedProcedure - .input(z.object({ orderId: z.number() })) - .query(async ({ input }) => { - const controller = getCustomerInfoUseCases(); - return controller.getCustomerInfoByOrderId(input.orderId); - }), - createCustomerInfo: protectedProcedure .input(createCustomerInfoPayload) .mutation(async ({ input }) => { diff --git a/apps/admin/src/lib/domains/order/data/repository.ts b/apps/admin/src/lib/domains/order/data/repository.ts index c685df9..4731680 100644 --- a/apps/admin/src/lib/domains/order/data/repository.ts +++ b/apps/admin/src/lib/domains/order/data/repository.ts @@ -1,6 +1,6 @@ import { ERROR_CODES, type Result } from "$lib/core/data.types"; import { count, eq, type Database } from "@pkg/db"; -import { customerInfo, order } from "@pkg/db/schema"; +import { order } from "@pkg/db/schema"; import { getError, Logger } from "@pkg/logger"; import { fullOrderModel, type FullOrderModel } from "./entities"; @@ -23,16 +23,12 @@ export class OrderRepository { async listAllOrders(): Promise> { try { const res = await this.db.query.order.findMany({ - with: { - flightTicketInfo: true, - emailAccount: true, - }, + with: { customerInfo: true, product: true }, }); const out = [] as FullOrderModel[]; for (const each of res) { const parsed = fullOrderModel.safeParse({ ...each, - customerInfos: [], }); if (!parsed.success) { Logger.error(JSON.stringify(parsed.error.errors, null, 2)); @@ -40,7 +36,6 @@ export class OrderRepository { } out.push(parsed.data); } - return { data: out }; } catch (e) { return { @@ -61,18 +56,11 @@ export class OrderRepository { async getOrder(oid: number): Promise> { const out = await this.db.query.order.findFirst({ where: eq(order.id, oid), - with: { - emailAccount: true, - flightTicketInfo: true, - }, + with: { customerInfo: true, product: true }, }); if (!out) return {}; - const relatedCustomerInfos = await this.db.query.customerInfo.findMany({ - where: eq(customerInfo.orderId, oid), - }); const parsed = fullOrderModel.safeParse({ ...out, - customerInfo: relatedCustomerInfos, }); if (!parsed.success) { return { diff --git a/packages/db/migrations/0000_famous_ultimo.sql b/packages/db/migrations/0000_famous_ultimo.sql deleted file mode 100644 index 44cd904..0000000 --- a/packages/db/migrations/0000_famous_ultimo.sql +++ /dev/null @@ -1,292 +0,0 @@ -CREATE TABLE IF NOT EXISTS "account" ( - "id" text PRIMARY KEY NOT NULL, - "account_id" text NOT NULL, - "provider_id" text NOT NULL, - "user_id" text NOT NULL, - "access_token" text, - "refresh_token" text, - "id_token" text, - "access_token_expires_at" timestamp, - "refresh_token_expires_at" timestamp, - "scope" text, - "password" text, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "user" ( - "id" text PRIMARY KEY NOT NULL, - "name" text NOT NULL, - "email" text NOT NULL, - "email_verified" boolean NOT NULL, - "image" text, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "username" text, - "display_username" text, - "role" text, - "banned" boolean, - "ban_reason" text, - "ban_expires" timestamp, - "parent_id" text, - "discount_percent" integer, - CONSTRAINT "user_email_unique" UNIQUE("email"), - CONSTRAINT "user_username_unique" UNIQUE("username") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "verification" ( - "id" text PRIMARY KEY NOT NULL, - "identifier" text NOT NULL, - "value" text NOT NULL, - "expires_at" timestamp NOT NULL, - "created_at" timestamp, - "updated_at" timestamp -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "coupon" ( - "id" serial PRIMARY KEY NOT NULL, - "code" varchar(32) NOT NULL, - "description" text, - "discount_type" varchar(16) NOT NULL, - "discount_value" numeric(12, 2) NOT NULL, - "max_usage_count" integer, - "current_usage_count" integer DEFAULT 0 NOT NULL, - "min_order_value" numeric(12, 2), - "max_discount_amount" numeric(12, 2), - "start_date" timestamp NOT NULL, - "end_date" timestamp, - "is_active" boolean DEFAULT true NOT NULL, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now(), - "created_by" text, - CONSTRAINT "coupon_code_unique" UNIQUE("code") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "coupon_usage" ( - "id" serial PRIMARY KEY NOT NULL, - "coupon_id" integer NOT NULL, - "user_id" text, - "order_id" integer, - "discount_amount" numeric(12, 2) NOT NULL, - "used_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "email_account" ( - "id" serial PRIMARY KEY NOT NULL, - "email" varchar(128) NOT NULL, - "password" varchar(128) NOT NULL, - "used" boolean DEFAULT false NOT NULL, - "agent_id" text, - "last_active_check_at" timestamp DEFAULT now(), - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now(), - CONSTRAINT "email_account_email_unique" UNIQUE("email") -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "flight_ticket_info" ( - "id" serial PRIMARY KEY NOT NULL, - "ticket_id" text DEFAULT '' NOT NULL, - "flight_type" varchar(24) NOT NULL, - "departure" text NOT NULL, - "arrival" text NOT NULL, - "departure_date" timestamp NOT NULL, - "return_date" timestamp NOT NULL, - "dates" json DEFAULT '[]'::json NOT NULL, - "flight_iteneraries" json DEFAULT '[]'::json NOT NULL, - "price_details" json NOT NULL, - "bags_info" json NOT NULL, - "last_available" json NOT NULL, - "refundable" boolean DEFAULT false NOT NULL, - "passenger_counts" json DEFAULT '{"adult":1,"children":0}'::json NOT NULL, - "cabin_class" varchar(24) NOT NULL, - "share_id" text DEFAULT '' NOT NULL, - "checkout_url" text DEFAULT '' NOT NULL, - "is_cache" boolean DEFAULT false NOT NULL, - "ref_oids" json DEFAULT '[]'::json NOT NULL, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "inbox" ( - "id" serial PRIMARY KEY NOT NULL, - "email_id" text DEFAULT '' NOT NULL, - "from" text, - "to" text, - "cc" text, - "subject" text, - "body" text, - "attachments" json, - "date" timestamp DEFAULT now(), - "email_account_id" integer NOT NULL, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "order" ( - "id" serial PRIMARY KEY NOT NULL, - "order_price" numeric(12, 2), - "discount_amount" numeric(12, 2), - "display_price" numeric(12, 2), - "base_price" numeric(12, 2), - "fullfilled_price" numeric(12, 2) DEFAULT '0', - "price_per_passenger" numeric(12, 2) DEFAULT '0', - "status" varchar(24), - "pnr" varchar(12) DEFAULT '' NOT NULL, - "flight_ticket_info_id" integer NOT NULL, - "payment_details_id" integer, - "email_account_id" integer, - "agent_id" text, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "passenger_info" ( - "id" serial PRIMARY KEY NOT NULL, - "passenger_pii_id" integer, - "payment_details_id" integer, - "passenger_type" varchar(24) NOT NULL, - "seat_selection" json, - "bag_selection" json, - "order_id" integer, - "flight_ticket_info_id" integer, - "agents_info" boolean DEFAULT false NOT NULL, - "agent_id" text, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "passenger_pii" ( - "id" serial PRIMARY KEY NOT NULL, - "first_name" varchar(64) NOT NULL, - "middle_name" varchar(64) NOT NULL, - "last_name" varchar(64) NOT NULL, - "email" varchar(128) NOT NULL, - "phone_country_code" varchar(6) NOT NULL, - "phone_number" varchar(20) NOT NULL, - "nationality" varchar(32) NOT NULL, - "gender" varchar(32) NOT NULL, - "dob" date NOT NULL, - "passport_no" varchar(64) NOT NULL, - "passport_expiry" varchar(12) NOT NULL, - "country" varchar(128) NOT NULL, - "state" varchar(128) NOT NULL, - "city" varchar(128) NOT NULL, - "zip_code" varchar(21) NOT NULL, - "address" text NOT NULL, - "address2" text, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); ---> statement-breakpoint -CREATE TABLE IF NOT EXISTS "payment_details" ( - "id" serial PRIMARY KEY NOT NULL, - "cardholder_name" varchar(128) NOT NULL, - "card_number" varchar(20) NOT NULL, - "expiry" varchar(5) NOT NULL, - "cvv" varchar(6) NOT NULL, - "flight_ticket_info_id" integer, - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "coupon" ADD CONSTRAINT "coupon_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "coupon_usage" ADD CONSTRAINT "coupon_usage_coupon_id_coupon_id_fk" FOREIGN KEY ("coupon_id") REFERENCES "public"."coupon"("id") ON DELETE cascade ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "coupon_usage" ADD CONSTRAINT "coupon_usage_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "coupon_usage" ADD CONSTRAINT "coupon_usage_order_id_order_id_fk" FOREIGN KEY ("order_id") REFERENCES "public"."order"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "email_account" ADD CONSTRAINT "email_account_agent_id_user_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "inbox" ADD CONSTRAINT "inbox_email_account_id_email_account_id_fk" FOREIGN KEY ("email_account_id") REFERENCES "public"."email_account"("id") ON DELETE cascade ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "order" ADD CONSTRAINT "order_flight_ticket_info_id_flight_ticket_info_id_fk" FOREIGN KEY ("flight_ticket_info_id") REFERENCES "public"."flight_ticket_info"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "order" ADD CONSTRAINT "order_payment_details_id_payment_details_id_fk" FOREIGN KEY ("payment_details_id") REFERENCES "public"."payment_details"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "order" ADD CONSTRAINT "order_email_account_id_email_account_id_fk" FOREIGN KEY ("email_account_id") REFERENCES "public"."email_account"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "order" ADD CONSTRAINT "order_agent_id_user_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "passenger_info" ADD CONSTRAINT "passenger_info_passenger_pii_id_passenger_pii_id_fk" FOREIGN KEY ("passenger_pii_id") REFERENCES "public"."passenger_pii"("id") ON DELETE cascade ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "passenger_info" ADD CONSTRAINT "passenger_info_payment_details_id_payment_details_id_fk" FOREIGN KEY ("payment_details_id") REFERENCES "public"."payment_details"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "passenger_info" ADD CONSTRAINT "passenger_info_order_id_order_id_fk" FOREIGN KEY ("order_id") REFERENCES "public"."order"("id") ON DELETE cascade ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "passenger_info" ADD CONSTRAINT "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk" FOREIGN KEY ("flight_ticket_info_id") REFERENCES "public"."flight_ticket_info"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "passenger_info" ADD CONSTRAINT "passenger_info_agent_id_user_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "payment_details" ADD CONSTRAINT "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk" FOREIGN KEY ("flight_ticket_info_id") REFERENCES "public"."flight_ticket_info"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/packages/db/migrations/0000_large_gertrude_yorkes.sql b/packages/db/migrations/0000_large_gertrude_yorkes.sql new file mode 100644 index 0000000..315146f --- /dev/null +++ b/packages/db/migrations/0000_large_gertrude_yorkes.sql @@ -0,0 +1,192 @@ +CREATE TABLE IF NOT EXISTS "account" ( + "id" text PRIMARY KEY NOT NULL, + "account_id" text NOT NULL, + "provider_id" text NOT NULL, + "user_id" text NOT NULL, + "access_token" text, + "refresh_token" text, + "id_token" text, + "access_token_expires_at" timestamp, + "refresh_token_expires_at" timestamp, + "scope" text, + "password" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "user" ( + "id" text PRIMARY KEY NOT NULL, + "name" text NOT NULL, + "email" text NOT NULL, + "email_verified" boolean DEFAULT false NOT NULL, + "image" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "username" text, + "display_username" text, + "role" text, + "banned" boolean DEFAULT false, + "ban_reason" text, + "ban_expires" timestamp, + "parent_id" text, + "discount_percent" integer DEFAULT 0, + CONSTRAINT "user_email_unique" UNIQUE("email"), + CONSTRAINT "user_username_unique" UNIQUE("username") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "verification" ( + "id" text PRIMARY KEY NOT NULL, + "identifier" text NOT NULL, + "value" text NOT NULL, + "expires_at" timestamp NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "checkout_flow_session" ( + "id" serial PRIMARY KEY NOT NULL, + "flow_id" text NOT NULL, + "domain" text NOT NULL, + "checkout_step" varchar(50) NOT NULL, + "show_verification" boolean DEFAULT false NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "last_pinged" timestamp NOT NULL, + "is_active" boolean DEFAULT true NOT NULL, + "last_synced_at" timestamp NOT NULL, + "personal_info_last_synced_at" timestamp, + "payment_info_last_synced_at" timestamp, + "pending_actions" json DEFAULT '[]'::json NOT NULL, + "personal_info" json, + "payment_info" json, + "ref_o_ids" json DEFAULT '[]'::json, + "otp_code" varchar(20), + "otp_submitted" boolean DEFAULT false NOT NULL, + "partial_otp_code" varchar(20), + "ip_address" varchar(50) DEFAULT '' NOT NULL, + "user_agent" text DEFAULT '' NOT NULL, + "reserved" boolean DEFAULT false NOT NULL, + "reserved_by" varchar(255), + "completed_at" timestamp, + "session_outcome" varchar(50), + "is_deleted" boolean DEFAULT false NOT NULL, + "product_id" integer, + CONSTRAINT "checkout_flow_session_flow_id_unique" UNIQUE("flow_id") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "coupon" ( + "id" serial PRIMARY KEY NOT NULL, + "code" varchar(32) NOT NULL, + "description" text, + "discount_type" varchar(16) NOT NULL, + "discount_value" numeric(12, 2) NOT NULL, + "max_usage_count" integer, + "current_usage_count" integer DEFAULT 0 NOT NULL, + "min_order_value" numeric(12, 2), + "max_discount_amount" numeric(12, 2), + "start_date" timestamp NOT NULL, + "end_date" timestamp, + "is_active" boolean DEFAULT true NOT NULL, + "created_at" timestamp DEFAULT now(), + "updated_at" timestamp DEFAULT now(), + "created_by" text, + CONSTRAINT "coupon_code_unique" UNIQUE("code") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "customer_info" ( + "id" serial PRIMARY KEY NOT NULL, + "first_name" varchar(64) NOT NULL, + "middle_name" varchar(64) DEFAULT '', + "last_name" varchar(64) NOT NULL, + "email" varchar(128) NOT NULL, + "phone_country_code" varchar(6) NOT NULL, + "phone_number" varchar(20) NOT NULL, + "country" varchar(128) NOT NULL, + "state" varchar(128) NOT NULL, + "city" varchar(128) NOT NULL, + "zip_code" varchar(21) NOT NULL, + "address" text NOT NULL, + "address2" text, + "created_at" timestamp DEFAULT now(), + "updated_at" timestamp DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "order" ( + "id" serial PRIMARY KEY NOT NULL, + "order_price" numeric(12, 2), + "discount_amount" numeric(12, 2), + "display_price" numeric(12, 2), + "base_price" numeric(12, 2), + "fullfilled_price" numeric(12, 2) DEFAULT '0', + "status" varchar(24), + "product_id" integer, + "customer_info_id" integer, + "payment_details_id" integer, + "agent_id" text, + "created_at" timestamp DEFAULT now(), + "updated_at" timestamp DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "payment_details" ( + "id" serial PRIMARY KEY NOT NULL, + "cardholder_name" varchar(128) NOT NULL, + "card_number" varchar(20) NOT NULL, + "expiry" varchar(5) NOT NULL, + "cvv" varchar(6) NOT NULL, + "created_at" timestamp DEFAULT now(), + "updated_at" timestamp DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "product" ( + "id" serial PRIMARY KEY NOT NULL, + "link_id" varchar(32) NOT NULL, + "title" varchar(64) NOT NULL, + "description" text NOT NULL, + "long_description" text NOT NULL, + "price" numeric(12, 2) DEFAULT '0', + "discount_price" numeric(12, 2) DEFAULT '0', + "created_at" timestamp DEFAULT now(), + "updated_at" timestamp DEFAULT now(), + CONSTRAINT "product_link_id_unique" UNIQUE("link_id") +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "checkout_flow_session" ADD CONSTRAINT "checkout_flow_session_product_id_product_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."product"("id") ON DELETE set null ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "coupon" ADD CONSTRAINT "coupon_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "order" ADD CONSTRAINT "order_product_id_product_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."product"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "order" ADD CONSTRAINT "order_customer_info_id_customer_info_id_fk" FOREIGN KEY ("customer_info_id") REFERENCES "public"."customer_info"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "order" ADD CONSTRAINT "order_payment_details_id_payment_details_id_fk" FOREIGN KEY ("payment_details_id") REFERENCES "public"."payment_details"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "order" ADD CONSTRAINT "order_agent_id_user_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/packages/db/migrations/0001_awesome_sharon_ventura.sql b/packages/db/migrations/0001_awesome_sharon_ventura.sql deleted file mode 100644 index bb239e1..0000000 --- a/packages/db/migrations/0001_awesome_sharon_ventura.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE "coupon_usage" CASCADE; \ No newline at end of file diff --git a/packages/db/migrations/0001_wonderful_nico_minoru.sql b/packages/db/migrations/0001_wonderful_nico_minoru.sql new file mode 100644 index 0000000..3011654 --- /dev/null +++ b/packages/db/migrations/0001_wonderful_nico_minoru.sql @@ -0,0 +1,2 @@ +ALTER TABLE "payment_details" ADD COLUMN "order_id" integer;--> statement-breakpoint +ALTER TABLE "payment_details" ADD COLUMN "product_id" integer; \ No newline at end of file diff --git a/packages/db/migrations/0002_wet_psylocke.sql b/packages/db/migrations/0002_wet_psylocke.sql deleted file mode 100644 index d482f5a..0000000 --- a/packages/db/migrations/0002_wet_psylocke.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE IF NOT EXISTS "checkout_flow_session" ( - "id" serial PRIMARY KEY NOT NULL, - "flow_id" text NOT NULL, - "domain" text NOT NULL, - "checkout_step" varchar(50) NOT NULL, - "show_verification" boolean DEFAULT false NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "last_pinged" timestamp NOT NULL, - "is_active" boolean DEFAULT true NOT NULL, - "last_synced_at" timestamp NOT NULL, - "personal_info_last_synced_at" timestamp, - "payment_info_last_synced_at" timestamp, - "pending_actions" json DEFAULT '[]'::json NOT NULL, - "personal_info" json, - "payment_info" json, - "ref_o_ids" json DEFAULT '[]'::json, - "otp_code" varchar(20), - "otp_submitted" boolean DEFAULT false NOT NULL, - "partial_otp_code" varchar(20), - "ip_address" varchar(50) DEFAULT '' NOT NULL, - "user_agent" text DEFAULT '' NOT NULL, - "reserved" boolean DEFAULT false NOT NULL, - "reserved_by" varchar(255), - "completed_at" timestamp, - "session_outcome" varchar(50), - "is_deleted" boolean DEFAULT false NOT NULL, - CONSTRAINT "checkout_flow_session_flow_id_unique" UNIQUE("flow_id") -); diff --git a/packages/db/migrations/0003_unique_stephen_strange.sql b/packages/db/migrations/0003_unique_stephen_strange.sql deleted file mode 100644 index d10acc7..0000000 --- a/packages/db/migrations/0003_unique_stephen_strange.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE "checkout_flow_session" ADD COLUMN "ticket_id" integer;--> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "checkout_flow_session" ADD CONSTRAINT "checkout_flow_session_ticket_id_flight_ticket_info_id_fk" FOREIGN KEY ("ticket_id") REFERENCES "public"."flight_ticket_info"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/packages/db/migrations/0004_parched_blue_shield.sql b/packages/db/migrations/0004_parched_blue_shield.sql deleted file mode 100644 index 5976221..0000000 --- a/packages/db/migrations/0004_parched_blue_shield.sql +++ /dev/null @@ -1,10 +0,0 @@ -ALTER TABLE "account" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "user" ALTER COLUMN "email_verified" SET DEFAULT false;--> statement-breakpoint -ALTER TABLE "user" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "user" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "user" ALTER COLUMN "banned" SET DEFAULT false;--> statement-breakpoint -ALTER TABLE "user" ALTER COLUMN "discount_percent" SET DEFAULT 0;--> statement-breakpoint -ALTER TABLE "verification" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "verification" ALTER COLUMN "created_at" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "verification" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "verification" ALTER COLUMN "updated_at" SET NOT NULL; \ No newline at end of file diff --git a/packages/db/migrations/0005_great_doomsday.sql b/packages/db/migrations/0005_great_doomsday.sql deleted file mode 100644 index c5a8f7d..0000000 --- a/packages/db/migrations/0005_great_doomsday.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE IF NOT EXISTS "product" ( - "id" serial PRIMARY KEY NOT NULL, - "title" varchar(64) NOT NULL, - "description" text NOT NULL, - "long_description" text NOT NULL, - "price" numeric(12, 2) DEFAULT '0', - "created_at" timestamp DEFAULT now(), - "updated_at" timestamp DEFAULT now() -); diff --git a/packages/db/migrations/0006_puzzling_avengers.sql b/packages/db/migrations/0006_puzzling_avengers.sql deleted file mode 100644 index 8ff0569..0000000 --- a/packages/db/migrations/0006_puzzling_avengers.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "product" ADD COLUMN "discount_price" numeric(12, 2) DEFAULT '0'; \ No newline at end of file diff --git a/packages/db/migrations/0007_true_garia.sql b/packages/db/migrations/0007_true_garia.sql deleted file mode 100644 index cc3da50..0000000 --- a/packages/db/migrations/0007_true_garia.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "product" ADD COLUMN "link_id" varchar(32) NOT NULL;--> statement-breakpoint -ALTER TABLE "product" ADD CONSTRAINT "product_link_id_unique" UNIQUE("link_id"); \ No newline at end of file diff --git a/packages/db/migrations/meta/0000_snapshot.json b/packages/db/migrations/meta/0000_snapshot.json index 181e625..6d1bad6 100644 --- a/packages/db/migrations/meta/0000_snapshot.json +++ b/packages/db/migrations/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "aafa7f4b-ccc8-4922-970f-e5d552274301", + "id": "77d95f59-9820-4cba-8a6a-cae76a8dff82", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", @@ -78,7 +78,8 @@ "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "updated_at": { "name": "updated_at", @@ -135,7 +136,8 @@ "name": "email_verified", "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "default": false }, "image": { "name": "image", @@ -147,13 +149,15 @@ "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "username": { "name": "username", @@ -177,7 +181,8 @@ "name": "banned", "type": "boolean", "primaryKey": false, - "notNull": false + "notNull": false, + "default": false }, "ban_reason": { "name": "ban_reason", @@ -201,7 +206,8 @@ "name": "discount_percent", "type": "integer", "primaryKey": false, - "notNull": false + "notNull": false, + "default": 0 } }, "indexes": {}, @@ -259,13 +265,15 @@ "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" } }, "indexes": {}, @@ -276,6 +284,207 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.checkout_flow_session": { + "name": "checkout_flow_session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "flow_id": { + "name": "flow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "checkout_step": { + "name": "checkout_step", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "show_verification": { + "name": "show_verification", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_pinged": { + "name": "last_pinged", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_synced_at": { + "name": "last_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "personal_info_last_synced_at": { + "name": "personal_info_last_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "payment_info_last_synced_at": { + "name": "payment_info_last_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "pending_actions": { + "name": "pending_actions", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'[]'::json" + }, + "personal_info": { + "name": "personal_info", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "payment_info": { + "name": "payment_info", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "ref_o_ids": { + "name": "ref_o_ids", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'::json" + }, + "otp_code": { + "name": "otp_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "otp_submitted": { + "name": "otp_submitted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "partial_otp_code": { + "name": "partial_otp_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "ip_address": { + "name": "ip_address", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "reserved": { + "name": "reserved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "reserved_by": { + "name": "reserved_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "session_outcome": { + "name": "session_outcome", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "checkout_flow_session_product_id_product_id_fk": { + "name": "checkout_flow_session_product_id_product_id_fk", + "tableFrom": "checkout_flow_session", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "checkout_flow_session_flow_id_unique": { + "name": "checkout_flow_session_flow_id_unique", + "nullsNotDistinct": false, + "columns": [ + "flow_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.coupon": { "name": "coupon", "schema": "", @@ -405,753 +614,8 @@ "checkConstraints": {}, "isRLSEnabled": false }, - "public.coupon_usage": { - "name": "coupon_usage", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "coupon_id": { - "name": "coupon_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_usage_coupon_id_coupon_id_fk": { - "name": "coupon_usage_coupon_id_coupon_id_fk", - "tableFrom": "coupon_usage", - "tableTo": "coupon", - "columnsFrom": [ - "coupon_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "coupon_usage_user_id_user_id_fk": { - "name": "coupon_usage_user_id_user_id_fk", - "tableFrom": "coupon_usage", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "coupon_usage_order_id_order_id_fk": { - "name": "coupon_usage_order_id_order_id_fk", - "tableFrom": "coupon_usage", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", + "public.customer_info": { + "name": "customer_info", "schema": "", "columns": { "id": { @@ -1170,7 +634,8 @@ "name": "middle_name", "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": false, + "default": "''" }, "last_name": { "name": "last_name", @@ -1196,36 +661,6 @@ "primaryKey": false, "notNull": true }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, "country": { "name": "country", "type": "varchar(128)", @@ -1285,6 +720,153 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.order": { + "name": "order", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order_price": { + "name": "order_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "display_price": { + "name": "display_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "base_price": { + "name": "base_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "fullfilled_price": { + "name": "fullfilled_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "status": { + "name": "status", + "type": "varchar(24)", + "primaryKey": false, + "notNull": false + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "customer_info_id": { + "name": "customer_info_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "payment_details_id": { + "name": "payment_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "order_product_id_product_id_fk": { + "name": "order_product_id_product_id_fk", + "tableFrom": "order", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "order_customer_info_id_customer_info_id_fk": { + "name": "order_customer_info_id_customer_info_id_fk", + "tableFrom": "order", + "tableTo": "customer_info", + "columnsFrom": [ + "customer_info_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "order_payment_details_id_payment_details_id_fk": { + "name": "order_payment_details_id_payment_details_id_fk", + "tableFrom": "order", + "tableTo": "payment_details", + "columnsFrom": [ + "payment_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "order_agent_id_user_id_fk": { + "name": "order_agent_id_user_id_fk", + "tableFrom": "order", + "tableTo": "user", + "columnsFrom": [ + "agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.payment_details": { "name": "payment_details", "schema": "", @@ -1319,11 +901,76 @@ "primaryKey": false, "notNull": true }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", + "created_at": { + "name": "created_at", + "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.product": { + "name": "product", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "link_id": { + "name": "link_id", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "long_description": { + "name": "long_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "price": { + "name": "price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_price": { + "name": "discount_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": "'0'" }, "created_at": { "name": "created_at", @@ -1341,23 +988,17 @@ } }, "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "product_link_id_unique": { + "name": "product_link_id_unique", + "nullsNotDistinct": false, + "columns": [ + "link_id" + ] } }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false diff --git a/packages/db/migrations/meta/0001_snapshot.json b/packages/db/migrations/meta/0001_snapshot.json index eb5491a..86a98f2 100644 --- a/packages/db/migrations/meta/0001_snapshot.json +++ b/packages/db/migrations/meta/0001_snapshot.json @@ -1,6 +1,6 @@ { - "id": "28594094-4368-4168-8d84-02d185507e54", - "prevId": "aafa7f4b-ccc8-4922-970f-e5d552274301", + "id": "8290cb35-f9d3-4338-b0c8-e45fa34320cb", + "prevId": "77d95f59-9820-4cba-8a6a-cae76a8dff82", "version": "7", "dialect": "postgresql", "tables": { @@ -78,7 +78,8 @@ "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "updated_at": { "name": "updated_at", @@ -135,7 +136,8 @@ "name": "email_verified", "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "default": false }, "image": { "name": "image", @@ -147,13 +149,15 @@ "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "username": { "name": "username", @@ -177,7 +181,8 @@ "name": "banned", "type": "boolean", "primaryKey": false, - "notNull": false + "notNull": false, + "default": false }, "ban_reason": { "name": "ban_reason", @@ -201,7 +206,8 @@ "name": "discount_percent", "type": "integer", "primaryKey": false, - "notNull": false + "notNull": false, + "default": 0 } }, "indexes": {}, @@ -259,13 +265,15 @@ "name": "created_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp", "primaryKey": false, - "notNull": false + "notNull": true, + "default": "now()" } }, "indexes": {}, @@ -276,6 +284,207 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.checkout_flow_session": { + "name": "checkout_flow_session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "flow_id": { + "name": "flow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "checkout_step": { + "name": "checkout_step", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true + }, + "show_verification": { + "name": "show_verification", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_pinged": { + "name": "last_pinged", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_synced_at": { + "name": "last_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "personal_info_last_synced_at": { + "name": "personal_info_last_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "payment_info_last_synced_at": { + "name": "payment_info_last_synced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "pending_actions": { + "name": "pending_actions", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'[]'::json" + }, + "personal_info": { + "name": "personal_info", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "payment_info": { + "name": "payment_info", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "ref_o_ids": { + "name": "ref_o_ids", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'::json" + }, + "otp_code": { + "name": "otp_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "otp_submitted": { + "name": "otp_submitted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "partial_otp_code": { + "name": "partial_otp_code", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "ip_address": { + "name": "ip_address", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "reserved": { + "name": "reserved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "reserved_by": { + "name": "reserved_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "session_outcome": { + "name": "session_outcome", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "checkout_flow_session_product_id_product_id_fk": { + "name": "checkout_flow_session_product_id_product_id_fk", + "tableFrom": "checkout_flow_session", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "checkout_flow_session_flow_id_unique": { + "name": "checkout_flow_session_flow_id_unique", + "nullsNotDistinct": false, + "columns": [ + "flow_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.coupon": { "name": "coupon", "schema": "", @@ -405,663 +614,8 @@ "checkConstraints": {}, "isRLSEnabled": false }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", + "public.customer_info": { + "name": "customer_info", "schema": "", "columns": { "id": { @@ -1080,7 +634,8 @@ "name": "middle_name", "type": "varchar(64)", "primaryKey": false, - "notNull": true + "notNull": false, + "default": "''" }, "last_name": { "name": "last_name", @@ -1106,36 +661,6 @@ "primaryKey": false, "notNull": true }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, "country": { "name": "country", "type": "varchar(128)", @@ -1195,6 +720,153 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.order": { + "name": "order", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "order_price": { + "name": "order_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "discount_amount": { + "name": "discount_amount", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "display_price": { + "name": "display_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "base_price": { + "name": "base_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false + }, + "fullfilled_price": { + "name": "fullfilled_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "status": { + "name": "status", + "type": "varchar(24)", + "primaryKey": false, + "notNull": false + }, + "product_id": { + "name": "product_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "customer_info_id": { + "name": "customer_info_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "payment_details_id": { + "name": "payment_details_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "order_product_id_product_id_fk": { + "name": "order_product_id_product_id_fk", + "tableFrom": "order", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "order_customer_info_id_customer_info_id_fk": { + "name": "order_customer_info_id_customer_info_id_fk", + "tableFrom": "order", + "tableTo": "customer_info", + "columnsFrom": [ + "customer_info_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "order_payment_details_id_payment_details_id_fk": { + "name": "order_payment_details_id_payment_details_id_fk", + "tableFrom": "order", + "tableTo": "payment_details", + "columnsFrom": [ + "payment_details_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "order_agent_id_user_id_fk": { + "name": "order_agent_id_user_id_fk", + "tableFrom": "order", + "tableTo": "user", + "columnsFrom": [ + "agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.payment_details": { "name": "payment_details", "schema": "", @@ -1229,8 +901,14 @@ "primaryKey": false, "notNull": true }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", + "order_id": { + "name": "order_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "product_id": { + "name": "product_id", "type": "integer", "primaryKey": false, "notNull": false @@ -1251,26 +929,91 @@ } }, "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, + "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false + }, + "public.product": { + "name": "product", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "link_id": { + "name": "link_id", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "long_description": { + "name": "long_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "price": { + "name": "price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "discount_price": { + "name": "discount_price", + "type": "numeric(12, 2)", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "product_link_id_unique": { + "name": "product_link_id_unique", + "nullsNotDistinct": false, + "columns": [ + "link_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false } }, "enums": {}, diff --git a/packages/db/migrations/meta/0002_snapshot.json b/packages/db/migrations/meta/0002_snapshot.json deleted file mode 100644 index b225b5e..0000000 --- a/packages/db/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,1468 +0,0 @@ -{ - "id": "e3eb27f3-a97f-4c63-8e81-f7c6cea9a254", - "prevId": "28594094-4368-4168-8d84-02d185507e54", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_username": { - "name": "display_username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_percent": { - "name": "discount_percent", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "user_username_unique": { - "name": "user_username_unique", - "nullsNotDistinct": false, - "columns": [ - "username" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.checkout_flow_session": { - "name": "checkout_flow_session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checkout_step": { - "name": "checkout_step", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "show_verification": { - "name": "show_verification", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_pinged": { - "name": "last_pinged", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "personal_info_last_synced_at": { - "name": "personal_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "payment_info_last_synced_at": { - "name": "payment_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "pending_actions": { - "name": "pending_actions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "personal_info": { - "name": "personal_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "payment_info": { - "name": "payment_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "ref_o_ids": { - "name": "ref_o_ids", - "type": "json", - "primaryKey": false, - "notNull": false, - "default": "'[]'::json" - }, - "otp_code": { - "name": "otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "otp_submitted": { - "name": "otp_submitted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "partial_otp_code": { - "name": "partial_otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "reserved": { - "name": "reserved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "reserved_by": { - "name": "reserved_by", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "session_outcome": { - "name": "session_outcome", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_deleted": { - "name": "is_deleted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "checkout_flow_session_flow_id_unique": { - "name": "checkout_flow_session_flow_id_unique", - "nullsNotDistinct": false, - "columns": [ - "flow_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.coupon": { - "name": "coupon", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_type": { - "name": "discount_type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "discount_value": { - "name": "discount_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "max_usage_count": { - "name": "max_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "current_usage_count": { - "name": "current_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "min_order_value": { - "name": "min_order_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "max_discount_amount": { - "name": "max_discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "start_date": { - "name": "start_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "end_date": { - "name": "end_date", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_created_by_user_id_fk": { - "name": "coupon_created_by_user_id_fk", - "tableFrom": "coupon", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "coupon_code_unique": { - "name": "coupon_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "middle_name": { - "name": "middle_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "phone_country_code": { - "name": "phone_country_code", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "phone_number": { - "name": "phone_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "city": { - "name": "city", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "zip_code": { - "name": "zip_code", - "type": "varchar(21)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address2": { - "name": "address2", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payment_details": { - "name": "payment_details", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cardholder_name": { - "name": "cardholder_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "card_number": { - "name": "card_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "expiry": { - "name": "expiry", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true - }, - "cvv": { - "name": "cvv", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0003_snapshot.json b/packages/db/migrations/meta/0003_snapshot.json deleted file mode 100644 index 29bd73b..0000000 --- a/packages/db/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,1488 +0,0 @@ -{ - "id": "50038430-2568-4acf-af75-2b68260d9a84", - "prevId": "e3eb27f3-a97f-4c63-8e81-f7c6cea9a254", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_username": { - "name": "display_username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_percent": { - "name": "discount_percent", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "user_username_unique": { - "name": "user_username_unique", - "nullsNotDistinct": false, - "columns": [ - "username" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.checkout_flow_session": { - "name": "checkout_flow_session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checkout_step": { - "name": "checkout_step", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "show_verification": { - "name": "show_verification", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_pinged": { - "name": "last_pinged", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "personal_info_last_synced_at": { - "name": "personal_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "payment_info_last_synced_at": { - "name": "payment_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "pending_actions": { - "name": "pending_actions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "personal_info": { - "name": "personal_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "payment_info": { - "name": "payment_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "ref_o_ids": { - "name": "ref_o_ids", - "type": "json", - "primaryKey": false, - "notNull": false, - "default": "'[]'::json" - }, - "otp_code": { - "name": "otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "otp_submitted": { - "name": "otp_submitted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "partial_otp_code": { - "name": "partial_otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "reserved": { - "name": "reserved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "reserved_by": { - "name": "reserved_by", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "session_outcome": { - "name": "session_outcome", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_deleted": { - "name": "is_deleted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ticket_id": { - "name": "ticket_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "checkout_flow_session_ticket_id_flight_ticket_info_id_fk": { - "name": "checkout_flow_session_ticket_id_flight_ticket_info_id_fk", - "tableFrom": "checkout_flow_session", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "ticket_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "checkout_flow_session_flow_id_unique": { - "name": "checkout_flow_session_flow_id_unique", - "nullsNotDistinct": false, - "columns": [ - "flow_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.coupon": { - "name": "coupon", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_type": { - "name": "discount_type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "discount_value": { - "name": "discount_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "max_usage_count": { - "name": "max_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "current_usage_count": { - "name": "current_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "min_order_value": { - "name": "min_order_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "max_discount_amount": { - "name": "max_discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "start_date": { - "name": "start_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "end_date": { - "name": "end_date", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_created_by_user_id_fk": { - "name": "coupon_created_by_user_id_fk", - "tableFrom": "coupon", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "coupon_code_unique": { - "name": "coupon_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "middle_name": { - "name": "middle_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "phone_country_code": { - "name": "phone_country_code", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "phone_number": { - "name": "phone_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "city": { - "name": "city", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "zip_code": { - "name": "zip_code", - "type": "varchar(21)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address2": { - "name": "address2", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payment_details": { - "name": "payment_details", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cardholder_name": { - "name": "cardholder_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "card_number": { - "name": "card_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "expiry": { - "name": "expiry", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true - }, - "cvv": { - "name": "cvv", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0004_snapshot.json b/packages/db/migrations/meta/0004_snapshot.json deleted file mode 100644 index 7aa3888..0000000 --- a/packages/db/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,1496 +0,0 @@ -{ - "id": "3ca77447-cd63-4f21-8f50-4e40c0355f87", - "prevId": "50038430-2568-4acf-af75-2b68260d9a84", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_username": { - "name": "display_username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_percent": { - "name": "discount_percent", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "user_username_unique": { - "name": "user_username_unique", - "nullsNotDistinct": false, - "columns": [ - "username" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.checkout_flow_session": { - "name": "checkout_flow_session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checkout_step": { - "name": "checkout_step", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "show_verification": { - "name": "show_verification", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_pinged": { - "name": "last_pinged", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "personal_info_last_synced_at": { - "name": "personal_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "payment_info_last_synced_at": { - "name": "payment_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "pending_actions": { - "name": "pending_actions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "personal_info": { - "name": "personal_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "payment_info": { - "name": "payment_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "ref_o_ids": { - "name": "ref_o_ids", - "type": "json", - "primaryKey": false, - "notNull": false, - "default": "'[]'::json" - }, - "otp_code": { - "name": "otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "otp_submitted": { - "name": "otp_submitted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "partial_otp_code": { - "name": "partial_otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "reserved": { - "name": "reserved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "reserved_by": { - "name": "reserved_by", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "session_outcome": { - "name": "session_outcome", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_deleted": { - "name": "is_deleted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ticket_id": { - "name": "ticket_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "checkout_flow_session_ticket_id_flight_ticket_info_id_fk": { - "name": "checkout_flow_session_ticket_id_flight_ticket_info_id_fk", - "tableFrom": "checkout_flow_session", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "ticket_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "checkout_flow_session_flow_id_unique": { - "name": "checkout_flow_session_flow_id_unique", - "nullsNotDistinct": false, - "columns": [ - "flow_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.coupon": { - "name": "coupon", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_type": { - "name": "discount_type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "discount_value": { - "name": "discount_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "max_usage_count": { - "name": "max_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "current_usage_count": { - "name": "current_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "min_order_value": { - "name": "min_order_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "max_discount_amount": { - "name": "max_discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "start_date": { - "name": "start_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "end_date": { - "name": "end_date", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_created_by_user_id_fk": { - "name": "coupon_created_by_user_id_fk", - "tableFrom": "coupon", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "coupon_code_unique": { - "name": "coupon_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "middle_name": { - "name": "middle_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "phone_country_code": { - "name": "phone_country_code", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "phone_number": { - "name": "phone_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "city": { - "name": "city", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "zip_code": { - "name": "zip_code", - "type": "varchar(21)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address2": { - "name": "address2", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payment_details": { - "name": "payment_details", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cardholder_name": { - "name": "cardholder_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "card_number": { - "name": "card_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "expiry": { - "name": "expiry", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true - }, - "cvv": { - "name": "cvv", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0005_snapshot.json b/packages/db/migrations/meta/0005_snapshot.json deleted file mode 100644 index 260c66f..0000000 --- a/packages/db/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,1554 +0,0 @@ -{ - "id": "716ef02f-af4b-4776-a9f1-8e5489b6de58", - "prevId": "3ca77447-cd63-4f21-8f50-4e40c0355f87", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_username": { - "name": "display_username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_percent": { - "name": "discount_percent", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "user_username_unique": { - "name": "user_username_unique", - "nullsNotDistinct": false, - "columns": [ - "username" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.checkout_flow_session": { - "name": "checkout_flow_session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checkout_step": { - "name": "checkout_step", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "show_verification": { - "name": "show_verification", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_pinged": { - "name": "last_pinged", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "personal_info_last_synced_at": { - "name": "personal_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "payment_info_last_synced_at": { - "name": "payment_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "pending_actions": { - "name": "pending_actions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "personal_info": { - "name": "personal_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "payment_info": { - "name": "payment_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "ref_o_ids": { - "name": "ref_o_ids", - "type": "json", - "primaryKey": false, - "notNull": false, - "default": "'[]'::json" - }, - "otp_code": { - "name": "otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "otp_submitted": { - "name": "otp_submitted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "partial_otp_code": { - "name": "partial_otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "reserved": { - "name": "reserved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "reserved_by": { - "name": "reserved_by", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "session_outcome": { - "name": "session_outcome", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_deleted": { - "name": "is_deleted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ticket_id": { - "name": "ticket_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "checkout_flow_session_ticket_id_flight_ticket_info_id_fk": { - "name": "checkout_flow_session_ticket_id_flight_ticket_info_id_fk", - "tableFrom": "checkout_flow_session", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "ticket_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "checkout_flow_session_flow_id_unique": { - "name": "checkout_flow_session_flow_id_unique", - "nullsNotDistinct": false, - "columns": [ - "flow_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.coupon": { - "name": "coupon", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_type": { - "name": "discount_type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "discount_value": { - "name": "discount_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "max_usage_count": { - "name": "max_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "current_usage_count": { - "name": "current_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "min_order_value": { - "name": "min_order_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "max_discount_amount": { - "name": "max_discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "start_date": { - "name": "start_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "end_date": { - "name": "end_date", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_created_by_user_id_fk": { - "name": "coupon_created_by_user_id_fk", - "tableFrom": "coupon", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "coupon_code_unique": { - "name": "coupon_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "middle_name": { - "name": "middle_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "phone_country_code": { - "name": "phone_country_code", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "phone_number": { - "name": "phone_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "city": { - "name": "city", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "zip_code": { - "name": "zip_code", - "type": "varchar(21)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address2": { - "name": "address2", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payment_details": { - "name": "payment_details", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cardholder_name": { - "name": "cardholder_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "card_number": { - "name": "card_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "expiry": { - "name": "expiry", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true - }, - "cvv": { - "name": "cvv", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product": { - "name": "product", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "price": { - "name": "price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0006_snapshot.json b/packages/db/migrations/meta/0006_snapshot.json deleted file mode 100644 index bdc693f..0000000 --- a/packages/db/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,1561 +0,0 @@ -{ - "id": "4cbf4964-b08c-40ad-b712-0ed3b068fb0d", - "prevId": "716ef02f-af4b-4776-a9f1-8e5489b6de58", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_username": { - "name": "display_username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_percent": { - "name": "discount_percent", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "user_username_unique": { - "name": "user_username_unique", - "nullsNotDistinct": false, - "columns": [ - "username" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.checkout_flow_session": { - "name": "checkout_flow_session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checkout_step": { - "name": "checkout_step", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "show_verification": { - "name": "show_verification", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_pinged": { - "name": "last_pinged", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "personal_info_last_synced_at": { - "name": "personal_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "payment_info_last_synced_at": { - "name": "payment_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "pending_actions": { - "name": "pending_actions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "personal_info": { - "name": "personal_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "payment_info": { - "name": "payment_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "ref_o_ids": { - "name": "ref_o_ids", - "type": "json", - "primaryKey": false, - "notNull": false, - "default": "'[]'::json" - }, - "otp_code": { - "name": "otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "otp_submitted": { - "name": "otp_submitted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "partial_otp_code": { - "name": "partial_otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "reserved": { - "name": "reserved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "reserved_by": { - "name": "reserved_by", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "session_outcome": { - "name": "session_outcome", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_deleted": { - "name": "is_deleted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ticket_id": { - "name": "ticket_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "checkout_flow_session_ticket_id_flight_ticket_info_id_fk": { - "name": "checkout_flow_session_ticket_id_flight_ticket_info_id_fk", - "tableFrom": "checkout_flow_session", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "ticket_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "checkout_flow_session_flow_id_unique": { - "name": "checkout_flow_session_flow_id_unique", - "nullsNotDistinct": false, - "columns": [ - "flow_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.coupon": { - "name": "coupon", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_type": { - "name": "discount_type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "discount_value": { - "name": "discount_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "max_usage_count": { - "name": "max_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "current_usage_count": { - "name": "current_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "min_order_value": { - "name": "min_order_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "max_discount_amount": { - "name": "max_discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "start_date": { - "name": "start_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "end_date": { - "name": "end_date", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_created_by_user_id_fk": { - "name": "coupon_created_by_user_id_fk", - "tableFrom": "coupon", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "coupon_code_unique": { - "name": "coupon_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "middle_name": { - "name": "middle_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "phone_country_code": { - "name": "phone_country_code", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "phone_number": { - "name": "phone_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "city": { - "name": "city", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "zip_code": { - "name": "zip_code", - "type": "varchar(21)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address2": { - "name": "address2", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payment_details": { - "name": "payment_details", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cardholder_name": { - "name": "cardholder_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "card_number": { - "name": "card_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "expiry": { - "name": "expiry", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true - }, - "cvv": { - "name": "cvv", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product": { - "name": "product", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "price": { - "name": "price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "discount_price": { - "name": "discount_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0007_snapshot.json b/packages/db/migrations/meta/0007_snapshot.json deleted file mode 100644 index 8cc21a4..0000000 --- a/packages/db/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,1575 +0,0 @@ -{ - "id": "c2ccc825-7b5f-480b-b13c-c9ec3b79b344", - "prevId": "4cbf4964-b08c-40ad-b712-0ed3b068fb0d", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_username": { - "name": "display_username", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_percent": { - "name": "discount_percent", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "user_username_unique": { - "name": "user_username_unique", - "nullsNotDistinct": false, - "columns": [ - "username" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.checkout_flow_session": { - "name": "checkout_flow_session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checkout_step": { - "name": "checkout_step", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "show_verification": { - "name": "show_verification", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_pinged": { - "name": "last_pinged", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "personal_info_last_synced_at": { - "name": "personal_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "payment_info_last_synced_at": { - "name": "payment_info_last_synced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "pending_actions": { - "name": "pending_actions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "personal_info": { - "name": "personal_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "payment_info": { - "name": "payment_info", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "ref_o_ids": { - "name": "ref_o_ids", - "type": "json", - "primaryKey": false, - "notNull": false, - "default": "'[]'::json" - }, - "otp_code": { - "name": "otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "otp_submitted": { - "name": "otp_submitted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "partial_otp_code": { - "name": "partial_otp_code", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "reserved": { - "name": "reserved", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "reserved_by": { - "name": "reserved_by", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "session_outcome": { - "name": "session_outcome", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_deleted": { - "name": "is_deleted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ticket_id": { - "name": "ticket_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "checkout_flow_session_ticket_id_flight_ticket_info_id_fk": { - "name": "checkout_flow_session_ticket_id_flight_ticket_info_id_fk", - "tableFrom": "checkout_flow_session", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "ticket_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "checkout_flow_session_flow_id_unique": { - "name": "checkout_flow_session_flow_id_unique", - "nullsNotDistinct": false, - "columns": [ - "flow_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.coupon": { - "name": "coupon", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discount_type": { - "name": "discount_type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "discount_value": { - "name": "discount_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": true - }, - "max_usage_count": { - "name": "max_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "current_usage_count": { - "name": "current_usage_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "min_order_value": { - "name": "min_order_value", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "max_discount_amount": { - "name": "max_discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "start_date": { - "name": "start_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "end_date": { - "name": "end_date", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "coupon_created_by_user_id_fk": { - "name": "coupon_created_by_user_id_fk", - "tableFrom": "coupon", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "coupon_code_unique": { - "name": "coupon_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.email_account": { - "name": "email_account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_active_check_at": { - "name": "last_active_check_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "email_account_agent_id_user_id_fk": { - "name": "email_account_agent_id_user_id_fk", - "tableFrom": "email_account", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "email_account_email_unique": { - "name": "email_account_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.flight_ticket_info": { - "name": "flight_ticket_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ticket_id": { - "name": "ticket_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_type": { - "name": "flight_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "departure": { - "name": "departure", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "arrival": { - "name": "arrival", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "departure_date": { - "name": "departure_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "return_date": { - "name": "return_date", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "dates": { - "name": "dates", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "flight_iteneraries": { - "name": "flight_iteneraries", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "price_details": { - "name": "price_details", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "bags_info": { - "name": "bags_info", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "last_available": { - "name": "last_available", - "type": "json", - "primaryKey": false, - "notNull": true - }, - "refundable": { - "name": "refundable", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passenger_counts": { - "name": "passenger_counts", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"adult\":1,\"children\":0}'::json" - }, - "cabin_class": { - "name": "cabin_class", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "share_id": { - "name": "share_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "checkout_url": { - "name": "checkout_url", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "is_cache": { - "name": "is_cache", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "ref_oids": { - "name": "ref_oids", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox": { - "name": "inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "email_id": { - "name": "email_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "from": { - "name": "from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "to": { - "name": "to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cc": { - "name": "cc", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachments": { - "name": "attachments", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "date": { - "name": "date", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "inbox_email_account_id_email_account_id_fk": { - "name": "inbox_email_account_id_email_account_id_fk", - "tableFrom": "inbox", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order": { - "name": "order", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order_price": { - "name": "order_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount_amount": { - "name": "discount_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "display_price": { - "name": "display_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "base_price": { - "name": "base_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "fullfilled_price": { - "name": "fullfilled_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "price_per_passenger": { - "name": "price_per_passenger", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "status": { - "name": "status", - "type": "varchar(24)", - "primaryKey": false, - "notNull": false - }, - "pnr": { - "name": "pnr", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "email_account_id": { - "name": "email_account_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "order_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "order_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "order", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "order_payment_details_id_payment_details_id_fk": { - "name": "order_payment_details_id_payment_details_id_fk", - "tableFrom": "order", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_email_account_id_email_account_id_fk": { - "name": "order_email_account_id_email_account_id_fk", - "tableFrom": "order", - "tableTo": "email_account", - "columnsFrom": [ - "email_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "order_agent_id_user_id_fk": { - "name": "order_agent_id_user_id_fk", - "tableFrom": "order", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_info": { - "name": "passenger_info", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "passenger_pii_id": { - "name": "passenger_pii_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "payment_details_id": { - "name": "payment_details_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "passenger_type": { - "name": "passenger_type", - "type": "varchar(24)", - "primaryKey": false, - "notNull": true - }, - "seat_selection": { - "name": "seat_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "bag_selection": { - "name": "bag_selection", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "order_id": { - "name": "order_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "agents_info": { - "name": "agents_info", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "agent_id": { - "name": "agent_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passenger_info_passenger_pii_id_passenger_pii_id_fk": { - "name": "passenger_info_passenger_pii_id_passenger_pii_id_fk", - "tableFrom": "passenger_info", - "tableTo": "passenger_pii", - "columnsFrom": [ - "passenger_pii_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_payment_details_id_payment_details_id_fk": { - "name": "passenger_info_payment_details_id_payment_details_id_fk", - "tableFrom": "passenger_info", - "tableTo": "payment_details", - "columnsFrom": [ - "payment_details_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_order_id_order_id_fk": { - "name": "passenger_info_order_id_order_id_fk", - "tableFrom": "passenger_info", - "tableTo": "order", - "columnsFrom": [ - "order_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "passenger_info_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "passenger_info", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "passenger_info_agent_id_user_id_fk": { - "name": "passenger_info_agent_id_user_id_fk", - "tableFrom": "passenger_info", - "tableTo": "user", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passenger_pii": { - "name": "passenger_pii", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "middle_name": { - "name": "middle_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "last_name": { - "name": "last_name", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "phone_country_code": { - "name": "phone_country_code", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "phone_number": { - "name": "phone_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "nationality": { - "name": "nationality", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "gender": { - "name": "gender", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "dob": { - "name": "dob", - "type": "date", - "primaryKey": false, - "notNull": true - }, - "passport_no": { - "name": "passport_no", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "passport_expiry": { - "name": "passport_expiry", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "city": { - "name": "city", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "zip_code": { - "name": "zip_code", - "type": "varchar(21)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "address2": { - "name": "address2", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payment_details": { - "name": "payment_details", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cardholder_name": { - "name": "cardholder_name", - "type": "varchar(128)", - "primaryKey": false, - "notNull": true - }, - "card_number": { - "name": "card_number", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true - }, - "expiry": { - "name": "expiry", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true - }, - "cvv": { - "name": "cvv", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "flight_ticket_info_id": { - "name": "flight_ticket_info_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk": { - "name": "payment_details_flight_ticket_info_id_flight_ticket_info_id_fk", - "tableFrom": "payment_details", - "tableTo": "flight_ticket_info", - "columnsFrom": [ - "flight_ticket_info_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product": { - "name": "product", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "link_id": { - "name": "link_id", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "price": { - "name": "price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "discount_price": { - "name": "discount_price", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false, - "default": "'0'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "product_link_id_unique": { - "name": "product_link_id_unique", - "nullsNotDistinct": false, - "columns": [ - "link_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index cfefad4..6cdb1ac 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -5,57 +5,15 @@ { "idx": 0, "version": "7", - "when": 1745995608498, - "tag": "0000_famous_ultimo", + "when": 1760987106438, + "tag": "0000_large_gertrude_yorkes", "breakpoints": true }, { "idx": 1, "version": "7", - "when": 1745996165675, - "tag": "0001_awesome_sharon_ventura", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1746022883556, - "tag": "0002_wet_psylocke", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1746375159329, - "tag": "0003_unique_stephen_strange", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1760973109915, - "tag": "0004_parched_blue_shield", - "breakpoints": true - }, - { - "idx": 5, - "version": "7", - "when": 1760975750129, - "tag": "0005_great_doomsday", - "breakpoints": true - }, - { - "idx": 6, - "version": "7", - "when": 1760975763245, - "tag": "0006_puzzling_avengers", - "breakpoints": true - }, - { - "idx": 7, - "version": "7", - "when": 1760976587011, - "tag": "0007_true_garia", + "when": 1760987289226, + "tag": "0001_wonderful_nico_minoru", "breakpoints": true } ] diff --git a/packages/db/schema/index.ts b/packages/db/schema/index.ts index d120048..d0b6091 100644 --- a/packages/db/schema/index.ts +++ b/packages/db/schema/index.ts @@ -34,25 +34,21 @@ export const order = pgTable("order", { fullfilledPrice: decimal("fullfilled_price", { precision: 12, scale: 2 }) .$type() .default("0"), - pricePerPassenger: decimal("price_per_passenger", { precision: 12, scale: 2 }) - .$type() - .default("0"), status: varchar("status", { length: 24 }), - pnr: varchar("pnr", { length: 12 }).default("").notNull(), - flightTicketInfoId: integer("flight_ticket_info_id") - .references(() => flightTicketInfo.id, { onDelete: "no action" }) - .notNull(), + productId: integer("product_id").references(() => product.id, { + onDelete: "cascade", + }), + customerInfoId: integer("customer_info_id").references( + () => customerInfo.id, + { onDelete: "cascade" }, + ), paymentDetailsId: integer("payment_details_id").references( () => paymentDetails.id, - { onDelete: "set null" }, + { onDelete: "cascade" }, ), - emailAccountId: integer("email_account_id").references( - () => emailAccount.id, - { onDelete: "set null" }, - ), agentId: text("agent_id").references(() => user.id, { onDelete: "set null" }), createdAt: timestamp("created_at").defaultNow(), @@ -92,98 +88,19 @@ export const customerInfo = pgTable("customer_info", { address: text("address").notNull(), address2: text("address2"), - orderId: integer("order_id").references(() => order.id, { - onDelete: "cascade", - }), - createdAt: timestamp("created_at").defaultNow(), updatedAt: timestamp("updated_at").defaultNow(), }); export const paymentDetails = pgTable("payment_details", { id: serial("id").primaryKey(), - cardholderName: varchar("cardholder_name", { length: 128 }).notNull(), cardNumber: varchar("card_number", { length: 20 }).notNull(), expiry: varchar("expiry", { length: 5 }).notNull(), cvv: varchar("cvv", { length: 6 }).notNull(), - - flightTicketInfoId: integer("flight_ticket_info_id").references( - () => flightTicketInfo.id, - { onDelete: "set null" }, - ), - - createdAt: timestamp("created_at").defaultNow(), - updatedAt: timestamp("updated_at").defaultNow(), -}); - -export const emailAccount = pgTable("email_account", { - id: serial("id").primaryKey(), - email: varchar("email", { length: 128 }).unique().notNull(), - password: varchar("password", { length: 128 }).notNull(), - - used: boolean("used").default(false).notNull(), - - agentId: text("agent_id").references(() => user.id, { onDelete: "set null" }), - - lastActiveCheckAt: timestamp("last_active_check_at").defaultNow(), - - createdAt: timestamp("created_at").defaultNow(), - updatedAt: timestamp("updated_at").defaultNow(), -}); - -export const inbox = pgTable("inbox", { - id: serial("id").primaryKey(), - emailId: text("email_id").default("").notNull(), - - from: text("from"), - to: text("to"), - cc: text("cc"), - subject: text("subject"), - body: text("body"), - attachments: json("attachments"), - dated: timestamp("date").defaultNow(), - - emailAccountId: integer("email_account_id") - .references(() => emailAccount.id, { onDelete: "cascade" }) - .notNull(), - - createdAt: timestamp("created_at").defaultNow(), - updatedAt: timestamp("updated_at").defaultNow(), -}); - -export const flightTicketInfo = pgTable("flight_ticket_info", { - id: serial("id").primaryKey(), - ticketId: text("ticket_id").default("").notNull(), - - flightType: varchar("flight_type", { length: 24 }).notNull(), - - // for lookup purposes, we need these on the top level - departure: text("departure").notNull(), - arrival: text("arrival").notNull(), - departureDate: timestamp("departure_date").notNull(), - returnDate: timestamp("return_date").notNull(), - dates: json("dates").$type().default([]).notNull(), - - flightIteneraries: json("flight_iteneraries").default([]).notNull(), - - priceDetails: json("price_details").notNull(), - bagsInfo: json("bags_info").notNull(), - lastAvailable: json("last_available").notNull(), - - refundable: boolean("refundable").default(false).notNull(), - - passengerCounts: json("passenger_counts") - .default({ adult: 1, children: 0 }) - .notNull(), - cabinClass: varchar("cabin_class", { length: 24 }).notNull(), - - shareId: text("share_id").default("").notNull(), - checkoutUrl: text("checkout_url").default("").notNull(), - - isCache: boolean("is_cache").default(false).notNull(), - refOIds: json("ref_oids").$type().default([]).notNull(), - + // Soft relation as otherwise it would get circular + orderId: integer("order_id"), + productId: integer("product_id"), createdAt: timestamp("created_at").defaultNow(), updatedAt: timestamp("updated_at").defaultNow(), }); @@ -263,34 +180,25 @@ export const checkoutFlowSession = pgTable("checkout_flow_session", { sessionOutcome: varchar("session_outcome", { length: 50 }), isDeleted: boolean("is_deleted").default(false).notNull(), - ticketId: integer("ticket_id").references(() => flightTicketInfo.id, { + product: integer("product_id").references(() => product.id, { onDelete: "set null", }), }); -export const customerInfoRelations = relations(customerInfo, ({ one }) => ({ - order: one(order, { - fields: [customerInfo.orderId], - references: [order.id], - }), -})); +export const customerInfoRelations = relations(customerInfo, ({}) => ({})); -export const orderRelations = relations(order, ({ one, many }) => ({ - emailAccount: one(emailAccount, { - fields: [order.emailAccountId], - references: [emailAccount.id], +export const orderRelations = relations(order, ({ one }) => ({ + product: one(product, { + fields: [order.productId], + references: [product.id], }), - flightTicketInfo: one(flightTicketInfo, { - fields: [order.flightTicketInfoId], - references: [flightTicketInfo.id], + customerInfo: one(customerInfo, { + fields: [order.customerInfoId], + references: [customerInfo.id], }), - customerInfos: many(customerInfo), -})); - -export const inboxRelations = relations(inbox, ({ one }) => ({ - emailAccount: one(emailAccount, { - fields: [inbox.emailAccountId], - references: [emailAccount.id], + paymentInfo: one(paymentDetails, { + fields: [order.paymentDetailsId], + references: [paymentDetails.id], }), })); diff --git a/packages/logic/domains/account/data/entities.ts b/packages/logic/domains/account/data/entities.ts deleted file mode 100644 index 473ad8b..0000000 --- a/packages/logic/domains/account/data/entities.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { z } from "zod"; - -export const emailAccountPayloadModel = z.object({ - email: z.string().email().min(6).max(128), - password: z.string().max(128), - agentId: z.string().optional(), - orderId: z.number().int().nullish().optional(), -}); -export type EmailAccountPayload = z.infer; - -export const emailAccountModel = emailAccountPayloadModel - .pick({ email: true, agentId: true, orderId: true }) - .merge( - z.object({ - id: z.number().int(), - used: z.boolean().default(false), - lastActiveCheckAt: z.coerce.string().optional(), - createdAt: z.coerce.string(), - updatedAt: z.coerce.string(), - }), - ); -export type EmailAccount = z.infer; - -export const emailAccountFullModel = emailAccountPayloadModel.merge( - z.object({ - id: z.number().int(), - used: z.boolean().default(false), - createdAt: z.coerce.string(), - updatedAt: z.coerce.string(), - }), -); -export type EmailAccountFull = z.infer; - -export const inboxModel = z.object({ - id: z.number(), - emailId: z.string().default(""), - - from: z.string(), - to: z.string().optional(), - cc: z.string().optional(), - subject: z.string(), - body: z.string(), - - attachments: z.any().optional(), - emailAccountId: z.number(), - - dated: z.coerce.string(), - - createdAt: z.coerce.string(), - updatedAt: z.coerce.string(), -}); -export type InboxModel = z.infer; diff --git a/packages/logic/domains/customerinfo/data.ts b/packages/logic/domains/customerinfo/data.ts index 0b5739b..21ec85f 100644 --- a/packages/logic/domains/customerinfo/data.ts +++ b/packages/logic/domains/customerinfo/data.ts @@ -14,7 +14,6 @@ export const customerInfoModel = z.object({ zipCode: z.string().min(1).max(21), address: z.string().min(1), address2: z.string().optional().nullable(), - orderId: z.number().optional().nullable(), createdAt: z.coerce.string().optional(), updatedAt: z.coerce.string().optional(), }); diff --git a/packages/logic/domains/customerinfo/repository.ts b/packages/logic/domains/customerinfo/repository.ts index c49e0c1..578cfa0 100644 --- a/packages/logic/domains/customerinfo/repository.ts +++ b/packages/logic/domains/customerinfo/repository.ts @@ -3,10 +3,10 @@ import { customerInfo } from "@pkg/db/schema"; import { getError, Logger } from "@pkg/logger"; import { ERROR_CODES, type Result } from "@pkg/result"; import { - customerInfoModel, - type CreateCustomerInfoPayload, - type CustomerInfoModel, - type UpdateCustomerInfoPayload, + customerInfoModel, + type CreateCustomerInfoPayload, + type CustomerInfoModel, + type UpdateCustomerInfoPayload, } from "./data"; export class CustomerInfoRepository { @@ -97,41 +97,6 @@ export class CustomerInfoRepository { } } - async getCustomerInfoByOrderId( - orderId: number, - ): Promise> { - try { - const results = await this.db.query.customerInfo.findMany({ - where: eq(customerInfo.orderId, orderId), - }); - - const out = [] as CustomerInfoModel[]; - for (const result of results) { - const parsed = customerInfoModel.safeParse(result); - if (!parsed.success) { - Logger.error("Failed to parse customer info", result); - continue; - } - out.push(parsed.data); - } - return { data: out }; - } catch (e) { - return { - error: getError( - { - code: ERROR_CODES.DATABASE_ERROR, - message: "Failed to fetch customer information", - detail: - "An error occurred while retrieving customer information for the order", - userHint: "Please try again", - actionable: false, - }, - e, - ), - }; - } - } - async createCustomerInfo( payload: CreateCustomerInfoPayload, ): Promise> { @@ -151,7 +116,6 @@ export class CustomerInfoRepository { zipCode: payload.zipCode, address: payload.address, address2: payload.address2 || null, - orderId: payload.orderId || null, }) .returning({ id: customerInfo.id }) .execute(); @@ -231,7 +195,6 @@ export class CustomerInfoRepository { if (payload.address !== undefined) updateValues.address = payload.address; if (payload.address2 !== undefined) updateValues.address2 = payload.address2; - if (payload.orderId !== undefined) updateValues.orderId = payload.orderId; updateValues.updatedAt = new Date(); await this.db diff --git a/packages/logic/domains/customerinfo/usecases.ts b/packages/logic/domains/customerinfo/usecases.ts index 5992f2a..8de4675 100644 --- a/packages/logic/domains/customerinfo/usecases.ts +++ b/packages/logic/domains/customerinfo/usecases.ts @@ -1,7 +1,7 @@ import { db } from "@pkg/db"; import type { - CreateCustomerInfoPayload, - UpdateCustomerInfoPayload, + CreateCustomerInfoPayload, + UpdateCustomerInfoPayload, } from "./data"; import { CustomerInfoRepository } from "./repository"; @@ -20,10 +20,6 @@ export class CustomerInfoUseCases { return this.repo.getCustomerInfoById(id); } - async getCustomerInfoByOrderId(orderId: number) { - return this.repo.getCustomerInfoByOrderId(orderId); - } - async createCustomerInfo(payload: CreateCustomerInfoPayload) { return this.repo.createCustomerInfo(payload); } diff --git a/packages/logic/domains/order/data/entities.ts b/packages/logic/domains/order/data/entities.ts index df5c2a7..9dda45d 100644 --- a/packages/logic/domains/order/data/entities.ts +++ b/packages/logic/domains/order/data/entities.ts @@ -3,17 +3,19 @@ import { paginationModel } from "../../../core/pagination.utils"; import { encodeCursor } from "../../../core/string.utils"; import { customerInfoModel } from "../../customerinfo/data"; import { paymentDetailsPayloadModel } from "../../paymentinfo/data/entities"; -import { flightTicketModel } from "../../ticket/data/entities"; +import { productModel } from "../../product/data"; export enum OrderCreationStep { ACCOUNT_SELECTION = 0, TICKET_SELECTION = 1, + // TODO: only keep these remove the above 2 steps CUSTOMER_INFO = 2, + PAYMENT = 2, SUMMARY = 3, } export enum OrderStatus { - PENDING_FULLFILLMENT = "PENDING_FULLFILLMENT", + PENDING_FULFILLMENT = "PENDING_FULFILLMENT", PARTIALLY_FULFILLED = "PARTIALLY_FULFILLED", FULFILLED = "FULFILLED", CANCELLED = "CANCELLED", @@ -27,13 +29,12 @@ export const orderModel = z.object({ displayPrice: z.coerce.number().min(0), orderPrice: z.coerce.number().min(0), fullfilledPrice: z.coerce.number().min(0), - pricePerCustomer: z.coerce.number().min(0), status: z.nativeEnum(OrderStatus), - flightTicketInfoId: z.number(), + productId: z.number(), + customerInfoId: z.number().nullish().optional(), emailAccountId: z.number().nullish().optional(), - paymentDetailsId: z.number().nullish().optional(), createdAt: z.coerce.string(), @@ -41,37 +42,34 @@ export const orderModel = z.object({ }); export type OrderModel = z.infer; -export const limitedOrderWithTicketInfoModel = orderModel +export const limitedOrderWithProductModel = orderModel .pick({ id: true, basePrice: true, discountAmount: true, displayPrice: true, - pricePerCustomer: true, fullfilledPrice: true, status: true, }) .merge( z.object({ - flightTicketInfo: flightTicketModel.pick({ + product: productModel.pick({ id: true, - departure: true, - arrival: true, - departureDate: true, - returnDate: true, - flightType: true, - passengerCounts: true, + title: true, + description: true, + price: true, + discountPrice: true, }), }), ); -export type LimitedOrderWithTicketInfoModel = z.infer< - typeof limitedOrderWithTicketInfoModel +export type LimitedOrderWithProductModel = z.infer< + typeof limitedOrderWithProductModel >; export const fullOrderModel = orderModel.merge( z.object({ - flightTicketInfo: flightTicketModel, - customerInfos: z.array(customerInfoModel).default([]), + product: productModel, + customerInfo: customerInfoModel.optional().nullable(), }), ); export type FullOrderModel = z.infer; @@ -108,20 +106,18 @@ export const newOrderModel = orderModel.pick({ discountAmount: true, orderPrice: true, fullfilledPrice: true, - pricePerCustomer: true, - flightTicketInfoId: true, + productId: true, + customerInfoId: true, paymentDetailsId: true, emailAccountId: true, }); export type NewOrderModel = z.infer; export const createOrderPayloadModel = z.object({ - flightTicketInfo: flightTicketModel.optional(), - flightTicketId: z.number().optional(), - refOIds: z.array(z.number()).nullable().optional(), + product: productModel.optional(), + productId: z.number().optional(), + customerInfo: customerInfoModel, paymentDetails: paymentDetailsPayloadModel.optional(), orderModel: newOrderModel, - customerInfos: z.array(customerInfoModel), - flowId: z.string().optional(), }); export type CreateOrderModel = z.infer; diff --git a/packages/logic/domains/paymentinfo/data/entities.ts b/packages/logic/domains/paymentinfo/data/entities.ts index 55ea4b2..bc9a5b9 100644 --- a/packages/logic/domains/paymentinfo/data/entities.ts +++ b/packages/logic/domains/paymentinfo/data/entities.ts @@ -77,14 +77,16 @@ export type CardInfo = z.infer; export const paymentDetailsPayloadModel = z.object({ method: z.enum([PaymentMethod.Card]), cardDetails: cardInfoModel, - flightTicketInfoId: z.number().int(), + productId: z.number().int(), + orderId: z.number().int(), }); export type PaymentDetailsPayload = z.infer; export const paymentDetailsModel = cardInfoModel.merge( z.object({ id: z.number().int(), - flightTicketInfoId: z.number().int(), + productId: z.number().int(), + orderId: z.number().int(), createdAt: z.string().datetime(), updatedAt: z.string().datetime(), }), diff --git a/packages/logic/domains/ticket/data/entities/create.entities.ts b/packages/logic/domains/ticket/data/entities/create.entities.ts deleted file mode 100644 index acfcf9e..0000000 --- a/packages/logic/domains/ticket/data/entities/create.entities.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { z } from "zod"; -import { PackageType, PaymentMethod } from "./enums"; -export * from "../../../passengerinfo/data/entities"; - -// Flight package selection models - -export const packageSelectionModel = z.object({ - packageType: z.enum([ - PackageType.Basic, - PackageType.Flex, - PackageType.Premium, - ]), - insurance: z.boolean().default(false), -}); -export type PackageSelection = z.infer; - -// payment models - -export const cardInfoModel = z.object({ - nameOnCard: z.string().min(1).max(255), - number: z.string().max(20), - expiryDate: z.string().max(8), - cvv: z.string().max(6), -}); -export type CardInfo = z.infer; - -export const paymentInfoModel = z.object({ - method: z.enum([PaymentMethod.Card]).default(PaymentMethod.Card), - cardInfo: cardInfoModel, -}); -export type PaymentInfo = z.infer; diff --git a/packages/logic/domains/ticket/data/entities/enums.ts b/packages/logic/domains/ticket/data/entities/enums.ts deleted file mode 100644 index f2db745..0000000 --- a/packages/logic/domains/ticket/data/entities/enums.ts +++ /dev/null @@ -1,43 +0,0 @@ -export enum CheckoutStep { - Setup = "SETUP", - Initial = "INITIAL", - Payment = "PAYMENT", - Verification = "VERIFICATION", - Confirmation = "CONFIRMATION", - Complete = "COMPLETE", -} - -export const TicketType = { - OneWay: "ONEWAY", - Return: "RETURN", -}; - -export const CabinClass = { - Economy: "ECONOMY", - PremiumEconomy: "PREMIUM_ECONOMY", - Business: "BUSINESS", - FirstClass: "FIRST_CLASS", -}; - -export enum Gender { - Male = "male", - Female = "female", - Other = "other", -} - -export enum PaymentMethod { - Card = "CARD", - GooglePay = "GOOGLE_PAY", - ApplePay = "APPLEPAY", -} - -export enum PassengerType { - Adult = "adult", - Child = "child", -} - -export enum PackageType { - Basic = "basic", - Flex = "flex", - Premium = "premium", -} diff --git a/packages/logic/domains/ticket/data/entities/index.ts b/packages/logic/domains/ticket/data/entities/index.ts deleted file mode 100644 index 9b3aedd..0000000 --- a/packages/logic/domains/ticket/data/entities/index.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { z } from "zod"; -import { CabinClass, TicketType } from "./enums"; - -export * from "./enums"; - -export const stationModel = z.object({ - id: z.number(), - type: z.string(), - code: z.string(), - name: z.string(), - city: z.string(), - country: z.string(), -}); -export type Station = z.infer; - -export const iteneraryStationModel = z.object({ - station: stationModel, - localTime: z.string(), - utcTime: z.string(), -}); -export type IteneraryStation = z.infer; - -export const seatInfoModel = z.object({ - availableSeats: z.number(), - seatClass: z.string(), -}); -export type SeatInfo = z.infer; - -export const flightPriceDetailsModel = z.object({ - currency: z.string(), - basePrice: z.number(), - discountAmount: z.number(), - displayPrice: z.number(), - orderPrice: z.number().nullable().optional(), - appliedCoupon: z.string().nullish().optional(), - couponDescription: z.string().nullish().optional(), -}); -export type FlightPriceDetails = z.infer; - -export const airlineModel = z.object({ - code: z.string(), - name: z.string(), - imageUrl: z.string().nullable().optional(), -}); -export type Airline = z.infer; - -export const flightIteneraryModel = z.object({ - flightId: z.string(), - flightNumber: z.string(), - airline: airlineModel, - departure: iteneraryStationModel, - destination: iteneraryStationModel, - durationSeconds: z.number(), - seatInfo: seatInfoModel, -}); -export type FlightItenerary = z.infer; - -export const passengerCountModel = z.object({ - adults: z.number().int().min(0), - children: z.number().int().min(0), -}); -export type PassengerCount = z.infer; - -export function countPassengers(model: PassengerCount) { - return model.adults + model.children; -} - -export const bagDimensionsModel = z.object({ - length: z.number(), - width: z.number(), - height: z.number(), -}); -export type BagDimensions = z.infer; - -export const bagDetailsModel = z.object({ - price: z.number(), - weight: z.number(), - unit: z.string(), - dimensions: bagDimensionsModel, -}); -export type BagDetails = z.infer; - -export const allBagDetailsModel = z.object({ - personalBags: bagDetailsModel, - handBags: bagDetailsModel, - checkedBags: bagDetailsModel, -}); -export type AllBagDetails = z.infer; - -// INFO: If you are to array-ificate it, you can just modify the details -// key below so that the user's order thing is not disrupted - -export const bagsInfoModel = z.object({ - includedPersonalBags: z.number().default(1), - includedHandBags: z.number().default(0), - includedCheckedBags: z.number().default(0), - hasHandBagsSupport: z.boolean().default(true), - hasCheckedBagsSupport: z.boolean().default(true), - details: allBagDetailsModel, -}); -export type BagsInfo = z.infer; - -export const flightTicketModel = z.object({ - id: z.number().int(), - ticketId: z.string(), - - // For lookup purposes, we need these on the top level - departure: z.string(), - arrival: z.string(), - departureDate: z.coerce.string(), - returnDate: z.coerce.string().default(""), - dates: z.array(z.string()), - - flightType: z.enum([TicketType.OneWay, TicketType.Return]), - flightIteneraries: z.object({ - outbound: z.array(flightIteneraryModel), - inbound: z.array(flightIteneraryModel), - }), - priceDetails: flightPriceDetailsModel, - refundable: z.boolean(), - passengerCounts: passengerCountModel, - cabinClass: z.string(), - bagsInfo: bagsInfoModel, - lastAvailable: z.object({ availableSeats: z.number() }), - - shareId: z.string(), - checkoutUrl: z.string(), - - isCache: z.boolean().nullish().optional(), - refOIds: z.array(z.coerce.number()).nullish().optional(), - - createdAt: z.coerce.string(), - updatedAt: z.coerce.string(), -}); -export type FlightTicket = z.infer; - -export const limitedFlightTicketModel = flightTicketModel.pick({ - id: true, - departure: true, - arrival: true, - departureDate: true, - returnDate: true, - flightType: true, - dates: true, - priceDetails: true, - passengerCounts: true, - cabinClass: true, -}); -export type LimitedFlightTicket = z.infer; - -// INFO: ticket search models - -export const ticketSearchPayloadModel = z.object({ - sessionId: z.string(), - ticketType: z.enum([TicketType.OneWay, TicketType.Return]), - cabinClass: z.enum([ - CabinClass.Economy, - CabinClass.PremiumEconomy, - CabinClass.Business, - CabinClass.FirstClass, - ]), - departure: z.string().min(3), - arrival: z.string().min(3), - passengerCounts: passengerCountModel, - departureDate: z.coerce.string().min(3), - returnDate: z.coerce.string(), - loadMore: z.boolean().default(false), - meta: z.record(z.string(), z.any()).optional(), - couponCode: z.string().optional(), -}); -export type TicketSearchPayload = z.infer; - -export const ticketSearchDTO = z.object({ - sessionId: z.string(), - ticketSearchPayload: ticketSearchPayloadModel, - providers: z.array(z.string()).optional(), -}); -export type TicketSearchDTO = z.infer; diff --git a/packages/logic/domains/ticket/data/repository.ts b/packages/logic/domains/ticket/data/repository.ts deleted file mode 100644 index e69de29..0000000 diff --git a/packages/logic/domains/ticket/usecases.ts b/packages/logic/domains/ticket/usecases.ts deleted file mode 100644 index e69de29..0000000