@voyant-travel/quotes 0.122.0 → 0.122.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
DO $$ BEGIN
|
|
2
|
+
CREATE TYPE "public"."entity_type" AS ENUM('organization', 'person', 'quote', 'activity');
|
|
3
|
+
EXCEPTION WHEN duplicate_object THEN null;
|
|
4
|
+
END $$;--> statement-breakpoint
|
|
5
|
+
DO $$ BEGIN
|
|
6
|
+
CREATE TYPE "public"."participant_role" AS ENUM('traveler', 'booker', 'decision_maker', 'finance', 'other');
|
|
7
|
+
EXCEPTION WHEN duplicate_object THEN null;
|
|
8
|
+
END $$;--> statement-breakpoint
|
|
9
|
+
DO $$ BEGIN
|
|
10
|
+
CREATE TYPE "public"."quote_status" AS ENUM('open', 'won', 'lost', 'archived');
|
|
11
|
+
EXCEPTION WHEN duplicate_object THEN null;
|
|
12
|
+
END $$;--> statement-breakpoint
|
|
13
|
+
DO $$ BEGIN
|
|
14
|
+
CREATE TYPE "public"."quote_version_status" AS ENUM('draft', 'sent', 'accepted', 'declined', 'superseded', 'expired');
|
|
15
|
+
EXCEPTION WHEN duplicate_object THEN null;
|
|
16
|
+
END $$;--> statement-breakpoint
|
|
17
|
+
CREATE TABLE "booking_crm_details" (
|
|
18
|
+
"booking_id" text PRIMARY KEY NOT NULL,
|
|
19
|
+
"quote_id" text,
|
|
20
|
+
"quote_version_id" text,
|
|
21
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
22
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE TABLE "pipelines" (
|
|
26
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
27
|
+
"entity_type" "entity_type" DEFAULT 'quote' NOT NULL,
|
|
28
|
+
"name" text NOT NULL,
|
|
29
|
+
"is_default" boolean DEFAULT false NOT NULL,
|
|
30
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
31
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
32
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
33
|
+
);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
CREATE TABLE "quote_media" (
|
|
36
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
37
|
+
"quote_id" text NOT NULL,
|
|
38
|
+
"media_type" text NOT NULL,
|
|
39
|
+
"name" text NOT NULL,
|
|
40
|
+
"url" text NOT NULL,
|
|
41
|
+
"storage_key" text,
|
|
42
|
+
"mime_type" text,
|
|
43
|
+
"file_size" integer,
|
|
44
|
+
"alt_text" text,
|
|
45
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
46
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
47
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
48
|
+
);
|
|
49
|
+
--> statement-breakpoint
|
|
50
|
+
CREATE TABLE "quote_participants" (
|
|
51
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
52
|
+
"quote_id" text NOT NULL,
|
|
53
|
+
"person_id" text NOT NULL,
|
|
54
|
+
"role" "participant_role" DEFAULT 'other' NOT NULL,
|
|
55
|
+
"is_primary" boolean DEFAULT false NOT NULL,
|
|
56
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
57
|
+
);
|
|
58
|
+
--> statement-breakpoint
|
|
59
|
+
CREATE TABLE "quote_products" (
|
|
60
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
61
|
+
"quote_id" text NOT NULL,
|
|
62
|
+
"product_id" text,
|
|
63
|
+
"supplier_service_id" text,
|
|
64
|
+
"name_snapshot" text NOT NULL,
|
|
65
|
+
"description" text,
|
|
66
|
+
"quantity" integer DEFAULT 1 NOT NULL,
|
|
67
|
+
"unit_price_amount_cents" integer,
|
|
68
|
+
"cost_amount_cents" integer,
|
|
69
|
+
"currency" text,
|
|
70
|
+
"discount_amount_cents" integer,
|
|
71
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
72
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
73
|
+
);
|
|
74
|
+
--> statement-breakpoint
|
|
75
|
+
CREATE TABLE "quote_version_lines" (
|
|
76
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
77
|
+
"quote_version_id" text NOT NULL,
|
|
78
|
+
"product_id" text,
|
|
79
|
+
"supplier_service_id" text,
|
|
80
|
+
"description" text NOT NULL,
|
|
81
|
+
"quantity" integer DEFAULT 1 NOT NULL,
|
|
82
|
+
"unit_price_amount_cents" integer DEFAULT 0 NOT NULL,
|
|
83
|
+
"total_amount_cents" integer DEFAULT 0 NOT NULL,
|
|
84
|
+
"currency" text NOT NULL,
|
|
85
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
86
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
87
|
+
);
|
|
88
|
+
--> statement-breakpoint
|
|
89
|
+
CREATE TABLE "quote_versions" (
|
|
90
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
91
|
+
"quote_id" text NOT NULL,
|
|
92
|
+
"label" text,
|
|
93
|
+
"status" "quote_version_status" DEFAULT 'draft' NOT NULL,
|
|
94
|
+
"supersedes_id" text,
|
|
95
|
+
"trip_snapshot_id" text,
|
|
96
|
+
"valid_until" date,
|
|
97
|
+
"currency" text NOT NULL,
|
|
98
|
+
"subtotal_amount_cents" integer DEFAULT 0 NOT NULL,
|
|
99
|
+
"tax_amount_cents" integer DEFAULT 0 NOT NULL,
|
|
100
|
+
"total_amount_cents" integer DEFAULT 0 NOT NULL,
|
|
101
|
+
"notes" text,
|
|
102
|
+
"sent_at" timestamp with time zone,
|
|
103
|
+
"viewed_at" timestamp with time zone,
|
|
104
|
+
"decided_at" timestamp with time zone,
|
|
105
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
106
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
107
|
+
"archived_at" timestamp with time zone
|
|
108
|
+
);
|
|
109
|
+
--> statement-breakpoint
|
|
110
|
+
CREATE TABLE "quotes" (
|
|
111
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
112
|
+
"title" text NOT NULL,
|
|
113
|
+
"person_id" text,
|
|
114
|
+
"organization_id" text,
|
|
115
|
+
"pipeline_id" text NOT NULL,
|
|
116
|
+
"stage_id" text NOT NULL,
|
|
117
|
+
"owner_id" text,
|
|
118
|
+
"status" "quote_status" DEFAULT 'open' NOT NULL,
|
|
119
|
+
"accepted_version_id" text,
|
|
120
|
+
"value_amount_cents" integer,
|
|
121
|
+
"value_currency" text,
|
|
122
|
+
"pax_count" integer,
|
|
123
|
+
"expected_close_date" date,
|
|
124
|
+
"source" text,
|
|
125
|
+
"source_ref" text,
|
|
126
|
+
"lost_reason" text,
|
|
127
|
+
"tags" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
128
|
+
"custom_fields" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
129
|
+
"description" text,
|
|
130
|
+
"created_by" text,
|
|
131
|
+
"updated_by" text,
|
|
132
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
133
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
134
|
+
"stage_changed_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
135
|
+
"closed_at" timestamp with time zone
|
|
136
|
+
);
|
|
137
|
+
--> statement-breakpoint
|
|
138
|
+
CREATE TABLE "stages" (
|
|
139
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
140
|
+
"pipeline_id" text NOT NULL,
|
|
141
|
+
"name" text NOT NULL,
|
|
142
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
143
|
+
"probability" integer,
|
|
144
|
+
"is_closed" boolean DEFAULT false NOT NULL,
|
|
145
|
+
"is_won" boolean DEFAULT false NOT NULL,
|
|
146
|
+
"is_lost" boolean DEFAULT false NOT NULL,
|
|
147
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
148
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
149
|
+
);
|
|
150
|
+
--> statement-breakpoint
|
|
151
|
+
ALTER TABLE "quote_media" ADD CONSTRAINT "quote_media_quote_id_quotes_id_fk" FOREIGN KEY ("quote_id") REFERENCES "public"."quotes"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
152
|
+
ALTER TABLE "quote_participants" ADD CONSTRAINT "quote_participants_quote_id_quotes_id_fk" FOREIGN KEY ("quote_id") REFERENCES "public"."quotes"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
153
|
+
ALTER TABLE "quote_products" ADD CONSTRAINT "quote_products_quote_id_quotes_id_fk" FOREIGN KEY ("quote_id") REFERENCES "public"."quotes"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
154
|
+
ALTER TABLE "quote_version_lines" ADD CONSTRAINT "quote_version_lines_quote_version_id_quote_versions_id_fk" FOREIGN KEY ("quote_version_id") REFERENCES "public"."quote_versions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
155
|
+
ALTER TABLE "quote_versions" ADD CONSTRAINT "quote_versions_quote_id_quotes_id_fk" FOREIGN KEY ("quote_id") REFERENCES "public"."quotes"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
156
|
+
ALTER TABLE "quote_versions" ADD CONSTRAINT "quote_versions_supersedes_id_quote_versions_id_fk" FOREIGN KEY ("supersedes_id") REFERENCES "public"."quote_versions"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
157
|
+
ALTER TABLE "quotes" ADD CONSTRAINT "quotes_pipeline_id_pipelines_id_fk" FOREIGN KEY ("pipeline_id") REFERENCES "public"."pipelines"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
158
|
+
ALTER TABLE "quotes" ADD CONSTRAINT "quotes_stage_id_stages_id_fk" FOREIGN KEY ("stage_id") REFERENCES "public"."stages"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
|
|
159
|
+
ALTER TABLE "stages" ADD CONSTRAINT "stages_pipeline_id_pipelines_id_fk" FOREIGN KEY ("pipeline_id") REFERENCES "public"."pipelines"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
160
|
+
CREATE INDEX "idx_bcd_quote" ON "booking_crm_details" USING btree ("quote_id");--> statement-breakpoint
|
|
161
|
+
CREATE INDEX "idx_bcd_quote_version" ON "booking_crm_details" USING btree ("quote_version_id");--> statement-breakpoint
|
|
162
|
+
CREATE INDEX "idx_pipelines_entity" ON "pipelines" USING btree ("entity_type");--> statement-breakpoint
|
|
163
|
+
CREATE INDEX "idx_pipelines_sort" ON "pipelines" USING btree ("sort_order","created_at");--> statement-breakpoint
|
|
164
|
+
CREATE INDEX "idx_pipelines_entity_sort" ON "pipelines" USING btree ("entity_type","sort_order","created_at");--> statement-breakpoint
|
|
165
|
+
CREATE UNIQUE INDEX "uidx_pipelines_entity_name" ON "pipelines" USING btree ("entity_type","name");--> statement-breakpoint
|
|
166
|
+
CREATE INDEX "idx_quote_media_quote" ON "quote_media" USING btree ("quote_id");--> statement-breakpoint
|
|
167
|
+
CREATE INDEX "idx_quote_media_quote_sort" ON "quote_media" USING btree ("quote_id","sort_order");--> statement-breakpoint
|
|
168
|
+
CREATE INDEX "idx_quote_participants_quote" ON "quote_participants" USING btree ("quote_id");--> statement-breakpoint
|
|
169
|
+
CREATE INDEX "idx_quote_participants_quote_primary" ON "quote_participants" USING btree ("quote_id","is_primary","created_at");--> statement-breakpoint
|
|
170
|
+
CREATE INDEX "idx_quote_participants_person" ON "quote_participants" USING btree ("person_id");--> statement-breakpoint
|
|
171
|
+
CREATE UNIQUE INDEX "uidx_quote_participants_unique" ON "quote_participants" USING btree ("quote_id","person_id");--> statement-breakpoint
|
|
172
|
+
CREATE INDEX "idx_quote_products_quote" ON "quote_products" USING btree ("quote_id");--> statement-breakpoint
|
|
173
|
+
CREATE INDEX "idx_quote_products_quote_created" ON "quote_products" USING btree ("quote_id","created_at");--> statement-breakpoint
|
|
174
|
+
CREATE INDEX "idx_quote_products_product" ON "quote_products" USING btree ("product_id");--> statement-breakpoint
|
|
175
|
+
CREATE INDEX "idx_quote_products_supplier_service" ON "quote_products" USING btree ("supplier_service_id");--> statement-breakpoint
|
|
176
|
+
CREATE INDEX "idx_quote_version_lines_version" ON "quote_version_lines" USING btree ("quote_version_id");--> statement-breakpoint
|
|
177
|
+
CREATE INDEX "idx_quote_version_lines_version_created" ON "quote_version_lines" USING btree ("quote_version_id","created_at");--> statement-breakpoint
|
|
178
|
+
CREATE INDEX "idx_quote_version_lines_product" ON "quote_version_lines" USING btree ("product_id");--> statement-breakpoint
|
|
179
|
+
CREATE INDEX "idx_quote_version_lines_supplier_service" ON "quote_version_lines" USING btree ("supplier_service_id");--> statement-breakpoint
|
|
180
|
+
CREATE INDEX "idx_quote_versions_quote" ON "quote_versions" USING btree ("quote_id");--> statement-breakpoint
|
|
181
|
+
CREATE INDEX "idx_quote_versions_status" ON "quote_versions" USING btree ("status");--> statement-breakpoint
|
|
182
|
+
CREATE INDEX "idx_quote_versions_supersedes" ON "quote_versions" USING btree ("supersedes_id");--> statement-breakpoint
|
|
183
|
+
CREATE INDEX "idx_quote_versions_trip_snapshot" ON "quote_versions" USING btree ("trip_snapshot_id");--> statement-breakpoint
|
|
184
|
+
CREATE INDEX "idx_quote_versions_quote_updated" ON "quote_versions" USING btree ("quote_id","updated_at");--> statement-breakpoint
|
|
185
|
+
CREATE INDEX "idx_quote_versions_status_updated" ON "quote_versions" USING btree ("status","updated_at");--> statement-breakpoint
|
|
186
|
+
CREATE INDEX "idx_quotes_person" ON "quotes" USING btree ("person_id");--> statement-breakpoint
|
|
187
|
+
CREATE INDEX "idx_quotes_org" ON "quotes" USING btree ("organization_id");--> statement-breakpoint
|
|
188
|
+
CREATE INDEX "idx_quotes_pipeline" ON "quotes" USING btree ("pipeline_id");--> statement-breakpoint
|
|
189
|
+
CREATE INDEX "idx_quotes_stage" ON "quotes" USING btree ("stage_id");--> statement-breakpoint
|
|
190
|
+
CREATE INDEX "idx_quotes_owner" ON "quotes" USING btree ("owner_id");--> statement-breakpoint
|
|
191
|
+
CREATE INDEX "idx_quotes_status" ON "quotes" USING btree ("status");--> statement-breakpoint
|
|
192
|
+
CREATE INDEX "idx_quotes_accepted_version" ON "quotes" USING btree ("accepted_version_id");--> statement-breakpoint
|
|
193
|
+
CREATE INDEX "idx_quotes_person_updated" ON "quotes" USING btree ("person_id","updated_at");--> statement-breakpoint
|
|
194
|
+
CREATE INDEX "idx_quotes_org_updated" ON "quotes" USING btree ("organization_id","updated_at");--> statement-breakpoint
|
|
195
|
+
CREATE INDEX "idx_quotes_pipeline_updated" ON "quotes" USING btree ("pipeline_id","updated_at");--> statement-breakpoint
|
|
196
|
+
CREATE INDEX "idx_quotes_stage_updated" ON "quotes" USING btree ("stage_id","updated_at");--> statement-breakpoint
|
|
197
|
+
CREATE INDEX "idx_quotes_owner_updated" ON "quotes" USING btree ("owner_id","updated_at");--> statement-breakpoint
|
|
198
|
+
CREATE INDEX "idx_quotes_status_updated" ON "quotes" USING btree ("status","updated_at");--> statement-breakpoint
|
|
199
|
+
CREATE INDEX "idx_stages_pipeline" ON "stages" USING btree ("pipeline_id");--> statement-breakpoint
|
|
200
|
+
CREATE INDEX "idx_stages_sort" ON "stages" USING btree ("sort_order","created_at");--> statement-breakpoint
|
|
201
|
+
CREATE INDEX "idx_stages_pipeline_sort" ON "stages" USING btree ("pipeline_id","sort_order","created_at");--> statement-breakpoint
|
|
202
|
+
CREATE UNIQUE INDEX "uidx_stages_pipeline_name" ON "stages" USING btree ("pipeline_id","name");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/quotes",
|
|
3
|
-
"version": "0.122.
|
|
3
|
+
"version": "0.122.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -41,16 +41,19 @@
|
|
|
41
41
|
"zod": "^4.3.6",
|
|
42
42
|
"@voyant-travel/core": "^0.110.0",
|
|
43
43
|
"@voyant-travel/quotes-contracts": "^0.108.0",
|
|
44
|
-
"@voyant-travel/db": "^0.108.
|
|
44
|
+
"@voyant-travel/db": "^0.108.4",
|
|
45
45
|
"@voyant-travel/hono": "^0.112.2",
|
|
46
|
-
"@voyant-travel/trips": "^0.
|
|
46
|
+
"@voyant-travel/trips": "^0.117.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"drizzle-kit": "^0.31.10",
|
|
49
50
|
"typescript": "^6.0.2",
|
|
50
51
|
"@voyant-travel/voyant-typescript-config": "^0.1.0"
|
|
51
52
|
},
|
|
52
53
|
"files": [
|
|
53
|
-
"dist"
|
|
54
|
+
"dist",
|
|
55
|
+
"migrations/*.sql",
|
|
56
|
+
"migrations/meta/_journal.json"
|
|
54
57
|
],
|
|
55
58
|
"publishConfig": {
|
|
56
59
|
"access": "public"
|
|
@@ -71,7 +74,8 @@
|
|
|
71
74
|
"lint": "biome check src/",
|
|
72
75
|
"test": "vitest run",
|
|
73
76
|
"build": "tsc -p tsconfig.json",
|
|
74
|
-
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
77
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
78
|
+
"db:generate": "drizzle-kit generate --config=drizzle.migrations.config.ts --name=quotes_baseline && node ../../scripts/d2/guard-create-type.mjs ./migrations && node ../../scripts/d2/ensure-extensions.mjs ./migrations"
|
|
75
79
|
},
|
|
76
80
|
"main": "./dist/index.js",
|
|
77
81
|
"types": "./dist/index.d.ts"
|