@stacksjs/commerce 0.70.88 → 0.70.91
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/coupons/destroy.d.ts +17 -0
- package/dist/coupons/fetch.d.ts +59 -0
- package/dist/coupons/index.d.ts +27 -0
- package/dist/coupons/store.d.ts +9 -0
- package/dist/coupons/update.d.ts +46 -0
- package/dist/customers/destroy.d.ts +14 -0
- package/dist/customers/fetch.d.ts +9 -0
- package/dist/customers/index.d.ts +14 -0
- package/dist/customers/store.d.ts +9 -0
- package/dist/customers/update.d.ts +10 -0
- package/dist/devices/destroy.d.ts +14 -0
- package/dist/devices/export.d.ts +35 -0
- package/dist/devices/fetch.d.ts +38 -0
- package/dist/devices/index.d.ts +27 -0
- package/dist/devices/store.d.ts +16 -0
- package/dist/devices/update.d.ts +26 -0
- package/dist/errors/destroy.d.ts +12 -0
- package/dist/errors/fetch.d.ts +54 -0
- package/dist/errors/index.d.ts +25 -0
- package/dist/errors/update.d.ts +24 -0
- package/dist/gift-cards/destroy.d.ts +23 -0
- package/dist/gift-cards/fetch.d.ts +88 -0
- package/dist/gift-cards/index.d.ts +23 -0
- package/dist/gift-cards/store.d.ts +9 -0
- package/dist/gift-cards/update.d.ts +30 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +2 -0
- package/dist/orders/destroy.d.ts +28 -0
- package/dist/orders/events.d.ts +46 -0
- package/dist/orders/export.d.ts +32 -0
- package/dist/orders/fetch.d.ts +76 -0
- package/dist/orders/guards.d.ts +93 -0
- package/dist/orders/index.d.ts +82 -0
- package/dist/orders/place-order.d.ts +18 -0
- package/dist/orders/store.d.ts +9 -0
- package/dist/orders/totals.d.ts +24 -0
- package/dist/orders/update.d.ts +28 -0
- package/dist/orders/webhook.d.ts +31 -0
- package/dist/payments/destroy.d.ts +14 -0
- package/dist/payments/fetch.d.ts +55 -0
- package/dist/payments/index.d.ts +13 -0
- package/dist/payments/store.d.ts +9 -0
- package/dist/payments/update.d.ts +18 -0
- package/dist/products/categories/destroy.d.ts +30 -0
- package/dist/products/categories/fetch.d.ts +49 -0
- package/dist/products/categories/index.d.ts +33 -0
- package/dist/products/categories/store.d.ts +21 -0
- package/dist/products/categories/update.d.ts +33 -0
- package/dist/products/index.d.ts +24 -0
- package/dist/products/items/destroy.d.ts +14 -0
- package/dist/products/items/fetch.d.ts +66 -0
- package/dist/products/items/index.d.ts +23 -0
- package/dist/products/items/store.d.ts +16 -0
- package/dist/products/items/update.d.ts +82 -0
- package/dist/products/manufacturers/destroy.d.ts +14 -0
- package/dist/products/manufacturers/fetch.d.ts +23 -0
- package/dist/products/manufacturers/index.d.ts +21 -0
- package/dist/products/manufacturers/store.d.ts +16 -0
- package/dist/products/manufacturers/update.d.ts +26 -0
- package/dist/products/reviews/destroy.d.ts +14 -0
- package/dist/products/reviews/fetch.d.ts +22 -0
- package/dist/products/reviews/index.d.ts +22 -0
- package/dist/products/reviews/store.d.ts +16 -0
- package/dist/products/reviews/update.d.ts +19 -0
- package/dist/products/units/destroy.d.ts +14 -0
- package/dist/products/units/fetch.d.ts +9 -0
- package/dist/products/units/index.d.ts +9 -0
- package/dist/products/units/store.d.ts +31 -0
- package/dist/products/units/update.d.ts +25 -0
- package/dist/products/variants/destroy.d.ts +14 -0
- package/dist/products/variants/fetch.d.ts +9 -0
- package/dist/products/variants/index.d.ts +18 -0
- package/dist/products/variants/store.d.ts +43 -0
- package/dist/products/variants/update.d.ts +25 -0
- package/dist/receipts/destroy.d.ts +14 -0
- package/dist/receipts/fetch.d.ts +80 -0
- package/dist/receipts/index.d.ts +21 -0
- package/dist/receipts/store.d.ts +16 -0
- package/dist/receipts/update.d.ts +28 -0
- package/dist/shippings/delivery-routes/destroy.d.ts +14 -0
- package/dist/shippings/delivery-routes/fetch.d.ts +17 -0
- package/dist/shippings/delivery-routes/index.d.ts +23 -0
- package/dist/shippings/delivery-routes/store.d.ts +16 -0
- package/dist/shippings/delivery-routes/update.d.ts +27 -0
- package/dist/shippings/digital-deliveries/destroy.d.ts +28 -0
- package/dist/shippings/digital-deliveries/fetch.d.ts +9 -0
- package/dist/shippings/digital-deliveries/index.d.ts +23 -0
- package/dist/shippings/digital-deliveries/store.d.ts +16 -0
- package/dist/shippings/digital-deliveries/update.d.ts +29 -0
- package/dist/shippings/drivers/destroy.d.ts +16 -0
- package/dist/shippings/drivers/fetch.d.ts +9 -0
- package/dist/shippings/drivers/index.d.ts +21 -0
- package/dist/shippings/drivers/store.d.ts +16 -0
- package/dist/shippings/drivers/update.d.ts +26 -0
- package/dist/shippings/index.d.ts +27 -0
- package/dist/shippings/license-keys/destroy.d.ts +28 -0
- package/dist/shippings/license-keys/fetch.d.ts +9 -0
- package/dist/shippings/license-keys/index.d.ts +23 -0
- package/dist/shippings/license-keys/store.d.ts +17 -0
- package/dist/shippings/license-keys/update.d.ts +26 -0
- package/dist/shippings/shipping-methods/destroy.d.ts +28 -0
- package/dist/shippings/shipping-methods/fetch.d.ts +9 -0
- package/dist/shippings/shipping-methods/index.d.ts +25 -0
- package/dist/shippings/shipping-methods/store.d.ts +28 -0
- package/dist/shippings/shipping-methods/update.d.ts +27 -0
- package/dist/shippings/shipping-rates/destroy.d.ts +28 -0
- package/dist/shippings/shipping-rates/fetch.d.ts +98 -0
- package/dist/shippings/shipping-rates/index.d.ts +33 -0
- package/dist/shippings/shipping-rates/store.d.ts +17 -0
- package/dist/shippings/shipping-rates/update.d.ts +36 -0
- package/dist/shippings/shipping-zones/destroy.d.ts +28 -0
- package/dist/shippings/shipping-zones/fetch.d.ts +28 -0
- package/dist/shippings/shipping-zones/index.d.ts +23 -0
- package/dist/shippings/shipping-zones/store.d.ts +17 -0
- package/dist/shippings/shipping-zones/update.d.ts +35 -0
- package/dist/tax/destroy.d.ts +14 -0
- package/dist/tax/fetch.d.ts +9 -0
- package/dist/tax/index.d.ts +21 -0
- package/dist/tax/store.d.ts +16 -0
- package/dist/tax/update.d.ts +26 -0
- package/dist/types.d.ts +265 -0
- package/dist/utils/typed-stats.d.ts +23 -0
- package/dist/waitlists/index.d.ts +12 -0
- package/dist/waitlists/products/destroy.d.ts +15 -0
- package/dist/waitlists/products/fetch.d.ts +100 -0
- package/dist/waitlists/products/index.d.ts +30 -0
- package/dist/waitlists/products/store.d.ts +16 -0
- package/dist/waitlists/products/update.d.ts +26 -0
- package/dist/waitlists/restaurant/destroy.d.ts +15 -0
- package/dist/waitlists/restaurant/fetch.d.ts +149 -0
- package/dist/waitlists/restaurant/index.d.ts +40 -0
- package/dist/waitlists/restaurant/store.d.ts +16 -0
- package/dist/waitlists/restaurant/update.d.ts +43 -0
- package/package.json +1 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// Define the input for creating a customer
|
|
2
|
+
export declare interface CreateCustomerInput {
|
|
3
|
+
name: string
|
|
4
|
+
email: string
|
|
5
|
+
phone: string
|
|
6
|
+
orders?: number
|
|
7
|
+
total_spent?: number
|
|
8
|
+
last_order?: string
|
|
9
|
+
status?: string
|
|
10
|
+
avatar?: string
|
|
11
|
+
user_id?: number
|
|
12
|
+
}
|
|
13
|
+
// Define the input for updating a customer
|
|
14
|
+
export declare interface UpdateCustomerInput {
|
|
15
|
+
name?: string
|
|
16
|
+
email?: string
|
|
17
|
+
phone?: string
|
|
18
|
+
orders?: number
|
|
19
|
+
total_spent?: number
|
|
20
|
+
last_order?: string
|
|
21
|
+
status?: string
|
|
22
|
+
avatar?: string
|
|
23
|
+
user_id?: number
|
|
24
|
+
}
|
|
25
|
+
// Define the structure of an order item
|
|
26
|
+
export declare interface OrderItem {
|
|
27
|
+
product_id: string
|
|
28
|
+
quantity: number
|
|
29
|
+
price: number
|
|
30
|
+
special_instructions?: string
|
|
31
|
+
}
|
|
32
|
+
// Type for status count
|
|
33
|
+
export declare interface StatusCount {
|
|
34
|
+
status: string
|
|
35
|
+
count: number | string
|
|
36
|
+
}
|
|
37
|
+
// Type for order type count
|
|
38
|
+
export declare interface OrderTypeCount {
|
|
39
|
+
order_type: string
|
|
40
|
+
count: number | string
|
|
41
|
+
}
|
|
42
|
+
// Type for the stats return value
|
|
43
|
+
export declare interface OrderStats {
|
|
44
|
+
total: number
|
|
45
|
+
by_status: StatusCount[]
|
|
46
|
+
by_type: OrderTypeCount[]
|
|
47
|
+
recent: OrderJsonResponse[]
|
|
48
|
+
revenue: number
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Represents a simplified order item structure with required properties for total calculation
|
|
52
|
+
*/
|
|
53
|
+
export declare interface OrderItemForCalculation {
|
|
54
|
+
price: number
|
|
55
|
+
quantity: number
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Represents the totals calculated for an order
|
|
59
|
+
*/
|
|
60
|
+
export declare interface OrderTotals {
|
|
61
|
+
subtotal: number
|
|
62
|
+
tax_amount: number
|
|
63
|
+
total_amount: number
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents statistics for a discount type
|
|
67
|
+
*/
|
|
68
|
+
export declare interface DiscountTypeCount {
|
|
69
|
+
discount_type: string | undefined
|
|
70
|
+
count: string | number | bigint
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents comprehensive coupon statistics
|
|
74
|
+
*/
|
|
75
|
+
export declare interface CouponStats {
|
|
76
|
+
total: number
|
|
77
|
+
active: number
|
|
78
|
+
by_type: DiscountTypeCount[]
|
|
79
|
+
most_used: {
|
|
80
|
+
id: number | undefined
|
|
81
|
+
code: string | undefined
|
|
82
|
+
discount_type: string | undefined
|
|
83
|
+
discount_value: number | undefined
|
|
84
|
+
usage_count: number | undefined
|
|
85
|
+
}[]
|
|
86
|
+
upcoming: {
|
|
87
|
+
id: number | undefined
|
|
88
|
+
code: string | undefined
|
|
89
|
+
discount_type: string | undefined
|
|
90
|
+
discount_value: number | undefined
|
|
91
|
+
start_date: Date | string
|
|
92
|
+
end_date: Date | string
|
|
93
|
+
}[]
|
|
94
|
+
}
|
|
95
|
+
export declare interface OrderWithTotals {
|
|
96
|
+
order_items: OrderItemJsonResponse[] | []
|
|
97
|
+
id: number
|
|
98
|
+
customer_id: number
|
|
99
|
+
customer: CustomerJsonResponse | undefined
|
|
100
|
+
coupon_id: number
|
|
101
|
+
coupon: CouponJsonResponse | undefined
|
|
102
|
+
status: string
|
|
103
|
+
total_amount: number
|
|
104
|
+
tax_amount: number | undefined
|
|
105
|
+
discount_amount: number | undefined
|
|
106
|
+
delivery_fee: number | undefined
|
|
107
|
+
tip_amount: number | undefined
|
|
108
|
+
order_type: string
|
|
109
|
+
delivery_address: string | undefined
|
|
110
|
+
special_instructions: string | undefined
|
|
111
|
+
estimated_delivery_time: string | undefined
|
|
112
|
+
applied_coupon_id: string | undefined
|
|
113
|
+
uuid: string | undefined
|
|
114
|
+
created_at: Date | undefined
|
|
115
|
+
updated_at: Date | undefined
|
|
116
|
+
customer_name: string | null
|
|
117
|
+
customer_email: string | null
|
|
118
|
+
totalItems: number
|
|
119
|
+
totalPrice: number
|
|
120
|
+
}
|
|
121
|
+
export declare interface FetchGiftCardsOptions {
|
|
122
|
+
page?: number
|
|
123
|
+
limit?: number
|
|
124
|
+
search?: string
|
|
125
|
+
status?: string
|
|
126
|
+
is_active?: boolean
|
|
127
|
+
is_digital?: boolean
|
|
128
|
+
is_reloadable?: boolean
|
|
129
|
+
sortBy?: string
|
|
130
|
+
sortOrder?: 'asc' | 'desc'
|
|
131
|
+
purchaser_id?: string
|
|
132
|
+
from_date?: string
|
|
133
|
+
to_date?: string
|
|
134
|
+
min_balance?: number
|
|
135
|
+
max_balance?: number
|
|
136
|
+
}
|
|
137
|
+
declare interface BaseResponse {
|
|
138
|
+
paging: {
|
|
139
|
+
total_records: number
|
|
140
|
+
page: number
|
|
141
|
+
total_pages: number
|
|
142
|
+
}
|
|
143
|
+
next_cursor: number | null
|
|
144
|
+
}
|
|
145
|
+
export declare interface GiftCardResponse extends BaseResponse {
|
|
146
|
+
data: GiftCardJsonResponse[]
|
|
147
|
+
}
|
|
148
|
+
export declare interface GiftCardStats {
|
|
149
|
+
total: number
|
|
150
|
+
active: number
|
|
151
|
+
by_status: Array<{ status: string, count: number }>
|
|
152
|
+
by_balance: {
|
|
153
|
+
low: number
|
|
154
|
+
medium: number
|
|
155
|
+
high: number
|
|
156
|
+
}
|
|
157
|
+
expiring_soon: GiftCardJsonResponse[]
|
|
158
|
+
recently_used: GiftCardJsonResponse[]
|
|
159
|
+
}
|
|
160
|
+
export declare interface FetchReviewsOptions {
|
|
161
|
+
page?: number
|
|
162
|
+
limit?: number
|
|
163
|
+
}
|
|
164
|
+
export declare interface ReviewResponse extends BaseResponse {
|
|
165
|
+
data: ReviewJsonResponse[]
|
|
166
|
+
}
|
|
167
|
+
export declare interface ManufacturerResponse extends BaseResponse {
|
|
168
|
+
data: ManufacturerJsonResponse[]
|
|
169
|
+
}
|
|
170
|
+
export declare interface ReviewStats {
|
|
171
|
+
total: number
|
|
172
|
+
average_rating: number
|
|
173
|
+
rating_distribution: {
|
|
174
|
+
one_star: number
|
|
175
|
+
two_star: number
|
|
176
|
+
three_star: number
|
|
177
|
+
four_star: number
|
|
178
|
+
five_star: number
|
|
179
|
+
}
|
|
180
|
+
recent_reviews: ReviewJsonResponse[]
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Represents comprehensive category statistics
|
|
184
|
+
*/
|
|
185
|
+
export declare interface CategoryStats {
|
|
186
|
+
total: number
|
|
187
|
+
active: number
|
|
188
|
+
root_categories: number
|
|
189
|
+
child_categories: number
|
|
190
|
+
with_images: number
|
|
191
|
+
recently_added: Array<any>
|
|
192
|
+
top_parent_categories: Array<{
|
|
193
|
+
id: string
|
|
194
|
+
name: string
|
|
195
|
+
child_count: number
|
|
196
|
+
}>
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Options for fetching product manufacturers
|
|
200
|
+
*/
|
|
201
|
+
export declare interface FetchManufacturersOptions {
|
|
202
|
+
country?: string
|
|
203
|
+
featured?: boolean
|
|
204
|
+
search?: string
|
|
205
|
+
}
|
|
206
|
+
export declare interface FetchCouponsOptions {
|
|
207
|
+
page?: number
|
|
208
|
+
limit?: number
|
|
209
|
+
search?: string
|
|
210
|
+
is_active?: boolean
|
|
211
|
+
discount_type?: string
|
|
212
|
+
sortBy?: string
|
|
213
|
+
sortOrder?: 'asc' | 'desc'
|
|
214
|
+
product_id?: string
|
|
215
|
+
category_id?: string
|
|
216
|
+
from_date?: string
|
|
217
|
+
to_date?: string
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Interface for coupon count statistics
|
|
221
|
+
*/
|
|
222
|
+
export declare interface CouponCountStats {
|
|
223
|
+
total: number
|
|
224
|
+
active: number
|
|
225
|
+
inactive: number
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Interface for time-based coupon statistics
|
|
229
|
+
*/
|
|
230
|
+
export declare interface CouponTimeStats {
|
|
231
|
+
week: CouponCountStats
|
|
232
|
+
month: CouponCountStats
|
|
233
|
+
year: CouponCountStats
|
|
234
|
+
all_time: CouponCountStats
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Interface for coupon redemption statistics
|
|
238
|
+
*/
|
|
239
|
+
export declare interface CouponRedemptionStats {
|
|
240
|
+
total: number
|
|
241
|
+
week: number
|
|
242
|
+
month: number
|
|
243
|
+
year: number
|
|
244
|
+
by_type: Record<string, number>
|
|
245
|
+
}
|
|
246
|
+
export declare interface FetchOrdersOptions {
|
|
247
|
+
page?: number
|
|
248
|
+
limit?: number
|
|
249
|
+
search?: string
|
|
250
|
+
status?: string
|
|
251
|
+
order_type?: string
|
|
252
|
+
customer_id?: number
|
|
253
|
+
sortBy?: string
|
|
254
|
+
sortOrder?: 'asc' | 'desc'
|
|
255
|
+
from_date?: string
|
|
256
|
+
to_date?: string
|
|
257
|
+
}
|
|
258
|
+
// Import the CustomerTable type from the ORM
|
|
259
|
+
declare type CouponJsonResponse = ModelRow<typeof Coupon>;
|
|
260
|
+
declare type CustomerJsonResponse = ModelRow<typeof Customer>;
|
|
261
|
+
declare type GiftCardJsonResponse = ModelRow<typeof GiftCard>;
|
|
262
|
+
declare type ManufacturerJsonResponse = ModelRow<typeof Manufacturer>;
|
|
263
|
+
declare type OrderJsonResponse = ModelRow<typeof Order>;
|
|
264
|
+
declare type OrderItemJsonResponse = ModelRow<typeof OrderItem>;
|
|
265
|
+
declare type ReviewJsonResponse = ModelRow<typeof Review>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a typed aggregate query against a table.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const stats = await aggregateStats('receipts', {
|
|
7
|
+
* total: { kind: 'count' },
|
|
8
|
+
* success: { kind: 'count', filter: { column: 'status', op: '=', value: 'success' } },
|
|
9
|
+
* averageSize: { kind: 'avg', column: 'size' },
|
|
10
|
+
* }, qb => qb.where('timestamp', '>=', start).where('timestamp', '<=', end))
|
|
11
|
+
* // typeof stats: { total: number; success: number; averageSize: number }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function aggregateStats<TKeys extends string>(table: string, descriptors: Record<TKeys, StatsDescriptor>, applyWhere?: (qb: any) => any): Promise<Record<TKeys, number>>;
|
|
15
|
+
/**
|
|
16
|
+
* Stats descriptors map: each key is the result-row alias; each value is
|
|
17
|
+
* a `{ kind, column, where? }` triple describing the aggregate to emit.
|
|
18
|
+
*/
|
|
19
|
+
export type StatsDescriptor = | { kind: 'count', column?: string, filter?: { column: string, op: string, value: unknown } }
|
|
20
|
+
| { kind: 'sum', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
21
|
+
| { kind: 'avg', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
22
|
+
| { kind: 'min', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
23
|
+
| { kind: 'max', column: string, filter?: { column: string, op: string, value: unknown } }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as products from './products/index';
|
|
2
|
+
import * as restaurant from './restaurant/index';
|
|
3
|
+
declare const waitlists: WaitlistsNamespace;
|
|
4
|
+
declare interface WaitlistsNamespace {
|
|
5
|
+
products: typeof products
|
|
6
|
+
restaurant: typeof restaurant
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
products,
|
|
10
|
+
restaurant,
|
|
11
|
+
};
|
|
12
|
+
export default waitlists;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a waitlist product entry by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the waitlist product to delete
|
|
5
|
+
* @returns The deleted waitlist product record
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<WaitlistProductJsonResponse | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple waitlist product entries by their IDs
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of waitlist product IDs to delete
|
|
12
|
+
* @returns Number of waitlist products deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
15
|
+
declare type WaitlistProductJsonResponse = ModelRow<typeof WaitlistProduct>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a waitlist product by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<WaitlistProductJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all waitlist products
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<WaitlistProductJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the count of waitlist products grouped by source
|
|
11
|
+
* @param startDate Optional start date to filter by
|
|
12
|
+
* @param endDate Optional end date to filter by
|
|
13
|
+
* @returns An object containing the count for each source
|
|
14
|
+
*/
|
|
15
|
+
export declare function fetchCountBySource(startDate?: Date, _endDate?: Date): Promise<Record<string, number>>;
|
|
16
|
+
/**
|
|
17
|
+
* Fetch the count of waitlist products for a specific date
|
|
18
|
+
* @param date The date to count entries for (defaults to today)
|
|
19
|
+
* @returns The count of entries for the specified date
|
|
20
|
+
*/
|
|
21
|
+
export declare function fetchCountByDate(date?: Date): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch the count of waitlist products with a specific quantity
|
|
24
|
+
* @param quantity The quantity to count orders for
|
|
25
|
+
* @returns The count of orders with the specified quantity
|
|
26
|
+
*/
|
|
27
|
+
export declare function fetchCountByQuantity(quantity: number): Promise<number>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetch the count of waitlist products grouped by quantity
|
|
30
|
+
* @param startDate Optional start date to filter by
|
|
31
|
+
* @param endDate Optional end date to filter by
|
|
32
|
+
* @returns An object containing the count for each quantity
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchCountByAllQuantities(startDate?: Date, _endDate?: Date): Promise<Record<number, number>>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch waitlist products between two dates
|
|
37
|
+
* @param startDate The start date of the range
|
|
38
|
+
* @param endDate The end date of the range
|
|
39
|
+
* @returns Array of waitlist products within the date range
|
|
40
|
+
*/
|
|
41
|
+
export declare function fetchBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Fetch waitlist products that were notified between two dates
|
|
44
|
+
* @param startDate The start date of the range
|
|
45
|
+
* @param endDate The end date of the range
|
|
46
|
+
* @returns Array of waitlist products that were notified within the date range
|
|
47
|
+
*/
|
|
48
|
+
export declare function fetchNotifiedBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Fetch waitlist products that were purchased between two dates
|
|
51
|
+
* @param startDate The start date of the range
|
|
52
|
+
* @param endDate The end date of the range
|
|
53
|
+
* @returns Array of waitlist products that were purchased within the date range
|
|
54
|
+
*/
|
|
55
|
+
export declare function fetchPurchasedBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Fetch waitlist products that were cancelled between two dates
|
|
58
|
+
* @param startDate The start date of the range
|
|
59
|
+
* @param endDate The end date of the range
|
|
60
|
+
* @returns Array of waitlist products that were cancelled within the date range
|
|
61
|
+
*/
|
|
62
|
+
export declare function fetchCancelledBetweenDates(startDate: Date, endDate: Date): Promise<WaitlistProductJsonResponse[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Fetch all waitlist products with waiting status
|
|
65
|
+
* @returns Array of waitlist products with waiting status
|
|
66
|
+
*/
|
|
67
|
+
export declare function fetchWaiting(): Promise<WaitlistProductJsonResponse[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Fetch the count of waitlist products by status
|
|
70
|
+
* @param status The status to filter by
|
|
71
|
+
* @param startDate Optional start date to filter by
|
|
72
|
+
* @param endDate Optional end date to filter by
|
|
73
|
+
* @returns The count of waitlist products with the specified status
|
|
74
|
+
*/
|
|
75
|
+
export declare function fetchCountByStatus(status: string, startDate?: Date, _endDate?: Date): Promise<number>;
|
|
76
|
+
/**
|
|
77
|
+
* Fetch conversion rates for waitlist products
|
|
78
|
+
* @param startDate Optional start date to filter by
|
|
79
|
+
* @param endDate Optional end date to filter by
|
|
80
|
+
* @returns Object containing total conversion rate and breakdown by status
|
|
81
|
+
*/
|
|
82
|
+
export declare function fetchConversionRates(_startDate?: Date, _endDate?: Date): Promise<{
|
|
83
|
+
totalConversionRate: number
|
|
84
|
+
statusBreakdown: Record<string, { count: number, percentage: number }>
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Fetch the count of waitlist products between two dates
|
|
88
|
+
* @param startDate The start date of the range
|
|
89
|
+
* @param endDate The end date of the range
|
|
90
|
+
* @returns The count of waitlist products within the date range
|
|
91
|
+
*/
|
|
92
|
+
export declare function fetchCountBetweenDates(startDate: Date, endDate: Date): Promise<number>;
|
|
93
|
+
/**
|
|
94
|
+
* Fetch the count of waitlist products grouped by date
|
|
95
|
+
* @param startDate Optional start date to filter by
|
|
96
|
+
* @param endDate Optional end date to filter by
|
|
97
|
+
* @returns An array of objects containing date and count
|
|
98
|
+
*/
|
|
99
|
+
export declare function fetchCountByDateGrouped(startDate?: Date, _endDate?: Date): Promise<{ date: string, count: number }[]>;
|
|
100
|
+
declare type WaitlistProductJsonResponse = ModelRow<typeof WaitlistProduct>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Functions from destroy.ts
|
|
2
|
+
export {
|
|
3
|
+
bulkDestroy,
|
|
4
|
+
destroy,
|
|
5
|
+
} from './destroy';
|
|
6
|
+
export {
|
|
7
|
+
fetchAll,
|
|
8
|
+
fetchById,
|
|
9
|
+
fetchCancelledBetweenDates,
|
|
10
|
+
fetchConversionRates,
|
|
11
|
+
fetchCountBetweenDates,
|
|
12
|
+
fetchCountByAllQuantities,
|
|
13
|
+
fetchCountByDate,
|
|
14
|
+
fetchCountByDateGrouped,
|
|
15
|
+
fetchCountByQuantity,
|
|
16
|
+
fetchCountBySource,
|
|
17
|
+
fetchCountByStatus,
|
|
18
|
+
fetchNotifiedBetweenDates,
|
|
19
|
+
fetchPurchasedBetweenDates,
|
|
20
|
+
fetchWaiting,
|
|
21
|
+
} from './fetch';
|
|
22
|
+
export {
|
|
23
|
+
bulkStore,
|
|
24
|
+
store,
|
|
25
|
+
} from './store';
|
|
26
|
+
export {
|
|
27
|
+
update,
|
|
28
|
+
updatePartySize,
|
|
29
|
+
updateStatus,
|
|
30
|
+
} from './update';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new waitlist product entry
|
|
3
|
+
*
|
|
4
|
+
* @param data Waitlist product data to store
|
|
5
|
+
* @returns The newly created waitlist product record
|
|
6
|
+
*/
|
|
7
|
+
export declare function store(data: NewWaitlistProduct): Promise<WaitlistProductJsonResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* Create multiple waitlist product entries at once
|
|
10
|
+
*
|
|
11
|
+
* @param data Array of waitlist product data to store
|
|
12
|
+
* @returns Number of waitlist products created
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkStore(data: NewWaitlistProduct[]): Promise<number>;
|
|
15
|
+
declare type WaitlistProductJsonResponse = ModelRow<typeof WaitlistProduct>;
|
|
16
|
+
declare type NewWaitlistProduct = NewModelData<typeof WaitlistProduct>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update a waitlist product
|
|
3
|
+
*
|
|
4
|
+
* @param id The id of the waitlist product to update
|
|
5
|
+
* @param data The waitlist product data to update
|
|
6
|
+
* @returns The updated waitlist product record
|
|
7
|
+
*/
|
|
8
|
+
export declare function update(id: number, data: WaitlistProductUpdate): Promise<WaitlistProductJsonResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Update a waitlist product's status
|
|
11
|
+
*
|
|
12
|
+
* @param id The ID of the waitlist product
|
|
13
|
+
* @param status The new status
|
|
14
|
+
* @returns The updated waitlist product with the new status
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateStatus(id: number, status: 'waiting' | 'purchased' | 'notified' | 'cancelled'): Promise<WaitlistProductJsonResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update party size for a waitlist product
|
|
19
|
+
*
|
|
20
|
+
* @param id The ID of the waitlist product
|
|
21
|
+
* @param partySize The updated party size
|
|
22
|
+
* @returns The updated waitlist product
|
|
23
|
+
*/
|
|
24
|
+
export declare function updatePartySize(id: number, partySize: number): Promise<WaitlistProductJsonResponse>;
|
|
25
|
+
declare type WaitlistProductJsonResponse = ModelRow<typeof WaitlistProduct>;
|
|
26
|
+
declare type WaitlistProductUpdate = UpdateModelData<typeof WaitlistProduct>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a restaurant waitlist entry by ID
|
|
3
|
+
*
|
|
4
|
+
* @param id The ID of the restaurant waitlist entry to delete
|
|
5
|
+
* @returns The deleted restaurant waitlist record
|
|
6
|
+
*/
|
|
7
|
+
export declare function destroy(id: number): Promise<WaitlistRestaurantJsonResponse | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Delete multiple restaurant waitlist entries by their IDs
|
|
10
|
+
*
|
|
11
|
+
* @param ids Array of restaurant waitlist entry IDs to delete
|
|
12
|
+
* @returns Number of restaurant waitlist entries deleted
|
|
13
|
+
*/
|
|
14
|
+
export declare function bulkDestroy(ids: number[]): Promise<number>;
|
|
15
|
+
declare type WaitlistRestaurantJsonResponse = ModelRow<typeof WaitlistRestaurant>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch a restaurant waitlist entry by ID
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchById(id: number): Promise<WaitlistRestaurantJsonResponse | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Fetch all restaurant waitlist entries
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchAll(): Promise<WaitlistRestaurantJsonResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the count of restaurant waitlist entries grouped by table preference
|
|
11
|
+
* @returns An object containing the count for each table preference
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchCountByTablePreference(): Promise<Record<string, number>>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch the count of restaurant waitlist entries for a specific date
|
|
16
|
+
* @param date The date to count entries for (defaults to today)
|
|
17
|
+
* @returns The count of entries for the specified date
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchCountByDate(date?: Date): Promise<number>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the count of restaurant waitlist entries with a specific party size
|
|
22
|
+
* @param partySize The party size to count entries for
|
|
23
|
+
* @returns The count of entries with the specified party size
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchCountByPartySize(partySize: number): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch the count of restaurant waitlist entries grouped by party size
|
|
28
|
+
* @returns An object containing the count for each party size
|
|
29
|
+
*/
|
|
30
|
+
export declare function fetchCountByAllPartySizes(): Promise<Record<number, number>>;
|
|
31
|
+
/**
|
|
32
|
+
* Fetch restaurant waitlist entries between two dates
|
|
33
|
+
* @param startDate The start date of the range
|
|
34
|
+
* @param endDate The end date of the range
|
|
35
|
+
* @returns Array of waitlist entries within the date range
|
|
36
|
+
*/
|
|
37
|
+
export declare function fetchBetweenDates(startDate: Date, _endDate: Date): Promise<WaitlistRestaurantJsonResponse[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Fetch restaurant waitlist entries that were seated between two dates
|
|
40
|
+
* @param startDate The start date of the range
|
|
41
|
+
* @param endDate The end date of the range
|
|
42
|
+
* @returns Array of waitlist entries that were seated within the date range
|
|
43
|
+
*/
|
|
44
|
+
export declare function fetchSeatedBetweenDates(startDate: Date, _endDate: Date): Promise<WaitlistRestaurantJsonResponse[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetch all restaurant waitlist entries with waiting status
|
|
47
|
+
* @returns Array of waitlist entries with waiting status
|
|
48
|
+
*/
|
|
49
|
+
export declare function fetchWaiting(): Promise<WaitlistRestaurantJsonResponse[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetch conversion rates for restaurant waitlist entries
|
|
52
|
+
* @returns Object containing total conversion rate and breakdown by status
|
|
53
|
+
*/
|
|
54
|
+
export declare function fetchConversionRates(): Promise<{
|
|
55
|
+
totalConversionRate: number
|
|
56
|
+
statusBreakdown: Record<string, { count: number, percentage: number }>
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Fetch average wait times for restaurant waitlist entries
|
|
60
|
+
* @returns Object containing average quoted and actual wait times
|
|
61
|
+
*/
|
|
62
|
+
export declare function fetchAverageWaitTimes(): Promise<{
|
|
63
|
+
averageQuotedWaitTime: number
|
|
64
|
+
averageActualWaitTime: number
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Fetch all waiting entries with their quoted wait times
|
|
68
|
+
* @returns Array of waiting entries with their quoted wait times
|
|
69
|
+
*/
|
|
70
|
+
export declare function fetchWaitingWithQuotedTimes(): Promise<{
|
|
71
|
+
entries: WaitlistRestaurantJsonResponse[]
|
|
72
|
+
totalQuotedWaitTime: number
|
|
73
|
+
averageQuotedWaitTime: number
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Fetch all waiting entries with party size calculations
|
|
77
|
+
* @returns Object containing waiting entries and party size statistics
|
|
78
|
+
*/
|
|
79
|
+
export declare function fetchWaitingWithPartySizes(): Promise<{
|
|
80
|
+
entries: WaitlistRestaurantJsonResponse[]
|
|
81
|
+
totalPartySize: number
|
|
82
|
+
averagePartySize: number
|
|
83
|
+
partySizeBreakdown: Record<number, number>
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Fetch tables turned statistics for today
|
|
87
|
+
* @returns Object containing tables turned statistics
|
|
88
|
+
*/
|
|
89
|
+
export declare function fetchTablesTurnedToday(): Promise<{
|
|
90
|
+
totalTablesTurned: number
|
|
91
|
+
averagePartySize: number
|
|
92
|
+
totalCustomersSeated: number
|
|
93
|
+
breakdownByTablePreference: Record<string, number>
|
|
94
|
+
breakdownByPartySize: Record<number, number>
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch seating rate statistics
|
|
98
|
+
* @param startDate Start date for filtering entries
|
|
99
|
+
* @param endDate End date for filtering entries
|
|
100
|
+
* @returns Object containing seating rate and status breakdown
|
|
101
|
+
*/
|
|
102
|
+
export declare function fetchSeatingRate(_startDate: Date, _endDate: Date): Promise<{
|
|
103
|
+
totalEntries: number
|
|
104
|
+
seatedEntries: number
|
|
105
|
+
seatingRate: number
|
|
106
|
+
statusBreakdown: Record<string, { count: number, percentage: number }>
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch no-show statistics
|
|
110
|
+
* @param startDate Start date for filtering entries
|
|
111
|
+
* @param endDate End date for filtering entries
|
|
112
|
+
* @returns Object containing no-show statistics and related information
|
|
113
|
+
*/
|
|
114
|
+
export declare function fetchNoShowStats(_startDate: Date, _endDate: Date): Promise<{
|
|
115
|
+
totalNoShows: number
|
|
116
|
+
noShowRate: number
|
|
117
|
+
averageQuotedWaitTime: number
|
|
118
|
+
averagePartySize: number
|
|
119
|
+
breakdownByTablePreference: Record<string, number>
|
|
120
|
+
breakdownByPartySize: Record<number, number>
|
|
121
|
+
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Fetch current wait time statistics
|
|
124
|
+
* @returns Object containing average quoted and actual wait times
|
|
125
|
+
*/
|
|
126
|
+
export declare function fetchCurrentWaitTimes(): Promise<{
|
|
127
|
+
averageQuoted: number
|
|
128
|
+
averageActual: number
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* Fetch seated statistics for the last 24 hours
|
|
132
|
+
* @returns Object containing total seated count and hourly breakdown
|
|
133
|
+
*/
|
|
134
|
+
export declare function fetchSeatedStats(): Promise<{
|
|
135
|
+
total: number
|
|
136
|
+
byHour: Array<{ hour: number, count: number }>
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Fetch time series statistics for all statuses
|
|
140
|
+
* @returns Object containing daily counts for each status
|
|
141
|
+
*/
|
|
142
|
+
export declare function fetchTimeSeriesStats(): Promise<Record<string, {
|
|
143
|
+
total: number
|
|
144
|
+
waiting: number
|
|
145
|
+
seated: number
|
|
146
|
+
cancelled: number
|
|
147
|
+
no_show: number
|
|
148
|
+
}>>;
|
|
149
|
+
declare type WaitlistRestaurantJsonResponse = ModelRow<typeof WaitlistRestaurant>;
|