@voyant-travel/commerce 0.1.0
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.
- package/LICENSE +201 -0
- package/README.md +145 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts +2 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts.map +1 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.js +398 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/interface.d.ts +18 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/interface.js +246 -0
- package/dist/interface.test.d.ts +2 -0
- package/dist/interface.test.d.ts.map +1 -0
- package/dist/interface.test.js +357 -0
- package/dist/markets/index.d.ts +11 -0
- package/dist/markets/index.d.ts.map +1 -0
- package/dist/markets/index.js +12 -0
- package/dist/markets/routes.d.ts +1182 -0
- package/dist/markets/routes.d.ts.map +1 -0
- package/dist/markets/routes.js +209 -0
- package/dist/markets/schema.d.ts +1527 -0
- package/dist/markets/schema.d.ts.map +1 -0
- package/dist/markets/schema.js +240 -0
- package/dist/markets/service-core.d.ts +253 -0
- package/dist/markets/service-core.d.ts.map +1 -0
- package/dist/markets/service-core.js +242 -0
- package/dist/markets/service-rules.d.ts +191 -0
- package/dist/markets/service-rules.d.ts.map +1 -0
- package/dist/markets/service-rules.js +155 -0
- package/dist/markets/service-shared.d.ts +36 -0
- package/dist/markets/service-shared.d.ts.map +1 -0
- package/dist/markets/service-shared.js +7 -0
- package/dist/markets/service.d.ts +43 -0
- package/dist/markets/service.d.ts.map +1 -0
- package/dist/markets/service.js +42 -0
- package/dist/markets/validation.d.ts +451 -0
- package/dist/markets/validation.d.ts.map +1 -0
- package/dist/markets/validation.js +160 -0
- package/dist/pricing/events.d.ts +53 -0
- package/dist/pricing/events.d.ts.map +1 -0
- package/dist/pricing/events.js +28 -0
- package/dist/pricing/index.d.ts +15 -0
- package/dist/pricing/index.d.ts.map +1 -0
- package/dist/pricing/index.js +18 -0
- package/dist/pricing/routes-core.d.ts +981 -0
- package/dist/pricing/routes-core.d.ts.map +1 -0
- package/dist/pricing/routes-core.js +102 -0
- package/dist/pricing/routes-public.d.ts +136 -0
- package/dist/pricing/routes-public.d.ts.map +1 -0
- package/dist/pricing/routes-public.js +14 -0
- package/dist/pricing/routes-rules.d.ts +1339 -0
- package/dist/pricing/routes-rules.d.ts.map +1 -0
- package/dist/pricing/routes-rules.js +138 -0
- package/dist/pricing/routes-shared.d.ts +14 -0
- package/dist/pricing/routes-shared.d.ts.map +1 -0
- package/dist/pricing/routes-shared.js +3 -0
- package/dist/pricing/routes.d.ts +7 -0
- package/dist/pricing/routes.d.ts.map +1 -0
- package/dist/pricing/routes.js +6 -0
- package/dist/pricing/schema-catalogs.d.ts +467 -0
- package/dist/pricing/schema-catalogs.d.ts.map +1 -0
- package/dist/pricing/schema-catalogs.js +47 -0
- package/dist/pricing/schema-categories.d.ts +497 -0
- package/dist/pricing/schema-categories.d.ts.map +1 -0
- package/dist/pricing/schema-categories.js +54 -0
- package/dist/pricing/schema-departure-overrides.d.ts +228 -0
- package/dist/pricing/schema-departure-overrides.d.ts.map +1 -0
- package/dist/pricing/schema-departure-overrides.js +36 -0
- package/dist/pricing/schema-option-rules.d.ts +1770 -0
- package/dist/pricing/schema-option-rules.d.ts.map +1 -0
- package/dist/pricing/schema-option-rules.js +181 -0
- package/dist/pricing/schema-policies.d.ts +395 -0
- package/dist/pricing/schema-policies.d.ts.map +1 -0
- package/dist/pricing/schema-policies.js +41 -0
- package/dist/pricing/schema-relations.d.ts +59 -0
- package/dist/pricing/schema-relations.d.ts.map +1 -0
- package/dist/pricing/schema-relations.js +111 -0
- package/dist/pricing/schema-shared.d.ts +11 -0
- package/dist/pricing/schema-shared.d.ts.map +1 -0
- package/dist/pricing/schema-shared.js +67 -0
- package/dist/pricing/schema.d.ts +8 -0
- package/dist/pricing/schema.d.ts.map +1 -0
- package/dist/pricing/schema.js +7 -0
- package/dist/pricing/service-catalog-plane-pricing.d.ts +95 -0
- package/dist/pricing/service-catalog-plane-pricing.d.ts.map +1 -0
- package/dist/pricing/service-catalog-plane-pricing.js +382 -0
- package/dist/pricing/service-catalogs.d.ts +139 -0
- package/dist/pricing/service-catalogs.d.ts.map +1 -0
- package/dist/pricing/service-catalogs.js +89 -0
- package/dist/pricing/service-categories.d.ts +147 -0
- package/dist/pricing/service-categories.d.ts.map +1 -0
- package/dist/pricing/service-categories.js +105 -0
- package/dist/pricing/service-departure-overrides.d.ts +67 -0
- package/dist/pricing/service-departure-overrides.d.ts.map +1 -0
- package/dist/pricing/service-departure-overrides.js +54 -0
- package/dist/pricing/service-option-rules.d.ts +321 -0
- package/dist/pricing/service-option-rules.d.ts.map +1 -0
- package/dist/pricing/service-option-rules.js +340 -0
- package/dist/pricing/service-policies.d.ts +123 -0
- package/dist/pricing/service-policies.d.ts.map +1 -0
- package/dist/pricing/service-policies.js +95 -0
- package/dist/pricing/service-public.d.ts +89 -0
- package/dist/pricing/service-public.d.ts.map +1 -0
- package/dist/pricing/service-public.js +473 -0
- package/dist/pricing/service-rule-resolver.d.ts +67 -0
- package/dist/pricing/service-rule-resolver.d.ts.map +1 -0
- package/dist/pricing/service-rule-resolver.js +204 -0
- package/dist/pricing/service-shared.d.ts +53 -0
- package/dist/pricing/service-shared.d.ts.map +1 -0
- package/dist/pricing/service-shared.js +4 -0
- package/dist/pricing/service-transfer-rules.d.ts +211 -0
- package/dist/pricing/service-transfer-rules.d.ts.map +1 -0
- package/dist/pricing/service-transfer-rules.js +139 -0
- package/dist/pricing/service.d.ts +79 -0
- package/dist/pricing/service.d.ts.map +1 -0
- package/dist/pricing/service.js +78 -0
- package/dist/pricing/validation-public.d.ts +412 -0
- package/dist/pricing/validation-public.d.ts.map +1 -0
- package/dist/pricing/validation-public.js +111 -0
- package/dist/pricing/validation-shared.d.ts +71 -0
- package/dist/pricing/validation-shared.d.ts.map +1 -0
- package/dist/pricing/validation-shared.js +63 -0
- package/dist/pricing/validation.d.ts +987 -0
- package/dist/pricing/validation.d.ts.map +1 -0
- package/dist/pricing/validation.js +307 -0
- package/dist/promotions/events.d.ts +38 -0
- package/dist/promotions/events.d.ts.map +1 -0
- package/dist/promotions/events.js +25 -0
- package/dist/promotions/index.d.ts +12 -0
- package/dist/promotions/index.d.ts.map +1 -0
- package/dist/promotions/index.js +17 -0
- package/dist/promotions/routes-shared.d.ts +14 -0
- package/dist/promotions/routes-shared.d.ts.map +1 -0
- package/dist/promotions/routes-shared.js +3 -0
- package/dist/promotions/routes.d.ts +395 -0
- package/dist/promotions/routes.d.ts.map +1 -0
- package/dist/promotions/routes.js +55 -0
- package/dist/promotions/schema.d.ts +675 -0
- package/dist/promotions/schema.d.ts.map +1 -0
- package/dist/promotions/schema.js +126 -0
- package/dist/promotions/service-booking-confirmed.d.ts +77 -0
- package/dist/promotions/service-booking-confirmed.d.ts.map +1 -0
- package/dist/promotions/service-booking-confirmed.js +134 -0
- package/dist/promotions/service-boundary-scheduler.d.ts +85 -0
- package/dist/promotions/service-boundary-scheduler.d.ts.map +1 -0
- package/dist/promotions/service-boundary-scheduler.js +141 -0
- package/dist/promotions/service-catalog-evaluator.d.ts +22 -0
- package/dist/promotions/service-catalog-evaluator.d.ts.map +1 -0
- package/dist/promotions/service-catalog-evaluator.js +33 -0
- package/dist/promotions/service-catalog-plane-promotions.d.ts +73 -0
- package/dist/promotions/service-catalog-plane-promotions.d.ts.map +1 -0
- package/dist/promotions/service-catalog-plane-promotions.js +118 -0
- package/dist/promotions/service-evaluator.d.ts +134 -0
- package/dist/promotions/service-evaluator.d.ts.map +1 -0
- package/dist/promotions/service-evaluator.js +302 -0
- package/dist/promotions/service-storefront.d.ts +147 -0
- package/dist/promotions/service-storefront.d.ts.map +1 -0
- package/dist/promotions/service-storefront.js +326 -0
- package/dist/promotions/service.d.ts +143 -0
- package/dist/promotions/service.d.ts.map +1 -0
- package/dist/promotions/service.js +359 -0
- package/dist/promotions/validation.d.ts +195 -0
- package/dist/promotions/validation.d.ts.map +1 -0
- package/dist/promotions/validation.js +167 -0
- package/dist/promotions/workflow-bulk-reindex.d.ts +36 -0
- package/dist/promotions/workflow-bulk-reindex.d.ts.map +1 -0
- package/dist/promotions/workflow-bulk-reindex.js +53 -0
- package/dist/promotions/workflow-runtime.d.ts +17 -0
- package/dist/promotions/workflow-runtime.d.ts.map +1 -0
- package/dist/promotions/workflow-runtime.js +9 -0
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +27 -0
- package/dist/runtime.test.d.ts +2 -0
- package/dist/runtime.test.d.ts.map +1 -0
- package/dist/runtime.test.js +25 -0
- package/dist/schema.d.ts +5 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +4 -0
- package/dist/sellability/index.d.ts +13 -0
- package/dist/sellability/index.d.ts.map +1 -0
- package/dist/sellability/index.js +17 -0
- package/dist/sellability/routes.d.ts +2332 -0
- package/dist/sellability/routes.d.ts.map +1 -0
- package/dist/sellability/routes.js +166 -0
- package/dist/sellability/schema.d.ts +1716 -0
- package/dist/sellability/schema.d.ts.map +1 -0
- package/dist/sellability/schema.js +278 -0
- package/dist/sellability/service-records.d.ts +316 -0
- package/dist/sellability/service-records.d.ts.map +1 -0
- package/dist/sellability/service-records.js +253 -0
- package/dist/sellability/service-resolve.d.ts +72 -0
- package/dist/sellability/service-resolve.d.ts.map +1 -0
- package/dist/sellability/service-resolve.js +580 -0
- package/dist/sellability/service-shared.d.ts +124 -0
- package/dist/sellability/service-shared.d.ts.map +1 -0
- package/dist/sellability/service-shared.js +96 -0
- package/dist/sellability/service-snapshots.d.ts +191 -0
- package/dist/sellability/service-snapshots.d.ts.map +1 -0
- package/dist/sellability/service-snapshots.js +153 -0
- package/dist/sellability/service.d.ts +1038 -0
- package/dist/sellability/service.d.ts.map +1 -0
- package/dist/sellability/service.js +17 -0
- package/dist/sellability/validation.d.ts +477 -0
- package/dist/sellability/validation.d.ts.map +1 -0
- package/dist/sellability/validation.js +192 -0
- package/dist/types.d.ts +239 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import type { CreatePricingCategoryDependencyInput, CreatePricingCategoryInput, PricingCategoryDependencyListQuery, PricingCategoryListQuery, UpdatePricingCategoryDependencyInput, UpdatePricingCategoryInput } from "./service-shared.js";
|
|
3
|
+
export declare function listPricingCategories(db: PostgresJsDatabase, query: PricingCategoryListQuery): Promise<{
|
|
4
|
+
data: {
|
|
5
|
+
id: string;
|
|
6
|
+
productId: string | null;
|
|
7
|
+
optionId: string | null;
|
|
8
|
+
unitId: string | null;
|
|
9
|
+
code: string | null;
|
|
10
|
+
name: string;
|
|
11
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
12
|
+
seatOccupancy: number;
|
|
13
|
+
groupSize: number | null;
|
|
14
|
+
isAgeQualified: boolean;
|
|
15
|
+
minAge: number | null;
|
|
16
|
+
maxAge: number | null;
|
|
17
|
+
internalUseOnly: boolean;
|
|
18
|
+
active: boolean;
|
|
19
|
+
sortOrder: number;
|
|
20
|
+
metadata: Record<string, unknown> | null;
|
|
21
|
+
createdAt: Date;
|
|
22
|
+
updatedAt: Date;
|
|
23
|
+
}[];
|
|
24
|
+
total: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function getPricingCategoryById(db: PostgresJsDatabase, id: string): Promise<{
|
|
29
|
+
id: string;
|
|
30
|
+
productId: string | null;
|
|
31
|
+
optionId: string | null;
|
|
32
|
+
unitId: string | null;
|
|
33
|
+
code: string | null;
|
|
34
|
+
name: string;
|
|
35
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
36
|
+
seatOccupancy: number;
|
|
37
|
+
groupSize: number | null;
|
|
38
|
+
isAgeQualified: boolean;
|
|
39
|
+
minAge: number | null;
|
|
40
|
+
maxAge: number | null;
|
|
41
|
+
internalUseOnly: boolean;
|
|
42
|
+
active: boolean;
|
|
43
|
+
sortOrder: number;
|
|
44
|
+
metadata: Record<string, unknown> | null;
|
|
45
|
+
createdAt: Date;
|
|
46
|
+
updatedAt: Date;
|
|
47
|
+
} | null>;
|
|
48
|
+
export declare function createPricingCategory(db: PostgresJsDatabase, data: CreatePricingCategoryInput): Promise<{
|
|
49
|
+
metadata: Record<string, unknown> | null;
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
code: string | null;
|
|
54
|
+
updatedAt: Date;
|
|
55
|
+
active: boolean;
|
|
56
|
+
sortOrder: number;
|
|
57
|
+
productId: string | null;
|
|
58
|
+
optionId: string | null;
|
|
59
|
+
unitId: string | null;
|
|
60
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
61
|
+
seatOccupancy: number;
|
|
62
|
+
groupSize: number | null;
|
|
63
|
+
isAgeQualified: boolean;
|
|
64
|
+
minAge: number | null;
|
|
65
|
+
maxAge: number | null;
|
|
66
|
+
internalUseOnly: boolean;
|
|
67
|
+
} | null>;
|
|
68
|
+
export declare function updatePricingCategory(db: PostgresJsDatabase, id: string, data: UpdatePricingCategoryInput): Promise<{
|
|
69
|
+
id: string;
|
|
70
|
+
productId: string | null;
|
|
71
|
+
optionId: string | null;
|
|
72
|
+
unitId: string | null;
|
|
73
|
+
code: string | null;
|
|
74
|
+
name: string;
|
|
75
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
76
|
+
seatOccupancy: number;
|
|
77
|
+
groupSize: number | null;
|
|
78
|
+
isAgeQualified: boolean;
|
|
79
|
+
minAge: number | null;
|
|
80
|
+
maxAge: number | null;
|
|
81
|
+
internalUseOnly: boolean;
|
|
82
|
+
active: boolean;
|
|
83
|
+
sortOrder: number;
|
|
84
|
+
metadata: Record<string, unknown> | null;
|
|
85
|
+
createdAt: Date;
|
|
86
|
+
updatedAt: Date;
|
|
87
|
+
} | null>;
|
|
88
|
+
export declare function deletePricingCategory(db: PostgresJsDatabase, id: string): Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
} | null>;
|
|
91
|
+
export declare function listPricingCategoryDependencies(db: PostgresJsDatabase, query: PricingCategoryDependencyListQuery): Promise<{
|
|
92
|
+
data: {
|
|
93
|
+
id: string;
|
|
94
|
+
pricingCategoryId: string;
|
|
95
|
+
masterPricingCategoryId: string;
|
|
96
|
+
dependencyType: "requires" | "limits_per_master" | "limits_sum" | "excludes";
|
|
97
|
+
maxPerMaster: number | null;
|
|
98
|
+
maxDependentSum: number | null;
|
|
99
|
+
active: boolean;
|
|
100
|
+
notes: string | null;
|
|
101
|
+
createdAt: Date;
|
|
102
|
+
updatedAt: Date;
|
|
103
|
+
}[];
|
|
104
|
+
total: number;
|
|
105
|
+
limit: number;
|
|
106
|
+
offset: number;
|
|
107
|
+
}>;
|
|
108
|
+
export declare function getPricingCategoryDependencyById(db: PostgresJsDatabase, id: string): Promise<{
|
|
109
|
+
id: string;
|
|
110
|
+
pricingCategoryId: string;
|
|
111
|
+
masterPricingCategoryId: string;
|
|
112
|
+
dependencyType: "requires" | "limits_per_master" | "limits_sum" | "excludes";
|
|
113
|
+
maxPerMaster: number | null;
|
|
114
|
+
maxDependentSum: number | null;
|
|
115
|
+
active: boolean;
|
|
116
|
+
notes: string | null;
|
|
117
|
+
createdAt: Date;
|
|
118
|
+
updatedAt: Date;
|
|
119
|
+
} | null>;
|
|
120
|
+
export declare function createPricingCategoryDependency(db: PostgresJsDatabase, data: CreatePricingCategoryDependencyInput): Promise<{
|
|
121
|
+
id: string;
|
|
122
|
+
createdAt: Date;
|
|
123
|
+
notes: string | null;
|
|
124
|
+
updatedAt: Date;
|
|
125
|
+
active: boolean;
|
|
126
|
+
pricingCategoryId: string;
|
|
127
|
+
masterPricingCategoryId: string;
|
|
128
|
+
dependencyType: "requires" | "limits_per_master" | "limits_sum" | "excludes";
|
|
129
|
+
maxPerMaster: number | null;
|
|
130
|
+
maxDependentSum: number | null;
|
|
131
|
+
} | null>;
|
|
132
|
+
export declare function updatePricingCategoryDependency(db: PostgresJsDatabase, id: string, data: UpdatePricingCategoryDependencyInput): Promise<{
|
|
133
|
+
id: string;
|
|
134
|
+
pricingCategoryId: string;
|
|
135
|
+
masterPricingCategoryId: string;
|
|
136
|
+
dependencyType: "requires" | "limits_per_master" | "limits_sum" | "excludes";
|
|
137
|
+
maxPerMaster: number | null;
|
|
138
|
+
maxDependentSum: number | null;
|
|
139
|
+
active: boolean;
|
|
140
|
+
notes: string | null;
|
|
141
|
+
createdAt: Date;
|
|
142
|
+
updatedAt: Date;
|
|
143
|
+
} | null>;
|
|
144
|
+
export declare function deletePricingCategoryDependency(db: PostgresJsDatabase, id: string): Promise<{
|
|
145
|
+
id: string;
|
|
146
|
+
} | null>;
|
|
147
|
+
//# sourceMappingURL=service-categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-categories.d.ts","sourceRoot":"","sources":["../../src/pricing/service-categories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,oCAAoC,EACpC,0BAA0B,EAC1B,kCAAkC,EAClC,wBAAwB,EACxB,oCAAoC,EACpC,0BAA0B,EAC3B,MAAM,qBAAqB,CAAA;AAG5B,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;GA0BhC;AAED,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;UAO9E;AAED,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;UAIjC;AAED,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;UAQjC;AAED,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;UAM7E;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,kCAAkC;;;;;;;;;;;;;;;;GA+B1C;AAED,wBAAsB,gCAAgC,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;UAOxF;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,oCAAoC;;;;;;;;;;;UAI3C;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,oCAAoC;;;;;;;;;;;UAQ3C;AAED,wBAAsB,+BAA+B,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;UAMvF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { and, asc, eq, ilike, or, sql } from "drizzle-orm";
|
|
2
|
+
import { pricingCategories, pricingCategoryDependencies } from "./schema.js";
|
|
3
|
+
import { paginate } from "./service-shared.js";
|
|
4
|
+
export async function listPricingCategories(db, query) {
|
|
5
|
+
const conditions = [];
|
|
6
|
+
if (query.productId)
|
|
7
|
+
conditions.push(eq(pricingCategories.productId, query.productId));
|
|
8
|
+
if (query.optionId)
|
|
9
|
+
conditions.push(eq(pricingCategories.optionId, query.optionId));
|
|
10
|
+
if (query.unitId)
|
|
11
|
+
conditions.push(eq(pricingCategories.unitId, query.unitId));
|
|
12
|
+
if (query.categoryType)
|
|
13
|
+
conditions.push(eq(pricingCategories.categoryType, query.categoryType));
|
|
14
|
+
if (query.active !== undefined)
|
|
15
|
+
conditions.push(eq(pricingCategories.active, query.active));
|
|
16
|
+
if (query.search) {
|
|
17
|
+
const term = `%${query.search}%`;
|
|
18
|
+
conditions.push(or(ilike(pricingCategories.name, term), ilike(pricingCategories.code, term)));
|
|
19
|
+
}
|
|
20
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
21
|
+
return paginate(db
|
|
22
|
+
.select()
|
|
23
|
+
.from(pricingCategories)
|
|
24
|
+
.where(where)
|
|
25
|
+
.limit(query.limit)
|
|
26
|
+
.offset(query.offset)
|
|
27
|
+
.orderBy(asc(pricingCategories.sortOrder), asc(pricingCategories.name)), db.select({ count: sql `count(*)::int` }).from(pricingCategories).where(where), query.limit, query.offset);
|
|
28
|
+
}
|
|
29
|
+
export async function getPricingCategoryById(db, id) {
|
|
30
|
+
const [row] = await db
|
|
31
|
+
.select()
|
|
32
|
+
.from(pricingCategories)
|
|
33
|
+
.where(eq(pricingCategories.id, id))
|
|
34
|
+
.limit(1);
|
|
35
|
+
return row ?? null;
|
|
36
|
+
}
|
|
37
|
+
export async function createPricingCategory(db, data) {
|
|
38
|
+
const [row] = await db.insert(pricingCategories).values(data).returning();
|
|
39
|
+
return row ?? null;
|
|
40
|
+
}
|
|
41
|
+
export async function updatePricingCategory(db, id, data) {
|
|
42
|
+
const [row] = await db
|
|
43
|
+
.update(pricingCategories)
|
|
44
|
+
.set({ ...data, updatedAt: new Date() })
|
|
45
|
+
.where(eq(pricingCategories.id, id))
|
|
46
|
+
.returning();
|
|
47
|
+
return row ?? null;
|
|
48
|
+
}
|
|
49
|
+
export async function deletePricingCategory(db, id) {
|
|
50
|
+
const [row] = await db
|
|
51
|
+
.delete(pricingCategories)
|
|
52
|
+
.where(eq(pricingCategories.id, id))
|
|
53
|
+
.returning({ id: pricingCategories.id });
|
|
54
|
+
return row ?? null;
|
|
55
|
+
}
|
|
56
|
+
export async function listPricingCategoryDependencies(db, query) {
|
|
57
|
+
const conditions = [];
|
|
58
|
+
if (query.pricingCategoryId) {
|
|
59
|
+
conditions.push(eq(pricingCategoryDependencies.pricingCategoryId, query.pricingCategoryId));
|
|
60
|
+
}
|
|
61
|
+
if (query.masterPricingCategoryId) {
|
|
62
|
+
conditions.push(eq(pricingCategoryDependencies.masterPricingCategoryId, query.masterPricingCategoryId));
|
|
63
|
+
}
|
|
64
|
+
if (query.dependencyType) {
|
|
65
|
+
conditions.push(eq(pricingCategoryDependencies.dependencyType, query.dependencyType));
|
|
66
|
+
}
|
|
67
|
+
if (query.active !== undefined) {
|
|
68
|
+
conditions.push(eq(pricingCategoryDependencies.active, query.active));
|
|
69
|
+
}
|
|
70
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
71
|
+
return paginate(db
|
|
72
|
+
.select()
|
|
73
|
+
.from(pricingCategoryDependencies)
|
|
74
|
+
.where(where)
|
|
75
|
+
.limit(query.limit)
|
|
76
|
+
.offset(query.offset)
|
|
77
|
+
.orderBy(asc(pricingCategoryDependencies.createdAt)), db.select({ count: sql `count(*)::int` }).from(pricingCategoryDependencies).where(where), query.limit, query.offset);
|
|
78
|
+
}
|
|
79
|
+
export async function getPricingCategoryDependencyById(db, id) {
|
|
80
|
+
const [row] = await db
|
|
81
|
+
.select()
|
|
82
|
+
.from(pricingCategoryDependencies)
|
|
83
|
+
.where(eq(pricingCategoryDependencies.id, id))
|
|
84
|
+
.limit(1);
|
|
85
|
+
return row ?? null;
|
|
86
|
+
}
|
|
87
|
+
export async function createPricingCategoryDependency(db, data) {
|
|
88
|
+
const [row] = await db.insert(pricingCategoryDependencies).values(data).returning();
|
|
89
|
+
return row ?? null;
|
|
90
|
+
}
|
|
91
|
+
export async function updatePricingCategoryDependency(db, id, data) {
|
|
92
|
+
const [row] = await db
|
|
93
|
+
.update(pricingCategoryDependencies)
|
|
94
|
+
.set({ ...data, updatedAt: new Date() })
|
|
95
|
+
.where(eq(pricingCategoryDependencies.id, id))
|
|
96
|
+
.returning();
|
|
97
|
+
return row ?? null;
|
|
98
|
+
}
|
|
99
|
+
export async function deletePricingCategoryDependency(db, id) {
|
|
100
|
+
const [row] = await db
|
|
101
|
+
.delete(pricingCategoryDependencies)
|
|
102
|
+
.where(eq(pricingCategoryDependencies.id, id))
|
|
103
|
+
.returning({ id: pricingCategoryDependencies.id });
|
|
104
|
+
return row ?? null;
|
|
105
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import { type CreateDeparturePriceOverrideInput, type DeparturePriceOverrideListQuery, type UpdateDeparturePriceOverrideInput } from "./service-shared.js";
|
|
3
|
+
export declare function listDeparturePriceOverrides(db: PostgresJsDatabase, query: DeparturePriceOverrideListQuery): Promise<{
|
|
4
|
+
data: {
|
|
5
|
+
id: string;
|
|
6
|
+
departureId: string;
|
|
7
|
+
optionId: string;
|
|
8
|
+
optionUnitId: string;
|
|
9
|
+
priceCatalogId: string;
|
|
10
|
+
sellAmountCents: number;
|
|
11
|
+
costAmountCents: number | null;
|
|
12
|
+
notes: string | null;
|
|
13
|
+
active: boolean;
|
|
14
|
+
metadata: Record<string, unknown> | null;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}[];
|
|
18
|
+
total: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
offset: number;
|
|
21
|
+
}>;
|
|
22
|
+
export declare function getDeparturePriceOverrideById(db: PostgresJsDatabase, id: string): Promise<{
|
|
23
|
+
id: string;
|
|
24
|
+
departureId: string;
|
|
25
|
+
optionId: string;
|
|
26
|
+
optionUnitId: string;
|
|
27
|
+
priceCatalogId: string;
|
|
28
|
+
sellAmountCents: number;
|
|
29
|
+
costAmountCents: number | null;
|
|
30
|
+
notes: string | null;
|
|
31
|
+
active: boolean;
|
|
32
|
+
metadata: Record<string, unknown> | null;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
} | null>;
|
|
36
|
+
export declare function createDeparturePriceOverride(db: PostgresJsDatabase, data: CreateDeparturePriceOverrideInput): Promise<{
|
|
37
|
+
metadata: Record<string, unknown> | null;
|
|
38
|
+
id: string;
|
|
39
|
+
createdAt: Date;
|
|
40
|
+
notes: string | null;
|
|
41
|
+
updatedAt: Date;
|
|
42
|
+
active: boolean;
|
|
43
|
+
priceCatalogId: string;
|
|
44
|
+
optionId: string;
|
|
45
|
+
departureId: string;
|
|
46
|
+
optionUnitId: string;
|
|
47
|
+
sellAmountCents: number;
|
|
48
|
+
costAmountCents: number | null;
|
|
49
|
+
} | null>;
|
|
50
|
+
export declare function updateDeparturePriceOverride(db: PostgresJsDatabase, id: string, data: UpdateDeparturePriceOverrideInput): Promise<{
|
|
51
|
+
id: string;
|
|
52
|
+
departureId: string;
|
|
53
|
+
optionId: string;
|
|
54
|
+
optionUnitId: string;
|
|
55
|
+
priceCatalogId: string;
|
|
56
|
+
sellAmountCents: number;
|
|
57
|
+
costAmountCents: number | null;
|
|
58
|
+
notes: string | null;
|
|
59
|
+
active: boolean;
|
|
60
|
+
metadata: Record<string, unknown> | null;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
updatedAt: Date;
|
|
63
|
+
} | null>;
|
|
64
|
+
export declare function deleteDeparturePriceOverride(db: PostgresJsDatabase, id: string): Promise<{
|
|
65
|
+
id: string;
|
|
66
|
+
} | null>;
|
|
67
|
+
//# sourceMappingURL=service-departure-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-departure-overrides.d.ts","sourceRoot":"","sources":["../../src/pricing/service-departure-overrides.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EAEpC,KAAK,iCAAiC,EACvC,MAAM,qBAAqB,CAAA;AAE5B,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,+BAA+B;;;;;;;;;;;;;;;;;;GA4BvC;AAED,wBAAsB,6BAA6B,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;UAOrF;AAED,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,iCAAiC;;;;;;;;;;;;;UAIxC;AAED,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,iCAAiC;;;;;;;;;;;;;UAQxC;AAED,wBAAsB,4BAA4B,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;UAMpF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { and, desc, eq, sql } from "drizzle-orm";
|
|
2
|
+
import { departurePriceOverrides } from "./schema.js";
|
|
3
|
+
import { paginate, } from "./service-shared.js";
|
|
4
|
+
export async function listDeparturePriceOverrides(db, query) {
|
|
5
|
+
const conditions = [];
|
|
6
|
+
if (query.departureId)
|
|
7
|
+
conditions.push(eq(departurePriceOverrides.departureId, query.departureId));
|
|
8
|
+
if (query.optionId)
|
|
9
|
+
conditions.push(eq(departurePriceOverrides.optionId, query.optionId));
|
|
10
|
+
if (query.optionUnitId) {
|
|
11
|
+
conditions.push(eq(departurePriceOverrides.optionUnitId, query.optionUnitId));
|
|
12
|
+
}
|
|
13
|
+
if (query.priceCatalogId) {
|
|
14
|
+
conditions.push(eq(departurePriceOverrides.priceCatalogId, query.priceCatalogId));
|
|
15
|
+
}
|
|
16
|
+
if (query.active !== undefined) {
|
|
17
|
+
conditions.push(eq(departurePriceOverrides.active, query.active));
|
|
18
|
+
}
|
|
19
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
20
|
+
return paginate(db
|
|
21
|
+
.select()
|
|
22
|
+
.from(departurePriceOverrides)
|
|
23
|
+
.where(where)
|
|
24
|
+
.limit(query.limit)
|
|
25
|
+
.offset(query.offset)
|
|
26
|
+
.orderBy(desc(departurePriceOverrides.updatedAt)), db.select({ count: sql `count(*)::int` }).from(departurePriceOverrides).where(where), query.limit, query.offset);
|
|
27
|
+
}
|
|
28
|
+
export async function getDeparturePriceOverrideById(db, id) {
|
|
29
|
+
const [row] = await db
|
|
30
|
+
.select()
|
|
31
|
+
.from(departurePriceOverrides)
|
|
32
|
+
.where(eq(departurePriceOverrides.id, id))
|
|
33
|
+
.limit(1);
|
|
34
|
+
return row ?? null;
|
|
35
|
+
}
|
|
36
|
+
export async function createDeparturePriceOverride(db, data) {
|
|
37
|
+
const [row] = await db.insert(departurePriceOverrides).values(data).returning();
|
|
38
|
+
return row ?? null;
|
|
39
|
+
}
|
|
40
|
+
export async function updateDeparturePriceOverride(db, id, data) {
|
|
41
|
+
const [row] = await db
|
|
42
|
+
.update(departurePriceOverrides)
|
|
43
|
+
.set({ ...data, updatedAt: new Date() })
|
|
44
|
+
.where(eq(departurePriceOverrides.id, id))
|
|
45
|
+
.returning();
|
|
46
|
+
return row ?? null;
|
|
47
|
+
}
|
|
48
|
+
export async function deleteDeparturePriceOverride(db, id) {
|
|
49
|
+
const [row] = await db
|
|
50
|
+
.delete(departurePriceOverrides)
|
|
51
|
+
.where(eq(departurePriceOverrides.id, id))
|
|
52
|
+
.returning({ id: departurePriceOverrides.id });
|
|
53
|
+
return row ?? null;
|
|
54
|
+
}
|