@voyantjs/pricing 0.5.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routes-core.d.ts +34 -34
- package/dist/routes-core.d.ts.map +1 -1
- package/dist/routes-core.js +19 -18
- package/dist/routes-public.d.ts +3 -3
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +3 -2
- package/dist/routes-rules.d.ts +24 -24
- package/dist/routes-rules.d.ts.map +1 -1
- package/dist/routes-rules.js +22 -21
- package/dist/schema-categories.d.ts +1 -1
- package/dist/schema-option-rules.d.ts +1 -1
- package/dist/schema-policies.d.ts +1 -1
- package/dist/service-catalogs.d.ts +9 -9
- package/dist/service-categories.d.ts +9 -9
- package/dist/service-option-rules.d.ts +15 -15
- package/dist/service-policies.d.ts +10 -10
- package/dist/service-public.d.ts +3 -3
- package/dist/service-transfer-rules.d.ts +7 -7
- package/dist/validation-public.d.ts +14 -14
- package/dist/validation-shared.d.ts +4 -4
- package/dist/validation.d.ts +15 -15
- package/package.json +8 -8
package/dist/routes-rules.js
CHANGED
|
@@ -1,114 +1,115 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
1
2
|
import { Hono } from "hono";
|
|
2
3
|
import { notFound } from "./routes-shared.js";
|
|
3
4
|
import { pricingService } from "./service.js";
|
|
4
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
6
|
export const pricingRuleRoutes = new Hono()
|
|
6
|
-
.get("/option-price-rules", async (c) => c.json(await pricingService.listOptionPriceRules(c.get("db"),
|
|
7
|
+
.get("/option-price-rules", async (c) => c.json(await pricingService.listOptionPriceRules(c.get("db"), await parseQuery(c, optionPriceRuleListQuerySchema))))
|
|
7
8
|
.post("/option-price-rules", async (c) => c.json({
|
|
8
|
-
data: await pricingService.createOptionPriceRule(c.get("db"),
|
|
9
|
+
data: await pricingService.createOptionPriceRule(c.get("db"), await parseJsonBody(c, insertOptionPriceRuleSchema)),
|
|
9
10
|
}, 201))
|
|
10
11
|
.get("/option-price-rules/:id", async (c) => {
|
|
11
12
|
const row = await pricingService.getOptionPriceRuleById(c.get("db"), c.req.param("id"));
|
|
12
13
|
return row ? c.json({ data: row }) : notFound(c, "Option price rule not found");
|
|
13
14
|
})
|
|
14
15
|
.patch("/option-price-rules/:id", async (c) => {
|
|
15
|
-
const row = await pricingService.updateOptionPriceRule(c.get("db"), c.req.param("id"),
|
|
16
|
+
const row = await pricingService.updateOptionPriceRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOptionPriceRuleSchema));
|
|
16
17
|
return row ? c.json({ data: row }) : notFound(c, "Option price rule not found");
|
|
17
18
|
})
|
|
18
19
|
.delete("/option-price-rules/:id", async (c) => {
|
|
19
20
|
const row = await pricingService.deleteOptionPriceRule(c.get("db"), c.req.param("id"));
|
|
20
21
|
return row ? c.json({ success: true }) : notFound(c, "Option price rule not found");
|
|
21
22
|
})
|
|
22
|
-
.get("/option-unit-price-rules", async (c) => c.json(await pricingService.listOptionUnitPriceRules(c.get("db"),
|
|
23
|
+
.get("/option-unit-price-rules", async (c) => c.json(await pricingService.listOptionUnitPriceRules(c.get("db"), await parseQuery(c, optionUnitPriceRuleListQuerySchema))))
|
|
23
24
|
.post("/option-unit-price-rules", async (c) => c.json({
|
|
24
|
-
data: await pricingService.createOptionUnitPriceRule(c.get("db"),
|
|
25
|
+
data: await pricingService.createOptionUnitPriceRule(c.get("db"), await parseJsonBody(c, insertOptionUnitPriceRuleSchema)),
|
|
25
26
|
}, 201))
|
|
26
27
|
.get("/option-unit-price-rules/:id", async (c) => {
|
|
27
28
|
const row = await pricingService.getOptionUnitPriceRuleById(c.get("db"), c.req.param("id"));
|
|
28
29
|
return row ? c.json({ data: row }) : notFound(c, "Option unit price rule not found");
|
|
29
30
|
})
|
|
30
31
|
.patch("/option-unit-price-rules/:id", async (c) => {
|
|
31
|
-
const row = await pricingService.updateOptionUnitPriceRule(c.get("db"), c.req.param("id"),
|
|
32
|
+
const row = await pricingService.updateOptionUnitPriceRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOptionUnitPriceRuleSchema));
|
|
32
33
|
return row ? c.json({ data: row }) : notFound(c, "Option unit price rule not found");
|
|
33
34
|
})
|
|
34
35
|
.delete("/option-unit-price-rules/:id", async (c) => {
|
|
35
36
|
const row = await pricingService.deleteOptionUnitPriceRule(c.get("db"), c.req.param("id"));
|
|
36
37
|
return row ? c.json({ success: true }) : notFound(c, "Option unit price rule not found");
|
|
37
38
|
})
|
|
38
|
-
.get("/option-start-time-rules", async (c) => c.json(await pricingService.listOptionStartTimeRules(c.get("db"),
|
|
39
|
+
.get("/option-start-time-rules", async (c) => c.json(await pricingService.listOptionStartTimeRules(c.get("db"), await parseQuery(c, optionStartTimeRuleListQuerySchema))))
|
|
39
40
|
.post("/option-start-time-rules", async (c) => c.json({
|
|
40
|
-
data: await pricingService.createOptionStartTimeRule(c.get("db"),
|
|
41
|
+
data: await pricingService.createOptionStartTimeRule(c.get("db"), await parseJsonBody(c, insertOptionStartTimeRuleSchema)),
|
|
41
42
|
}, 201))
|
|
42
43
|
.get("/option-start-time-rules/:id", async (c) => {
|
|
43
44
|
const row = await pricingService.getOptionStartTimeRuleById(c.get("db"), c.req.param("id"));
|
|
44
45
|
return row ? c.json({ data: row }) : notFound(c, "Option start time rule not found");
|
|
45
46
|
})
|
|
46
47
|
.patch("/option-start-time-rules/:id", async (c) => {
|
|
47
|
-
const row = await pricingService.updateOptionStartTimeRule(c.get("db"), c.req.param("id"),
|
|
48
|
+
const row = await pricingService.updateOptionStartTimeRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOptionStartTimeRuleSchema));
|
|
48
49
|
return row ? c.json({ data: row }) : notFound(c, "Option start time rule not found");
|
|
49
50
|
})
|
|
50
51
|
.delete("/option-start-time-rules/:id", async (c) => {
|
|
51
52
|
const row = await pricingService.deleteOptionStartTimeRule(c.get("db"), c.req.param("id"));
|
|
52
53
|
return row ? c.json({ success: true }) : notFound(c, "Option start time rule not found");
|
|
53
54
|
})
|
|
54
|
-
.get("/option-unit-tiers", async (c) => c.json(await pricingService.listOptionUnitTiers(c.get("db"),
|
|
55
|
+
.get("/option-unit-tiers", async (c) => c.json(await pricingService.listOptionUnitTiers(c.get("db"), await parseQuery(c, optionUnitTierListQuerySchema))))
|
|
55
56
|
.post("/option-unit-tiers", async (c) => c.json({
|
|
56
|
-
data: await pricingService.createOptionUnitTier(c.get("db"),
|
|
57
|
+
data: await pricingService.createOptionUnitTier(c.get("db"), await parseJsonBody(c, insertOptionUnitTierSchema)),
|
|
57
58
|
}, 201))
|
|
58
59
|
.get("/option-unit-tiers/:id", async (c) => {
|
|
59
60
|
const row = await pricingService.getOptionUnitTierById(c.get("db"), c.req.param("id"));
|
|
60
61
|
return row ? c.json({ data: row }) : notFound(c, "Option unit tier not found");
|
|
61
62
|
})
|
|
62
63
|
.patch("/option-unit-tiers/:id", async (c) => {
|
|
63
|
-
const row = await pricingService.updateOptionUnitTier(c.get("db"), c.req.param("id"),
|
|
64
|
+
const row = await pricingService.updateOptionUnitTier(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOptionUnitTierSchema));
|
|
64
65
|
return row ? c.json({ data: row }) : notFound(c, "Option unit tier not found");
|
|
65
66
|
})
|
|
66
67
|
.delete("/option-unit-tiers/:id", async (c) => {
|
|
67
68
|
const row = await pricingService.deleteOptionUnitTier(c.get("db"), c.req.param("id"));
|
|
68
69
|
return row ? c.json({ success: true }) : notFound(c, "Option unit tier not found");
|
|
69
70
|
})
|
|
70
|
-
.get("/pickup-price-rules", async (c) => c.json(await pricingService.listPickupPriceRules(c.get("db"),
|
|
71
|
+
.get("/pickup-price-rules", async (c) => c.json(await pricingService.listPickupPriceRules(c.get("db"), await parseQuery(c, pickupPriceRuleListQuerySchema))))
|
|
71
72
|
.post("/pickup-price-rules", async (c) => c.json({
|
|
72
|
-
data: await pricingService.createPickupPriceRule(c.get("db"),
|
|
73
|
+
data: await pricingService.createPickupPriceRule(c.get("db"), await parseJsonBody(c, insertPickupPriceRuleSchema)),
|
|
73
74
|
}, 201))
|
|
74
75
|
.get("/pickup-price-rules/:id", async (c) => {
|
|
75
76
|
const row = await pricingService.getPickupPriceRuleById(c.get("db"), c.req.param("id"));
|
|
76
77
|
return row ? c.json({ data: row }) : notFound(c, "Pickup price rule not found");
|
|
77
78
|
})
|
|
78
79
|
.patch("/pickup-price-rules/:id", async (c) => {
|
|
79
|
-
const row = await pricingService.updatePickupPriceRule(c.get("db"), c.req.param("id"),
|
|
80
|
+
const row = await pricingService.updatePickupPriceRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePickupPriceRuleSchema));
|
|
80
81
|
return row ? c.json({ data: row }) : notFound(c, "Pickup price rule not found");
|
|
81
82
|
})
|
|
82
83
|
.delete("/pickup-price-rules/:id", async (c) => {
|
|
83
84
|
const row = await pricingService.deletePickupPriceRule(c.get("db"), c.req.param("id"));
|
|
84
85
|
return row ? c.json({ success: true }) : notFound(c, "Pickup price rule not found");
|
|
85
86
|
})
|
|
86
|
-
.get("/dropoff-price-rules", async (c) => c.json(await pricingService.listDropoffPriceRules(c.get("db"),
|
|
87
|
+
.get("/dropoff-price-rules", async (c) => c.json(await pricingService.listDropoffPriceRules(c.get("db"), await parseQuery(c, dropoffPriceRuleListQuerySchema))))
|
|
87
88
|
.post("/dropoff-price-rules", async (c) => c.json({
|
|
88
|
-
data: await pricingService.createDropoffPriceRule(c.get("db"),
|
|
89
|
+
data: await pricingService.createDropoffPriceRule(c.get("db"), await parseJsonBody(c, insertDropoffPriceRuleSchema)),
|
|
89
90
|
}, 201))
|
|
90
91
|
.get("/dropoff-price-rules/:id", async (c) => {
|
|
91
92
|
const row = await pricingService.getDropoffPriceRuleById(c.get("db"), c.req.param("id"));
|
|
92
93
|
return row ? c.json({ data: row }) : notFound(c, "Dropoff price rule not found");
|
|
93
94
|
})
|
|
94
95
|
.patch("/dropoff-price-rules/:id", async (c) => {
|
|
95
|
-
const row = await pricingService.updateDropoffPriceRule(c.get("db"), c.req.param("id"),
|
|
96
|
+
const row = await pricingService.updateDropoffPriceRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateDropoffPriceRuleSchema));
|
|
96
97
|
return row ? c.json({ data: row }) : notFound(c, "Dropoff price rule not found");
|
|
97
98
|
})
|
|
98
99
|
.delete("/dropoff-price-rules/:id", async (c) => {
|
|
99
100
|
const row = await pricingService.deleteDropoffPriceRule(c.get("db"), c.req.param("id"));
|
|
100
101
|
return row ? c.json({ success: true }) : notFound(c, "Dropoff price rule not found");
|
|
101
102
|
})
|
|
102
|
-
.get("/extra-price-rules", async (c) => c.json(await pricingService.listExtraPriceRules(c.get("db"),
|
|
103
|
+
.get("/extra-price-rules", async (c) => c.json(await pricingService.listExtraPriceRules(c.get("db"), await parseQuery(c, extraPriceRuleListQuerySchema))))
|
|
103
104
|
.post("/extra-price-rules", async (c) => c.json({
|
|
104
|
-
data: await pricingService.createExtraPriceRule(c.get("db"),
|
|
105
|
+
data: await pricingService.createExtraPriceRule(c.get("db"), await parseJsonBody(c, insertExtraPriceRuleSchema)),
|
|
105
106
|
}, 201))
|
|
106
107
|
.get("/extra-price-rules/:id", async (c) => {
|
|
107
108
|
const row = await pricingService.getExtraPriceRuleById(c.get("db"), c.req.param("id"));
|
|
108
109
|
return row ? c.json({ data: row }) : notFound(c, "Extra price rule not found");
|
|
109
110
|
})
|
|
110
111
|
.patch("/extra-price-rules/:id", async (c) => {
|
|
111
|
-
const row = await pricingService.updateExtraPriceRule(c.get("db"), c.req.param("id"),
|
|
112
|
+
const row = await pricingService.updateExtraPriceRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateExtraPriceRuleSchema));
|
|
112
113
|
return row ? c.json({ data: row }) : notFound(c, "Extra price rule not found");
|
|
113
114
|
})
|
|
114
115
|
.delete("/extra-price-rules/:id", async (c) => {
|
|
@@ -109,7 +109,7 @@ export declare const pricingCategories: import("drizzle-orm/pg-core").PgTableWit
|
|
|
109
109
|
tableName: "pricing_categories";
|
|
110
110
|
dataType: "string";
|
|
111
111
|
columnType: "PgEnumColumn";
|
|
112
|
-
data: "
|
|
112
|
+
data: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
113
113
|
driverParam: string;
|
|
114
114
|
notNull: true;
|
|
115
115
|
hasDefault: true;
|
|
@@ -722,7 +722,7 @@ export declare const optionStartTimeRules: import("drizzle-orm/pg-core").PgTable
|
|
|
722
722
|
tableName: "option_start_time_rules";
|
|
723
723
|
dataType: "string";
|
|
724
724
|
columnType: "PgEnumColumn";
|
|
725
|
-
data: "
|
|
725
|
+
data: "override" | "included" | "excluded" | "adjustment";
|
|
726
726
|
driverParam: string;
|
|
727
727
|
notNull: true;
|
|
728
728
|
hasDefault: true;
|
|
@@ -58,7 +58,7 @@ export declare const cancellationPolicies: import("drizzle-orm/pg-core").PgTable
|
|
|
58
58
|
tableName: "cancellation_policies";
|
|
59
59
|
dataType: "string";
|
|
60
60
|
columnType: "PgEnumColumn";
|
|
61
|
-
data: "
|
|
61
|
+
data: "custom" | "simple" | "advanced" | "non_refundable";
|
|
62
62
|
driverParam: string;
|
|
63
63
|
notNull: true;
|
|
64
64
|
hasDefault: true;
|
|
@@ -32,17 +32,17 @@ export declare function getPriceCatalogById(db: PostgresJsDatabase, id: string):
|
|
|
32
32
|
updatedAt: Date;
|
|
33
33
|
} | null>;
|
|
34
34
|
export declare function createPriceCatalog(db: PostgresJsDatabase, data: CreatePriceCatalogInput): Promise<{
|
|
35
|
+
metadata: Record<string, unknown> | null;
|
|
35
36
|
id: string;
|
|
36
37
|
name: string;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
notes: string | null;
|
|
37
41
|
code: string;
|
|
38
42
|
currencyCode: string | null;
|
|
39
43
|
catalogType: "internal" | "other" | "public" | "contract" | "net" | "gross" | "promo";
|
|
40
44
|
isDefault: boolean;
|
|
41
45
|
active: boolean;
|
|
42
|
-
notes: string | null;
|
|
43
|
-
metadata: Record<string, unknown> | null;
|
|
44
|
-
createdAt: Date;
|
|
45
|
-
updatedAt: Date;
|
|
46
46
|
} | null>;
|
|
47
47
|
export declare function updatePriceCatalog(db: PostgresJsDatabase, id: string, data: UpdatePriceCatalogInput): Promise<{
|
|
48
48
|
id: string;
|
|
@@ -100,17 +100,17 @@ export declare function getPriceScheduleById(db: PostgresJsDatabase, id: string)
|
|
|
100
100
|
updatedAt: Date;
|
|
101
101
|
} | null>;
|
|
102
102
|
export declare function createPriceSchedule(db: PostgresJsDatabase, data: CreatePriceScheduleInput): Promise<{
|
|
103
|
+
metadata: Record<string, unknown> | null;
|
|
103
104
|
id: string;
|
|
104
105
|
name: string;
|
|
105
|
-
code: string | null;
|
|
106
|
-
active: boolean;
|
|
107
|
-
notes: string | null;
|
|
108
|
-
metadata: Record<string, unknown> | null;
|
|
109
106
|
createdAt: Date;
|
|
110
107
|
updatedAt: Date;
|
|
108
|
+
notes: string | null;
|
|
109
|
+
timezone: string | null;
|
|
110
|
+
code: string | null;
|
|
111
|
+
active: boolean;
|
|
111
112
|
priceCatalogId: string;
|
|
112
113
|
recurrenceRule: string;
|
|
113
|
-
timezone: string | null;
|
|
114
114
|
validFrom: string | null;
|
|
115
115
|
validTo: string | null;
|
|
116
116
|
weekdays: string[] | null;
|
|
@@ -8,7 +8,7 @@ export declare function listPricingCategories(db: PostgresJsDatabase, query: Pri
|
|
|
8
8
|
unitId: string | null;
|
|
9
9
|
code: string | null;
|
|
10
10
|
name: string;
|
|
11
|
-
categoryType: "
|
|
11
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
12
12
|
seatOccupancy: number;
|
|
13
13
|
groupSize: number | null;
|
|
14
14
|
isAgeQualified: boolean;
|
|
@@ -32,7 +32,7 @@ export declare function getPricingCategoryById(db: PostgresJsDatabase, id: strin
|
|
|
32
32
|
unitId: string | null;
|
|
33
33
|
code: string | null;
|
|
34
34
|
name: string;
|
|
35
|
-
categoryType: "
|
|
35
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
36
36
|
seatOccupancy: number;
|
|
37
37
|
groupSize: number | null;
|
|
38
38
|
isAgeQualified: boolean;
|
|
@@ -46,17 +46,17 @@ export declare function getPricingCategoryById(db: PostgresJsDatabase, id: strin
|
|
|
46
46
|
updatedAt: Date;
|
|
47
47
|
} | null>;
|
|
48
48
|
export declare function createPricingCategory(db: PostgresJsDatabase, data: CreatePricingCategoryInput): Promise<{
|
|
49
|
+
metadata: Record<string, unknown> | null;
|
|
49
50
|
id: string;
|
|
50
51
|
name: string;
|
|
51
|
-
code: string | null;
|
|
52
|
-
active: boolean;
|
|
53
|
-
metadata: Record<string, unknown> | null;
|
|
54
52
|
createdAt: Date;
|
|
55
53
|
updatedAt: Date;
|
|
54
|
+
code: string | null;
|
|
55
|
+
active: boolean;
|
|
56
56
|
productId: string | null;
|
|
57
57
|
optionId: string | null;
|
|
58
58
|
unitId: string | null;
|
|
59
|
-
categoryType: "
|
|
59
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
60
60
|
seatOccupancy: number;
|
|
61
61
|
groupSize: number | null;
|
|
62
62
|
isAgeQualified: boolean;
|
|
@@ -72,7 +72,7 @@ export declare function updatePricingCategory(db: PostgresJsDatabase, id: string
|
|
|
72
72
|
unitId: string | null;
|
|
73
73
|
code: string | null;
|
|
74
74
|
name: string;
|
|
75
|
-
categoryType: "
|
|
75
|
+
categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
|
|
76
76
|
seatOccupancy: number;
|
|
77
77
|
groupSize: number | null;
|
|
78
78
|
isAgeQualified: boolean;
|
|
@@ -119,10 +119,10 @@ export declare function getPricingCategoryDependencyById(db: PostgresJsDatabase,
|
|
|
119
119
|
} | null>;
|
|
120
120
|
export declare function createPricingCategoryDependency(db: PostgresJsDatabase, data: CreatePricingCategoryDependencyInput): Promise<{
|
|
121
121
|
id: string;
|
|
122
|
-
active: boolean;
|
|
123
|
-
notes: string | null;
|
|
124
122
|
createdAt: Date;
|
|
125
123
|
updatedAt: Date;
|
|
124
|
+
notes: string | null;
|
|
125
|
+
active: boolean;
|
|
126
126
|
pricingCategoryId: string;
|
|
127
127
|
masterPricingCategoryId: string;
|
|
128
128
|
dependencyType: "requires" | "limits_per_master" | "limits_sum" | "excludes";
|
|
@@ -52,21 +52,21 @@ export declare function getOptionPriceRuleById(db: PostgresJsDatabase, id: strin
|
|
|
52
52
|
updatedAt: Date;
|
|
53
53
|
} | null>;
|
|
54
54
|
export declare function createOptionPriceRule(db: PostgresJsDatabase, data: CreateOptionPriceRuleInput): Promise<{
|
|
55
|
+
metadata: Record<string, unknown> | null;
|
|
55
56
|
id: string;
|
|
56
57
|
name: string;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
updatedAt: Date;
|
|
60
|
+
notes: string | null;
|
|
61
|
+
description: string | null;
|
|
57
62
|
code: string | null;
|
|
58
63
|
isDefault: boolean;
|
|
59
64
|
active: boolean;
|
|
60
|
-
notes: string | null;
|
|
61
|
-
metadata: Record<string, unknown> | null;
|
|
62
|
-
createdAt: Date;
|
|
63
|
-
updatedAt: Date;
|
|
64
65
|
priceCatalogId: string;
|
|
65
66
|
productId: string;
|
|
66
67
|
optionId: string;
|
|
67
68
|
cancellationPolicyId: string | null;
|
|
68
69
|
priceScheduleId: string | null;
|
|
69
|
-
description: string | null;
|
|
70
70
|
pricingMode: "per_person" | "per_booking" | "starting_from" | "free" | "on_request";
|
|
71
71
|
baseSellAmountCents: number | null;
|
|
72
72
|
baseCostAmountCents: number | null;
|
|
@@ -142,12 +142,12 @@ export declare function getOptionUnitPriceRuleById(db: PostgresJsDatabase, id: s
|
|
|
142
142
|
updatedAt: Date;
|
|
143
143
|
} | null>;
|
|
144
144
|
export declare function createOptionUnitPriceRule(db: PostgresJsDatabase, data: CreateOptionUnitPriceRuleInput): Promise<{
|
|
145
|
-
id: string;
|
|
146
|
-
active: boolean;
|
|
147
|
-
notes: string | null;
|
|
148
145
|
metadata: Record<string, unknown> | null;
|
|
146
|
+
id: string;
|
|
149
147
|
createdAt: Date;
|
|
150
148
|
updatedAt: Date;
|
|
149
|
+
notes: string | null;
|
|
150
|
+
active: boolean;
|
|
151
151
|
optionId: string;
|
|
152
152
|
unitId: string;
|
|
153
153
|
sortOrder: number;
|
|
@@ -186,7 +186,7 @@ export declare function listOptionStartTimeRules(db: PostgresJsDatabase, query:
|
|
|
186
186
|
optionPriceRuleId: string;
|
|
187
187
|
optionId: string;
|
|
188
188
|
startTimeId: string;
|
|
189
|
-
ruleMode: "
|
|
189
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
190
190
|
adjustmentType: "fixed" | "percentage" | null;
|
|
191
191
|
sellAdjustmentCents: number | null;
|
|
192
192
|
costAdjustmentCents: number | null;
|
|
@@ -205,7 +205,7 @@ export declare function getOptionStartTimeRuleById(db: PostgresJsDatabase, id: s
|
|
|
205
205
|
optionPriceRuleId: string;
|
|
206
206
|
optionId: string;
|
|
207
207
|
startTimeId: string;
|
|
208
|
-
ruleMode: "
|
|
208
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
209
209
|
adjustmentType: "fixed" | "percentage" | null;
|
|
210
210
|
sellAdjustmentCents: number | null;
|
|
211
211
|
costAdjustmentCents: number | null;
|
|
@@ -217,14 +217,14 @@ export declare function getOptionStartTimeRuleById(db: PostgresJsDatabase, id: s
|
|
|
217
217
|
} | null>;
|
|
218
218
|
export declare function createOptionStartTimeRule(db: PostgresJsDatabase, data: CreateOptionStartTimeRuleInput): Promise<{
|
|
219
219
|
id: string;
|
|
220
|
-
active: boolean;
|
|
221
|
-
notes: string | null;
|
|
222
220
|
createdAt: Date;
|
|
223
221
|
updatedAt: Date;
|
|
222
|
+
notes: string | null;
|
|
223
|
+
active: boolean;
|
|
224
224
|
optionId: string;
|
|
225
225
|
optionPriceRuleId: string;
|
|
226
226
|
startTimeId: string;
|
|
227
|
-
ruleMode: "
|
|
227
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
228
228
|
adjustmentType: "fixed" | "percentage" | null;
|
|
229
229
|
sellAdjustmentCents: number | null;
|
|
230
230
|
costAdjustmentCents: number | null;
|
|
@@ -235,7 +235,7 @@ export declare function updateOptionStartTimeRule(db: PostgresJsDatabase, id: st
|
|
|
235
235
|
optionPriceRuleId: string;
|
|
236
236
|
optionId: string;
|
|
237
237
|
startTimeId: string;
|
|
238
|
-
ruleMode: "
|
|
238
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
239
239
|
adjustmentType: "fixed" | "percentage" | null;
|
|
240
240
|
sellAdjustmentCents: number | null;
|
|
241
241
|
costAdjustmentCents: number | null;
|
|
@@ -279,9 +279,9 @@ export declare function getOptionUnitTierById(db: PostgresJsDatabase, id: string
|
|
|
279
279
|
} | null>;
|
|
280
280
|
export declare function createOptionUnitTier(db: PostgresJsDatabase, data: CreateOptionUnitTierInput): Promise<{
|
|
281
281
|
id: string;
|
|
282
|
-
active: boolean;
|
|
283
282
|
createdAt: Date;
|
|
284
283
|
updatedAt: Date;
|
|
284
|
+
active: boolean;
|
|
285
285
|
sortOrder: number;
|
|
286
286
|
sellAmountCents: number | null;
|
|
287
287
|
costAmountCents: number | null;
|
|
@@ -5,7 +5,7 @@ export declare function listCancellationPolicies(db: PostgresJsDatabase, query:
|
|
|
5
5
|
id: string;
|
|
6
6
|
code: string | null;
|
|
7
7
|
name: string;
|
|
8
|
-
policyType: "
|
|
8
|
+
policyType: "custom" | "simple" | "advanced" | "non_refundable";
|
|
9
9
|
simpleCutoffHours: number | null;
|
|
10
10
|
isDefault: boolean;
|
|
11
11
|
active: boolean;
|
|
@@ -22,7 +22,7 @@ export declare function getCancellationPolicyById(db: PostgresJsDatabase, id: st
|
|
|
22
22
|
id: string;
|
|
23
23
|
code: string | null;
|
|
24
24
|
name: string;
|
|
25
|
-
policyType: "
|
|
25
|
+
policyType: "custom" | "simple" | "advanced" | "non_refundable";
|
|
26
26
|
simpleCutoffHours: number | null;
|
|
27
27
|
isDefault: boolean;
|
|
28
28
|
active: boolean;
|
|
@@ -32,23 +32,23 @@ export declare function getCancellationPolicyById(db: PostgresJsDatabase, id: st
|
|
|
32
32
|
updatedAt: Date;
|
|
33
33
|
} | null>;
|
|
34
34
|
export declare function createCancellationPolicy(db: PostgresJsDatabase, data: CreateCancellationPolicyInput): Promise<{
|
|
35
|
+
metadata: Record<string, unknown> | null;
|
|
35
36
|
id: string;
|
|
36
37
|
name: string;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
notes: string | null;
|
|
37
41
|
code: string | null;
|
|
38
42
|
isDefault: boolean;
|
|
39
43
|
active: boolean;
|
|
40
|
-
|
|
41
|
-
metadata: Record<string, unknown> | null;
|
|
42
|
-
createdAt: Date;
|
|
43
|
-
updatedAt: Date;
|
|
44
|
-
policyType: "simple" | "advanced" | "non_refundable" | "custom";
|
|
44
|
+
policyType: "custom" | "simple" | "advanced" | "non_refundable";
|
|
45
45
|
simpleCutoffHours: number | null;
|
|
46
46
|
} | null>;
|
|
47
47
|
export declare function updateCancellationPolicy(db: PostgresJsDatabase, id: string, data: UpdateCancellationPolicyInput): Promise<{
|
|
48
48
|
id: string;
|
|
49
49
|
code: string | null;
|
|
50
50
|
name: string;
|
|
51
|
-
policyType: "
|
|
51
|
+
policyType: "custom" | "simple" | "advanced" | "non_refundable";
|
|
52
52
|
simpleCutoffHours: number | null;
|
|
53
53
|
isDefault: boolean;
|
|
54
54
|
active: boolean;
|
|
@@ -93,10 +93,10 @@ export declare function getCancellationPolicyRuleById(db: PostgresJsDatabase, id
|
|
|
93
93
|
} | null>;
|
|
94
94
|
export declare function createCancellationPolicyRule(db: PostgresJsDatabase, data: CreateCancellationPolicyRuleInput): Promise<{
|
|
95
95
|
id: string;
|
|
96
|
-
active: boolean;
|
|
97
|
-
notes: string | null;
|
|
98
96
|
createdAt: Date;
|
|
99
97
|
updatedAt: Date;
|
|
98
|
+
notes: string | null;
|
|
99
|
+
active: boolean;
|
|
100
100
|
sortOrder: number;
|
|
101
101
|
cancellationPolicyId: string;
|
|
102
102
|
cutoffMinutesBefore: number | null;
|
package/dist/service-public.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const publicPricingService: {
|
|
|
15
15
|
description: string | null;
|
|
16
16
|
status: "active" | "draft" | "archived";
|
|
17
17
|
isDefault: boolean;
|
|
18
|
-
bookingMode: "
|
|
18
|
+
bookingMode: "date" | "other" | "open" | "date_time" | "stay" | "transfer" | "itinerary";
|
|
19
19
|
capacityMode: "on_request" | "free_sale" | "limited";
|
|
20
20
|
pricingRules: {
|
|
21
21
|
id: string;
|
|
@@ -31,7 +31,7 @@ export declare const publicPricingService: {
|
|
|
31
31
|
id: string;
|
|
32
32
|
unitId: string;
|
|
33
33
|
unitName: string;
|
|
34
|
-
unitType: "
|
|
34
|
+
unitType: "service" | "other" | "group" | "room" | "vehicle" | "person";
|
|
35
35
|
pricingMode: "per_person" | "per_booking" | "free" | "on_request" | "per_unit" | "included";
|
|
36
36
|
sellAmountCents: number | null;
|
|
37
37
|
minQuantity: number | null;
|
|
@@ -51,7 +51,7 @@ export declare const publicPricingService: {
|
|
|
51
51
|
startTimeId: string;
|
|
52
52
|
label: string | null;
|
|
53
53
|
startTimeLocal: string;
|
|
54
|
-
ruleMode: "
|
|
54
|
+
ruleMode: "override" | "included" | "excluded" | "adjustment";
|
|
55
55
|
adjustmentType: "fixed" | "percentage" | null;
|
|
56
56
|
sellAdjustmentCents: number | null;
|
|
57
57
|
adjustmentBasisPoints: number | null;
|
|
@@ -35,10 +35,10 @@ export declare function getPickupPriceRuleById(db: PostgresJsDatabase, id: strin
|
|
|
35
35
|
} | null>;
|
|
36
36
|
export declare function createPickupPriceRule(db: PostgresJsDatabase, data: CreatePickupPriceRuleInput): Promise<{
|
|
37
37
|
id: string;
|
|
38
|
-
active: boolean;
|
|
39
|
-
notes: string | null;
|
|
40
38
|
createdAt: Date;
|
|
41
39
|
updatedAt: Date;
|
|
40
|
+
notes: string | null;
|
|
41
|
+
active: boolean;
|
|
42
42
|
optionId: string;
|
|
43
43
|
sortOrder: number;
|
|
44
44
|
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
@@ -103,10 +103,10 @@ export declare function getDropoffPriceRuleById(db: PostgresJsDatabase, id: stri
|
|
|
103
103
|
} | null>;
|
|
104
104
|
export declare function createDropoffPriceRule(db: PostgresJsDatabase, data: CreateDropoffPriceRuleInput): Promise<{
|
|
105
105
|
id: string;
|
|
106
|
-
active: boolean;
|
|
107
|
-
notes: string | null;
|
|
108
106
|
createdAt: Date;
|
|
109
107
|
updatedAt: Date;
|
|
108
|
+
notes: string | null;
|
|
109
|
+
active: boolean;
|
|
110
110
|
optionId: string;
|
|
111
111
|
sortOrder: number;
|
|
112
112
|
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
@@ -174,12 +174,12 @@ export declare function getExtraPriceRuleById(db: PostgresJsDatabase, id: string
|
|
|
174
174
|
updatedAt: Date;
|
|
175
175
|
} | null>;
|
|
176
176
|
export declare function createExtraPriceRule(db: PostgresJsDatabase, data: CreateExtraPriceRuleInput): Promise<{
|
|
177
|
-
id: string;
|
|
178
|
-
active: boolean;
|
|
179
|
-
notes: string | null;
|
|
180
177
|
metadata: Record<string, unknown> | null;
|
|
178
|
+
id: string;
|
|
181
179
|
createdAt: Date;
|
|
182
180
|
updatedAt: Date;
|
|
181
|
+
notes: string | null;
|
|
182
|
+
active: boolean;
|
|
183
183
|
optionId: string;
|
|
184
184
|
sortOrder: number;
|
|
185
185
|
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
@@ -34,11 +34,11 @@ export declare const publicOptionUnitPriceSchema: z.ZodObject<{
|
|
|
34
34
|
unitId: z.ZodString;
|
|
35
35
|
unitName: z.ZodString;
|
|
36
36
|
unitType: z.ZodEnum<{
|
|
37
|
+
service: "service";
|
|
38
|
+
other: "other";
|
|
37
39
|
group: "group";
|
|
38
40
|
room: "room";
|
|
39
41
|
vehicle: "vehicle";
|
|
40
|
-
service: "service";
|
|
41
|
-
other: "other";
|
|
42
42
|
person: "person";
|
|
43
43
|
}>;
|
|
44
44
|
pricingMode: z.ZodEnum<{
|
|
@@ -68,9 +68,9 @@ export declare const publicStartTimeAdjustmentSchema: z.ZodObject<{
|
|
|
68
68
|
label: z.ZodNullable<z.ZodString>;
|
|
69
69
|
startTimeLocal: z.ZodString;
|
|
70
70
|
ruleMode: z.ZodEnum<{
|
|
71
|
+
override: "override";
|
|
71
72
|
included: "included";
|
|
72
73
|
excluded: "excluded";
|
|
73
|
-
override: "override";
|
|
74
74
|
adjustment: "adjustment";
|
|
75
75
|
}>;
|
|
76
76
|
adjustmentType: z.ZodNullable<z.ZodEnum<{
|
|
@@ -101,11 +101,11 @@ export declare const publicOptionPricingRuleSchema: z.ZodObject<{
|
|
|
101
101
|
unitId: z.ZodString;
|
|
102
102
|
unitName: z.ZodString;
|
|
103
103
|
unitType: z.ZodEnum<{
|
|
104
|
+
service: "service";
|
|
105
|
+
other: "other";
|
|
104
106
|
group: "group";
|
|
105
107
|
room: "room";
|
|
106
108
|
vehicle: "vehicle";
|
|
107
|
-
service: "service";
|
|
108
|
-
other: "other";
|
|
109
109
|
person: "person";
|
|
110
110
|
}>;
|
|
111
111
|
pricingMode: z.ZodEnum<{
|
|
@@ -135,9 +135,9 @@ export declare const publicOptionPricingRuleSchema: z.ZodObject<{
|
|
|
135
135
|
label: z.ZodNullable<z.ZodString>;
|
|
136
136
|
startTimeLocal: z.ZodString;
|
|
137
137
|
ruleMode: z.ZodEnum<{
|
|
138
|
+
override: "override";
|
|
138
139
|
included: "included";
|
|
139
140
|
excluded: "excluded";
|
|
140
|
-
override: "override";
|
|
141
141
|
adjustment: "adjustment";
|
|
142
142
|
}>;
|
|
143
143
|
adjustmentType: z.ZodNullable<z.ZodEnum<{
|
|
@@ -159,8 +159,8 @@ export declare const publicPricedOptionSchema: z.ZodObject<{
|
|
|
159
159
|
}>;
|
|
160
160
|
isDefault: z.ZodBoolean;
|
|
161
161
|
bookingMode: z.ZodEnum<{
|
|
162
|
-
other: "other";
|
|
163
162
|
date: "date";
|
|
163
|
+
other: "other";
|
|
164
164
|
open: "open";
|
|
165
165
|
date_time: "date_time";
|
|
166
166
|
stay: "stay";
|
|
@@ -193,11 +193,11 @@ export declare const publicPricedOptionSchema: z.ZodObject<{
|
|
|
193
193
|
unitId: z.ZodString;
|
|
194
194
|
unitName: z.ZodString;
|
|
195
195
|
unitType: z.ZodEnum<{
|
|
196
|
+
service: "service";
|
|
197
|
+
other: "other";
|
|
196
198
|
group: "group";
|
|
197
199
|
room: "room";
|
|
198
200
|
vehicle: "vehicle";
|
|
199
|
-
service: "service";
|
|
200
|
-
other: "other";
|
|
201
201
|
person: "person";
|
|
202
202
|
}>;
|
|
203
203
|
pricingMode: z.ZodEnum<{
|
|
@@ -227,9 +227,9 @@ export declare const publicPricedOptionSchema: z.ZodObject<{
|
|
|
227
227
|
label: z.ZodNullable<z.ZodString>;
|
|
228
228
|
startTimeLocal: z.ZodString;
|
|
229
229
|
ruleMode: z.ZodEnum<{
|
|
230
|
+
override: "override";
|
|
230
231
|
included: "included";
|
|
231
232
|
excluded: "excluded";
|
|
232
|
-
override: "override";
|
|
233
233
|
adjustment: "adjustment";
|
|
234
234
|
}>;
|
|
235
235
|
adjustmentType: z.ZodNullable<z.ZodEnum<{
|
|
@@ -260,8 +260,8 @@ export declare const publicProductPricingSnapshotSchema: z.ZodObject<{
|
|
|
260
260
|
}>;
|
|
261
261
|
isDefault: z.ZodBoolean;
|
|
262
262
|
bookingMode: z.ZodEnum<{
|
|
263
|
-
other: "other";
|
|
264
263
|
date: "date";
|
|
264
|
+
other: "other";
|
|
265
265
|
open: "open";
|
|
266
266
|
date_time: "date_time";
|
|
267
267
|
stay: "stay";
|
|
@@ -294,11 +294,11 @@ export declare const publicProductPricingSnapshotSchema: z.ZodObject<{
|
|
|
294
294
|
unitId: z.ZodString;
|
|
295
295
|
unitName: z.ZodString;
|
|
296
296
|
unitType: z.ZodEnum<{
|
|
297
|
+
service: "service";
|
|
298
|
+
other: "other";
|
|
297
299
|
group: "group";
|
|
298
300
|
room: "room";
|
|
299
301
|
vehicle: "vehicle";
|
|
300
|
-
service: "service";
|
|
301
|
-
other: "other";
|
|
302
302
|
person: "person";
|
|
303
303
|
}>;
|
|
304
304
|
pricingMode: z.ZodEnum<{
|
|
@@ -328,9 +328,9 @@ export declare const publicProductPricingSnapshotSchema: z.ZodObject<{
|
|
|
328
328
|
label: z.ZodNullable<z.ZodString>;
|
|
329
329
|
startTimeLocal: z.ZodString;
|
|
330
330
|
ruleMode: z.ZodEnum<{
|
|
331
|
+
override: "override";
|
|
331
332
|
included: "included";
|
|
332
333
|
excluded: "excluded";
|
|
333
|
-
override: "override";
|
|
334
334
|
adjustment: "adjustment";
|
|
335
335
|
}>;
|
|
336
336
|
adjustmentType: z.ZodNullable<z.ZodEnum<{
|