@absolutejs/commerce 0.6.0-beta.0 → 0.8.0-beta.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/drizzle/index.d.ts +1196 -320
- package/dist/drizzle/index.js +64 -0
- package/dist/drizzle/queries.d.ts +912 -1
- package/package.json +1 -1
package/dist/drizzle/index.js
CHANGED
|
@@ -80,6 +80,27 @@ var redeemGiftCard = async (db, code, amountCents) => {
|
|
|
80
80
|
await db.update(commerceGiftCards).set({ balance_cents: balance }).where(eq(commerceGiftCards.code, card.code));
|
|
81
81
|
return { appliedCents: applied, balanceCents: balance };
|
|
82
82
|
};
|
|
83
|
+
var createGalleryItem = async (db, item) => {
|
|
84
|
+
const [created] = await db.insert(commerceGalleryItems).values(item).returning();
|
|
85
|
+
return created;
|
|
86
|
+
};
|
|
87
|
+
var listGalleryItems = (db) => db.select().from(commerceGalleryItems).orderBy(desc(commerceGalleryItems.created_at));
|
|
88
|
+
var deleteGalleryItem = async (db, id) => {
|
|
89
|
+
await db.delete(commerceGalleryItems).where(eq(commerceGalleryItems.id, id));
|
|
90
|
+
};
|
|
91
|
+
var createGroupStore = async (db, store) => {
|
|
92
|
+
const [created] = await db.insert(commerceGroupStores).values(store).returning();
|
|
93
|
+
return created;
|
|
94
|
+
};
|
|
95
|
+
var listGroupStores = (db) => db.select().from(commerceGroupStores).orderBy(desc(commerceGroupStores.created_at));
|
|
96
|
+
var getGroupStoreBySlug = async (db, slug) => {
|
|
97
|
+
const [store] = await db.select().from(commerceGroupStores).where(eq(commerceGroupStores.slug, slug)).limit(1);
|
|
98
|
+
return store ?? null;
|
|
99
|
+
};
|
|
100
|
+
var recordGroupOrder = async (db, slug, orderSessionId) => {
|
|
101
|
+
await db.insert(commerceGroupOrders).values({ group_slug: slug, order_session_id: orderSessionId });
|
|
102
|
+
};
|
|
103
|
+
var listGroupOrders = (db, slug) => db.select().from(commerceGroupOrders).where(eq(commerceGroupOrders.group_slug, slug)).orderBy(desc(commerceGroupOrders.created_at));
|
|
83
104
|
var createReturnRequest = async (db, request) => {
|
|
84
105
|
const [created] = await db.insert(commerceReturnRequests).values(request).returning();
|
|
85
106
|
return created;
|
|
@@ -194,6 +215,35 @@ var commerceGiftCards = pgTable("gift_cards", {
|
|
|
194
215
|
initial_cents: integer().notNull(),
|
|
195
216
|
recipient_email: varchar({ length: 320 })
|
|
196
217
|
});
|
|
218
|
+
var commerceGroupStores = pgTable("group_stores", {
|
|
219
|
+
active: boolean().notNull().default(true),
|
|
220
|
+
cause: varchar({ length: 160 }),
|
|
221
|
+
created_at: timestamp().notNull().defaultNow(),
|
|
222
|
+
deadline: varchar({ length: 60 }),
|
|
223
|
+
fundraise_cents: integer().notNull().default(0),
|
|
224
|
+
id: uuid().defaultRandom().primaryKey(),
|
|
225
|
+
message: text(),
|
|
226
|
+
name: varchar({ length: 160 }).notNull(),
|
|
227
|
+
organizer_email: varchar({ length: 320 }),
|
|
228
|
+
product_id: varchar({ length: 40 }).notNull(),
|
|
229
|
+
slug: varchar({ length: 80 }).notNull().unique()
|
|
230
|
+
});
|
|
231
|
+
var commerceGalleryItems = pgTable("gallery_items", {
|
|
232
|
+
created_at: timestamp().notNull().defaultNow(),
|
|
233
|
+
featured: boolean().notNull().default(false),
|
|
234
|
+
id: uuid().defaultRandom().primaryKey(),
|
|
235
|
+
image_url: varchar({ length: 600 }).notNull(),
|
|
236
|
+
method: varchar({ length: 40 }),
|
|
237
|
+
product_id: varchar({ length: 40 }),
|
|
238
|
+
tags: jsonb().$type().default([]),
|
|
239
|
+
title: varchar({ length: 160 }).notNull()
|
|
240
|
+
});
|
|
241
|
+
var commerceGroupOrders = pgTable("group_orders", {
|
|
242
|
+
created_at: timestamp().notNull().defaultNow(),
|
|
243
|
+
group_slug: varchar({ length: 80 }).notNull(),
|
|
244
|
+
id: uuid().defaultRandom().primaryKey(),
|
|
245
|
+
order_session_id: varchar({ length: 255 }).notNull()
|
|
246
|
+
});
|
|
197
247
|
var commerceFavorites = pgTable("favorites", {
|
|
198
248
|
created_at: timestamp().notNull().defaultNow(),
|
|
199
249
|
customer_email: varchar({ length: 320 }).notNull(),
|
|
@@ -237,7 +287,10 @@ var commerceDrizzleSchema = {
|
|
|
237
287
|
designs: commerceDesigns,
|
|
238
288
|
discounts: commerceDiscounts,
|
|
239
289
|
favorites: commerceFavorites,
|
|
290
|
+
galleryItems: commerceGalleryItems,
|
|
240
291
|
giftCards: commerceGiftCards,
|
|
292
|
+
groupOrders: commerceGroupOrders,
|
|
293
|
+
groupStores: commerceGroupStores,
|
|
241
294
|
orders: commerceOrders,
|
|
242
295
|
quotes: commerceQuotes,
|
|
243
296
|
returnRequests: commerceReturnRequests,
|
|
@@ -252,6 +305,7 @@ export {
|
|
|
252
305
|
setReturnStatus,
|
|
253
306
|
saveDesign,
|
|
254
307
|
redeemGiftCard,
|
|
308
|
+
recordGroupOrder,
|
|
255
309
|
recordAbandonedCart,
|
|
256
310
|
ratingSummaries,
|
|
257
311
|
markReminded,
|
|
@@ -259,23 +313,33 @@ export {
|
|
|
259
313
|
listSubscribers,
|
|
260
314
|
listSavedDesigns,
|
|
261
315
|
listReturnRequests,
|
|
316
|
+
listGroupStores,
|
|
317
|
+
listGroupOrders,
|
|
318
|
+
listGalleryItems,
|
|
262
319
|
listFavorites,
|
|
263
320
|
listApprovedReviews,
|
|
264
321
|
listAllReviews,
|
|
265
322
|
issueGiftCard,
|
|
323
|
+
getGroupStoreBySlug,
|
|
266
324
|
getGiftCard,
|
|
267
325
|
findOrderForTracking,
|
|
268
326
|
dueForReminder,
|
|
269
327
|
deleteSavedDesign,
|
|
328
|
+
deleteGalleryItem,
|
|
270
329
|
createReview,
|
|
271
330
|
createReturnRequest,
|
|
331
|
+
createGroupStore,
|
|
332
|
+
createGalleryItem,
|
|
272
333
|
commerceSubscribers,
|
|
273
334
|
commerceSavedDesigns,
|
|
274
335
|
commerceReviews,
|
|
275
336
|
commerceReturnRequests,
|
|
276
337
|
commerceQuotes,
|
|
277
338
|
commerceOrders,
|
|
339
|
+
commerceGroupStores,
|
|
340
|
+
commerceGroupOrders,
|
|
278
341
|
commerceGiftCards,
|
|
342
|
+
commerceGalleryItems,
|
|
279
343
|
commerceFavorites,
|
|
280
344
|
commerceDrizzleSchema,
|
|
281
345
|
commerceDiscounts,
|