@voyantjs/pricing 0.26.9 → 0.28.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/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/routes-rules.d.ts +172 -9
- package/dist/routes-rules.d.ts.map +1 -1
- package/dist/routes-rules.js +17 -1
- package/dist/schema-departure-overrides.d.ts +228 -0
- package/dist/schema-departure-overrides.d.ts.map +1 -0
- package/dist/schema-departure-overrides.js +36 -0
- package/dist/schema-relations.d.ts +4 -0
- package/dist/schema-relations.d.ts.map +1 -1
- package/dist/schema-relations.js +8 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -0
- package/dist/service-departure-overrides.d.ts +67 -0
- package/dist/service-departure-overrides.d.ts.map +1 -0
- package/dist/service-departure-overrides.js +54 -0
- package/dist/service-option-rules.d.ts +2 -2
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +11 -2
- package/dist/service-rule-resolver.d.ts +23 -0
- package/dist/service-rule-resolver.d.ts.map +1 -1
- package/dist/service-rule-resolver.js +28 -0
- package/dist/service-shared.d.ts +4 -1
- package/dist/service-shared.d.ts.map +1 -1
- package/dist/service-transfer-rules.d.ts +6 -6
- package/dist/service.d.ts +6 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +6 -0
- package/dist/validation.d.ts +47 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +20 -0
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ export { publicPricingRoutes } from "./routes-public.js";
|
|
|
7
7
|
export { publicPricingService } from "./service-public.js";
|
|
8
8
|
export declare const pricingModule: Module;
|
|
9
9
|
export declare const pricingHonoModule: HonoModule;
|
|
10
|
-
export type { CancellationPolicy, CancellationPolicyRule, DropoffPriceRule, ExtraPriceRule, NewCancellationPolicy, NewCancellationPolicyRule, NewDropoffPriceRule, NewExtraPriceRule, NewOptionPriceRule, NewOptionStartTimeRule, NewOptionUnitPriceRule, NewOptionUnitTier, NewPickupPriceRule, NewPriceCatalog, NewPriceSchedule, NewPricingCategory, NewPricingCategoryDependency, OptionPriceRule, OptionStartTimeRule, OptionUnitPriceRule, OptionUnitTier, PickupPriceRule, PriceCatalog, PriceSchedule, PricingCategory, PricingCategoryDependency, } from "./schema.js";
|
|
11
|
-
export { addonPricingModeEnum, cancellationChargeTypeEnum, cancellationPolicies, cancellationPolicyRules, cancellationPolicyTypeEnum, dropoffPriceRules, extraPriceRules, optionPriceRules, optionPricingModeEnum, optionStartTimeRuleModeEnum, optionStartTimeRules, optionUnitPriceRules, optionUnitPricingModeEnum, optionUnitTiers, pickupPriceRules, priceAdjustmentTypeEnum, priceCatalogs, priceCatalogTypeEnum, priceSchedules, pricingCategories, pricingCategoryDependencies, pricingCategoryTypeEnum, pricingDependencyTypeEnum, } from "./schema.js";
|
|
12
|
-
export {
|
|
10
|
+
export type { CancellationPolicy, CancellationPolicyRule, DeparturePriceOverride, DropoffPriceRule, ExtraPriceRule, NewCancellationPolicy, NewCancellationPolicyRule, NewDeparturePriceOverride, NewDropoffPriceRule, NewExtraPriceRule, NewOptionPriceRule, NewOptionStartTimeRule, NewOptionUnitPriceRule, NewOptionUnitTier, NewPickupPriceRule, NewPriceCatalog, NewPriceSchedule, NewPricingCategory, NewPricingCategoryDependency, OptionPriceRule, OptionStartTimeRule, OptionUnitPriceRule, OptionUnitTier, PickupPriceRule, PriceCatalog, PriceSchedule, PricingCategory, PricingCategoryDependency, } from "./schema.js";
|
|
11
|
+
export { addonPricingModeEnum, cancellationChargeTypeEnum, cancellationPolicies, cancellationPolicyRules, cancellationPolicyTypeEnum, departurePriceOverrides, dropoffPriceRules, extraPriceRules, optionPriceRules, optionPricingModeEnum, optionStartTimeRuleModeEnum, optionStartTimeRules, optionUnitPriceRules, optionUnitPricingModeEnum, optionUnitTiers, pickupPriceRules, priceAdjustmentTypeEnum, priceCatalogs, priceCatalogTypeEnum, priceSchedules, pricingCategories, pricingCategoryDependencies, pricingCategoryTypeEnum, pricingDependencyTypeEnum, } from "./schema.js";
|
|
12
|
+
export { loadDeparturePriceOverrides, pickRulesForDate, type ResolverRuleInput, type ResolverScheduleInput, resolveOptionPriceRulesForDate, type UnitPriceOverride, } from "./service-rule-resolver.js";
|
|
13
|
+
export { addonPricingModeSchema, cancellationChargeTypeSchema, cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, cancellationPolicyTypeSchema, departurePriceOverrideListQuerySchema, dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertDeparturePriceOverrideSchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, optionPriceRuleListQuerySchema, optionPricingModeSchema, optionStartTimeRuleListQuerySchema, optionStartTimeRuleModeSchema, optionUnitPriceRuleListQuerySchema, optionUnitPricingModeSchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, priceAdjustmentTypeSchema, priceCatalogListQuerySchema, priceCatalogTypeSchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, pricingCategoryTypeSchema, pricingDependencyTypeSchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updateDeparturePriceOverrideSchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema, } from "./validation.js";
|
|
13
14
|
export { pricingService };
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D,eAAO,MAAM,aAAa,EAAE,MAE3B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,UAK/B,CAAA;AAED,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,eAAe,EACf,yBAAyB,GAC1B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,gBAA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EAC5B,iCAAiC,EACjC,qCAAqC,EACrC,4BAA4B,EAC5B,qCAAqC,EACrC,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EAClC,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,EAC3B,8BAA8B,EAC9B,uBAAuB,EACvB,kCAAkC,EAClC,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EACzB,2BAA2B,EAC3B,sBAAsB,EACtB,4BAA4B,EAC5B,wCAAwC,EACxC,8BAA8B,EAC9B,yBAAyB,EACzB,2BAA2B,EAC3B,kCAAkC,EAClC,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,GAC5B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export const pricingHonoModule = {
|
|
|
12
12
|
publicRoutes: publicPricingRoutes,
|
|
13
13
|
routes: pricingRoutes,
|
|
14
14
|
};
|
|
15
|
-
export { addonPricingModeEnum, cancellationChargeTypeEnum, cancellationPolicies, cancellationPolicyRules, cancellationPolicyTypeEnum, dropoffPriceRules, extraPriceRules, optionPriceRules, optionPricingModeEnum, optionStartTimeRuleModeEnum, optionStartTimeRules, optionUnitPriceRules, optionUnitPricingModeEnum, optionUnitTiers, pickupPriceRules, priceAdjustmentTypeEnum, priceCatalogs, priceCatalogTypeEnum, priceSchedules, pricingCategories, pricingCategoryDependencies, pricingCategoryTypeEnum, pricingDependencyTypeEnum, } from "./schema.js";
|
|
16
|
-
export {
|
|
15
|
+
export { addonPricingModeEnum, cancellationChargeTypeEnum, cancellationPolicies, cancellationPolicyRules, cancellationPolicyTypeEnum, departurePriceOverrides, dropoffPriceRules, extraPriceRules, optionPriceRules, optionPricingModeEnum, optionStartTimeRuleModeEnum, optionStartTimeRules, optionUnitPriceRules, optionUnitPricingModeEnum, optionUnitTiers, pickupPriceRules, priceAdjustmentTypeEnum, priceCatalogs, priceCatalogTypeEnum, priceSchedules, pricingCategories, pricingCategoryDependencies, pricingCategoryTypeEnum, pricingDependencyTypeEnum, } from "./schema.js";
|
|
16
|
+
export { loadDeparturePriceOverrides, pickRulesForDate, resolveOptionPriceRulesForDate, } from "./service-rule-resolver.js";
|
|
17
|
+
export { addonPricingModeSchema, cancellationChargeTypeSchema, cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, cancellationPolicyTypeSchema, departurePriceOverrideListQuerySchema, dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertDeparturePriceOverrideSchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, optionPriceRuleListQuerySchema, optionPricingModeSchema, optionStartTimeRuleListQuerySchema, optionStartTimeRuleModeSchema, optionUnitPriceRuleListQuerySchema, optionUnitPricingModeSchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, priceAdjustmentTypeSchema, priceCatalogListQuerySchema, priceCatalogTypeSchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, pricingCategoryTypeSchema, pricingDependencyTypeSchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updateDeparturePriceOverrideSchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema, } from "./validation.js";
|
|
17
18
|
export { pricingService };
|
package/dist/routes-rules.d.ts
CHANGED
|
@@ -249,10 +249,10 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
249
249
|
unitId: string;
|
|
250
250
|
sortOrder: number;
|
|
251
251
|
pricingCategoryId: string | null;
|
|
252
|
-
pricingMode: "per_person" | "per_booking" | "free" | "on_request" | "per_unit" | "included";
|
|
253
|
-
optionPriceRuleId: string;
|
|
254
252
|
sellAmountCents: number | null;
|
|
255
253
|
costAmountCents: number | null;
|
|
254
|
+
pricingMode: "per_person" | "per_booking" | "free" | "on_request" | "per_unit" | "included";
|
|
255
|
+
optionPriceRuleId: string;
|
|
256
256
|
minQuantity: number | null;
|
|
257
257
|
maxQuantity: number | null;
|
|
258
258
|
} | null;
|
|
@@ -723,10 +723,10 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
723
723
|
active: boolean;
|
|
724
724
|
optionId: string;
|
|
725
725
|
sortOrder: number;
|
|
726
|
-
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
727
|
-
optionPriceRuleId: string;
|
|
728
726
|
sellAmountCents: number | null;
|
|
729
727
|
costAmountCents: number | null;
|
|
728
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
729
|
+
optionPriceRuleId: string;
|
|
730
730
|
pickupPointId: string;
|
|
731
731
|
} | null;
|
|
732
732
|
};
|
|
@@ -880,10 +880,10 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
880
880
|
active: boolean;
|
|
881
881
|
optionId: string;
|
|
882
882
|
sortOrder: number;
|
|
883
|
-
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
884
|
-
optionPriceRuleId: string;
|
|
885
883
|
sellAmountCents: number | null;
|
|
886
884
|
costAmountCents: number | null;
|
|
885
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
886
|
+
optionPriceRuleId: string;
|
|
887
887
|
facilityId: string | null;
|
|
888
888
|
dropoffCode: string | null;
|
|
889
889
|
dropoffName: string;
|
|
@@ -1048,10 +1048,10 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
1048
1048
|
active: boolean;
|
|
1049
1049
|
optionId: string;
|
|
1050
1050
|
sortOrder: number;
|
|
1051
|
-
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
1052
|
-
optionPriceRuleId: string;
|
|
1053
1051
|
sellAmountCents: number | null;
|
|
1054
1052
|
costAmountCents: number | null;
|
|
1053
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
1054
|
+
optionPriceRuleId: string;
|
|
1055
1055
|
productExtraId: string | null;
|
|
1056
1056
|
optionExtraConfigId: string | null;
|
|
1057
1057
|
} | null;
|
|
@@ -1172,5 +1172,168 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
1172
1172
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1173
1173
|
};
|
|
1174
1174
|
};
|
|
1175
|
-
}
|
|
1175
|
+
} & {
|
|
1176
|
+
"/departure-price-overrides": {
|
|
1177
|
+
$get: {
|
|
1178
|
+
input: {};
|
|
1179
|
+
output: {
|
|
1180
|
+
data: {
|
|
1181
|
+
id: string;
|
|
1182
|
+
departureId: string;
|
|
1183
|
+
optionId: string;
|
|
1184
|
+
optionUnitId: string;
|
|
1185
|
+
priceCatalogId: string;
|
|
1186
|
+
sellAmountCents: number;
|
|
1187
|
+
costAmountCents: number | null;
|
|
1188
|
+
notes: string | null;
|
|
1189
|
+
active: boolean;
|
|
1190
|
+
metadata: {
|
|
1191
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
1192
|
+
} | null;
|
|
1193
|
+
createdAt: string;
|
|
1194
|
+
updatedAt: string;
|
|
1195
|
+
}[];
|
|
1196
|
+
total: number;
|
|
1197
|
+
limit: number;
|
|
1198
|
+
offset: number;
|
|
1199
|
+
};
|
|
1200
|
+
outputFormat: "json";
|
|
1201
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
} & {
|
|
1205
|
+
"/departure-price-overrides": {
|
|
1206
|
+
$post: {
|
|
1207
|
+
input: {};
|
|
1208
|
+
output: {
|
|
1209
|
+
data: {
|
|
1210
|
+
metadata: {
|
|
1211
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
1212
|
+
} | null;
|
|
1213
|
+
id: string;
|
|
1214
|
+
createdAt: string;
|
|
1215
|
+
updatedAt: string;
|
|
1216
|
+
notes: string | null;
|
|
1217
|
+
active: boolean;
|
|
1218
|
+
priceCatalogId: string;
|
|
1219
|
+
optionId: string;
|
|
1220
|
+
departureId: string;
|
|
1221
|
+
optionUnitId: string;
|
|
1222
|
+
sellAmountCents: number;
|
|
1223
|
+
costAmountCents: number | null;
|
|
1224
|
+
} | null;
|
|
1225
|
+
};
|
|
1226
|
+
outputFormat: "json";
|
|
1227
|
+
status: 201;
|
|
1228
|
+
};
|
|
1229
|
+
};
|
|
1230
|
+
} & {
|
|
1231
|
+
"/departure-price-overrides/:id": {
|
|
1232
|
+
$get: {
|
|
1233
|
+
input: {
|
|
1234
|
+
param: {
|
|
1235
|
+
id: string;
|
|
1236
|
+
};
|
|
1237
|
+
};
|
|
1238
|
+
output: {
|
|
1239
|
+
error: string;
|
|
1240
|
+
};
|
|
1241
|
+
outputFormat: "json";
|
|
1242
|
+
status: 404;
|
|
1243
|
+
} | {
|
|
1244
|
+
input: {
|
|
1245
|
+
param: {
|
|
1246
|
+
id: string;
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1249
|
+
output: {
|
|
1250
|
+
data: {
|
|
1251
|
+
id: string;
|
|
1252
|
+
departureId: string;
|
|
1253
|
+
optionId: string;
|
|
1254
|
+
optionUnitId: string;
|
|
1255
|
+
priceCatalogId: string;
|
|
1256
|
+
sellAmountCents: number;
|
|
1257
|
+
costAmountCents: number | null;
|
|
1258
|
+
notes: string | null;
|
|
1259
|
+
active: boolean;
|
|
1260
|
+
metadata: {
|
|
1261
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
1262
|
+
} | null;
|
|
1263
|
+
createdAt: string;
|
|
1264
|
+
updatedAt: string;
|
|
1265
|
+
};
|
|
1266
|
+
};
|
|
1267
|
+
outputFormat: "json";
|
|
1268
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1269
|
+
};
|
|
1270
|
+
};
|
|
1271
|
+
} & {
|
|
1272
|
+
"/departure-price-overrides/:id": {
|
|
1273
|
+
$patch: {
|
|
1274
|
+
input: {
|
|
1275
|
+
param: {
|
|
1276
|
+
id: string;
|
|
1277
|
+
};
|
|
1278
|
+
};
|
|
1279
|
+
output: {
|
|
1280
|
+
error: string;
|
|
1281
|
+
};
|
|
1282
|
+
outputFormat: "json";
|
|
1283
|
+
status: 404;
|
|
1284
|
+
} | {
|
|
1285
|
+
input: {
|
|
1286
|
+
param: {
|
|
1287
|
+
id: string;
|
|
1288
|
+
};
|
|
1289
|
+
};
|
|
1290
|
+
output: {
|
|
1291
|
+
data: {
|
|
1292
|
+
id: string;
|
|
1293
|
+
departureId: string;
|
|
1294
|
+
optionId: string;
|
|
1295
|
+
optionUnitId: string;
|
|
1296
|
+
priceCatalogId: string;
|
|
1297
|
+
sellAmountCents: number;
|
|
1298
|
+
costAmountCents: number | null;
|
|
1299
|
+
notes: string | null;
|
|
1300
|
+
active: boolean;
|
|
1301
|
+
metadata: {
|
|
1302
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
1303
|
+
} | null;
|
|
1304
|
+
createdAt: string;
|
|
1305
|
+
updatedAt: string;
|
|
1306
|
+
};
|
|
1307
|
+
};
|
|
1308
|
+
outputFormat: "json";
|
|
1309
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1310
|
+
};
|
|
1311
|
+
};
|
|
1312
|
+
} & {
|
|
1313
|
+
"/departure-price-overrides/:id": {
|
|
1314
|
+
$delete: {
|
|
1315
|
+
input: {
|
|
1316
|
+
param: {
|
|
1317
|
+
id: string;
|
|
1318
|
+
};
|
|
1319
|
+
};
|
|
1320
|
+
output: {
|
|
1321
|
+
error: string;
|
|
1322
|
+
};
|
|
1323
|
+
outputFormat: "json";
|
|
1324
|
+
status: 404;
|
|
1325
|
+
} | {
|
|
1326
|
+
input: {
|
|
1327
|
+
param: {
|
|
1328
|
+
id: string;
|
|
1329
|
+
};
|
|
1330
|
+
};
|
|
1331
|
+
output: {
|
|
1332
|
+
success: true;
|
|
1333
|
+
};
|
|
1334
|
+
outputFormat: "json";
|
|
1335
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1336
|
+
};
|
|
1337
|
+
};
|
|
1338
|
+
}, "/", "/departure-price-overrides/:id">;
|
|
1176
1339
|
//# sourceMappingURL=routes-rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-rules.d.ts","sourceRoot":"","sources":["../src/routes-rules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"routes-rules.d.ts","sourceRoot":"","sources":["../src/routes-rules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AA6BvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAwR1B,CAAA"}
|
package/dist/routes-rules.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
import { notFound } from "./routes-shared.js";
|
|
4
4
|
import { pricingService } from "./service.js";
|
|
5
|
-
import { dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, optionPriceRuleListQuerySchema, optionStartTimeRuleListQuerySchema, optionUnitPriceRuleListQuerySchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, } from "./validation.js";
|
|
5
|
+
import { departurePriceOverrideListQuerySchema, dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertDeparturePriceOverrideSchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, optionPriceRuleListQuerySchema, optionStartTimeRuleListQuerySchema, optionUnitPriceRuleListQuerySchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, updateDeparturePriceOverrideSchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, } from "./validation.js";
|
|
6
6
|
export const pricingRuleRoutes = new Hono()
|
|
7
7
|
.get("/option-price-rules", async (c) => c.json(await pricingService.listOptionPriceRules(c.get("db"), await parseQuery(c, optionPriceRuleListQuerySchema))))
|
|
8
8
|
.post("/option-price-rules", async (c) => c.json({
|
|
@@ -115,4 +115,20 @@ export const pricingRuleRoutes = new Hono()
|
|
|
115
115
|
.delete("/extra-price-rules/:id", async (c) => {
|
|
116
116
|
const row = await pricingService.deleteExtraPriceRule(c.get("db"), c.req.param("id"));
|
|
117
117
|
return row ? c.json({ success: true }) : notFound(c, "Extra price rule not found");
|
|
118
|
+
})
|
|
119
|
+
.get("/departure-price-overrides", async (c) => c.json(await pricingService.listDeparturePriceOverrides(c.get("db"), await parseQuery(c, departurePriceOverrideListQuerySchema))))
|
|
120
|
+
.post("/departure-price-overrides", async (c) => c.json({
|
|
121
|
+
data: await pricingService.createDeparturePriceOverride(c.get("db"), await parseJsonBody(c, insertDeparturePriceOverrideSchema)),
|
|
122
|
+
}, 201))
|
|
123
|
+
.get("/departure-price-overrides/:id", async (c) => {
|
|
124
|
+
const row = await pricingService.getDeparturePriceOverrideById(c.get("db"), c.req.param("id"));
|
|
125
|
+
return row ? c.json({ data: row }) : notFound(c, "Departure price override not found");
|
|
126
|
+
})
|
|
127
|
+
.patch("/departure-price-overrides/:id", async (c) => {
|
|
128
|
+
const row = await pricingService.updateDeparturePriceOverride(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateDeparturePriceOverrideSchema));
|
|
129
|
+
return row ? c.json({ data: row }) : notFound(c, "Departure price override not found");
|
|
130
|
+
})
|
|
131
|
+
.delete("/departure-price-overrides/:id", async (c) => {
|
|
132
|
+
const row = await pricingService.deleteDeparturePriceOverride(c.get("db"), c.req.param("id"));
|
|
133
|
+
return row ? c.json({ success: true }) : notFound(c, "Departure price override not found");
|
|
118
134
|
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-departure price override.
|
|
3
|
+
*
|
|
4
|
+
* A single departure (availability slot) can opt out of the seasonal
|
|
5
|
+
* priceSchedule layer by setting an explicit per-unit price. Resolved at
|
|
6
|
+
* snapshot time before the option price rules: a unit with an active
|
|
7
|
+
* override on a given departure gets that override's amount; units without
|
|
8
|
+
* an override fall through to the schedule-matched rule.
|
|
9
|
+
*
|
|
10
|
+
* One row per (departure × unit × catalog). Operators wanting a flat
|
|
11
|
+
* whole-departure rate add one row per unit of the option.
|
|
12
|
+
*/
|
|
13
|
+
export declare const departurePriceOverrides: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
14
|
+
name: "departure_price_overrides";
|
|
15
|
+
schema: undefined;
|
|
16
|
+
columns: {
|
|
17
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
18
|
+
name: string;
|
|
19
|
+
tableName: "departure_price_overrides";
|
|
20
|
+
dataType: "string";
|
|
21
|
+
columnType: "PgText";
|
|
22
|
+
data: string;
|
|
23
|
+
driverParam: string;
|
|
24
|
+
notNull: true;
|
|
25
|
+
hasDefault: true;
|
|
26
|
+
isPrimaryKey: true;
|
|
27
|
+
isAutoincrement: false;
|
|
28
|
+
hasRuntimeDefault: true;
|
|
29
|
+
enumValues: [string, ...string[]];
|
|
30
|
+
baseColumn: never;
|
|
31
|
+
identity: undefined;
|
|
32
|
+
generated: undefined;
|
|
33
|
+
}, {}, {}>;
|
|
34
|
+
departureId: import("drizzle-orm/pg-core").PgColumn<{
|
|
35
|
+
name: "departure_id";
|
|
36
|
+
tableName: "departure_price_overrides";
|
|
37
|
+
dataType: "string";
|
|
38
|
+
columnType: "PgText";
|
|
39
|
+
data: string;
|
|
40
|
+
driverParam: string;
|
|
41
|
+
notNull: true;
|
|
42
|
+
hasDefault: false;
|
|
43
|
+
isPrimaryKey: false;
|
|
44
|
+
isAutoincrement: false;
|
|
45
|
+
hasRuntimeDefault: false;
|
|
46
|
+
enumValues: [string, ...string[]];
|
|
47
|
+
baseColumn: never;
|
|
48
|
+
identity: undefined;
|
|
49
|
+
generated: undefined;
|
|
50
|
+
}, {}, {}>;
|
|
51
|
+
optionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
52
|
+
name: "option_id";
|
|
53
|
+
tableName: "departure_price_overrides";
|
|
54
|
+
dataType: "string";
|
|
55
|
+
columnType: "PgText";
|
|
56
|
+
data: string;
|
|
57
|
+
driverParam: string;
|
|
58
|
+
notNull: true;
|
|
59
|
+
hasDefault: false;
|
|
60
|
+
isPrimaryKey: false;
|
|
61
|
+
isAutoincrement: false;
|
|
62
|
+
hasRuntimeDefault: false;
|
|
63
|
+
enumValues: [string, ...string[]];
|
|
64
|
+
baseColumn: never;
|
|
65
|
+
identity: undefined;
|
|
66
|
+
generated: undefined;
|
|
67
|
+
}, {}, {}>;
|
|
68
|
+
optionUnitId: import("drizzle-orm/pg-core").PgColumn<{
|
|
69
|
+
name: "option_unit_id";
|
|
70
|
+
tableName: "departure_price_overrides";
|
|
71
|
+
dataType: "string";
|
|
72
|
+
columnType: "PgText";
|
|
73
|
+
data: string;
|
|
74
|
+
driverParam: string;
|
|
75
|
+
notNull: true;
|
|
76
|
+
hasDefault: false;
|
|
77
|
+
isPrimaryKey: false;
|
|
78
|
+
isAutoincrement: false;
|
|
79
|
+
hasRuntimeDefault: false;
|
|
80
|
+
enumValues: [string, ...string[]];
|
|
81
|
+
baseColumn: never;
|
|
82
|
+
identity: undefined;
|
|
83
|
+
generated: undefined;
|
|
84
|
+
}, {}, {}>;
|
|
85
|
+
priceCatalogId: import("drizzle-orm/pg-core").PgColumn<{
|
|
86
|
+
name: string;
|
|
87
|
+
tableName: "departure_price_overrides";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "PgText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: true;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {}>;
|
|
102
|
+
sellAmountCents: import("drizzle-orm/pg-core").PgColumn<{
|
|
103
|
+
name: "sell_amount_cents";
|
|
104
|
+
tableName: "departure_price_overrides";
|
|
105
|
+
dataType: "number";
|
|
106
|
+
columnType: "PgInteger";
|
|
107
|
+
data: number;
|
|
108
|
+
driverParam: string | number;
|
|
109
|
+
notNull: true;
|
|
110
|
+
hasDefault: false;
|
|
111
|
+
isPrimaryKey: false;
|
|
112
|
+
isAutoincrement: false;
|
|
113
|
+
hasRuntimeDefault: false;
|
|
114
|
+
enumValues: undefined;
|
|
115
|
+
baseColumn: never;
|
|
116
|
+
identity: undefined;
|
|
117
|
+
generated: undefined;
|
|
118
|
+
}, {}, {}>;
|
|
119
|
+
costAmountCents: import("drizzle-orm/pg-core").PgColumn<{
|
|
120
|
+
name: "cost_amount_cents";
|
|
121
|
+
tableName: "departure_price_overrides";
|
|
122
|
+
dataType: "number";
|
|
123
|
+
columnType: "PgInteger";
|
|
124
|
+
data: number;
|
|
125
|
+
driverParam: string | number;
|
|
126
|
+
notNull: false;
|
|
127
|
+
hasDefault: false;
|
|
128
|
+
isPrimaryKey: false;
|
|
129
|
+
isAutoincrement: false;
|
|
130
|
+
hasRuntimeDefault: false;
|
|
131
|
+
enumValues: undefined;
|
|
132
|
+
baseColumn: never;
|
|
133
|
+
identity: undefined;
|
|
134
|
+
generated: undefined;
|
|
135
|
+
}, {}, {}>;
|
|
136
|
+
notes: import("drizzle-orm/pg-core").PgColumn<{
|
|
137
|
+
name: "notes";
|
|
138
|
+
tableName: "departure_price_overrides";
|
|
139
|
+
dataType: "string";
|
|
140
|
+
columnType: "PgText";
|
|
141
|
+
data: string;
|
|
142
|
+
driverParam: string;
|
|
143
|
+
notNull: false;
|
|
144
|
+
hasDefault: false;
|
|
145
|
+
isPrimaryKey: false;
|
|
146
|
+
isAutoincrement: false;
|
|
147
|
+
hasRuntimeDefault: false;
|
|
148
|
+
enumValues: [string, ...string[]];
|
|
149
|
+
baseColumn: never;
|
|
150
|
+
identity: undefined;
|
|
151
|
+
generated: undefined;
|
|
152
|
+
}, {}, {}>;
|
|
153
|
+
active: import("drizzle-orm/pg-core").PgColumn<{
|
|
154
|
+
name: "active";
|
|
155
|
+
tableName: "departure_price_overrides";
|
|
156
|
+
dataType: "boolean";
|
|
157
|
+
columnType: "PgBoolean";
|
|
158
|
+
data: boolean;
|
|
159
|
+
driverParam: boolean;
|
|
160
|
+
notNull: true;
|
|
161
|
+
hasDefault: true;
|
|
162
|
+
isPrimaryKey: false;
|
|
163
|
+
isAutoincrement: false;
|
|
164
|
+
hasRuntimeDefault: false;
|
|
165
|
+
enumValues: undefined;
|
|
166
|
+
baseColumn: never;
|
|
167
|
+
identity: undefined;
|
|
168
|
+
generated: undefined;
|
|
169
|
+
}, {}, {}>;
|
|
170
|
+
metadata: import("drizzle-orm/pg-core").PgColumn<{
|
|
171
|
+
name: "metadata";
|
|
172
|
+
tableName: "departure_price_overrides";
|
|
173
|
+
dataType: "json";
|
|
174
|
+
columnType: "PgJsonb";
|
|
175
|
+
data: Record<string, unknown>;
|
|
176
|
+
driverParam: unknown;
|
|
177
|
+
notNull: false;
|
|
178
|
+
hasDefault: false;
|
|
179
|
+
isPrimaryKey: false;
|
|
180
|
+
isAutoincrement: false;
|
|
181
|
+
hasRuntimeDefault: false;
|
|
182
|
+
enumValues: undefined;
|
|
183
|
+
baseColumn: never;
|
|
184
|
+
identity: undefined;
|
|
185
|
+
generated: undefined;
|
|
186
|
+
}, {}, {
|
|
187
|
+
$type: Record<string, unknown>;
|
|
188
|
+
}>;
|
|
189
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
190
|
+
name: "created_at";
|
|
191
|
+
tableName: "departure_price_overrides";
|
|
192
|
+
dataType: "date";
|
|
193
|
+
columnType: "PgTimestamp";
|
|
194
|
+
data: Date;
|
|
195
|
+
driverParam: string;
|
|
196
|
+
notNull: true;
|
|
197
|
+
hasDefault: true;
|
|
198
|
+
isPrimaryKey: false;
|
|
199
|
+
isAutoincrement: false;
|
|
200
|
+
hasRuntimeDefault: false;
|
|
201
|
+
enumValues: undefined;
|
|
202
|
+
baseColumn: never;
|
|
203
|
+
identity: undefined;
|
|
204
|
+
generated: undefined;
|
|
205
|
+
}, {}, {}>;
|
|
206
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
207
|
+
name: "updated_at";
|
|
208
|
+
tableName: "departure_price_overrides";
|
|
209
|
+
dataType: "date";
|
|
210
|
+
columnType: "PgTimestamp";
|
|
211
|
+
data: Date;
|
|
212
|
+
driverParam: string;
|
|
213
|
+
notNull: true;
|
|
214
|
+
hasDefault: true;
|
|
215
|
+
isPrimaryKey: false;
|
|
216
|
+
isAutoincrement: false;
|
|
217
|
+
hasRuntimeDefault: false;
|
|
218
|
+
enumValues: undefined;
|
|
219
|
+
baseColumn: never;
|
|
220
|
+
identity: undefined;
|
|
221
|
+
generated: undefined;
|
|
222
|
+
}, {}, {}>;
|
|
223
|
+
};
|
|
224
|
+
dialect: "pg";
|
|
225
|
+
}>;
|
|
226
|
+
export type DeparturePriceOverride = typeof departurePriceOverrides.$inferSelect;
|
|
227
|
+
export type NewDeparturePriceOverride = typeof departurePriceOverrides.$inferInsert;
|
|
228
|
+
//# sourceMappingURL=schema-departure-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-departure-overrides.d.ts","sourceRoot":"","sources":["../src/schema-departure-overrides.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BnC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,uBAAuB,CAAC,YAAY,CAAA;AAChF,MAAM,MAAM,yBAAyB,GAAG,OAAO,uBAAuB,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
|
|
2
|
+
import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
3
|
+
import { priceCatalogs } from "./schema-catalogs.js";
|
|
4
|
+
/**
|
|
5
|
+
* Per-departure price override.
|
|
6
|
+
*
|
|
7
|
+
* A single departure (availability slot) can opt out of the seasonal
|
|
8
|
+
* priceSchedule layer by setting an explicit per-unit price. Resolved at
|
|
9
|
+
* snapshot time before the option price rules: a unit with an active
|
|
10
|
+
* override on a given departure gets that override's amount; units without
|
|
11
|
+
* an override fall through to the schedule-matched rule.
|
|
12
|
+
*
|
|
13
|
+
* One row per (departure × unit × catalog). Operators wanting a flat
|
|
14
|
+
* whole-departure rate add one row per unit of the option.
|
|
15
|
+
*/
|
|
16
|
+
export const departurePriceOverrides = pgTable("departure_price_overrides", {
|
|
17
|
+
id: typeId("departure_price_overrides"),
|
|
18
|
+
departureId: text("departure_id").notNull(),
|
|
19
|
+
optionId: text("option_id").notNull(),
|
|
20
|
+
optionUnitId: text("option_unit_id").notNull(),
|
|
21
|
+
priceCatalogId: typeIdRef("price_catalog_id")
|
|
22
|
+
.notNull()
|
|
23
|
+
.references(() => priceCatalogs.id, { onDelete: "cascade" }),
|
|
24
|
+
sellAmountCents: integer("sell_amount_cents").notNull(),
|
|
25
|
+
costAmountCents: integer("cost_amount_cents"),
|
|
26
|
+
notes: text("notes"),
|
|
27
|
+
active: boolean("active").notNull().default(true),
|
|
28
|
+
metadata: jsonb("metadata").$type(),
|
|
29
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
30
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
31
|
+
}, (table) => [
|
|
32
|
+
uniqueIndex("uidx_departure_price_overrides_target").on(table.departureId, table.optionUnitId, table.priceCatalogId),
|
|
33
|
+
index("idx_departure_price_overrides_departure").on(table.departureId, table.active),
|
|
34
|
+
index("idx_departure_price_overrides_option").on(table.optionId, table.active),
|
|
35
|
+
index("idx_departure_price_overrides_catalog").on(table.priceCatalogId, table.active),
|
|
36
|
+
]);
|
|
@@ -17,6 +17,10 @@ export declare const cancellationPolicyRulesRelations: import("drizzle-orm").Rel
|
|
|
17
17
|
export declare const priceCatalogsRelations: import("drizzle-orm").Relations<"price_catalogs", {
|
|
18
18
|
schedules: import("drizzle-orm").Many<"price_schedules">;
|
|
19
19
|
optionPriceRules: import("drizzle-orm").Many<"option_price_rules">;
|
|
20
|
+
departureOverrides: import("drizzle-orm").Many<"departure_price_overrides">;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const departurePriceOverridesRelations: import("drizzle-orm").Relations<"departure_price_overrides", {
|
|
23
|
+
priceCatalog: import("drizzle-orm").One<"price_catalogs", true>;
|
|
20
24
|
}>;
|
|
21
25
|
export declare const priceSchedulesRelations: import("drizzle-orm").Relations<"price_schedules", {
|
|
22
26
|
priceCatalog: import("drizzle-orm").One<"price_catalogs", true>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-relations.d.ts","sourceRoot":"","sources":["../src/schema-relations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-relations.d.ts","sourceRoot":"","sources":["../src/schema-relations.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,0BAA0B;;;;EAIpC,CAAA;AAEH,eAAO,MAAM,oCAAoC;;;EAchD,CAAA;AAED,eAAO,MAAM,6BAA6B;;;EAGvC,CAAA;AAEH,eAAO,MAAM,gCAAgC;;EAK1C,CAAA;AAEH,eAAO,MAAM,sBAAsB;;;;EAIhC,CAAA;AAEH,eAAO,MAAM,gCAAgC;;EAK1C,CAAA;AAEH,eAAO,MAAM,uBAAuB;;;EAMjC,CAAA;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;EAkBnC,CAAA;AAEH,eAAO,MAAM,6BAA6B;;;;EAUvC,CAAA;AAEH,eAAO,MAAM,6BAA6B;;EAKvC,CAAA;AAEH,eAAO,MAAM,wBAAwB;;EAKlC,CAAA;AAEH,eAAO,MAAM,yBAAyB;;EAKnC,CAAA;AAEH,eAAO,MAAM,0BAA0B;;EAKpC,CAAA;AAEH,eAAO,MAAM,wBAAwB;;EAKlC,CAAA"}
|
package/dist/schema-relations.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { relations } from "drizzle-orm";
|
|
2
2
|
import { priceCatalogs, priceSchedules } from "./schema-catalogs.js";
|
|
3
3
|
import { pricingCategories, pricingCategoryDependencies } from "./schema-categories.js";
|
|
4
|
+
import { departurePriceOverrides } from "./schema-departure-overrides.js";
|
|
4
5
|
import { dropoffPriceRules, extraPriceRules, optionPriceRules, optionStartTimeRules, optionUnitPriceRules, optionUnitTiers, pickupPriceRules, } from "./schema-option-rules.js";
|
|
5
6
|
import { cancellationPolicies, cancellationPolicyRules } from "./schema-policies.js";
|
|
6
7
|
export const pricingCategoriesRelations = relations(pricingCategories, ({ many }) => ({
|
|
@@ -33,6 +34,13 @@ export const cancellationPolicyRulesRelations = relations(cancellationPolicyRule
|
|
|
33
34
|
export const priceCatalogsRelations = relations(priceCatalogs, ({ many }) => ({
|
|
34
35
|
schedules: many(priceSchedules),
|
|
35
36
|
optionPriceRules: many(optionPriceRules),
|
|
37
|
+
departureOverrides: many(departurePriceOverrides),
|
|
38
|
+
}));
|
|
39
|
+
export const departurePriceOverridesRelations = relations(departurePriceOverrides, ({ one }) => ({
|
|
40
|
+
priceCatalog: one(priceCatalogs, {
|
|
41
|
+
fields: [departurePriceOverrides.priceCatalogId],
|
|
42
|
+
references: [priceCatalogs.id],
|
|
43
|
+
}),
|
|
36
44
|
}));
|
|
37
45
|
export const priceSchedulesRelations = relations(priceSchedules, ({ one, many }) => ({
|
|
38
46
|
priceCatalog: one(priceCatalogs, {
|
package/dist/schema.d.ts
CHANGED
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -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
|
+
updatedAt: Date;
|
|
41
|
+
notes: string | null;
|
|
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/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
|
+
}
|
|
@@ -152,10 +152,10 @@ export declare function createOptionUnitPriceRule(db: PostgresJsDatabase, data:
|
|
|
152
152
|
unitId: string;
|
|
153
153
|
sortOrder: number;
|
|
154
154
|
pricingCategoryId: string | null;
|
|
155
|
-
pricingMode: "per_person" | "per_booking" | "free" | "on_request" | "per_unit" | "included";
|
|
156
|
-
optionPriceRuleId: string;
|
|
157
155
|
sellAmountCents: number | null;
|
|
158
156
|
costAmountCents: number | null;
|
|
157
|
+
pricingMode: "per_person" | "per_booking" | "free" | "on_request" | "per_unit" | "included";
|
|
158
|
+
optionPriceRuleId: string;
|
|
159
159
|
minQuantity: number | null;
|
|
160
160
|
maxQuantity: number | null;
|
|
161
161
|
} | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAgBjE,OAAO,KAAK,EACV,+BAA+B,EAC/B,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AA+J/B,eAAO,MAAM,oBAAoB;kCAEzB,kBAAkB,aACX,MAAM,SACV,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAyS5B,kBAAkB,aACX,MAAM,SACV,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGzC,CAAA"}
|
package/dist/service-public.js
CHANGED
|
@@ -2,7 +2,7 @@ import { availabilitySlots, availabilityStartTimes } from "@voyantjs/availabilit
|
|
|
2
2
|
import { optionUnits, productOptions, products } from "@voyantjs/products/schema";
|
|
3
3
|
import { and, asc, desc, eq, gte, inArray, lte, ne, or, sql } from "drizzle-orm";
|
|
4
4
|
import { optionPriceRules, optionStartTimeRules, optionUnitPriceRules, optionUnitTiers, priceCatalogs, priceSchedules, } from "./schema.js";
|
|
5
|
-
import { pickRulesForDate } from "./service-rule-resolver.js";
|
|
5
|
+
import { loadDeparturePriceOverrides, pickRulesForDate, } from "./service-rule-resolver.js";
|
|
6
6
|
function normalizeDate(value) {
|
|
7
7
|
if (!value) {
|
|
8
8
|
return null;
|
|
@@ -151,6 +151,12 @@ export const publicPricingService = {
|
|
|
151
151
|
}
|
|
152
152
|
const optionIds = options.map((option) => option.id);
|
|
153
153
|
const resolvedDate = await resolveQueryDate(db, query);
|
|
154
|
+
const overridesByUnit = query.departureId
|
|
155
|
+
? await loadDeparturePriceOverrides(db, {
|
|
156
|
+
departureId: query.departureId,
|
|
157
|
+
catalogId: catalog.id,
|
|
158
|
+
})
|
|
159
|
+
: new Map();
|
|
154
160
|
const [units, allRules] = await Promise.all([
|
|
155
161
|
db
|
|
156
162
|
.select({
|
|
@@ -301,13 +307,16 @@ export const publicPricingService = {
|
|
|
301
307
|
if (!unit) {
|
|
302
308
|
return null;
|
|
303
309
|
}
|
|
310
|
+
const override = overridesByUnit.get(unit.unitId);
|
|
304
311
|
return {
|
|
305
312
|
id: unitPrice.id,
|
|
306
313
|
unitId: unit.unitId,
|
|
307
314
|
unitName: unit.unitName,
|
|
308
315
|
unitType: unit.unitType,
|
|
309
316
|
pricingMode: unitPrice.pricingMode,
|
|
310
|
-
sellAmountCents:
|
|
317
|
+
sellAmountCents: override
|
|
318
|
+
? override.sellAmountCents
|
|
319
|
+
: (unitPrice.sellAmountCents ?? null),
|
|
311
320
|
minQuantity: unitPrice.minQuantity ?? null,
|
|
312
321
|
maxQuantity: unitPrice.maxQuantity ?? null,
|
|
313
322
|
pricingCategoryId: unitPrice.pricingCategoryId ?? null,
|
|
@@ -41,4 +41,27 @@ export interface ResolveOptionPriceRulesParams {
|
|
|
41
41
|
* (and have no default) are absent from the map.
|
|
42
42
|
*/
|
|
43
43
|
export declare function resolveOptionPriceRulesForDate(db: PostgresJsDatabase, params: ResolveOptionPriceRulesParams): Promise<Map<string, ResolverRuleInput>>;
|
|
44
|
+
/**
|
|
45
|
+
* Per-departure price override applied to a specific unit, keyed by unitId.
|
|
46
|
+
* Resolved AFTER rule selection: the rule's per-unit price gets replaced with
|
|
47
|
+
* the override's amount for any matching unit. Units without an override fall
|
|
48
|
+
* through to the rule's normal price.
|
|
49
|
+
*/
|
|
50
|
+
export interface UnitPriceOverride {
|
|
51
|
+
id: string;
|
|
52
|
+
unitId: string;
|
|
53
|
+
sellAmountCents: number;
|
|
54
|
+
costAmountCents: number | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Fetch active per-unit price overrides for a given departure + catalog.
|
|
58
|
+
*
|
|
59
|
+
* Returns a Map keyed by `optionUnitId` so callers can apply overrides while
|
|
60
|
+
* iterating per-unit prices in a snapshot. Inactive overrides are excluded at
|
|
61
|
+
* query time.
|
|
62
|
+
*/
|
|
63
|
+
export declare function loadDeparturePriceOverrides(db: PostgresJsDatabase, params: {
|
|
64
|
+
departureId: string;
|
|
65
|
+
catalogId: string;
|
|
66
|
+
}): Promise<Map<string, UnitPriceOverride>>;
|
|
44
67
|
//# sourceMappingURL=service-rule-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-rule-resolver.d.ts","sourceRoot":"","sources":["../src/service-rule-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-rule-resolver.d.ts","sourceRoot":"","sources":["../src/service-rule-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAOjE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAoED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,iBAAiB,EAAE,EAC1B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAC7C,OAAO,EAAE,MAAM,GACd,iBAAiB,EAAE,CAgCrB;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;GAOG;AACH,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,kBAAkB,EACtB,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CA8EzC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,kBAAkB,EACtB,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CA4BzC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { and, eq, inArray } from "drizzle-orm";
|
|
2
2
|
import { rrulestr } from "rrule";
|
|
3
3
|
import { priceSchedules } from "./schema-catalogs.js";
|
|
4
|
+
import { departurePriceOverrides } from "./schema-departure-overrides.js";
|
|
4
5
|
import { optionPriceRules } from "./schema-option-rules.js";
|
|
5
6
|
const ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
6
7
|
const WEEKDAY_CODES = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
@@ -170,3 +171,30 @@ export async function resolveOptionPriceRulesForDate(db, params) {
|
|
|
170
171
|
}
|
|
171
172
|
return result;
|
|
172
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Fetch active per-unit price overrides for a given departure + catalog.
|
|
176
|
+
*
|
|
177
|
+
* Returns a Map keyed by `optionUnitId` so callers can apply overrides while
|
|
178
|
+
* iterating per-unit prices in a snapshot. Inactive overrides are excluded at
|
|
179
|
+
* query time.
|
|
180
|
+
*/
|
|
181
|
+
export async function loadDeparturePriceOverrides(db, params) {
|
|
182
|
+
const rows = await db
|
|
183
|
+
.select({
|
|
184
|
+
id: departurePriceOverrides.id,
|
|
185
|
+
optionUnitId: departurePriceOverrides.optionUnitId,
|
|
186
|
+
sellAmountCents: departurePriceOverrides.sellAmountCents,
|
|
187
|
+
costAmountCents: departurePriceOverrides.costAmountCents,
|
|
188
|
+
})
|
|
189
|
+
.from(departurePriceOverrides)
|
|
190
|
+
.where(and(eq(departurePriceOverrides.departureId, params.departureId), eq(departurePriceOverrides.priceCatalogId, params.catalogId), eq(departurePriceOverrides.active, true)));
|
|
191
|
+
return new Map(rows.map((r) => [
|
|
192
|
+
r.optionUnitId,
|
|
193
|
+
{
|
|
194
|
+
id: r.id,
|
|
195
|
+
unitId: r.optionUnitId,
|
|
196
|
+
sellAmountCents: r.sellAmountCents,
|
|
197
|
+
costAmountCents: r.costAmountCents,
|
|
198
|
+
},
|
|
199
|
+
]));
|
|
200
|
+
}
|
package/dist/service-shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import type { cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, optionPriceRuleListQuerySchema, optionStartTimeRuleListQuerySchema, optionUnitPriceRuleListQuerySchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, priceCatalogListQuerySchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema } from "./validation.js";
|
|
2
|
+
import type { cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, departurePriceOverrideListQuerySchema, dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertDeparturePriceOverrideSchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, optionPriceRuleListQuerySchema, optionStartTimeRuleListQuerySchema, optionUnitPriceRuleListQuerySchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, priceCatalogListQuerySchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updateDeparturePriceOverrideSchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema } from "./validation.js";
|
|
3
3
|
export type PricingCategoryListQuery = z.infer<typeof pricingCategoryListQuerySchema>;
|
|
4
4
|
export type PricingCategoryDependencyListQuery = z.infer<typeof pricingCategoryDependencyListQuerySchema>;
|
|
5
5
|
export type CancellationPolicyListQuery = z.infer<typeof cancellationPolicyListQuerySchema>;
|
|
@@ -13,6 +13,7 @@ export type OptionUnitTierListQuery = z.infer<typeof optionUnitTierListQuerySche
|
|
|
13
13
|
export type PickupPriceRuleListQuery = z.infer<typeof pickupPriceRuleListQuerySchema>;
|
|
14
14
|
export type DropoffPriceRuleListQuery = z.infer<typeof dropoffPriceRuleListQuerySchema>;
|
|
15
15
|
export type ExtraPriceRuleListQuery = z.infer<typeof extraPriceRuleListQuerySchema>;
|
|
16
|
+
export type DeparturePriceOverrideListQuery = z.infer<typeof departurePriceOverrideListQuerySchema>;
|
|
16
17
|
export type CreatePricingCategoryInput = z.infer<typeof insertPricingCategorySchema>;
|
|
17
18
|
export type UpdatePricingCategoryInput = z.infer<typeof updatePricingCategorySchema>;
|
|
18
19
|
export type CreatePricingCategoryDependencyInput = z.infer<typeof insertPricingCategoryDependencySchema>;
|
|
@@ -39,6 +40,8 @@ export type CreateDropoffPriceRuleInput = z.infer<typeof insertDropoffPriceRuleS
|
|
|
39
40
|
export type UpdateDropoffPriceRuleInput = z.infer<typeof updateDropoffPriceRuleSchema>;
|
|
40
41
|
export type CreateExtraPriceRuleInput = z.infer<typeof insertExtraPriceRuleSchema>;
|
|
41
42
|
export type UpdateExtraPriceRuleInput = z.infer<typeof updateExtraPriceRuleSchema>;
|
|
43
|
+
export type CreateDeparturePriceOverrideInput = z.infer<typeof insertDeparturePriceOverrideSchema>;
|
|
44
|
+
export type UpdateDeparturePriceOverrideInput = z.infer<typeof updateDeparturePriceOverrideSchema>;
|
|
42
45
|
export declare function paginate<T extends object>(rowsQuery: Promise<T[]>, countQuery: Promise<Array<{
|
|
43
46
|
count: number;
|
|
44
47
|
}>>, limit: number, offset: number): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-shared.d.ts","sourceRoot":"","sources":["../src/service-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EACV,iCAAiC,EACjC,qCAAqC,EACrC,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EAClC,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,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number;
|
|
44
|
-
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
45
|
-
optionPriceRuleId: string;
|
|
46
44
|
sellAmountCents: number | null;
|
|
47
45
|
costAmountCents: number | null;
|
|
46
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
47
|
+
optionPriceRuleId: string;
|
|
48
48
|
pickupPointId: string;
|
|
49
49
|
} | null>;
|
|
50
50
|
export declare function updatePickupPriceRule(db: PostgresJsDatabase, id: string, data: UpdatePickupPriceRuleInput): Promise<{
|
|
@@ -109,10 +109,10 @@ export declare function createDropoffPriceRule(db: PostgresJsDatabase, data: Cre
|
|
|
109
109
|
active: boolean;
|
|
110
110
|
optionId: string;
|
|
111
111
|
sortOrder: number;
|
|
112
|
-
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
113
|
-
optionPriceRuleId: string;
|
|
114
112
|
sellAmountCents: number | null;
|
|
115
113
|
costAmountCents: number | null;
|
|
114
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
115
|
+
optionPriceRuleId: string;
|
|
116
116
|
facilityId: string | null;
|
|
117
117
|
dropoffCode: string | null;
|
|
118
118
|
dropoffName: string;
|
|
@@ -182,10 +182,10 @@ export declare function createExtraPriceRule(db: PostgresJsDatabase, data: Creat
|
|
|
182
182
|
active: boolean;
|
|
183
183
|
optionId: string;
|
|
184
184
|
sortOrder: number;
|
|
185
|
-
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
186
|
-
optionPriceRuleId: string;
|
|
187
185
|
sellAmountCents: number | null;
|
|
188
186
|
costAmountCents: number | null;
|
|
187
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
188
|
+
optionPriceRuleId: string;
|
|
189
189
|
productExtraId: string | null;
|
|
190
190
|
optionExtraConfigId: string | null;
|
|
191
191
|
} | null>;
|
package/dist/service.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPriceCatalog, createPriceSchedule, deletePriceCatalog, deletePriceSchedule, getPriceCatalogById, getPriceScheduleById, listPriceCatalogs, listPriceSchedules, updatePriceCatalog, updatePriceSchedule } from "./service-catalogs.js";
|
|
2
2
|
import { createPricingCategory, createPricingCategoryDependency, deletePricingCategory, deletePricingCategoryDependency, getPricingCategoryById, getPricingCategoryDependencyById, listPricingCategories, listPricingCategoryDependencies, updatePricingCategory, updatePricingCategoryDependency } from "./service-categories.js";
|
|
3
|
+
import { createDeparturePriceOverride, deleteDeparturePriceOverride, getDeparturePriceOverrideById, listDeparturePriceOverrides, updateDeparturePriceOverride } from "./service-departure-overrides.js";
|
|
3
4
|
import { createOptionPriceRule, createOptionStartTimeRule, createOptionUnitPriceRule, createOptionUnitTier, deleteOptionPriceRule, deleteOptionStartTimeRule, deleteOptionUnitPriceRule, deleteOptionUnitTier, getOptionPriceRuleById, getOptionStartTimeRuleById, getOptionUnitPriceRuleById, getOptionUnitTierById, listOptionPriceRules, listOptionStartTimeRules, listOptionUnitPriceRules, listOptionUnitTiers, updateOptionPriceRule, updateOptionStartTimeRule, updateOptionUnitPriceRule, updateOptionUnitTier } from "./service-option-rules.js";
|
|
4
5
|
import { createCancellationPolicy, createCancellationPolicyRule, deleteCancellationPolicy, deleteCancellationPolicyRule, getCancellationPolicyById, getCancellationPolicyRuleById, listCancellationPolicies, listCancellationPolicyRules, updateCancellationPolicy, updateCancellationPolicyRule } from "./service-policies.js";
|
|
5
6
|
import { createDropoffPriceRule, createExtraPriceRule, createPickupPriceRule, deleteDropoffPriceRule, deleteExtraPriceRule, deletePickupPriceRule, getDropoffPriceRuleById, getExtraPriceRuleById, getPickupPriceRuleById, listDropoffPriceRules, listExtraPriceRules, listPickupPriceRules, updateDropoffPriceRule, updateExtraPriceRule, updatePickupPriceRule } from "./service-transfer-rules.js";
|
|
@@ -69,5 +70,10 @@ export declare const pricingService: {
|
|
|
69
70
|
createExtraPriceRule: typeof createExtraPriceRule;
|
|
70
71
|
updateExtraPriceRule: typeof updateExtraPriceRule;
|
|
71
72
|
deleteExtraPriceRule: typeof deleteExtraPriceRule;
|
|
73
|
+
listDeparturePriceOverrides: typeof listDeparturePriceOverrides;
|
|
74
|
+
getDeparturePriceOverrideById: typeof getDeparturePriceOverrideById;
|
|
75
|
+
createDeparturePriceOverride: typeof createDeparturePriceOverride;
|
|
76
|
+
updateDeparturePriceOverride: typeof updateDeparturePriceOverride;
|
|
77
|
+
deleteDeparturePriceOverride: typeof deleteDeparturePriceOverride;
|
|
72
78
|
};
|
|
73
79
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,+BAA+B,EAC/B,sBAAsB,EACtB,gCAAgC,EAChC,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,+BAA+B,EAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,6BAA6B,CAAA;AAEpC,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,+BAA+B,EAC/B,sBAAsB,EACtB,gCAAgC,EAChC,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,+BAA+B,EAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,6BAA6B,CAAA;AAEpC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuE1B,CAAA"}
|
package/dist/service.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPriceCatalog, createPriceSchedule, deletePriceCatalog, deletePriceSchedule, getPriceCatalogById, getPriceScheduleById, listPriceCatalogs, listPriceSchedules, updatePriceCatalog, updatePriceSchedule, } from "./service-catalogs.js";
|
|
2
2
|
import { createPricingCategory, createPricingCategoryDependency, deletePricingCategory, deletePricingCategoryDependency, getPricingCategoryById, getPricingCategoryDependencyById, listPricingCategories, listPricingCategoryDependencies, updatePricingCategory, updatePricingCategoryDependency, } from "./service-categories.js";
|
|
3
|
+
import { createDeparturePriceOverride, deleteDeparturePriceOverride, getDeparturePriceOverrideById, listDeparturePriceOverrides, updateDeparturePriceOverride, } from "./service-departure-overrides.js";
|
|
3
4
|
import { createOptionPriceRule, createOptionStartTimeRule, createOptionUnitPriceRule, createOptionUnitTier, deleteOptionPriceRule, deleteOptionStartTimeRule, deleteOptionUnitPriceRule, deleteOptionUnitTier, getOptionPriceRuleById, getOptionStartTimeRuleById, getOptionUnitPriceRuleById, getOptionUnitTierById, listOptionPriceRules, listOptionStartTimeRules, listOptionUnitPriceRules, listOptionUnitTiers, updateOptionPriceRule, updateOptionStartTimeRule, updateOptionUnitPriceRule, updateOptionUnitTier, } from "./service-option-rules.js";
|
|
4
5
|
import { createCancellationPolicy, createCancellationPolicyRule, deleteCancellationPolicy, deleteCancellationPolicyRule, getCancellationPolicyById, getCancellationPolicyRuleById, listCancellationPolicies, listCancellationPolicyRules, updateCancellationPolicy, updateCancellationPolicyRule, } from "./service-policies.js";
|
|
5
6
|
import { createDropoffPriceRule, createExtraPriceRule, createPickupPriceRule, deleteDropoffPriceRule, deleteExtraPriceRule, deletePickupPriceRule, getDropoffPriceRuleById, getExtraPriceRuleById, getPickupPriceRuleById, listDropoffPriceRules, listExtraPriceRules, listPickupPriceRules, updateDropoffPriceRule, updateExtraPriceRule, updatePickupPriceRule, } from "./service-transfer-rules.js";
|
|
@@ -69,4 +70,9 @@ export const pricingService = {
|
|
|
69
70
|
createExtraPriceRule,
|
|
70
71
|
updateExtraPriceRule,
|
|
71
72
|
deleteExtraPriceRule,
|
|
73
|
+
listDeparturePriceOverrides,
|
|
74
|
+
getDeparturePriceOverrideById,
|
|
75
|
+
createDeparturePriceOverride,
|
|
76
|
+
updateDeparturePriceOverride,
|
|
77
|
+
deleteDeparturePriceOverride,
|
|
72
78
|
};
|
package/dist/validation.d.ts
CHANGED
|
@@ -935,6 +935,53 @@ export declare const extraPriceRuleListQuerySchema: z.ZodObject<{
|
|
|
935
935
|
false: "false";
|
|
936
936
|
}>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
937
937
|
}, z.core.$strip>;
|
|
938
|
+
export declare const departurePriceOverrideCoreSchema: z.ZodObject<{
|
|
939
|
+
departureId: z.ZodString;
|
|
940
|
+
optionId: z.ZodString;
|
|
941
|
+
optionUnitId: z.ZodString;
|
|
942
|
+
priceCatalogId: z.ZodString;
|
|
943
|
+
sellAmountCents: z.ZodNumber;
|
|
944
|
+
costAmountCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
945
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
946
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
947
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
948
|
+
}, z.core.$strip>;
|
|
949
|
+
export declare const insertDeparturePriceOverrideSchema: z.ZodObject<{
|
|
950
|
+
departureId: z.ZodString;
|
|
951
|
+
optionId: z.ZodString;
|
|
952
|
+
optionUnitId: z.ZodString;
|
|
953
|
+
priceCatalogId: z.ZodString;
|
|
954
|
+
sellAmountCents: z.ZodNumber;
|
|
955
|
+
costAmountCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
956
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
957
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
958
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
959
|
+
}, z.core.$strip>;
|
|
960
|
+
export declare const updateDeparturePriceOverrideSchema: z.ZodObject<{
|
|
961
|
+
departureId: z.ZodOptional<z.ZodString>;
|
|
962
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
963
|
+
optionUnitId: z.ZodOptional<z.ZodString>;
|
|
964
|
+
priceCatalogId: z.ZodOptional<z.ZodString>;
|
|
965
|
+
sellAmountCents: z.ZodOptional<z.ZodNumber>;
|
|
966
|
+
costAmountCents: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
967
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
968
|
+
active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
969
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
970
|
+
}, z.core.$strip>;
|
|
971
|
+
export declare const departurePriceOverrideListQuerySchema: z.ZodObject<{
|
|
972
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
973
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
974
|
+
departureId: z.ZodOptional<z.ZodString>;
|
|
975
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
976
|
+
optionUnitId: z.ZodOptional<z.ZodString>;
|
|
977
|
+
priceCatalogId: z.ZodOptional<z.ZodString>;
|
|
978
|
+
active: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
979
|
+
0: "0";
|
|
980
|
+
1: "1";
|
|
981
|
+
true: "true";
|
|
982
|
+
false: "false";
|
|
983
|
+
}>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
984
|
+
}, z.core.$strip>;
|
|
938
985
|
export * from "./validation-public.js";
|
|
939
986
|
export * from "./validation-shared.js";
|
|
940
987
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA2BvB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBpC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA4B,CAAA;AACpE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAA;AAC9E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;iBAOzC,CAAA;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;iBAQ9C,CAAA;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;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CAAkC;;;;;;;;;;iBAAmC,CAAA;AAClF,eAAO,MAAM,kCAAkC;;;;;;;;;;iBAA6C,CAAA;AAC5F,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;iBAMhD,CAAA;AAEF,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -283,5 +283,25 @@ export const extraPriceRuleListQuerySchema = paginationSchema.extend({
|
|
|
283
283
|
optionExtraConfigId: z.string().optional(),
|
|
284
284
|
active: booleanQueryParam.optional(),
|
|
285
285
|
});
|
|
286
|
+
export const departurePriceOverrideCoreSchema = z.object({
|
|
287
|
+
departureId: z.string(),
|
|
288
|
+
optionId: z.string(),
|
|
289
|
+
optionUnitId: z.string(),
|
|
290
|
+
priceCatalogId: z.string(),
|
|
291
|
+
sellAmountCents: z.number().int().min(0),
|
|
292
|
+
costAmountCents: z.number().int().min(0).nullable().optional(),
|
|
293
|
+
notes: z.string().nullable().optional(),
|
|
294
|
+
active: z.boolean().default(true),
|
|
295
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
296
|
+
});
|
|
297
|
+
export const insertDeparturePriceOverrideSchema = departurePriceOverrideCoreSchema;
|
|
298
|
+
export const updateDeparturePriceOverrideSchema = departurePriceOverrideCoreSchema.partial();
|
|
299
|
+
export const departurePriceOverrideListQuerySchema = paginationSchema.extend({
|
|
300
|
+
departureId: z.string().optional(),
|
|
301
|
+
optionId: z.string().optional(),
|
|
302
|
+
optionUnitId: z.string().optional(),
|
|
303
|
+
priceCatalogId: z.string().optional(),
|
|
304
|
+
active: booleanQueryParam.optional(),
|
|
305
|
+
});
|
|
286
306
|
export * from "./validation-public.js";
|
|
287
307
|
export * from "./validation-shared.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/pricing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"hono": "^4.12.10",
|
|
41
41
|
"rrule": "^2.8.1",
|
|
42
42
|
"zod": "^4.3.6",
|
|
43
|
-
"@voyantjs/availability": "0.
|
|
44
|
-
"@voyantjs/core": "0.
|
|
45
|
-
"@voyantjs/db": "0.
|
|
46
|
-
"@voyantjs/hono": "0.
|
|
47
|
-
"@voyantjs/products": "0.
|
|
43
|
+
"@voyantjs/availability": "0.28.0",
|
|
44
|
+
"@voyantjs/core": "0.28.0",
|
|
45
|
+
"@voyantjs/db": "0.28.0",
|
|
46
|
+
"@voyantjs/hono": "0.28.0",
|
|
47
|
+
"@voyantjs/products": "0.28.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^6.0.2",
|
|
51
|
-
"@voyantjs/extras": "0.
|
|
52
|
-
"@voyantjs/facilities": "0.
|
|
51
|
+
"@voyantjs/extras": "0.28.0",
|
|
52
|
+
"@voyantjs/facilities": "0.28.0",
|
|
53
53
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|