@coursebuilder/adapter-drizzle 0.1.2 → 0.1.3
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/{chunk-ISURSRBK.js → chunk-3LWFRGZT.js} +519 -313
- package/dist/{chunk-RVYJDDZD.js → chunk-NXFHRDLS.js} +2 -2
- package/dist/{chunk-44VDBYFU.js → chunk-QK6CINAJ.js} +3 -3
- package/dist/{chunk-MYRB6GLJ.js → chunk-ULABK6XG.js} +2 -2
- package/dist/{chunk-DHYYRN35.js → chunk-XSXWLOIN.js} +4624 -448
- package/dist/{chunk-QZOBGJSV.js → chunk-XXZQBN6S.js} +2 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +11 -27
- package/dist/lib/mysql/index.cjs +880 -721
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.ts +212 -10
- package/dist/lib/mysql/index.js +11 -14
- package/dist/lib/mysql/schemas/auth/accounts.cjs +73 -57
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.js +5 -4
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +64 -48
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.js +6 -5
- package/dist/lib/mysql/schemas/auth/roles.cjs +64 -48
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.js +5 -4
- package/dist/lib/mysql/schemas/auth/sessions.cjs +64 -48
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.js +6 -5
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +65 -49
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -4
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +67 -51
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.js +5 -4
- package/dist/lib/mysql/schemas/auth/users.cjs +170 -154
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.js +5 -4
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +4 -4
- package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/price.cjs +189 -11
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.ts +6 -1
- package/dist/lib/mysql/schemas/commerce/price.js +14 -3
- package/dist/lib/mysql/schemas/commerce/product.cjs +227 -9
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.ts +8 -2
- package/dist/lib/mysql/schemas/commerce/product.js +12 -1
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +140 -122
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.js +5 -4
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +107 -24
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -2
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +84 -68
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -4
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +92 -76
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.js +5 -4
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +243 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +101 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.js +19 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +67 -51
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -4
- package/dist/lib/mysql/schemas/content/content-resource.cjs +116 -62
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +1 -0
- package/dist/lib/mysql/schemas/content/content-resource.js +5 -4
- package/dist/lib/utils.cjs.map +1 -1
- package/dist/lib/utils.d.ts +3 -7
- package/dist/lib/utils.js +12 -3
- package/dist/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +0 -8
- package/src/lib/mysql/index.ts +154 -23
- package/src/lib/mysql/schemas/auth/user-roles.ts +2 -2
- package/src/lib/mysql/schemas/commerce/coupon.ts +2 -2
- package/src/lib/mysql/schemas/commerce/price.ts +22 -1
- package/src/lib/mysql/schemas/commerce/product.ts +26 -2
- package/src/lib/mysql/schemas/content/content-resource-product.ts +62 -0
- package/src/lib/mysql/schemas/content/content-resource.ts +5 -0
- package/src/lib/utils.ts +1 -9
- package/dist/chunk-7LAAAEVE.js +0 -379
- package/dist/chunk-AFQGYW7Z.js +0 -45
- package/dist/chunk-CPE4P26C.js +0 -42
- package/dist/chunk-GFUUJRX7.js +0 -18
- package/dist/chunk-O2KKII62.js +0 -381
- package/dist/chunk-Y34AIPU7.js +0 -4137
- package/dist/lib/pg.cjs +0 -4527
- package/dist/lib/pg.cjs.map +0 -1
- package/dist/lib/pg.d.ts +0 -496
- package/dist/lib/pg.js +0 -11
- package/dist/lib/sqlite.cjs +0 -4536
- package/dist/lib/sqlite.cjs.map +0 -1
- package/dist/lib/sqlite.d.ts +0 -496
- package/dist/lib/sqlite.js +0 -12
- package/dist/lib/sqlite.js.map +0 -1
- package/src/lib/pg.ts +0 -579
- package/src/lib/sqlite.ts +0 -562
- /package/dist/lib/{pg.js.map → mysql/schemas/content/content-resource-product.js.map} +0 -0
package/dist/lib/mysql/index.cjs
CHANGED
|
@@ -27,8 +27,8 @@ __export(mysql_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(mysql_exports);
|
|
29
29
|
var import_date_fns = require("date-fns");
|
|
30
|
-
var
|
|
31
|
-
var
|
|
30
|
+
var import_drizzle_orm27 = require("drizzle-orm");
|
|
31
|
+
var import_mysql_core32 = require("drizzle-orm/mysql-core");
|
|
32
32
|
var import_uuid = require("uuid");
|
|
33
33
|
|
|
34
34
|
// ../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
|
|
@@ -185,8 +185,8 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
185
185
|
"not_finite"
|
|
186
186
|
]);
|
|
187
187
|
var quotelessJson = /* @__PURE__ */ __name((obj) => {
|
|
188
|
-
const
|
|
189
|
-
return
|
|
188
|
+
const json10 = JSON.stringify(obj, null, 2);
|
|
189
|
+
return json10.replace(/"([^"]+)":/g, "$1:");
|
|
190
190
|
}, "quotelessJson");
|
|
191
191
|
var ZodError = class extends Error {
|
|
192
192
|
constructor(issues) {
|
|
@@ -2288,10 +2288,10 @@ var ZodObject = class extends ZodType {
|
|
|
2288
2288
|
// }) as any;
|
|
2289
2289
|
// return merged;
|
|
2290
2290
|
// }
|
|
2291
|
-
catchall(
|
|
2291
|
+
catchall(index18) {
|
|
2292
2292
|
return new ZodObject({
|
|
2293
2293
|
...this._def,
|
|
2294
|
-
catchall:
|
|
2294
|
+
catchall: index18
|
|
2295
2295
|
});
|
|
2296
2296
|
}
|
|
2297
2297
|
pick(mask) {
|
|
@@ -2603,9 +2603,9 @@ function mergeValues(a, b) {
|
|
|
2603
2603
|
return { valid: false };
|
|
2604
2604
|
}
|
|
2605
2605
|
const newArray = [];
|
|
2606
|
-
for (let
|
|
2607
|
-
const itemA = a[
|
|
2608
|
-
const itemB = b[
|
|
2606
|
+
for (let index18 = 0; index18 < a.length; index18++) {
|
|
2607
|
+
const itemA = a[index18];
|
|
2608
|
+
const itemB = b[index18];
|
|
2609
2609
|
const sharedValue = mergeValues(itemA, itemB);
|
|
2610
2610
|
if (!sharedValue.valid) {
|
|
2611
2611
|
return { valid: false };
|
|
@@ -2814,10 +2814,10 @@ var ZodMap = class extends ZodType {
|
|
|
2814
2814
|
}
|
|
2815
2815
|
const keyType = this._def.keyType;
|
|
2816
2816
|
const valueType = this._def.valueType;
|
|
2817
|
-
const pairs = [...ctx.data.entries()].map(([key, value],
|
|
2817
|
+
const pairs = [...ctx.data.entries()].map(([key, value], index18) => {
|
|
2818
2818
|
return {
|
|
2819
|
-
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
|
|
2820
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [
|
|
2819
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index18, "key"])),
|
|
2820
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index18, "value"]))
|
|
2821
2821
|
};
|
|
2822
2822
|
});
|
|
2823
2823
|
if (ctx.common.async) {
|
|
@@ -3983,8 +3983,8 @@ var ZodIssueCode2 = util2.arrayToEnum([
|
|
|
3983
3983
|
"not_finite"
|
|
3984
3984
|
]);
|
|
3985
3985
|
var quotelessJson2 = /* @__PURE__ */ __name2((obj) => {
|
|
3986
|
-
const
|
|
3987
|
-
return
|
|
3986
|
+
const json10 = JSON.stringify(obj, null, 2);
|
|
3987
|
+
return json10.replace(/"([^"]+)":/g, "$1:");
|
|
3988
3988
|
}, "quotelessJson");
|
|
3989
3989
|
var ZodError2 = /* @__PURE__ */ __name(class extends Error {
|
|
3990
3990
|
constructor(issues) {
|
|
@@ -6253,10 +6253,10 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6253
6253
|
// }) as any;
|
|
6254
6254
|
// return merged;
|
|
6255
6255
|
// }
|
|
6256
|
-
catchall(
|
|
6256
|
+
catchall(index18) {
|
|
6257
6257
|
return new ZodObject2({
|
|
6258
6258
|
...this._def,
|
|
6259
|
-
catchall:
|
|
6259
|
+
catchall: index18
|
|
6260
6260
|
});
|
|
6261
6261
|
}
|
|
6262
6262
|
pick(mask) {
|
|
@@ -6593,9 +6593,9 @@ function mergeValues2(a, b) {
|
|
|
6593
6593
|
};
|
|
6594
6594
|
}
|
|
6595
6595
|
const newArray = [];
|
|
6596
|
-
for (let
|
|
6597
|
-
const itemA = a[
|
|
6598
|
-
const itemB = b[
|
|
6596
|
+
for (let index18 = 0; index18 < a.length; index18++) {
|
|
6597
|
+
const itemA = a[index18];
|
|
6598
|
+
const itemB = b[index18];
|
|
6599
6599
|
const sharedValue = mergeValues2(itemA, itemB);
|
|
6600
6600
|
if (!sharedValue.valid) {
|
|
6601
6601
|
return {
|
|
@@ -6822,14 +6822,14 @@ var ZodMap2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6822
6822
|
const valueType = this._def.valueType;
|
|
6823
6823
|
const pairs = [
|
|
6824
6824
|
...ctx.data.entries()
|
|
6825
|
-
].map(([key, value],
|
|
6825
|
+
].map(([key, value], index18) => {
|
|
6826
6826
|
return {
|
|
6827
6827
|
key: keyType._parse(new ParseInputLazyPath2(ctx, key, ctx.path, [
|
|
6828
|
-
|
|
6828
|
+
index18,
|
|
6829
6829
|
"key"
|
|
6830
6830
|
])),
|
|
6831
6831
|
value: valueType._parse(new ParseInputLazyPath2(ctx, value, ctx.path, [
|
|
6832
|
-
|
|
6832
|
+
index18,
|
|
6833
6833
|
"value"
|
|
6834
6834
|
]))
|
|
6835
6835
|
};
|
|
@@ -8024,20 +8024,6 @@ var merchantProductSchema = z2.object({
|
|
|
8024
8024
|
createdAt: z2.date().nullable()
|
|
8025
8025
|
});
|
|
8026
8026
|
|
|
8027
|
-
// ../core/dist/chunk-FM4F3ZJD.js
|
|
8028
|
-
var priceSchema = z2.object({
|
|
8029
|
-
id: z2.string().max(191),
|
|
8030
|
-
productId: z2.string().max(191).optional().nullable(),
|
|
8031
|
-
nickname: z2.string().max(191).optional().nullable(),
|
|
8032
|
-
status: z2.number().int().default(0),
|
|
8033
|
-
unitAmount: z2.coerce.number().refine((value) => {
|
|
8034
|
-
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8035
|
-
return decimalPlaces <= 2;
|
|
8036
|
-
}),
|
|
8037
|
-
createdAt: z2.date().nullable(),
|
|
8038
|
-
metadata: z2.record(z2.any()).default({})
|
|
8039
|
-
});
|
|
8040
|
-
|
|
8041
8027
|
// ../core/dist/chunk-3PNHS6OB.js
|
|
8042
8028
|
var userSchema = z2.object({
|
|
8043
8029
|
id: z2.string().length(255),
|
|
@@ -8052,7 +8038,21 @@ var userSchema = z2.object({
|
|
|
8052
8038
|
createdAt: z2.date().nullable()
|
|
8053
8039
|
});
|
|
8054
8040
|
|
|
8055
|
-
// ../core/dist/chunk-
|
|
8041
|
+
// ../core/dist/chunk-FM4F3ZJD.js
|
|
8042
|
+
var priceSchema = z2.object({
|
|
8043
|
+
id: z2.string().max(191),
|
|
8044
|
+
productId: z2.string().max(191).optional().nullable(),
|
|
8045
|
+
nickname: z2.string().max(191).optional().nullable(),
|
|
8046
|
+
status: z2.number().int().default(0),
|
|
8047
|
+
unitAmount: z2.coerce.number().refine((value) => {
|
|
8048
|
+
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8049
|
+
return decimalPlaces <= 2;
|
|
8050
|
+
}),
|
|
8051
|
+
createdAt: z2.date().nullable(),
|
|
8052
|
+
metadata: z2.record(z2.any()).default({})
|
|
8053
|
+
});
|
|
8054
|
+
|
|
8055
|
+
// ../core/dist/chunk-QVE5LSW7.js
|
|
8056
8056
|
var productSchema = z2.object({
|
|
8057
8057
|
id: z2.string().max(191),
|
|
8058
8058
|
name: z2.string().max(191),
|
|
@@ -8060,7 +8060,8 @@ var productSchema = z2.object({
|
|
|
8060
8060
|
metadata: z2.record(z2.any()).default({}),
|
|
8061
8061
|
createdAt: z2.date().nullable(),
|
|
8062
8062
|
status: z2.number().int().default(0),
|
|
8063
|
-
quantityAvailable: z2.number().int().default(-1)
|
|
8063
|
+
quantityAvailable: z2.number().int().default(-1),
|
|
8064
|
+
price: priceSchema.nullable().optional()
|
|
8064
8065
|
});
|
|
8065
8066
|
|
|
8066
8067
|
// ../core/dist/chunk-ZVLW7GN3.js
|
|
@@ -8083,7 +8084,7 @@ var couponSchema = z2.object({
|
|
|
8083
8084
|
bulkPurchaseId: z2.string().max(191).optional().nullable()
|
|
8084
8085
|
});
|
|
8085
8086
|
|
|
8086
|
-
// ../core/dist/chunk-
|
|
8087
|
+
// ../core/dist/chunk-4IVPKC6V.js
|
|
8087
8088
|
var purchaseSchema = z2.object({
|
|
8088
8089
|
id: z2.string().max(191),
|
|
8089
8090
|
userId: z2.string().max(191).optional().nullable(),
|
|
@@ -8144,16 +8145,16 @@ var ResourceVisibilitySchema = z2.union([
|
|
|
8144
8145
|
]);
|
|
8145
8146
|
|
|
8146
8147
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
8147
|
-
var
|
|
8148
|
-
var
|
|
8148
|
+
var import_drizzle_orm19 = require("drizzle-orm");
|
|
8149
|
+
var import_mysql_core22 = require("drizzle-orm/mysql-core");
|
|
8149
8150
|
|
|
8150
8151
|
// src/lib/mysql/schemas/auth/users.ts
|
|
8151
|
-
var
|
|
8152
|
-
var
|
|
8152
|
+
var import_drizzle_orm18 = require("drizzle-orm");
|
|
8153
|
+
var import_mysql_core21 = require("drizzle-orm/mysql-core");
|
|
8153
8154
|
|
|
8154
8155
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
8155
|
-
var
|
|
8156
|
-
var
|
|
8156
|
+
var import_drizzle_orm10 = require("drizzle-orm");
|
|
8157
|
+
var import_mysql_core11 = require("drizzle-orm/mysql-core");
|
|
8157
8158
|
|
|
8158
8159
|
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
8159
8160
|
var import_drizzle_orm = require("drizzle-orm");
|
|
@@ -8176,7 +8177,7 @@ function getCouponSchema(mysqlTable) {
|
|
|
8176
8177
|
}),
|
|
8177
8178
|
metadata: (0, import_mysql_core.json)("fields").$type().default({}),
|
|
8178
8179
|
maxUses: (0, import_mysql_core.int)("maxUses").default(-1).notNull(),
|
|
8179
|
-
default: (0, import_mysql_core.
|
|
8180
|
+
default: (0, import_mysql_core.boolean)("default").default(false).notNull(),
|
|
8180
8181
|
merchantCouponId: (0, import_mysql_core.varchar)("merchantCouponId", {
|
|
8181
8182
|
length: 191
|
|
8182
8183
|
}),
|
|
@@ -8276,509 +8277,725 @@ function getMerchantSessionSchema(mysqlTable) {
|
|
|
8276
8277
|
__name(getMerchantSessionSchema, "getMerchantSessionSchema");
|
|
8277
8278
|
|
|
8278
8279
|
// src/lib/mysql/schemas/commerce/product.ts
|
|
8280
|
+
var import_drizzle_orm9 = require("drizzle-orm");
|
|
8281
|
+
var import_mysql_core10 = require("drizzle-orm/mysql-core");
|
|
8282
|
+
|
|
8283
|
+
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
8284
|
+
var import_drizzle_orm5 = require("drizzle-orm");
|
|
8285
|
+
var import_mysql_core6 = require("drizzle-orm/mysql-core");
|
|
8286
|
+
|
|
8287
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
8288
|
+
var import_drizzle_orm4 = require("drizzle-orm");
|
|
8289
|
+
var import_mysql_core5 = require("drizzle-orm/mysql-core");
|
|
8290
|
+
|
|
8291
|
+
// src/lib/mysql/schemas/content/content-resource-resource.ts
|
|
8279
8292
|
var import_drizzle_orm3 = require("drizzle-orm");
|
|
8280
8293
|
var import_mysql_core4 = require("drizzle-orm/mysql-core");
|
|
8281
|
-
function
|
|
8282
|
-
return mysqlTable("
|
|
8283
|
-
|
|
8284
|
-
length:
|
|
8294
|
+
function getContentResourceResourceSchema(mysqlTable) {
|
|
8295
|
+
return mysqlTable("contentResourceResource", {
|
|
8296
|
+
resourceOfId: (0, import_mysql_core4.varchar)("resourceOfId", {
|
|
8297
|
+
length: 255
|
|
8285
8298
|
}).notNull(),
|
|
8286
|
-
|
|
8287
|
-
length:
|
|
8299
|
+
resourceId: (0, import_mysql_core4.varchar)("resourceId", {
|
|
8300
|
+
length: 255
|
|
8288
8301
|
}).notNull(),
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
}),
|
|
8292
|
-
metadata: (0, import_mysql_core4.json)("fields").$type().default({}),
|
|
8302
|
+
position: (0, import_mysql_core4.double)("position").notNull().default(0),
|
|
8303
|
+
metadata: (0, import_mysql_core4.json)("metadata").$type().default({}),
|
|
8293
8304
|
createdAt: (0, import_mysql_core4.timestamp)("createdAt", {
|
|
8294
8305
|
mode: "date",
|
|
8295
8306
|
fsp: 3
|
|
8296
|
-
}).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`)
|
|
8297
|
-
|
|
8298
|
-
quantityAvailable: (0, import_mysql_core4.int)("quantityAvailable").default(-1).notNull()
|
|
8299
|
-
}, (table) => {
|
|
8300
|
-
return {
|
|
8301
|
-
productId: (0, import_mysql_core4.primaryKey)({
|
|
8302
|
-
columns: [
|
|
8303
|
-
table.id
|
|
8304
|
-
],
|
|
8305
|
-
name: "Product_id"
|
|
8306
|
-
})
|
|
8307
|
-
};
|
|
8308
|
-
});
|
|
8309
|
-
}
|
|
8310
|
-
__name(getProductSchema, "getProductSchema");
|
|
8311
|
-
|
|
8312
|
-
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
8313
|
-
function getPurchaseSchema(mysqlTable) {
|
|
8314
|
-
return mysqlTable("purchases", {
|
|
8315
|
-
id: (0, import_mysql_core5.varchar)("id", {
|
|
8316
|
-
length: 191
|
|
8317
|
-
}).notNull(),
|
|
8318
|
-
userId: (0, import_mysql_core5.varchar)("userId", {
|
|
8319
|
-
length: 191
|
|
8320
|
-
}),
|
|
8321
|
-
createdAt: (0, import_mysql_core5.timestamp)("createdAt", {
|
|
8307
|
+
}).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`),
|
|
8308
|
+
updatedAt: (0, import_mysql_core4.timestamp)("updatedAt", {
|
|
8322
8309
|
mode: "date",
|
|
8323
8310
|
fsp: 3
|
|
8324
|
-
}).default(
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
})
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
state: (0, import_mysql_core5.varchar)("state", {
|
|
8336
|
-
length: 191
|
|
8337
|
-
}),
|
|
8338
|
-
country: (0, import_mysql_core5.varchar)("country", {
|
|
8339
|
-
length: 191
|
|
8340
|
-
}),
|
|
8341
|
-
couponId: (0, import_mysql_core5.varchar)("couponId", {
|
|
8342
|
-
length: 191
|
|
8343
|
-
}),
|
|
8344
|
-
productId: (0, import_mysql_core5.varchar)("productId", {
|
|
8345
|
-
length: 191
|
|
8346
|
-
}).notNull(),
|
|
8347
|
-
merchantChargeId: (0, import_mysql_core5.varchar)("merchantChargeId", {
|
|
8348
|
-
length: 191
|
|
8349
|
-
}),
|
|
8350
|
-
upgradedFromId: (0, import_mysql_core5.varchar)("upgradedFromId", {
|
|
8351
|
-
length: 191
|
|
8352
|
-
}),
|
|
8353
|
-
status: (0, import_mysql_core5.varchar)("status", {
|
|
8354
|
-
length: 191
|
|
8355
|
-
}).default("Valid").notNull(),
|
|
8356
|
-
bulkCouponId: (0, import_mysql_core5.varchar)("bulkCouponId", {
|
|
8357
|
-
length: 191
|
|
8358
|
-
}),
|
|
8359
|
-
merchantSessionId: (0, import_mysql_core5.varchar)("merchantSessionId", {
|
|
8360
|
-
length: 191
|
|
8361
|
-
}),
|
|
8362
|
-
redeemedBulkCouponId: (0, import_mysql_core5.varchar)("redeemedBulkCouponId", {
|
|
8363
|
-
length: 191
|
|
8311
|
+
}).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`),
|
|
8312
|
+
deletedAt: (0, import_mysql_core4.timestamp)("deletedAt", {
|
|
8313
|
+
mode: "date",
|
|
8314
|
+
fsp: 3
|
|
8315
|
+
})
|
|
8316
|
+
}, (crr) => ({
|
|
8317
|
+
pk: (0, import_mysql_core4.primaryKey)({
|
|
8318
|
+
columns: [
|
|
8319
|
+
crr.resourceOfId,
|
|
8320
|
+
crr.resourceId
|
|
8321
|
+
]
|
|
8364
8322
|
}),
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
purchaseId: (0, import_mysql_core5.primaryKey)({
|
|
8369
|
-
columns: [
|
|
8370
|
-
table.id
|
|
8371
|
-
],
|
|
8372
|
-
name: "Purchase_id"
|
|
8373
|
-
}),
|
|
8374
|
-
purchaseUpgradedFromIdKey: (0, import_mysql_core5.unique)("Purchase_upgradedFromId_key").on(table.upgradedFromId)
|
|
8375
|
-
};
|
|
8376
|
-
});
|
|
8323
|
+
contentResourceIdIdx: (0, import_mysql_core4.index)("contentResourceId_idx").on(crr.resourceOfId),
|
|
8324
|
+
resourceIdIdx: (0, import_mysql_core4.index)("resourceId_idx").on(crr.resourceId)
|
|
8325
|
+
}));
|
|
8377
8326
|
}
|
|
8378
|
-
__name(
|
|
8379
|
-
function
|
|
8380
|
-
const
|
|
8381
|
-
const
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
8385
|
-
const coupons = getCouponSchema(mysqlTable);
|
|
8386
|
-
return (0, import_drizzle_orm4.relations)(purchases, ({ many, one }) => ({
|
|
8387
|
-
user: one(users, {
|
|
8388
|
-
fields: [
|
|
8389
|
-
purchases.userId
|
|
8390
|
-
],
|
|
8391
|
-
references: [
|
|
8392
|
-
users.id
|
|
8393
|
-
],
|
|
8394
|
-
relationName: "user"
|
|
8395
|
-
}),
|
|
8396
|
-
product: one(products, {
|
|
8397
|
-
fields: [
|
|
8398
|
-
purchases.productId
|
|
8399
|
-
],
|
|
8400
|
-
references: [
|
|
8401
|
-
products.id
|
|
8402
|
-
],
|
|
8403
|
-
relationName: "product"
|
|
8404
|
-
}),
|
|
8405
|
-
bulkCoupon: one(coupons, {
|
|
8406
|
-
fields: [
|
|
8407
|
-
purchases.bulkCouponId
|
|
8408
|
-
],
|
|
8409
|
-
references: [
|
|
8410
|
-
coupons.id
|
|
8411
|
-
],
|
|
8412
|
-
relationName: "bulkCoupon"
|
|
8413
|
-
}),
|
|
8414
|
-
merchantCharge: one(merchantCharges, {
|
|
8327
|
+
__name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
|
|
8328
|
+
function getContentResourceResourceRelationsSchema(mysqlTable) {
|
|
8329
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8330
|
+
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
8331
|
+
return (0, import_drizzle_orm3.relations)(contentResourceResource, ({ one }) => ({
|
|
8332
|
+
resourceOf: one(contentResource, {
|
|
8415
8333
|
fields: [
|
|
8416
|
-
|
|
8334
|
+
contentResourceResource.resourceOfId
|
|
8417
8335
|
],
|
|
8418
8336
|
references: [
|
|
8419
|
-
|
|
8337
|
+
contentResource.id
|
|
8420
8338
|
],
|
|
8421
|
-
relationName: "
|
|
8339
|
+
relationName: "resourceOf"
|
|
8422
8340
|
}),
|
|
8423
|
-
|
|
8341
|
+
resource: one(contentResource, {
|
|
8424
8342
|
fields: [
|
|
8425
|
-
|
|
8343
|
+
contentResourceResource.resourceId
|
|
8426
8344
|
],
|
|
8427
8345
|
references: [
|
|
8428
|
-
|
|
8346
|
+
contentResource.id
|
|
8429
8347
|
],
|
|
8430
|
-
relationName: "
|
|
8348
|
+
relationName: "resource"
|
|
8431
8349
|
})
|
|
8432
8350
|
}));
|
|
8433
8351
|
}
|
|
8434
|
-
__name(
|
|
8435
|
-
|
|
8436
|
-
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
8437
|
-
var import_drizzle_orm5 = require("drizzle-orm");
|
|
8438
|
-
var import_mysql_core8 = require("drizzle-orm/mysql-core");
|
|
8352
|
+
__name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
|
|
8439
8353
|
|
|
8440
|
-
// src/lib/mysql/schemas/
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
id: (0, import_mysql_core6.varchar)("id", {
|
|
8354
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
8355
|
+
function getContentResourceSchema(mysqlTable) {
|
|
8356
|
+
return mysqlTable("contentResource", {
|
|
8357
|
+
id: (0, import_mysql_core5.varchar)("id", {
|
|
8445
8358
|
length: 255
|
|
8446
8359
|
}).notNull().primaryKey(),
|
|
8447
|
-
|
|
8360
|
+
type: (0, import_mysql_core5.varchar)("type", {
|
|
8448
8361
|
length: 255
|
|
8449
8362
|
}).notNull(),
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8363
|
+
createdById: (0, import_mysql_core5.varchar)("createdById", {
|
|
8364
|
+
length: 255
|
|
8365
|
+
}).notNull(),
|
|
8366
|
+
fields: (0, import_mysql_core5.json)("fields").$type().default({}),
|
|
8367
|
+
createdAt: (0, import_mysql_core5.timestamp)("createdAt", {
|
|
8453
8368
|
mode: "date",
|
|
8454
8369
|
fsp: 3
|
|
8455
|
-
}).
|
|
8456
|
-
updatedAt: (0,
|
|
8370
|
+
}).default(import_drizzle_orm4.sql`CURRENT_TIMESTAMP(3)`),
|
|
8371
|
+
updatedAt: (0, import_mysql_core5.timestamp)("updatedAt", {
|
|
8457
8372
|
mode: "date",
|
|
8458
8373
|
fsp: 3
|
|
8459
|
-
}).
|
|
8460
|
-
deletedAt: (0,
|
|
8374
|
+
}).default(import_drizzle_orm4.sql`CURRENT_TIMESTAMP(3)`),
|
|
8375
|
+
deletedAt: (0, import_mysql_core5.timestamp)("deletedAt", {
|
|
8461
8376
|
mode: "date",
|
|
8462
8377
|
fsp: 3
|
|
8463
8378
|
})
|
|
8464
|
-
}, (
|
|
8465
|
-
|
|
8379
|
+
}, (cm) => ({
|
|
8380
|
+
typeIdx: (0, import_mysql_core5.index)("type_idx").on(cm.type),
|
|
8381
|
+
createdByIdx: (0, import_mysql_core5.index)("createdById_idx").on(cm.createdById),
|
|
8382
|
+
createdAtIdx: (0, import_mysql_core5.index)("createdAt_idx").on(cm.createdAt)
|
|
8466
8383
|
}));
|
|
8467
8384
|
}
|
|
8468
|
-
__name(
|
|
8385
|
+
__name(getContentResourceSchema, "getContentResourceSchema");
|
|
8386
|
+
function getContentResourceRelationsSchema(mysqlTable) {
|
|
8387
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8388
|
+
const users = getUsersSchema(mysqlTable);
|
|
8389
|
+
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
8390
|
+
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
8391
|
+
return (0, import_drizzle_orm4.relations)(contentResource, ({ one, many }) => ({
|
|
8392
|
+
createdBy: one(users, {
|
|
8393
|
+
fields: [
|
|
8394
|
+
contentResource.createdById
|
|
8395
|
+
],
|
|
8396
|
+
references: [
|
|
8397
|
+
users.id
|
|
8398
|
+
],
|
|
8399
|
+
relationName: "user"
|
|
8400
|
+
}),
|
|
8401
|
+
resources: many(contentResourceResource, {
|
|
8402
|
+
relationName: "resourceOf"
|
|
8403
|
+
}),
|
|
8404
|
+
resourceOf: many(contentResourceResource, {
|
|
8405
|
+
relationName: "resource"
|
|
8406
|
+
}),
|
|
8407
|
+
resourceProducts: many(contentResourceProduct, {
|
|
8408
|
+
relationName: "resource"
|
|
8409
|
+
})
|
|
8410
|
+
}));
|
|
8411
|
+
}
|
|
8412
|
+
__name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
|
|
8469
8413
|
|
|
8470
|
-
// src/lib/mysql/schemas/
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
id: (0, import_mysql_core7.varchar)("id", {
|
|
8414
|
+
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
8415
|
+
function getContentResourceProductSchema(mysqlTable) {
|
|
8416
|
+
return mysqlTable("contentResourceProduct", {
|
|
8417
|
+
productId: (0, import_mysql_core6.varchar)("productId", {
|
|
8475
8418
|
length: 255
|
|
8476
|
-
}).notNull()
|
|
8477
|
-
|
|
8419
|
+
}).notNull(),
|
|
8420
|
+
resourceId: (0, import_mysql_core6.varchar)("resourceId", {
|
|
8478
8421
|
length: 255
|
|
8479
8422
|
}).notNull(),
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
createdAt: (0,
|
|
8423
|
+
position: (0, import_mysql_core6.double)("position").notNull().default(0),
|
|
8424
|
+
metadata: (0, import_mysql_core6.json)("metadata").$type().default({}),
|
|
8425
|
+
createdAt: (0, import_mysql_core6.timestamp)("createdAt", {
|
|
8483
8426
|
mode: "date",
|
|
8484
8427
|
fsp: 3
|
|
8485
|
-
}).
|
|
8486
|
-
updatedAt: (0,
|
|
8428
|
+
}).default(import_drizzle_orm5.sql`CURRENT_TIMESTAMP(3)`),
|
|
8429
|
+
updatedAt: (0, import_mysql_core6.timestamp)("updatedAt", {
|
|
8487
8430
|
mode: "date",
|
|
8488
8431
|
fsp: 3
|
|
8489
|
-
}),
|
|
8490
|
-
deletedAt: (0,
|
|
8432
|
+
}).default(import_drizzle_orm5.sql`CURRENT_TIMESTAMP(3)`),
|
|
8433
|
+
deletedAt: (0, import_mysql_core6.timestamp)("deletedAt", {
|
|
8491
8434
|
mode: "date",
|
|
8492
8435
|
fsp: 3
|
|
8493
8436
|
})
|
|
8494
|
-
})
|
|
8437
|
+
}, (crr) => ({
|
|
8438
|
+
pk: (0, import_mysql_core6.primaryKey)({
|
|
8439
|
+
columns: [
|
|
8440
|
+
crr.productId,
|
|
8441
|
+
crr.resourceId
|
|
8442
|
+
]
|
|
8443
|
+
}),
|
|
8444
|
+
contentResourceIdIdx: (0, import_mysql_core6.index)("contentResourceId_idx").on(crr.productId),
|
|
8445
|
+
resourceIdIdx: (0, import_mysql_core6.index)("resourceId_idx").on(crr.resourceId)
|
|
8446
|
+
}));
|
|
8495
8447
|
}
|
|
8496
|
-
__name(
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8448
|
+
__name(getContentResourceProductSchema, "getContentResourceProductSchema");
|
|
8449
|
+
function getContentResourceProductRelationsSchema(mysqlTable) {
|
|
8450
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8451
|
+
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
8452
|
+
const product = getProductSchema(mysqlTable);
|
|
8453
|
+
return (0, import_drizzle_orm5.relations)(contentResourceProduct, ({ one }) => ({
|
|
8454
|
+
product: one(product, {
|
|
8455
|
+
fields: [
|
|
8456
|
+
contentResourceProduct.productId
|
|
8457
|
+
],
|
|
8458
|
+
references: [
|
|
8459
|
+
product.id
|
|
8460
|
+
],
|
|
8461
|
+
relationName: "product"
|
|
8462
|
+
}),
|
|
8463
|
+
resource: one(contentResource, {
|
|
8464
|
+
fields: [
|
|
8465
|
+
contentResourceProduct.resourceId
|
|
8466
|
+
],
|
|
8467
|
+
references: [
|
|
8468
|
+
contentResource.id
|
|
8469
|
+
],
|
|
8470
|
+
relationName: "resource"
|
|
8471
|
+
})
|
|
8472
|
+
}));
|
|
8473
|
+
}
|
|
8474
|
+
__name(getContentResourceProductRelationsSchema, "getContentResourceProductRelationsSchema");
|
|
8475
|
+
|
|
8476
|
+
// src/lib/mysql/schemas/commerce/merchant-product.ts
|
|
8477
|
+
var import_drizzle_orm6 = require("drizzle-orm");
|
|
8478
|
+
var import_mysql_core7 = require("drizzle-orm/mysql-core");
|
|
8479
|
+
function getMerchantProductSchema(mysqlTable) {
|
|
8480
|
+
return mysqlTable("merchantProducts", {
|
|
8481
|
+
id: (0, import_mysql_core7.varchar)("id", {
|
|
8482
|
+
length: 191
|
|
8506
8483
|
}).notNull(),
|
|
8507
|
-
|
|
8508
|
-
length:
|
|
8484
|
+
merchantAccountId: (0, import_mysql_core7.varchar)("merchantAccountId", {
|
|
8485
|
+
length: 191
|
|
8509
8486
|
}).notNull(),
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
"medium",
|
|
8513
|
-
"high"
|
|
8514
|
-
]).notNull().default("medium"),
|
|
8515
|
-
preferenceTypeId: (0, import_mysql_core8.varchar)("preferenceTypeId", {
|
|
8516
|
-
length: 255
|
|
8487
|
+
productId: (0, import_mysql_core7.varchar)("productId", {
|
|
8488
|
+
length: 191
|
|
8517
8489
|
}).notNull(),
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
optInAt: (0, import_mysql_core8.timestamp)("optInAt", {
|
|
8490
|
+
status: (0, import_mysql_core7.int)("status").default(0).notNull(),
|
|
8491
|
+
identifier: (0, import_mysql_core7.varchar)("identifier", {
|
|
8492
|
+
length: 191
|
|
8493
|
+
}),
|
|
8494
|
+
createdAt: (0, import_mysql_core7.timestamp)("createdAt", {
|
|
8524
8495
|
mode: "date",
|
|
8525
8496
|
fsp: 3
|
|
8497
|
+
}).default(import_drizzle_orm6.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
8498
|
+
}, (table) => {
|
|
8499
|
+
return {
|
|
8500
|
+
merchantProductId: (0, import_mysql_core7.primaryKey)({
|
|
8501
|
+
columns: [
|
|
8502
|
+
table.id
|
|
8503
|
+
],
|
|
8504
|
+
name: "MerchantProduct_id"
|
|
8505
|
+
}),
|
|
8506
|
+
merchantProductIdentifierKey: (0, import_mysql_core7.unique)("MerchantProduct_identifier_key").on(table.identifier)
|
|
8507
|
+
};
|
|
8508
|
+
});
|
|
8509
|
+
}
|
|
8510
|
+
__name(getMerchantProductSchema, "getMerchantProductSchema");
|
|
8511
|
+
|
|
8512
|
+
// src/lib/mysql/schemas/commerce/price.ts
|
|
8513
|
+
var import_drizzle_orm8 = require("drizzle-orm");
|
|
8514
|
+
var import_mysql_core9 = require("drizzle-orm/mysql-core");
|
|
8515
|
+
|
|
8516
|
+
// src/lib/mysql/schemas/commerce/merchant-price.ts
|
|
8517
|
+
var import_drizzle_orm7 = require("drizzle-orm");
|
|
8518
|
+
var import_mysql_core8 = require("drizzle-orm/mysql-core");
|
|
8519
|
+
function getMerchantPriceSchema(mysqlTable) {
|
|
8520
|
+
return mysqlTable("merchantPrices", {
|
|
8521
|
+
id: (0, import_mysql_core8.varchar)("id", {
|
|
8522
|
+
length: 191
|
|
8523
|
+
}).notNull(),
|
|
8524
|
+
merchantAccountId: (0, import_mysql_core8.varchar)("merchantAccountId", {
|
|
8525
|
+
length: 191
|
|
8526
|
+
}).notNull(),
|
|
8527
|
+
merchantProductId: (0, import_mysql_core8.varchar)("merchantProductId", {
|
|
8528
|
+
length: 191
|
|
8529
|
+
}).notNull(),
|
|
8530
|
+
status: (0, import_mysql_core8.int)("status").default(0),
|
|
8531
|
+
identifier: (0, import_mysql_core8.varchar)("identifier", {
|
|
8532
|
+
length: 191
|
|
8526
8533
|
}),
|
|
8527
|
-
|
|
8534
|
+
createdAt: (0, import_mysql_core8.timestamp)("createdAt", {
|
|
8528
8535
|
mode: "date",
|
|
8529
8536
|
fsp: 3
|
|
8537
|
+
}).default(import_drizzle_orm7.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8538
|
+
priceId: (0, import_mysql_core8.varchar)("priceId", {
|
|
8539
|
+
length: 191
|
|
8540
|
+
})
|
|
8541
|
+
}, (table) => {
|
|
8542
|
+
return {
|
|
8543
|
+
merchantPriceId: (0, import_mysql_core8.primaryKey)({
|
|
8544
|
+
columns: [
|
|
8545
|
+
table.id
|
|
8546
|
+
],
|
|
8547
|
+
name: "MerchantPrice_id"
|
|
8548
|
+
}),
|
|
8549
|
+
merchantPriceIdentifierKey: (0, import_mysql_core8.unique)("MerchantPrice_identifier_key").on(table.identifier)
|
|
8550
|
+
};
|
|
8551
|
+
});
|
|
8552
|
+
}
|
|
8553
|
+
__name(getMerchantPriceSchema, "getMerchantPriceSchema");
|
|
8554
|
+
|
|
8555
|
+
// src/lib/mysql/schemas/commerce/price.ts
|
|
8556
|
+
function getPriceSchema(mysqlTable) {
|
|
8557
|
+
return mysqlTable("prices", {
|
|
8558
|
+
id: (0, import_mysql_core9.varchar)("id", {
|
|
8559
|
+
length: 191
|
|
8560
|
+
}).notNull(),
|
|
8561
|
+
productId: (0, import_mysql_core9.varchar)("productId", {
|
|
8562
|
+
length: 191
|
|
8563
|
+
}),
|
|
8564
|
+
nickname: (0, import_mysql_core9.varchar)("nickname", {
|
|
8565
|
+
length: 191
|
|
8530
8566
|
}),
|
|
8531
|
-
|
|
8567
|
+
status: (0, import_mysql_core9.int)("status").default(0).notNull(),
|
|
8568
|
+
unitAmount: (0, import_mysql_core9.decimal)("unitAmount", {
|
|
8569
|
+
precision: 10,
|
|
8570
|
+
scale: 2
|
|
8571
|
+
}).notNull(),
|
|
8572
|
+
createdAt: (0, import_mysql_core9.timestamp)("createdAt", {
|
|
8532
8573
|
mode: "date",
|
|
8533
8574
|
fsp: 3
|
|
8534
|
-
}).
|
|
8535
|
-
|
|
8575
|
+
}).default(import_drizzle_orm8.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8576
|
+
metadata: (0, import_mysql_core9.json)("fields").$type().default({})
|
|
8577
|
+
}, (table) => {
|
|
8578
|
+
return {
|
|
8579
|
+
priceId: (0, import_mysql_core9.primaryKey)({
|
|
8580
|
+
columns: [
|
|
8581
|
+
table.id
|
|
8582
|
+
],
|
|
8583
|
+
name: "Price_id"
|
|
8584
|
+
})
|
|
8585
|
+
};
|
|
8586
|
+
});
|
|
8587
|
+
}
|
|
8588
|
+
__name(getPriceSchema, "getPriceSchema");
|
|
8589
|
+
|
|
8590
|
+
// src/lib/mysql/schemas/commerce/product.ts
|
|
8591
|
+
function getProductSchema(mysqlTable) {
|
|
8592
|
+
return mysqlTable("products", {
|
|
8593
|
+
id: (0, import_mysql_core10.varchar)("id", {
|
|
8594
|
+
length: 191
|
|
8595
|
+
}).notNull(),
|
|
8596
|
+
name: (0, import_mysql_core10.varchar)("name", {
|
|
8597
|
+
length: 191
|
|
8598
|
+
}).notNull(),
|
|
8599
|
+
key: (0, import_mysql_core10.varchar)("key", {
|
|
8600
|
+
length: 191
|
|
8601
|
+
}),
|
|
8602
|
+
fields: (0, import_mysql_core10.json)("fields").$type().default({}),
|
|
8603
|
+
createdAt: (0, import_mysql_core10.timestamp)("createdAt", {
|
|
8536
8604
|
mode: "date",
|
|
8537
8605
|
fsp: 3
|
|
8606
|
+
}).default(import_drizzle_orm9.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8607
|
+
status: (0, import_mysql_core10.int)("status").default(0).notNull(),
|
|
8608
|
+
quantityAvailable: (0, import_mysql_core10.int)("quantityAvailable").default(-1).notNull()
|
|
8609
|
+
}, (table) => {
|
|
8610
|
+
return {
|
|
8611
|
+
productId: (0, import_mysql_core10.primaryKey)({
|
|
8612
|
+
columns: [
|
|
8613
|
+
table.id
|
|
8614
|
+
],
|
|
8615
|
+
name: "Product_id"
|
|
8616
|
+
})
|
|
8617
|
+
};
|
|
8618
|
+
});
|
|
8619
|
+
}
|
|
8620
|
+
__name(getProductSchema, "getProductSchema");
|
|
8621
|
+
function getProductRelationsSchema(mysqlTable) {
|
|
8622
|
+
const product = getProductSchema(mysqlTable);
|
|
8623
|
+
const price = getPriceSchema(mysqlTable);
|
|
8624
|
+
const merchantProduct = getMerchantProductSchema(mysqlTable);
|
|
8625
|
+
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
8626
|
+
return (0, import_drizzle_orm9.relations)(product, ({ one, many }) => ({
|
|
8627
|
+
price: one(price, {
|
|
8628
|
+
fields: [
|
|
8629
|
+
product.id
|
|
8630
|
+
],
|
|
8631
|
+
references: [
|
|
8632
|
+
price.productId
|
|
8633
|
+
],
|
|
8634
|
+
relationName: "price"
|
|
8635
|
+
}),
|
|
8636
|
+
resources: many(contentResourceProduct, {
|
|
8637
|
+
relationName: "product"
|
|
8638
|
+
}),
|
|
8639
|
+
merchantProduct: one(merchantProduct, {
|
|
8640
|
+
fields: [
|
|
8641
|
+
product.id
|
|
8642
|
+
],
|
|
8643
|
+
references: [
|
|
8644
|
+
merchantProduct.productId
|
|
8645
|
+
],
|
|
8646
|
+
relationName: "merchantProduct"
|
|
8538
8647
|
})
|
|
8539
|
-
}, (cp) => ({
|
|
8540
|
-
userIdIdx: (0, import_mysql_core8.index)("userId_idx").on(cp.userId),
|
|
8541
|
-
preferenceTypeIdx: (0, import_mysql_core8.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
8542
|
-
channelIdIdx: (0, import_mysql_core8.index)("channelId_idx").on(cp.channelId)
|
|
8543
8648
|
}));
|
|
8544
8649
|
}
|
|
8545
|
-
__name(
|
|
8546
|
-
|
|
8547
|
-
|
|
8650
|
+
__name(getProductRelationsSchema, "getProductRelationsSchema");
|
|
8651
|
+
|
|
8652
|
+
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
8653
|
+
function getPurchaseSchema(mysqlTable) {
|
|
8654
|
+
return mysqlTable("purchases", {
|
|
8655
|
+
id: (0, import_mysql_core11.varchar)("id", {
|
|
8656
|
+
length: 191
|
|
8657
|
+
}).notNull(),
|
|
8658
|
+
userId: (0, import_mysql_core11.varchar)("userId", {
|
|
8659
|
+
length: 191
|
|
8660
|
+
}),
|
|
8661
|
+
createdAt: (0, import_mysql_core11.timestamp)("createdAt", {
|
|
8662
|
+
mode: "date",
|
|
8663
|
+
fsp: 3
|
|
8664
|
+
}).default(import_drizzle_orm10.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8665
|
+
totalAmount: (0, import_mysql_core11.decimal)("totalAmount", {
|
|
8666
|
+
precision: 65,
|
|
8667
|
+
scale: 30
|
|
8668
|
+
}).notNull(),
|
|
8669
|
+
ipAddress: (0, import_mysql_core11.varchar)("ip_address", {
|
|
8670
|
+
length: 191
|
|
8671
|
+
}),
|
|
8672
|
+
city: (0, import_mysql_core11.varchar)("city", {
|
|
8673
|
+
length: 191
|
|
8674
|
+
}),
|
|
8675
|
+
state: (0, import_mysql_core11.varchar)("state", {
|
|
8676
|
+
length: 191
|
|
8677
|
+
}),
|
|
8678
|
+
country: (0, import_mysql_core11.varchar)("country", {
|
|
8679
|
+
length: 191
|
|
8680
|
+
}),
|
|
8681
|
+
couponId: (0, import_mysql_core11.varchar)("couponId", {
|
|
8682
|
+
length: 191
|
|
8683
|
+
}),
|
|
8684
|
+
productId: (0, import_mysql_core11.varchar)("productId", {
|
|
8685
|
+
length: 191
|
|
8686
|
+
}).notNull(),
|
|
8687
|
+
merchantChargeId: (0, import_mysql_core11.varchar)("merchantChargeId", {
|
|
8688
|
+
length: 191
|
|
8689
|
+
}),
|
|
8690
|
+
upgradedFromId: (0, import_mysql_core11.varchar)("upgradedFromId", {
|
|
8691
|
+
length: 191
|
|
8692
|
+
}),
|
|
8693
|
+
status: (0, import_mysql_core11.varchar)("status", {
|
|
8694
|
+
length: 191
|
|
8695
|
+
}).default("Valid").notNull(),
|
|
8696
|
+
bulkCouponId: (0, import_mysql_core11.varchar)("bulkCouponId", {
|
|
8697
|
+
length: 191
|
|
8698
|
+
}),
|
|
8699
|
+
merchantSessionId: (0, import_mysql_core11.varchar)("merchantSessionId", {
|
|
8700
|
+
length: 191
|
|
8701
|
+
}),
|
|
8702
|
+
redeemedBulkCouponId: (0, import_mysql_core11.varchar)("redeemedBulkCouponId", {
|
|
8703
|
+
length: 191
|
|
8704
|
+
}),
|
|
8705
|
+
metadata: (0, import_mysql_core11.json)("fields").$type().default({})
|
|
8706
|
+
}, (table) => {
|
|
8707
|
+
return {
|
|
8708
|
+
purchaseId: (0, import_mysql_core11.primaryKey)({
|
|
8709
|
+
columns: [
|
|
8710
|
+
table.id
|
|
8711
|
+
],
|
|
8712
|
+
name: "Purchase_id"
|
|
8713
|
+
}),
|
|
8714
|
+
purchaseUpgradedFromIdKey: (0, import_mysql_core11.unique)("Purchase_upgradedFromId_key").on(table.upgradedFromId)
|
|
8715
|
+
};
|
|
8716
|
+
});
|
|
8717
|
+
}
|
|
8718
|
+
__name(getPurchaseSchema, "getPurchaseSchema");
|
|
8719
|
+
function getPurchaseRelationsSchema(mysqlTable) {
|
|
8720
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
8548
8721
|
const users = getUsersSchema(mysqlTable);
|
|
8549
|
-
const
|
|
8550
|
-
const
|
|
8551
|
-
|
|
8722
|
+
const products = getProductSchema(mysqlTable);
|
|
8723
|
+
const merchantCharges = getMerchantChargeSchema(mysqlTable);
|
|
8724
|
+
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
8725
|
+
const coupons = getCouponSchema(mysqlTable);
|
|
8726
|
+
return (0, import_drizzle_orm10.relations)(purchases, ({ many, one }) => ({
|
|
8552
8727
|
user: one(users, {
|
|
8553
8728
|
fields: [
|
|
8554
|
-
|
|
8729
|
+
purchases.userId
|
|
8555
8730
|
],
|
|
8556
8731
|
references: [
|
|
8557
8732
|
users.id
|
|
8558
8733
|
],
|
|
8559
8734
|
relationName: "user"
|
|
8560
8735
|
}),
|
|
8561
|
-
|
|
8736
|
+
product: one(products, {
|
|
8562
8737
|
fields: [
|
|
8563
|
-
|
|
8738
|
+
purchases.productId
|
|
8564
8739
|
],
|
|
8565
8740
|
references: [
|
|
8566
|
-
|
|
8741
|
+
products.id
|
|
8567
8742
|
],
|
|
8568
|
-
relationName: "
|
|
8743
|
+
relationName: "product"
|
|
8569
8744
|
}),
|
|
8570
|
-
|
|
8745
|
+
bulkCoupon: one(coupons, {
|
|
8571
8746
|
fields: [
|
|
8572
|
-
|
|
8747
|
+
purchases.bulkCouponId
|
|
8573
8748
|
],
|
|
8574
8749
|
references: [
|
|
8575
|
-
|
|
8750
|
+
coupons.id
|
|
8576
8751
|
],
|
|
8577
|
-
relationName: "
|
|
8752
|
+
relationName: "bulkCoupon"
|
|
8753
|
+
}),
|
|
8754
|
+
merchantCharge: one(merchantCharges, {
|
|
8755
|
+
fields: [
|
|
8756
|
+
purchases.merchantChargeId
|
|
8757
|
+
],
|
|
8758
|
+
references: [
|
|
8759
|
+
merchantCharges.id
|
|
8760
|
+
],
|
|
8761
|
+
relationName: "merchantCharge"
|
|
8762
|
+
}),
|
|
8763
|
+
merchantSession: one(merchantSessions, {
|
|
8764
|
+
fields: [
|
|
8765
|
+
purchases.merchantSessionId
|
|
8766
|
+
],
|
|
8767
|
+
references: [
|
|
8768
|
+
merchantSessions.id
|
|
8769
|
+
],
|
|
8770
|
+
relationName: "merchantSession"
|
|
8578
8771
|
})
|
|
8579
8772
|
}));
|
|
8580
8773
|
}
|
|
8581
|
-
__name(
|
|
8582
|
-
|
|
8583
|
-
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
8584
|
-
var import_drizzle_orm9 = require("drizzle-orm");
|
|
8585
|
-
var import_mysql_core12 = require("drizzle-orm/mysql-core");
|
|
8774
|
+
__name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
|
|
8586
8775
|
|
|
8587
|
-
// src/lib/mysql/schemas/
|
|
8588
|
-
var
|
|
8589
|
-
var
|
|
8776
|
+
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
8777
|
+
var import_drizzle_orm11 = require("drizzle-orm");
|
|
8778
|
+
var import_mysql_core14 = require("drizzle-orm/mysql-core");
|
|
8590
8779
|
|
|
8591
|
-
// src/lib/mysql/schemas/
|
|
8592
|
-
var
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
resourceOfId: (0, import_mysql_core9.varchar)("resourceOfId", {
|
|
8780
|
+
// src/lib/mysql/schemas/communication/communication-channel.ts
|
|
8781
|
+
var import_mysql_core12 = require("drizzle-orm/mysql-core");
|
|
8782
|
+
function getCommunicationChannelSchema(mysqlTable) {
|
|
8783
|
+
return mysqlTable("communicationChannel", {
|
|
8784
|
+
id: (0, import_mysql_core12.varchar)("id", {
|
|
8597
8785
|
length: 255
|
|
8598
|
-
}).notNull(),
|
|
8599
|
-
|
|
8786
|
+
}).notNull().primaryKey(),
|
|
8787
|
+
name: (0, import_mysql_core12.varchar)("name", {
|
|
8600
8788
|
length: 255
|
|
8601
8789
|
}).notNull(),
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
createdAt: (0,
|
|
8790
|
+
description: (0, import_mysql_core12.text)("description"),
|
|
8791
|
+
active: (0, import_mysql_core12.boolean)("active").notNull().default(true),
|
|
8792
|
+
createdAt: (0, import_mysql_core12.timestamp)("createdAt", {
|
|
8605
8793
|
mode: "date",
|
|
8606
8794
|
fsp: 3
|
|
8607
|
-
}).
|
|
8608
|
-
updatedAt: (0,
|
|
8795
|
+
}).defaultNow(),
|
|
8796
|
+
updatedAt: (0, import_mysql_core12.timestamp)("updatedAt", {
|
|
8609
8797
|
mode: "date",
|
|
8610
8798
|
fsp: 3
|
|
8611
|
-
}).
|
|
8612
|
-
deletedAt: (0,
|
|
8799
|
+
}).defaultNow(),
|
|
8800
|
+
deletedAt: (0, import_mysql_core12.timestamp)("deletedAt", {
|
|
8613
8801
|
mode: "date",
|
|
8614
8802
|
fsp: 3
|
|
8615
8803
|
})
|
|
8616
|
-
}, (
|
|
8617
|
-
|
|
8618
|
-
columns: [
|
|
8619
|
-
crr.resourceOfId,
|
|
8620
|
-
crr.resourceId
|
|
8621
|
-
]
|
|
8622
|
-
}),
|
|
8623
|
-
contentResourceIdIdx: (0, import_mysql_core9.index)("contentResourceId_idx").on(crr.resourceOfId),
|
|
8624
|
-
resourceIdIdx: (0, import_mysql_core9.index)("resourceId_idx").on(crr.resourceId)
|
|
8804
|
+
}, (cc) => ({
|
|
8805
|
+
nameIdx: (0, import_mysql_core12.index)("name_idx").on(cc.name)
|
|
8625
8806
|
}));
|
|
8626
8807
|
}
|
|
8627
|
-
__name(
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8808
|
+
__name(getCommunicationChannelSchema, "getCommunicationChannelSchema");
|
|
8809
|
+
|
|
8810
|
+
// src/lib/mysql/schemas/communication/communication-preference-types.ts
|
|
8811
|
+
var import_mysql_core13 = require("drizzle-orm/mysql-core");
|
|
8812
|
+
function getCommunicationPreferenceTypesSchema(mysqlTable) {
|
|
8813
|
+
return mysqlTable("communicationPreferenceType", {
|
|
8814
|
+
id: (0, import_mysql_core13.varchar)("id", {
|
|
8815
|
+
length: 255
|
|
8816
|
+
}).notNull().primaryKey(),
|
|
8817
|
+
name: (0, import_mysql_core13.varchar)("name", {
|
|
8818
|
+
length: 255
|
|
8819
|
+
}).notNull(),
|
|
8820
|
+
description: (0, import_mysql_core13.text)("description"),
|
|
8821
|
+
active: (0, import_mysql_core13.boolean)("active").notNull().default(true),
|
|
8822
|
+
createdAt: (0, import_mysql_core13.timestamp)("createdAt", {
|
|
8823
|
+
mode: "date",
|
|
8824
|
+
fsp: 3
|
|
8825
|
+
}).defaultNow(),
|
|
8826
|
+
updatedAt: (0, import_mysql_core13.timestamp)("updatedAt", {
|
|
8827
|
+
mode: "date",
|
|
8828
|
+
fsp: 3
|
|
8640
8829
|
}),
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
],
|
|
8645
|
-
references: [
|
|
8646
|
-
contentResource.id
|
|
8647
|
-
],
|
|
8648
|
-
relationName: "resource"
|
|
8830
|
+
deletedAt: (0, import_mysql_core13.timestamp)("deletedAt", {
|
|
8831
|
+
mode: "date",
|
|
8832
|
+
fsp: 3
|
|
8649
8833
|
})
|
|
8650
|
-
})
|
|
8834
|
+
});
|
|
8651
8835
|
}
|
|
8652
|
-
__name(
|
|
8836
|
+
__name(getCommunicationPreferenceTypesSchema, "getCommunicationPreferenceTypesSchema");
|
|
8653
8837
|
|
|
8654
|
-
// src/lib/mysql/schemas/
|
|
8655
|
-
function
|
|
8656
|
-
return mysqlTable("
|
|
8657
|
-
id: (0,
|
|
8838
|
+
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
8839
|
+
function getCommunicationPreferencesSchema(mysqlTable) {
|
|
8840
|
+
return mysqlTable("communicationPreference", {
|
|
8841
|
+
id: (0, import_mysql_core14.varchar)("id", {
|
|
8658
8842
|
length: 255
|
|
8659
8843
|
}).notNull().primaryKey(),
|
|
8660
|
-
|
|
8844
|
+
userId: (0, import_mysql_core14.varchar)("userId", {
|
|
8661
8845
|
length: 255
|
|
8662
8846
|
}).notNull(),
|
|
8663
|
-
|
|
8847
|
+
channelId: (0, import_mysql_core14.varchar)("channelId", {
|
|
8664
8848
|
length: 255
|
|
8665
8849
|
}).notNull(),
|
|
8666
|
-
|
|
8667
|
-
|
|
8850
|
+
preferenceLevel: (0, import_mysql_core14.mysqlEnum)("preferenceLevel", [
|
|
8851
|
+
"low",
|
|
8852
|
+
"medium",
|
|
8853
|
+
"high"
|
|
8854
|
+
]).notNull().default("medium"),
|
|
8855
|
+
preferenceTypeId: (0, import_mysql_core14.varchar)("preferenceTypeId", {
|
|
8856
|
+
length: 255
|
|
8857
|
+
}).notNull(),
|
|
8858
|
+
active: (0, import_mysql_core14.boolean)("active").notNull().default(true),
|
|
8859
|
+
createdAt: (0, import_mysql_core14.timestamp)("createdAt", {
|
|
8860
|
+
mode: "date",
|
|
8861
|
+
fsp: 3
|
|
8862
|
+
}).defaultNow(),
|
|
8863
|
+
optInAt: (0, import_mysql_core14.timestamp)("optInAt", {
|
|
8668
8864
|
mode: "date",
|
|
8669
8865
|
fsp: 3
|
|
8670
|
-
})
|
|
8671
|
-
|
|
8866
|
+
}),
|
|
8867
|
+
optOutAt: (0, import_mysql_core14.timestamp)("optOutAt", {
|
|
8672
8868
|
mode: "date",
|
|
8673
8869
|
fsp: 3
|
|
8674
|
-
})
|
|
8675
|
-
|
|
8870
|
+
}),
|
|
8871
|
+
updatedAt: (0, import_mysql_core14.timestamp)("updatedAt", {
|
|
8872
|
+
mode: "date",
|
|
8873
|
+
fsp: 3
|
|
8874
|
+
}).defaultNow(),
|
|
8875
|
+
deletedAt: (0, import_mysql_core14.timestamp)("deletedAt", {
|
|
8676
8876
|
mode: "date",
|
|
8677
8877
|
fsp: 3
|
|
8678
8878
|
})
|
|
8679
|
-
}, (
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8879
|
+
}, (cp) => ({
|
|
8880
|
+
userIdIdx: (0, import_mysql_core14.index)("userId_idx").on(cp.userId),
|
|
8881
|
+
preferenceTypeIdx: (0, import_mysql_core14.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
8882
|
+
channelIdIdx: (0, import_mysql_core14.index)("channelId_idx").on(cp.channelId)
|
|
8683
8883
|
}));
|
|
8684
8884
|
}
|
|
8685
|
-
__name(
|
|
8686
|
-
function
|
|
8687
|
-
const
|
|
8885
|
+
__name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
|
|
8886
|
+
function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
8887
|
+
const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
|
|
8688
8888
|
const users = getUsersSchema(mysqlTable);
|
|
8689
|
-
const
|
|
8690
|
-
|
|
8691
|
-
|
|
8889
|
+
const communicationChannel = getCommunicationChannelSchema(mysqlTable);
|
|
8890
|
+
const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
|
|
8891
|
+
return (0, import_drizzle_orm11.relations)(communicationPreferences, ({ one }) => ({
|
|
8892
|
+
user: one(users, {
|
|
8692
8893
|
fields: [
|
|
8693
|
-
|
|
8894
|
+
communicationPreferences.userId
|
|
8694
8895
|
],
|
|
8695
8896
|
references: [
|
|
8696
8897
|
users.id
|
|
8697
8898
|
],
|
|
8698
8899
|
relationName: "user"
|
|
8699
8900
|
}),
|
|
8700
|
-
|
|
8701
|
-
|
|
8901
|
+
channel: one(communicationChannel, {
|
|
8902
|
+
fields: [
|
|
8903
|
+
communicationPreferences.channelId
|
|
8904
|
+
],
|
|
8905
|
+
references: [
|
|
8906
|
+
communicationChannel.id
|
|
8907
|
+
],
|
|
8908
|
+
relationName: "channel"
|
|
8702
8909
|
}),
|
|
8703
|
-
|
|
8704
|
-
|
|
8910
|
+
preferenceType: one(communicationPreferenceTypes, {
|
|
8911
|
+
fields: [
|
|
8912
|
+
communicationPreferences.preferenceTypeId
|
|
8913
|
+
],
|
|
8914
|
+
references: [
|
|
8915
|
+
communicationPreferenceTypes.id
|
|
8916
|
+
],
|
|
8917
|
+
relationName: "preferenceType"
|
|
8705
8918
|
})
|
|
8706
8919
|
}));
|
|
8707
8920
|
}
|
|
8708
|
-
__name(
|
|
8921
|
+
__name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
|
|
8922
|
+
|
|
8923
|
+
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
8924
|
+
var import_drizzle_orm13 = require("drizzle-orm");
|
|
8925
|
+
var import_mysql_core16 = require("drizzle-orm/mysql-core");
|
|
8709
8926
|
|
|
8710
8927
|
// src/lib/mysql/schemas/content/contribution-types.ts
|
|
8711
|
-
var
|
|
8712
|
-
var
|
|
8928
|
+
var import_drizzle_orm12 = require("drizzle-orm");
|
|
8929
|
+
var import_mysql_core15 = require("drizzle-orm/mysql-core");
|
|
8713
8930
|
function getContributionTypesSchema(mysqlTable) {
|
|
8714
8931
|
return mysqlTable("contributionType", {
|
|
8715
|
-
id: (0,
|
|
8932
|
+
id: (0, import_mysql_core15.varchar)("id", {
|
|
8716
8933
|
length: 255
|
|
8717
8934
|
}).notNull().primaryKey(),
|
|
8718
|
-
slug: (0,
|
|
8935
|
+
slug: (0, import_mysql_core15.varchar)("slug", {
|
|
8719
8936
|
length: 255
|
|
8720
8937
|
}).notNull().unique(),
|
|
8721
|
-
name: (0,
|
|
8938
|
+
name: (0, import_mysql_core15.varchar)("name", {
|
|
8722
8939
|
length: 255
|
|
8723
8940
|
}).notNull(),
|
|
8724
|
-
description: (0,
|
|
8725
|
-
active: (0,
|
|
8726
|
-
createdAt: (0,
|
|
8941
|
+
description: (0, import_mysql_core15.text)("description"),
|
|
8942
|
+
active: (0, import_mysql_core15.boolean)("active").notNull().default(true),
|
|
8943
|
+
createdAt: (0, import_mysql_core15.timestamp)("createdAt", {
|
|
8727
8944
|
mode: "date",
|
|
8728
8945
|
fsp: 3
|
|
8729
8946
|
}).defaultNow(),
|
|
8730
|
-
updatedAt: (0,
|
|
8947
|
+
updatedAt: (0, import_mysql_core15.timestamp)("updatedAt", {
|
|
8731
8948
|
mode: "date",
|
|
8732
8949
|
fsp: 3
|
|
8733
8950
|
}).defaultNow(),
|
|
8734
|
-
deletedAt: (0,
|
|
8951
|
+
deletedAt: (0, import_mysql_core15.timestamp)("deletedAt", {
|
|
8735
8952
|
mode: "date",
|
|
8736
8953
|
fsp: 3
|
|
8737
8954
|
})
|
|
8738
8955
|
}, (ct) => ({
|
|
8739
|
-
nameIdx: (0,
|
|
8740
|
-
slugIdx: (0,
|
|
8956
|
+
nameIdx: (0, import_mysql_core15.index)("name_idx").on(ct.name),
|
|
8957
|
+
slugIdx: (0, import_mysql_core15.index)("slug_idx").on(ct.slug)
|
|
8741
8958
|
}));
|
|
8742
8959
|
}
|
|
8743
8960
|
__name(getContributionTypesSchema, "getContributionTypesSchema");
|
|
8744
8961
|
function getContributionTypesRelationsSchema(mysqlTable) {
|
|
8745
8962
|
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
8746
|
-
return (0,
|
|
8963
|
+
return (0, import_drizzle_orm12.relations)(contributionTypes, ({ many }) => ({}));
|
|
8747
8964
|
}
|
|
8748
8965
|
__name(getContributionTypesRelationsSchema, "getContributionTypesRelationsSchema");
|
|
8749
8966
|
|
|
8750
8967
|
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
8751
8968
|
function getContentContributionsSchema(mysqlTable) {
|
|
8752
8969
|
return mysqlTable("contentContribution", {
|
|
8753
|
-
id: (0,
|
|
8970
|
+
id: (0, import_mysql_core16.varchar)("id", {
|
|
8754
8971
|
length: 255
|
|
8755
8972
|
}).notNull().primaryKey(),
|
|
8756
|
-
userId: (0,
|
|
8973
|
+
userId: (0, import_mysql_core16.varchar)("userId", {
|
|
8757
8974
|
length: 255
|
|
8758
8975
|
}).notNull(),
|
|
8759
|
-
contentId: (0,
|
|
8976
|
+
contentId: (0, import_mysql_core16.varchar)("contentId", {
|
|
8760
8977
|
length: 255
|
|
8761
8978
|
}).notNull(),
|
|
8762
|
-
contributionTypeId: (0,
|
|
8979
|
+
contributionTypeId: (0, import_mysql_core16.varchar)("contributionTypeId", {
|
|
8763
8980
|
length: 255
|
|
8764
8981
|
}).notNull(),
|
|
8765
|
-
active: (0,
|
|
8766
|
-
createdAt: (0,
|
|
8982
|
+
active: (0, import_mysql_core16.boolean)("active").notNull().default(true),
|
|
8983
|
+
createdAt: (0, import_mysql_core16.timestamp)("createdAt", {
|
|
8767
8984
|
mode: "date",
|
|
8768
8985
|
fsp: 3
|
|
8769
8986
|
}).defaultNow(),
|
|
8770
|
-
updatedAt: (0,
|
|
8987
|
+
updatedAt: (0, import_mysql_core16.timestamp)("updatedAt", {
|
|
8771
8988
|
mode: "date",
|
|
8772
8989
|
fsp: 3
|
|
8773
8990
|
}).defaultNow(),
|
|
8774
|
-
deletedAt: (0,
|
|
8991
|
+
deletedAt: (0, import_mysql_core16.timestamp)("deletedAt", {
|
|
8775
8992
|
mode: "date",
|
|
8776
8993
|
fsp: 3
|
|
8777
8994
|
})
|
|
8778
8995
|
}, (cc) => ({
|
|
8779
|
-
userIdIdx: (0,
|
|
8780
|
-
contentIdIdx: (0,
|
|
8781
|
-
contributionTypeIdIdx: (0,
|
|
8996
|
+
userIdIdx: (0, import_mysql_core16.index)("userId_idx").on(cc.userId),
|
|
8997
|
+
contentIdIdx: (0, import_mysql_core16.index)("contentId_idx").on(cc.contentId),
|
|
8998
|
+
contributionTypeIdIdx: (0, import_mysql_core16.index)("contributionTypeId_idx").on(cc.contributionTypeId)
|
|
8782
8999
|
}));
|
|
8783
9000
|
}
|
|
8784
9001
|
__name(getContentContributionsSchema, "getContentContributionsSchema");
|
|
@@ -8787,7 +9004,7 @@ function getContentContributionRelationsSchema(mysqlTable) {
|
|
|
8787
9004
|
const users = getUsersSchema(mysqlTable);
|
|
8788
9005
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8789
9006
|
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
8790
|
-
return (0,
|
|
9007
|
+
return (0, import_drizzle_orm13.relations)(contentContributions, ({ one }) => ({
|
|
8791
9008
|
user: one(users, {
|
|
8792
9009
|
fields: [
|
|
8793
9010
|
contentContributions.userId
|
|
@@ -8820,75 +9037,75 @@ function getContentContributionRelationsSchema(mysqlTable) {
|
|
|
8820
9037
|
__name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
|
|
8821
9038
|
|
|
8822
9039
|
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
8823
|
-
var
|
|
8824
|
-
var
|
|
9040
|
+
var import_drizzle_orm15 = require("drizzle-orm");
|
|
9041
|
+
var import_mysql_core18 = require("drizzle-orm/mysql-core");
|
|
8825
9042
|
|
|
8826
9043
|
// src/lib/mysql/schemas/auth/permissions.ts
|
|
8827
|
-
var
|
|
8828
|
-
var
|
|
9044
|
+
var import_drizzle_orm14 = require("drizzle-orm");
|
|
9045
|
+
var import_mysql_core17 = require("drizzle-orm/mysql-core");
|
|
8829
9046
|
function getPermissionsSchema(mysqlTable) {
|
|
8830
9047
|
return mysqlTable("permission", {
|
|
8831
|
-
id: (0,
|
|
9048
|
+
id: (0, import_mysql_core17.varchar)("id", {
|
|
8832
9049
|
length: 255
|
|
8833
9050
|
}).notNull().primaryKey(),
|
|
8834
|
-
name: (0,
|
|
9051
|
+
name: (0, import_mysql_core17.varchar)("name", {
|
|
8835
9052
|
length: 255
|
|
8836
9053
|
}).notNull().unique(),
|
|
8837
|
-
description: (0,
|
|
8838
|
-
active: (0,
|
|
8839
|
-
createdAt: (0,
|
|
9054
|
+
description: (0, import_mysql_core17.text)("description"),
|
|
9055
|
+
active: (0, import_mysql_core17.boolean)("active").notNull().default(true),
|
|
9056
|
+
createdAt: (0, import_mysql_core17.timestamp)("createdAt", {
|
|
8840
9057
|
mode: "date",
|
|
8841
9058
|
fsp: 3
|
|
8842
9059
|
}).defaultNow(),
|
|
8843
|
-
updatedAt: (0,
|
|
9060
|
+
updatedAt: (0, import_mysql_core17.timestamp)("updatedAt", {
|
|
8844
9061
|
mode: "date",
|
|
8845
9062
|
fsp: 3
|
|
8846
9063
|
}).defaultNow(),
|
|
8847
|
-
deletedAt: (0,
|
|
9064
|
+
deletedAt: (0, import_mysql_core17.timestamp)("deletedAt", {
|
|
8848
9065
|
mode: "date",
|
|
8849
9066
|
fsp: 3
|
|
8850
9067
|
})
|
|
8851
9068
|
}, (permission) => ({
|
|
8852
|
-
nameIdx: (0,
|
|
9069
|
+
nameIdx: (0, import_mysql_core17.index)("name_idx").on(permission.name)
|
|
8853
9070
|
}));
|
|
8854
9071
|
}
|
|
8855
9072
|
__name(getPermissionsSchema, "getPermissionsSchema");
|
|
8856
9073
|
function getPermissionsRelationsSchema(mysqlTable) {
|
|
8857
|
-
return (0,
|
|
9074
|
+
return (0, import_drizzle_orm14.relations)(getPermissionsSchema(mysqlTable), ({ many }) => ({}));
|
|
8858
9075
|
}
|
|
8859
9076
|
__name(getPermissionsRelationsSchema, "getPermissionsRelationsSchema");
|
|
8860
9077
|
|
|
8861
9078
|
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
8862
9079
|
function getUserPermissionsSchema(mysqlTable) {
|
|
8863
9080
|
return mysqlTable("userPermission", {
|
|
8864
|
-
userId: (0,
|
|
9081
|
+
userId: (0, import_mysql_core18.varchar)("userId", {
|
|
8865
9082
|
length: 255
|
|
8866
9083
|
}).notNull(),
|
|
8867
|
-
permissionId: (0,
|
|
9084
|
+
permissionId: (0, import_mysql_core18.varchar)("permissionId", {
|
|
8868
9085
|
length: 255
|
|
8869
9086
|
}).notNull(),
|
|
8870
|
-
active: (0,
|
|
8871
|
-
createdAt: (0,
|
|
9087
|
+
active: (0, import_mysql_core18.boolean)("active").notNull().default(true),
|
|
9088
|
+
createdAt: (0, import_mysql_core18.timestamp)("createdAt", {
|
|
8872
9089
|
mode: "date",
|
|
8873
9090
|
fsp: 3
|
|
8874
9091
|
}).defaultNow(),
|
|
8875
|
-
updatedAt: (0,
|
|
9092
|
+
updatedAt: (0, import_mysql_core18.timestamp)("updatedAt", {
|
|
8876
9093
|
mode: "date",
|
|
8877
9094
|
fsp: 3
|
|
8878
9095
|
}).defaultNow(),
|
|
8879
|
-
deletedAt: (0,
|
|
9096
|
+
deletedAt: (0, import_mysql_core18.timestamp)("deletedAt", {
|
|
8880
9097
|
mode: "date",
|
|
8881
9098
|
fsp: 3
|
|
8882
9099
|
})
|
|
8883
9100
|
}, (up) => ({
|
|
8884
|
-
pk: (0,
|
|
9101
|
+
pk: (0, import_mysql_core18.primaryKey)({
|
|
8885
9102
|
columns: [
|
|
8886
9103
|
up.userId,
|
|
8887
9104
|
up.permissionId
|
|
8888
9105
|
]
|
|
8889
9106
|
}),
|
|
8890
|
-
userIdIdx: (0,
|
|
8891
|
-
permissionIdIdx: (0,
|
|
9107
|
+
userIdIdx: (0, import_mysql_core18.index)("userId_idx").on(up.userId),
|
|
9108
|
+
permissionIdIdx: (0, import_mysql_core18.index)("permissionId_idx").on(up.permissionId)
|
|
8892
9109
|
}));
|
|
8893
9110
|
}
|
|
8894
9111
|
__name(getUserPermissionsSchema, "getUserPermissionsSchema");
|
|
@@ -8896,7 +9113,7 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
8896
9113
|
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
8897
9114
|
const users = getUsersSchema(mysqlTable);
|
|
8898
9115
|
const permissions = getPermissionsSchema(mysqlTable);
|
|
8899
|
-
return (0,
|
|
9116
|
+
return (0, import_drizzle_orm15.relations)(userPermissions, ({ one }) => ({
|
|
8900
9117
|
user: one(users, {
|
|
8901
9118
|
fields: [
|
|
8902
9119
|
userPermissions.userId
|
|
@@ -8920,43 +9137,43 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
8920
9137
|
__name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
|
|
8921
9138
|
|
|
8922
9139
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
8923
|
-
var
|
|
8924
|
-
var
|
|
9140
|
+
var import_drizzle_orm17 = require("drizzle-orm");
|
|
9141
|
+
var import_mysql_core20 = require("drizzle-orm/mysql-core");
|
|
8925
9142
|
|
|
8926
9143
|
// src/lib/mysql/schemas/auth/roles.ts
|
|
8927
|
-
var
|
|
8928
|
-
var
|
|
9144
|
+
var import_drizzle_orm16 = require("drizzle-orm");
|
|
9145
|
+
var import_mysql_core19 = require("drizzle-orm/mysql-core");
|
|
8929
9146
|
function getRolesSchema(mysqlTable) {
|
|
8930
9147
|
return mysqlTable("role", {
|
|
8931
|
-
id: (0,
|
|
9148
|
+
id: (0, import_mysql_core19.varchar)("id", {
|
|
8932
9149
|
length: 255
|
|
8933
9150
|
}).notNull().primaryKey(),
|
|
8934
|
-
name: (0,
|
|
9151
|
+
name: (0, import_mysql_core19.varchar)("name", {
|
|
8935
9152
|
length: 255
|
|
8936
9153
|
}).notNull().unique(),
|
|
8937
|
-
description: (0,
|
|
8938
|
-
active: (0,
|
|
8939
|
-
createdAt: (0,
|
|
9154
|
+
description: (0, import_mysql_core19.text)("description"),
|
|
9155
|
+
active: (0, import_mysql_core19.boolean)("active").notNull().default(true),
|
|
9156
|
+
createdAt: (0, import_mysql_core19.timestamp)("createdAt", {
|
|
8940
9157
|
mode: "date",
|
|
8941
9158
|
fsp: 3
|
|
8942
9159
|
}).defaultNow(),
|
|
8943
|
-
updatedAt: (0,
|
|
9160
|
+
updatedAt: (0, import_mysql_core19.timestamp)("updatedAt", {
|
|
8944
9161
|
mode: "date",
|
|
8945
9162
|
fsp: 3
|
|
8946
9163
|
}).defaultNow(),
|
|
8947
|
-
deletedAt: (0,
|
|
9164
|
+
deletedAt: (0, import_mysql_core19.timestamp)("deletedAt", {
|
|
8948
9165
|
mode: "date",
|
|
8949
9166
|
fsp: 3
|
|
8950
9167
|
})
|
|
8951
9168
|
}, (role) => ({
|
|
8952
|
-
nameIdx: (0,
|
|
9169
|
+
nameIdx: (0, import_mysql_core19.index)("name_idx").on(role.name)
|
|
8953
9170
|
}));
|
|
8954
9171
|
}
|
|
8955
9172
|
__name(getRolesSchema, "getRolesSchema");
|
|
8956
9173
|
function getRolesRelationsSchema(mysqlTable) {
|
|
8957
9174
|
const roles = getRolesSchema(mysqlTable);
|
|
8958
9175
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
8959
|
-
return (0,
|
|
9176
|
+
return (0, import_drizzle_orm16.relations)(roles, ({ many }) => ({
|
|
8960
9177
|
userRoles: many(userRoles, {
|
|
8961
9178
|
relationName: "role"
|
|
8962
9179
|
})
|
|
@@ -8967,34 +9184,34 @@ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
|
|
|
8967
9184
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
8968
9185
|
function getUserRolesSchema(mysqlTable) {
|
|
8969
9186
|
return mysqlTable("userRole", {
|
|
8970
|
-
userId: (0,
|
|
9187
|
+
userId: (0, import_mysql_core20.varchar)("userId", {
|
|
8971
9188
|
length: 255
|
|
8972
9189
|
}).notNull(),
|
|
8973
|
-
roleId: (0,
|
|
9190
|
+
roleId: (0, import_mysql_core20.varchar)("roleId", {
|
|
8974
9191
|
length: 255
|
|
8975
9192
|
}).notNull(),
|
|
8976
|
-
active: (0,
|
|
8977
|
-
createdAt: (0,
|
|
9193
|
+
active: (0, import_mysql_core20.boolean)("active").notNull().default(true),
|
|
9194
|
+
createdAt: (0, import_mysql_core20.timestamp)("createdAt", {
|
|
8978
9195
|
mode: "date",
|
|
8979
9196
|
fsp: 3
|
|
8980
9197
|
}).defaultNow(),
|
|
8981
|
-
updatedAt: (0,
|
|
9198
|
+
updatedAt: (0, import_mysql_core20.timestamp)("updatedAt", {
|
|
8982
9199
|
mode: "date",
|
|
8983
9200
|
fsp: 3
|
|
8984
9201
|
}).defaultNow(),
|
|
8985
|
-
deletedAt: (0,
|
|
9202
|
+
deletedAt: (0, import_mysql_core20.timestamp)("deletedAt", {
|
|
8986
9203
|
mode: "date",
|
|
8987
9204
|
fsp: 3
|
|
8988
9205
|
})
|
|
8989
9206
|
}, (ur) => ({
|
|
8990
|
-
pk: (0,
|
|
9207
|
+
pk: (0, import_mysql_core20.primaryKey)({
|
|
8991
9208
|
columns: [
|
|
8992
9209
|
ur.userId,
|
|
8993
9210
|
ur.roleId
|
|
8994
9211
|
]
|
|
8995
9212
|
}),
|
|
8996
|
-
userIdIdx: (0,
|
|
8997
|
-
roleIdIdx: (0,
|
|
9213
|
+
userIdIdx: (0, import_mysql_core20.index)("userId_idx").on(ur.userId),
|
|
9214
|
+
roleIdIdx: (0, import_mysql_core20.index)("roleId_idx").on(ur.roleId)
|
|
8998
9215
|
}));
|
|
8999
9216
|
}
|
|
9000
9217
|
__name(getUserRolesSchema, "getUserRolesSchema");
|
|
@@ -9002,7 +9219,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
|
|
|
9002
9219
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
9003
9220
|
const users = getUsersSchema(mysqlTable);
|
|
9004
9221
|
const roles = getRolesSchema(mysqlTable);
|
|
9005
|
-
return (0,
|
|
9222
|
+
return (0, import_drizzle_orm17.relations)(userRoles, ({ one }) => ({
|
|
9006
9223
|
user: one(users, {
|
|
9007
9224
|
fields: [
|
|
9008
9225
|
userRoles.userId
|
|
@@ -9010,7 +9227,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
|
|
|
9010
9227
|
references: [
|
|
9011
9228
|
users.id
|
|
9012
9229
|
],
|
|
9013
|
-
relationName: "
|
|
9230
|
+
relationName: "user"
|
|
9014
9231
|
}),
|
|
9015
9232
|
role: one(roles, {
|
|
9016
9233
|
fields: [
|
|
@@ -9019,7 +9236,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
|
|
|
9019
9236
|
references: [
|
|
9020
9237
|
roles.id
|
|
9021
9238
|
],
|
|
9022
|
-
relationName: "
|
|
9239
|
+
relationName: "role"
|
|
9023
9240
|
})
|
|
9024
9241
|
}));
|
|
9025
9242
|
}
|
|
@@ -9028,34 +9245,34 @@ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
|
|
|
9028
9245
|
// src/lib/mysql/schemas/auth/users.ts
|
|
9029
9246
|
function getUsersSchema(mysqlTable) {
|
|
9030
9247
|
return mysqlTable("user", {
|
|
9031
|
-
id: (0,
|
|
9248
|
+
id: (0, import_mysql_core21.varchar)("id", {
|
|
9032
9249
|
length: 255
|
|
9033
9250
|
}).notNull().primaryKey(),
|
|
9034
|
-
name: (0,
|
|
9251
|
+
name: (0, import_mysql_core21.varchar)("name", {
|
|
9035
9252
|
length: 255
|
|
9036
9253
|
}),
|
|
9037
|
-
role: (0,
|
|
9254
|
+
role: (0, import_mysql_core21.mysqlEnum)("role", [
|
|
9038
9255
|
"user",
|
|
9039
9256
|
"admin"
|
|
9040
9257
|
]).default("user"),
|
|
9041
|
-
email: (0,
|
|
9258
|
+
email: (0, import_mysql_core21.varchar)("email", {
|
|
9042
9259
|
length: 255
|
|
9043
9260
|
}).notNull().unique(),
|
|
9044
|
-
emailVerified: (0,
|
|
9261
|
+
emailVerified: (0, import_mysql_core21.timestamp)("emailVerified", {
|
|
9045
9262
|
mode: "date",
|
|
9046
9263
|
fsp: 3
|
|
9047
9264
|
}),
|
|
9048
|
-
image: (0,
|
|
9265
|
+
image: (0, import_mysql_core21.varchar)("image", {
|
|
9049
9266
|
length: 255
|
|
9050
9267
|
}),
|
|
9051
|
-
createdAt: (0,
|
|
9268
|
+
createdAt: (0, import_mysql_core21.timestamp)("createdAt", {
|
|
9052
9269
|
mode: "date",
|
|
9053
9270
|
fsp: 3
|
|
9054
|
-
}).default(
|
|
9271
|
+
}).default(import_drizzle_orm18.sql`CURRENT_TIMESTAMP(3)`)
|
|
9055
9272
|
}, (user) => ({
|
|
9056
|
-
emailIdx: (0,
|
|
9057
|
-
roleIdx: (0,
|
|
9058
|
-
createdAtIdx: (0,
|
|
9273
|
+
emailIdx: (0, import_mysql_core21.index)("email_idx").on(user.email),
|
|
9274
|
+
roleIdx: (0, import_mysql_core21.index)("role_idx").on(user.role),
|
|
9275
|
+
createdAtIdx: (0, import_mysql_core21.index)("created_at_idx").on(user.createdAt)
|
|
9059
9276
|
}));
|
|
9060
9277
|
}
|
|
9061
9278
|
__name(getUsersSchema, "getUsersSchema");
|
|
@@ -9068,7 +9285,7 @@ function getUsersRelationsSchema(mysqlTable) {
|
|
|
9068
9285
|
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
9069
9286
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
9070
9287
|
const purchases = getPurchaseSchema(mysqlTable);
|
|
9071
|
-
return (0,
|
|
9288
|
+
return (0, import_drizzle_orm18.relations)(users, ({ many }) => ({
|
|
9072
9289
|
accounts: many(accounts, {
|
|
9073
9290
|
relationName: "user"
|
|
9074
9291
|
}),
|
|
@@ -9097,49 +9314,49 @@ __name(getUsersRelationsSchema, "getUsersRelationsSchema");
|
|
|
9097
9314
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
9098
9315
|
function getAccountsSchema(mysqlTable) {
|
|
9099
9316
|
return mysqlTable("account", {
|
|
9100
|
-
userId: (0,
|
|
9317
|
+
userId: (0, import_mysql_core22.varchar)("userId", {
|
|
9101
9318
|
length: 255
|
|
9102
9319
|
}).notNull(),
|
|
9103
|
-
type: (0,
|
|
9320
|
+
type: (0, import_mysql_core22.varchar)("type", {
|
|
9104
9321
|
length: 255
|
|
9105
9322
|
}).$type().notNull(),
|
|
9106
|
-
provider: (0,
|
|
9323
|
+
provider: (0, import_mysql_core22.varchar)("provider", {
|
|
9107
9324
|
length: 255
|
|
9108
9325
|
}).notNull(),
|
|
9109
|
-
providerAccountId: (0,
|
|
9326
|
+
providerAccountId: (0, import_mysql_core22.varchar)("providerAccountId", {
|
|
9110
9327
|
length: 255
|
|
9111
9328
|
}).notNull(),
|
|
9112
|
-
refresh_token: (0,
|
|
9113
|
-
access_token: (0,
|
|
9114
|
-
oauth_token: (0,
|
|
9115
|
-
oauth_token_secret: (0,
|
|
9116
|
-
expires_at: (0,
|
|
9117
|
-
token_type: (0,
|
|
9329
|
+
refresh_token: (0, import_mysql_core22.text)("refresh_token"),
|
|
9330
|
+
access_token: (0, import_mysql_core22.text)("access_token"),
|
|
9331
|
+
oauth_token: (0, import_mysql_core22.text)("oauth_token"),
|
|
9332
|
+
oauth_token_secret: (0, import_mysql_core22.text)("oauth_token_secret"),
|
|
9333
|
+
expires_at: (0, import_mysql_core22.int)("expires_at"),
|
|
9334
|
+
token_type: (0, import_mysql_core22.varchar)("token_type", {
|
|
9118
9335
|
length: 255
|
|
9119
9336
|
}),
|
|
9120
|
-
scope: (0,
|
|
9337
|
+
scope: (0, import_mysql_core22.varchar)("scope", {
|
|
9121
9338
|
length: 255
|
|
9122
9339
|
}),
|
|
9123
|
-
id_token: (0,
|
|
9124
|
-
session_state: (0,
|
|
9340
|
+
id_token: (0, import_mysql_core22.text)("id_token"),
|
|
9341
|
+
session_state: (0, import_mysql_core22.varchar)("session_state", {
|
|
9125
9342
|
length: 255
|
|
9126
9343
|
}),
|
|
9127
|
-
refresh_token_expires_in: (0,
|
|
9344
|
+
refresh_token_expires_in: (0, import_mysql_core22.int)("refresh_token_expires_in")
|
|
9128
9345
|
}, (account) => ({
|
|
9129
|
-
pk: (0,
|
|
9346
|
+
pk: (0, import_mysql_core22.primaryKey)({
|
|
9130
9347
|
columns: [
|
|
9131
9348
|
account.provider,
|
|
9132
9349
|
account.providerAccountId
|
|
9133
9350
|
]
|
|
9134
9351
|
}),
|
|
9135
|
-
userIdIdx: (0,
|
|
9352
|
+
userIdIdx: (0, import_mysql_core22.index)("userId_idx").on(account.userId)
|
|
9136
9353
|
}));
|
|
9137
9354
|
}
|
|
9138
9355
|
__name(getAccountsSchema, "getAccountsSchema");
|
|
9139
9356
|
function getAccountsRelationsSchema(mysqlTable) {
|
|
9140
9357
|
const accounts = getAccountsSchema(mysqlTable);
|
|
9141
9358
|
const users = getUsersSchema(mysqlTable);
|
|
9142
|
-
return (0,
|
|
9359
|
+
return (0, import_drizzle_orm19.relations)(accounts, ({ one }) => ({
|
|
9143
9360
|
user: one(users, {
|
|
9144
9361
|
fields: [
|
|
9145
9362
|
accounts.userId
|
|
@@ -9154,38 +9371,38 @@ function getAccountsRelationsSchema(mysqlTable) {
|
|
|
9154
9371
|
__name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
|
|
9155
9372
|
|
|
9156
9373
|
// src/lib/mysql/schemas/auth/role-permissions.ts
|
|
9157
|
-
var
|
|
9158
|
-
var
|
|
9374
|
+
var import_drizzle_orm20 = require("drizzle-orm");
|
|
9375
|
+
var import_mysql_core23 = require("drizzle-orm/mysql-core");
|
|
9159
9376
|
function getRolePermissionsSchema(mysqlTable) {
|
|
9160
9377
|
return mysqlTable("rolePermission", {
|
|
9161
|
-
roleId: (0,
|
|
9378
|
+
roleId: (0, import_mysql_core23.varchar)("roleId", {
|
|
9162
9379
|
length: 255
|
|
9163
9380
|
}).notNull(),
|
|
9164
|
-
permissionId: (0,
|
|
9381
|
+
permissionId: (0, import_mysql_core23.varchar)("permissionId", {
|
|
9165
9382
|
length: 255
|
|
9166
9383
|
}).notNull(),
|
|
9167
|
-
active: (0,
|
|
9168
|
-
createdAt: (0,
|
|
9384
|
+
active: (0, import_mysql_core23.boolean)("active").notNull().default(true),
|
|
9385
|
+
createdAt: (0, import_mysql_core23.timestamp)("createdAt", {
|
|
9169
9386
|
mode: "date",
|
|
9170
9387
|
fsp: 3
|
|
9171
9388
|
}).defaultNow(),
|
|
9172
|
-
updatedAt: (0,
|
|
9389
|
+
updatedAt: (0, import_mysql_core23.timestamp)("updatedAt", {
|
|
9173
9390
|
mode: "date",
|
|
9174
9391
|
fsp: 3
|
|
9175
9392
|
}).defaultNow(),
|
|
9176
|
-
deletedAt: (0,
|
|
9393
|
+
deletedAt: (0, import_mysql_core23.timestamp)("deletedAt", {
|
|
9177
9394
|
mode: "date",
|
|
9178
9395
|
fsp: 3
|
|
9179
9396
|
})
|
|
9180
9397
|
}, (rp) => ({
|
|
9181
|
-
pk: (0,
|
|
9398
|
+
pk: (0, import_mysql_core23.primaryKey)({
|
|
9182
9399
|
columns: [
|
|
9183
9400
|
rp.roleId,
|
|
9184
9401
|
rp.permissionId
|
|
9185
9402
|
]
|
|
9186
9403
|
}),
|
|
9187
|
-
roleIdIdx: (0,
|
|
9188
|
-
permissionIdIdx: (0,
|
|
9404
|
+
roleIdIdx: (0, import_mysql_core23.index)("roleId_idx").on(rp.roleId),
|
|
9405
|
+
permissionIdIdx: (0, import_mysql_core23.index)("permissionId_idx").on(rp.permissionId)
|
|
9189
9406
|
}));
|
|
9190
9407
|
}
|
|
9191
9408
|
__name(getRolePermissionsSchema, "getRolePermissionsSchema");
|
|
@@ -9193,7 +9410,7 @@ function getRolePermissionsRelationsSchema(mysqlTable) {
|
|
|
9193
9410
|
const permissions = getPermissionsSchema(mysqlTable);
|
|
9194
9411
|
const roles = getRolesSchema(mysqlTable);
|
|
9195
9412
|
const rolePermissions = getRolePermissionsSchema(mysqlTable);
|
|
9196
|
-
return (0,
|
|
9413
|
+
return (0, import_drizzle_orm20.relations)(rolePermissions, ({ one }) => ({
|
|
9197
9414
|
role: one(roles, {
|
|
9198
9415
|
fields: [
|
|
9199
9416
|
rolePermissions.roleId
|
|
@@ -9217,28 +9434,28 @@ function getRolePermissionsRelationsSchema(mysqlTable) {
|
|
|
9217
9434
|
__name(getRolePermissionsRelationsSchema, "getRolePermissionsRelationsSchema");
|
|
9218
9435
|
|
|
9219
9436
|
// src/lib/mysql/schemas/auth/sessions.ts
|
|
9220
|
-
var
|
|
9221
|
-
var
|
|
9437
|
+
var import_drizzle_orm21 = require("drizzle-orm");
|
|
9438
|
+
var import_mysql_core24 = require("drizzle-orm/mysql-core");
|
|
9222
9439
|
function getSessionsSchema(mysqlTable) {
|
|
9223
9440
|
return mysqlTable("session", {
|
|
9224
|
-
sessionToken: (0,
|
|
9441
|
+
sessionToken: (0, import_mysql_core24.varchar)("sessionToken", {
|
|
9225
9442
|
length: 255
|
|
9226
9443
|
}).notNull().primaryKey(),
|
|
9227
|
-
userId: (0,
|
|
9444
|
+
userId: (0, import_mysql_core24.varchar)("userId", {
|
|
9228
9445
|
length: 255
|
|
9229
9446
|
}).notNull(),
|
|
9230
|
-
expires: (0,
|
|
9447
|
+
expires: (0, import_mysql_core24.timestamp)("expires", {
|
|
9231
9448
|
mode: "date"
|
|
9232
9449
|
}).notNull()
|
|
9233
9450
|
}, (session) => ({
|
|
9234
|
-
userIdIdx: (0,
|
|
9451
|
+
userIdIdx: (0, import_mysql_core24.index)("userId_idx").on(session.userId)
|
|
9235
9452
|
}));
|
|
9236
9453
|
}
|
|
9237
9454
|
__name(getSessionsSchema, "getSessionsSchema");
|
|
9238
9455
|
function getSessionRelationsSchema(mysqlTable) {
|
|
9239
9456
|
const sessions = getSessionsSchema(mysqlTable);
|
|
9240
9457
|
const users = getUsersSchema(mysqlTable);
|
|
9241
|
-
return (0,
|
|
9458
|
+
return (0, import_drizzle_orm21.relations)(sessions, ({ one }) => ({
|
|
9242
9459
|
user: one(users, {
|
|
9243
9460
|
fields: [
|
|
9244
9461
|
sessions.userId
|
|
@@ -9253,24 +9470,24 @@ function getSessionRelationsSchema(mysqlTable) {
|
|
|
9253
9470
|
__name(getSessionRelationsSchema, "getSessionRelationsSchema");
|
|
9254
9471
|
|
|
9255
9472
|
// src/lib/mysql/schemas/auth/verification-tokens.ts
|
|
9256
|
-
var
|
|
9473
|
+
var import_mysql_core25 = require("drizzle-orm/mysql-core");
|
|
9257
9474
|
function getVerificationTokensSchema(mysqlTable) {
|
|
9258
9475
|
return mysqlTable("verificationToken", {
|
|
9259
|
-
identifier: (0,
|
|
9476
|
+
identifier: (0, import_mysql_core25.varchar)("identifier", {
|
|
9260
9477
|
length: 255
|
|
9261
9478
|
}).notNull(),
|
|
9262
|
-
token: (0,
|
|
9479
|
+
token: (0, import_mysql_core25.varchar)("token", {
|
|
9263
9480
|
length: 255
|
|
9264
9481
|
}).notNull(),
|
|
9265
|
-
expires: (0,
|
|
9482
|
+
expires: (0, import_mysql_core25.timestamp)("expires", {
|
|
9266
9483
|
mode: "date"
|
|
9267
9484
|
}).notNull(),
|
|
9268
|
-
createdAt: (0,
|
|
9485
|
+
createdAt: (0, import_mysql_core25.timestamp)("createdAt", {
|
|
9269
9486
|
mode: "date",
|
|
9270
9487
|
fsp: 3
|
|
9271
9488
|
}).defaultNow()
|
|
9272
9489
|
}, (vt) => ({
|
|
9273
|
-
pk: (0,
|
|
9490
|
+
pk: (0, import_mysql_core25.primaryKey)({
|
|
9274
9491
|
columns: [
|
|
9275
9492
|
vt.identifier,
|
|
9276
9493
|
vt.token
|
|
@@ -9281,27 +9498,27 @@ function getVerificationTokensSchema(mysqlTable) {
|
|
|
9281
9498
|
__name(getVerificationTokensSchema, "getVerificationTokensSchema");
|
|
9282
9499
|
|
|
9283
9500
|
// src/lib/mysql/schemas/commerce/merchant-account.ts
|
|
9284
|
-
var
|
|
9285
|
-
var
|
|
9501
|
+
var import_drizzle_orm22 = require("drizzle-orm");
|
|
9502
|
+
var import_mysql_core26 = require("drizzle-orm/mysql-core");
|
|
9286
9503
|
function getMerchantAccountSchema(mysqlTable) {
|
|
9287
9504
|
return mysqlTable("merchantAccounts", {
|
|
9288
|
-
id: (0,
|
|
9505
|
+
id: (0, import_mysql_core26.varchar)("id", {
|
|
9289
9506
|
length: 191
|
|
9290
9507
|
}).notNull(),
|
|
9291
|
-
status: (0,
|
|
9292
|
-
createdAt: (0,
|
|
9508
|
+
status: (0, import_mysql_core26.int)("status").default(0).notNull(),
|
|
9509
|
+
createdAt: (0, import_mysql_core26.timestamp)("createdAt", {
|
|
9293
9510
|
mode: "date",
|
|
9294
9511
|
fsp: 3
|
|
9295
|
-
}).default(
|
|
9296
|
-
label: (0,
|
|
9512
|
+
}).default(import_drizzle_orm22.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9513
|
+
label: (0, import_mysql_core26.varchar)("label", {
|
|
9297
9514
|
length: 191
|
|
9298
9515
|
}),
|
|
9299
|
-
identifier: (0,
|
|
9516
|
+
identifier: (0, import_mysql_core26.varchar)("identifier", {
|
|
9300
9517
|
length: 191
|
|
9301
9518
|
})
|
|
9302
9519
|
}, (table) => {
|
|
9303
9520
|
return {
|
|
9304
|
-
merchantAccountId: (0,
|
|
9521
|
+
merchantAccountId: (0, import_mysql_core26.primaryKey)({
|
|
9305
9522
|
columns: [
|
|
9306
9523
|
table.id
|
|
9307
9524
|
],
|
|
@@ -9313,197 +9530,85 @@ function getMerchantAccountSchema(mysqlTable) {
|
|
|
9313
9530
|
__name(getMerchantAccountSchema, "getMerchantAccountSchema");
|
|
9314
9531
|
|
|
9315
9532
|
// src/lib/mysql/schemas/commerce/merchant-coupon.ts
|
|
9316
|
-
var
|
|
9533
|
+
var import_mysql_core27 = require("drizzle-orm/mysql-core");
|
|
9317
9534
|
function getMerchantCouponSchema(mysqlTable) {
|
|
9318
9535
|
return mysqlTable("merchantCoupons", {
|
|
9319
|
-
id: (0,
|
|
9536
|
+
id: (0, import_mysql_core27.varchar)("id", {
|
|
9320
9537
|
length: 191
|
|
9321
9538
|
}).notNull(),
|
|
9322
|
-
identifier: (0,
|
|
9539
|
+
identifier: (0, import_mysql_core27.varchar)("identifier", {
|
|
9323
9540
|
length: 191
|
|
9324
9541
|
}),
|
|
9325
|
-
status: (0,
|
|
9326
|
-
merchantAccountId: (0,
|
|
9542
|
+
status: (0, import_mysql_core27.int)("status").default(0).notNull(),
|
|
9543
|
+
merchantAccountId: (0, import_mysql_core27.varchar)("merchantAccountId", {
|
|
9327
9544
|
length: 191
|
|
9328
9545
|
}).notNull(),
|
|
9329
|
-
percentageDiscount: (0,
|
|
9546
|
+
percentageDiscount: (0, import_mysql_core27.decimal)("percentageDiscount", {
|
|
9330
9547
|
precision: 3,
|
|
9331
9548
|
scale: 2
|
|
9332
9549
|
}).notNull(),
|
|
9333
|
-
type: (0,
|
|
9550
|
+
type: (0, import_mysql_core27.varchar)("type", {
|
|
9334
9551
|
length: 191
|
|
9335
9552
|
})
|
|
9336
9553
|
}, (table) => {
|
|
9337
9554
|
return {
|
|
9338
|
-
merchantCouponId: (0,
|
|
9555
|
+
merchantCouponId: (0, import_mysql_core27.primaryKey)({
|
|
9339
9556
|
columns: [
|
|
9340
9557
|
table.id
|
|
9341
9558
|
],
|
|
9342
9559
|
name: "MerchantCoupon_id"
|
|
9343
9560
|
}),
|
|
9344
|
-
merchantCouponIdentifierKey: (0,
|
|
9561
|
+
merchantCouponIdentifierKey: (0, import_mysql_core27.unique)("MerchantCoupon_identifier_key").on(table.identifier)
|
|
9345
9562
|
};
|
|
9346
9563
|
});
|
|
9347
9564
|
}
|
|
9348
9565
|
__name(getMerchantCouponSchema, "getMerchantCouponSchema");
|
|
9349
9566
|
|
|
9350
9567
|
// src/lib/mysql/schemas/commerce/merchant-customer.ts
|
|
9351
|
-
var
|
|
9352
|
-
var
|
|
9568
|
+
var import_drizzle_orm23 = require("drizzle-orm");
|
|
9569
|
+
var import_mysql_core28 = require("drizzle-orm/mysql-core");
|
|
9353
9570
|
function getMerchantCustomerSchema(mysqlTable) {
|
|
9354
9571
|
return mysqlTable("merchantCustomers", {
|
|
9355
|
-
id: (0,
|
|
9572
|
+
id: (0, import_mysql_core28.varchar)("id", {
|
|
9356
9573
|
length: 191
|
|
9357
9574
|
}).notNull(),
|
|
9358
|
-
userId: (0,
|
|
9575
|
+
userId: (0, import_mysql_core28.varchar)("userId", {
|
|
9359
9576
|
length: 191
|
|
9360
9577
|
}).notNull(),
|
|
9361
|
-
merchantAccountId: (0,
|
|
9578
|
+
merchantAccountId: (0, import_mysql_core28.varchar)("merchantAccountId", {
|
|
9362
9579
|
length: 191
|
|
9363
9580
|
}).notNull(),
|
|
9364
|
-
identifier: (0,
|
|
9581
|
+
identifier: (0, import_mysql_core28.varchar)("identifier", {
|
|
9365
9582
|
length: 191
|
|
9366
9583
|
}).notNull(),
|
|
9367
|
-
createdAt: (0,
|
|
9584
|
+
createdAt: (0, import_mysql_core28.timestamp)("createdAt", {
|
|
9368
9585
|
mode: "date",
|
|
9369
9586
|
fsp: 3
|
|
9370
|
-
}).default(
|
|
9371
|
-
status: (0,
|
|
9587
|
+
}).default(import_drizzle_orm23.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9588
|
+
status: (0, import_mysql_core28.int)("status").default(0)
|
|
9372
9589
|
}, (table) => {
|
|
9373
9590
|
return {
|
|
9374
|
-
merchantCustomerId: (0,
|
|
9591
|
+
merchantCustomerId: (0, import_mysql_core28.primaryKey)({
|
|
9375
9592
|
columns: [
|
|
9376
9593
|
table.id
|
|
9377
9594
|
],
|
|
9378
9595
|
name: "MerchantCustomer_id"
|
|
9379
9596
|
}),
|
|
9380
|
-
merchantCustomerIdentifierKey: (0,
|
|
9597
|
+
merchantCustomerIdentifierKey: (0, import_mysql_core28.unique)("MerchantCustomer_identifier_key").on(table.identifier)
|
|
9381
9598
|
};
|
|
9382
9599
|
});
|
|
9383
9600
|
}
|
|
9384
9601
|
__name(getMerchantCustomerSchema, "getMerchantCustomerSchema");
|
|
9385
9602
|
|
|
9386
|
-
// src/lib/mysql/schemas/commerce/merchant-price.ts
|
|
9387
|
-
var import_drizzle_orm20 = require("drizzle-orm");
|
|
9388
|
-
var import_mysql_core25 = require("drizzle-orm/mysql-core");
|
|
9389
|
-
function getMerchantPriceSchema(mysqlTable) {
|
|
9390
|
-
return mysqlTable("merchantPrices", {
|
|
9391
|
-
id: (0, import_mysql_core25.varchar)("id", {
|
|
9392
|
-
length: 191
|
|
9393
|
-
}).notNull(),
|
|
9394
|
-
merchantAccountId: (0, import_mysql_core25.varchar)("merchantAccountId", {
|
|
9395
|
-
length: 191
|
|
9396
|
-
}).notNull(),
|
|
9397
|
-
merchantProductId: (0, import_mysql_core25.varchar)("merchantProductId", {
|
|
9398
|
-
length: 191
|
|
9399
|
-
}).notNull(),
|
|
9400
|
-
status: (0, import_mysql_core25.int)("status").default(0),
|
|
9401
|
-
identifier: (0, import_mysql_core25.varchar)("identifier", {
|
|
9402
|
-
length: 191
|
|
9403
|
-
}),
|
|
9404
|
-
createdAt: (0, import_mysql_core25.timestamp)("createdAt", {
|
|
9405
|
-
mode: "date",
|
|
9406
|
-
fsp: 3
|
|
9407
|
-
}).default(import_drizzle_orm20.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9408
|
-
priceId: (0, import_mysql_core25.varchar)("priceId", {
|
|
9409
|
-
length: 191
|
|
9410
|
-
})
|
|
9411
|
-
}, (table) => {
|
|
9412
|
-
return {
|
|
9413
|
-
merchantPriceId: (0, import_mysql_core25.primaryKey)({
|
|
9414
|
-
columns: [
|
|
9415
|
-
table.id
|
|
9416
|
-
],
|
|
9417
|
-
name: "MerchantPrice_id"
|
|
9418
|
-
}),
|
|
9419
|
-
merchantPriceIdentifierKey: (0, import_mysql_core25.unique)("MerchantPrice_identifier_key").on(table.identifier)
|
|
9420
|
-
};
|
|
9421
|
-
});
|
|
9422
|
-
}
|
|
9423
|
-
__name(getMerchantPriceSchema, "getMerchantPriceSchema");
|
|
9424
|
-
|
|
9425
|
-
// src/lib/mysql/schemas/commerce/merchant-product.ts
|
|
9426
|
-
var import_drizzle_orm21 = require("drizzle-orm");
|
|
9427
|
-
var import_mysql_core26 = require("drizzle-orm/mysql-core");
|
|
9428
|
-
function getMerchantProductSchema(mysqlTable) {
|
|
9429
|
-
return mysqlTable("merchantProducts", {
|
|
9430
|
-
id: (0, import_mysql_core26.varchar)("id", {
|
|
9431
|
-
length: 191
|
|
9432
|
-
}).notNull(),
|
|
9433
|
-
merchantAccountId: (0, import_mysql_core26.varchar)("merchantAccountId", {
|
|
9434
|
-
length: 191
|
|
9435
|
-
}).notNull(),
|
|
9436
|
-
productId: (0, import_mysql_core26.varchar)("productId", {
|
|
9437
|
-
length: 191
|
|
9438
|
-
}).notNull(),
|
|
9439
|
-
status: (0, import_mysql_core26.int)("status").default(0).notNull(),
|
|
9440
|
-
identifier: (0, import_mysql_core26.varchar)("identifier", {
|
|
9441
|
-
length: 191
|
|
9442
|
-
}),
|
|
9443
|
-
createdAt: (0, import_mysql_core26.timestamp)("createdAt", {
|
|
9444
|
-
mode: "date",
|
|
9445
|
-
fsp: 3
|
|
9446
|
-
}).default(import_drizzle_orm21.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
9447
|
-
}, (table) => {
|
|
9448
|
-
return {
|
|
9449
|
-
merchantProductId: (0, import_mysql_core26.primaryKey)({
|
|
9450
|
-
columns: [
|
|
9451
|
-
table.id
|
|
9452
|
-
],
|
|
9453
|
-
name: "MerchantProduct_id"
|
|
9454
|
-
}),
|
|
9455
|
-
merchantProductIdentifierKey: (0, import_mysql_core26.unique)("MerchantProduct_identifier_key").on(table.identifier)
|
|
9456
|
-
};
|
|
9457
|
-
});
|
|
9458
|
-
}
|
|
9459
|
-
__name(getMerchantProductSchema, "getMerchantProductSchema");
|
|
9460
|
-
|
|
9461
|
-
// src/lib/mysql/schemas/commerce/price.ts
|
|
9462
|
-
var import_drizzle_orm22 = require("drizzle-orm");
|
|
9463
|
-
var import_mysql_core27 = require("drizzle-orm/mysql-core");
|
|
9464
|
-
function getPriceSchema(mysqlTable) {
|
|
9465
|
-
return mysqlTable("prices", {
|
|
9466
|
-
id: (0, import_mysql_core27.varchar)("id", {
|
|
9467
|
-
length: 191
|
|
9468
|
-
}).notNull(),
|
|
9469
|
-
productId: (0, import_mysql_core27.varchar)("productId", {
|
|
9470
|
-
length: 191
|
|
9471
|
-
}),
|
|
9472
|
-
nickname: (0, import_mysql_core27.varchar)("nickname", {
|
|
9473
|
-
length: 191
|
|
9474
|
-
}),
|
|
9475
|
-
status: (0, import_mysql_core27.int)("status").default(0).notNull(),
|
|
9476
|
-
unitAmount: (0, import_mysql_core27.decimal)("unitAmount", {
|
|
9477
|
-
precision: 10,
|
|
9478
|
-
scale: 2
|
|
9479
|
-
}).notNull(),
|
|
9480
|
-
createdAt: (0, import_mysql_core27.timestamp)("createdAt", {
|
|
9481
|
-
mode: "date",
|
|
9482
|
-
fsp: 3
|
|
9483
|
-
}).default(import_drizzle_orm22.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9484
|
-
metadata: (0, import_mysql_core27.json)("fields").$type().default({})
|
|
9485
|
-
}, (table) => {
|
|
9486
|
-
return {
|
|
9487
|
-
priceId: (0, import_mysql_core27.primaryKey)({
|
|
9488
|
-
columns: [
|
|
9489
|
-
table.id
|
|
9490
|
-
],
|
|
9491
|
-
name: "Price_id"
|
|
9492
|
-
})
|
|
9493
|
-
};
|
|
9494
|
-
});
|
|
9495
|
-
}
|
|
9496
|
-
__name(getPriceSchema, "getPriceSchema");
|
|
9497
|
-
|
|
9498
9603
|
// src/lib/mysql/schemas/commerce/purchase-user-transfer.ts
|
|
9499
|
-
var
|
|
9500
|
-
var
|
|
9604
|
+
var import_drizzle_orm24 = require("drizzle-orm");
|
|
9605
|
+
var import_mysql_core29 = require("drizzle-orm/mysql-core");
|
|
9501
9606
|
function getPurchaseUserTransferSchema(mysqlTable) {
|
|
9502
9607
|
return mysqlTable("purchaseUserTransfers", {
|
|
9503
|
-
id: (0,
|
|
9608
|
+
id: (0, import_mysql_core29.varchar)("id", {
|
|
9504
9609
|
length: 191
|
|
9505
9610
|
}).notNull(),
|
|
9506
|
-
transferState: (0,
|
|
9611
|
+
transferState: (0, import_mysql_core29.mysqlEnum)("transferState", [
|
|
9507
9612
|
"AVAILABLE",
|
|
9508
9613
|
"INITIATED",
|
|
9509
9614
|
"VERIFIED",
|
|
@@ -9512,38 +9617,38 @@ function getPurchaseUserTransferSchema(mysqlTable) {
|
|
|
9512
9617
|
"CONFIRMED",
|
|
9513
9618
|
"COMPLETED"
|
|
9514
9619
|
]).default("AVAILABLE").notNull(),
|
|
9515
|
-
purchaseId: (0,
|
|
9620
|
+
purchaseId: (0, import_mysql_core29.varchar)("purchaseId", {
|
|
9516
9621
|
length: 191
|
|
9517
9622
|
}).notNull(),
|
|
9518
|
-
sourceUserId: (0,
|
|
9623
|
+
sourceUserId: (0, import_mysql_core29.varchar)("sourceUserId", {
|
|
9519
9624
|
length: 191
|
|
9520
9625
|
}).notNull(),
|
|
9521
|
-
targetUserId: (0,
|
|
9626
|
+
targetUserId: (0, import_mysql_core29.varchar)("targetUserId", {
|
|
9522
9627
|
length: 191
|
|
9523
9628
|
}),
|
|
9524
|
-
createdAt: (0,
|
|
9629
|
+
createdAt: (0, import_mysql_core29.timestamp)("createdAt", {
|
|
9525
9630
|
mode: "date",
|
|
9526
9631
|
fsp: 3
|
|
9527
|
-
}).default(
|
|
9528
|
-
expiresAt: (0,
|
|
9632
|
+
}).default(import_drizzle_orm24.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9633
|
+
expiresAt: (0, import_mysql_core29.timestamp)("expiresAt", {
|
|
9529
9634
|
mode: "date",
|
|
9530
9635
|
fsp: 3
|
|
9531
9636
|
}),
|
|
9532
|
-
canceledAt: (0,
|
|
9637
|
+
canceledAt: (0, import_mysql_core29.timestamp)("canceledAt", {
|
|
9533
9638
|
mode: "date",
|
|
9534
9639
|
fsp: 3
|
|
9535
9640
|
}),
|
|
9536
|
-
confirmedAt: (0,
|
|
9641
|
+
confirmedAt: (0, import_mysql_core29.timestamp)("confirmedAt", {
|
|
9537
9642
|
mode: "date",
|
|
9538
9643
|
fsp: 3
|
|
9539
9644
|
}),
|
|
9540
|
-
completedAt: (0,
|
|
9645
|
+
completedAt: (0, import_mysql_core29.timestamp)("completedAt", {
|
|
9541
9646
|
mode: "date",
|
|
9542
9647
|
fsp: 3
|
|
9543
9648
|
})
|
|
9544
9649
|
}, (table) => {
|
|
9545
9650
|
return {
|
|
9546
|
-
purchaseUserTransferId: (0,
|
|
9651
|
+
purchaseUserTransferId: (0, import_mysql_core29.primaryKey)({
|
|
9547
9652
|
columns: [
|
|
9548
9653
|
table.id
|
|
9549
9654
|
],
|
|
@@ -9555,46 +9660,46 @@ function getPurchaseUserTransferSchema(mysqlTable) {
|
|
|
9555
9660
|
__name(getPurchaseUserTransferSchema, "getPurchaseUserTransferSchema");
|
|
9556
9661
|
|
|
9557
9662
|
// src/lib/mysql/schemas/commerce/upgradable-products.ts
|
|
9558
|
-
var
|
|
9559
|
-
var
|
|
9663
|
+
var import_drizzle_orm25 = require("drizzle-orm");
|
|
9664
|
+
var import_mysql_core30 = require("drizzle-orm/mysql-core");
|
|
9560
9665
|
function getUpgradableProductsSchema(mysqlTable) {
|
|
9561
9666
|
return mysqlTable("upgradableProducts", {
|
|
9562
|
-
upgradableToId: (0,
|
|
9667
|
+
upgradableToId: (0, import_mysql_core30.varchar)("upgradableToId", {
|
|
9563
9668
|
length: 255
|
|
9564
9669
|
}).notNull(),
|
|
9565
|
-
upgradableFromId: (0,
|
|
9670
|
+
upgradableFromId: (0, import_mysql_core30.varchar)("upgradableFrom", {
|
|
9566
9671
|
length: 255
|
|
9567
9672
|
}).notNull(),
|
|
9568
|
-
position: (0,
|
|
9569
|
-
metadata: (0,
|
|
9570
|
-
createdAt: (0,
|
|
9673
|
+
position: (0, import_mysql_core30.double)("position").notNull().default(0),
|
|
9674
|
+
metadata: (0, import_mysql_core30.json)("metadata").$type().default({}),
|
|
9675
|
+
createdAt: (0, import_mysql_core30.timestamp)("createdAt", {
|
|
9571
9676
|
mode: "date",
|
|
9572
9677
|
fsp: 3
|
|
9573
|
-
}).default(
|
|
9574
|
-
updatedAt: (0,
|
|
9678
|
+
}).default(import_drizzle_orm25.sql`CURRENT_TIMESTAMP(3)`),
|
|
9679
|
+
updatedAt: (0, import_mysql_core30.timestamp)("updatedAt", {
|
|
9575
9680
|
mode: "date",
|
|
9576
9681
|
fsp: 3
|
|
9577
|
-
}).default(
|
|
9578
|
-
deletedAt: (0,
|
|
9682
|
+
}).default(import_drizzle_orm25.sql`CURRENT_TIMESTAMP(3)`),
|
|
9683
|
+
deletedAt: (0, import_mysql_core30.timestamp)("deletedAt", {
|
|
9579
9684
|
mode: "date",
|
|
9580
9685
|
fsp: 3
|
|
9581
9686
|
})
|
|
9582
9687
|
}, (crr) => ({
|
|
9583
|
-
pk: (0,
|
|
9688
|
+
pk: (0, import_mysql_core30.primaryKey)({
|
|
9584
9689
|
columns: [
|
|
9585
9690
|
crr.upgradableToId,
|
|
9586
9691
|
crr.upgradableFromId
|
|
9587
9692
|
]
|
|
9588
9693
|
}),
|
|
9589
|
-
upgradableToIdIdx: (0,
|
|
9590
|
-
upgradableFromIdIdx: (0,
|
|
9694
|
+
upgradableToIdIdx: (0, import_mysql_core30.index)("upgradableFromId_idx").on(crr.upgradableToId),
|
|
9695
|
+
upgradableFromIdIdx: (0, import_mysql_core30.index)("upgradableToId_idx").on(crr.upgradableFromId)
|
|
9591
9696
|
}));
|
|
9592
9697
|
}
|
|
9593
9698
|
__name(getUpgradableProductsSchema, "getUpgradableProductsSchema");
|
|
9594
9699
|
function getUpgradableProductsRelationsSchema(mysqlTable) {
|
|
9595
9700
|
const product = getProductSchema(mysqlTable);
|
|
9596
9701
|
const upgradableProduct = getUpgradableProductsSchema(mysqlTable);
|
|
9597
|
-
return (0,
|
|
9702
|
+
return (0, import_drizzle_orm25.relations)(upgradableProduct, ({ one }) => ({
|
|
9598
9703
|
upgradableTo: one(product, {
|
|
9599
9704
|
fields: [
|
|
9600
9705
|
upgradableProduct.upgradableToId
|
|
@@ -9618,40 +9723,40 @@ function getUpgradableProductsRelationsSchema(mysqlTable) {
|
|
|
9618
9723
|
__name(getUpgradableProductsRelationsSchema, "getUpgradableProductsRelationsSchema");
|
|
9619
9724
|
|
|
9620
9725
|
// src/lib/mysql/schemas/content/resource-progress.ts
|
|
9621
|
-
var
|
|
9622
|
-
var
|
|
9726
|
+
var import_drizzle_orm26 = require("drizzle-orm");
|
|
9727
|
+
var import_mysql_core31 = require("drizzle-orm/mysql-core");
|
|
9623
9728
|
function getResourceProgressSchema(mysqlTable) {
|
|
9624
9729
|
return mysqlTable("resourceProgresses", {
|
|
9625
|
-
userId: (0,
|
|
9730
|
+
userId: (0, import_mysql_core31.varchar)("userId", {
|
|
9626
9731
|
length: 191
|
|
9627
9732
|
}).notNull(),
|
|
9628
|
-
contentResourceId: (0,
|
|
9733
|
+
contentResourceId: (0, import_mysql_core31.varchar)("contentResourceId", {
|
|
9629
9734
|
length: 191
|
|
9630
9735
|
}),
|
|
9631
|
-
metadata: (0,
|
|
9632
|
-
completedAt: (0,
|
|
9736
|
+
metadata: (0, import_mysql_core31.json)("fields").$type().default({}),
|
|
9737
|
+
completedAt: (0, import_mysql_core31.datetime)("completedAt", {
|
|
9633
9738
|
mode: "date",
|
|
9634
9739
|
fsp: 3
|
|
9635
9740
|
}),
|
|
9636
|
-
updatedAt: (0,
|
|
9741
|
+
updatedAt: (0, import_mysql_core31.datetime)("updatedAt", {
|
|
9637
9742
|
mode: "date",
|
|
9638
9743
|
fsp: 3
|
|
9639
9744
|
}),
|
|
9640
|
-
createdAt: (0,
|
|
9745
|
+
createdAt: (0, import_mysql_core31.datetime)("createdAt", {
|
|
9641
9746
|
mode: "date",
|
|
9642
9747
|
fsp: 3
|
|
9643
|
-
}).default(
|
|
9748
|
+
}).default(import_drizzle_orm26.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
9644
9749
|
}, (crp) => {
|
|
9645
9750
|
return {
|
|
9646
|
-
userIdLessonIdIdx: (0,
|
|
9647
|
-
pk: (0,
|
|
9751
|
+
userIdLessonIdIdx: (0, import_mysql_core31.index)("crp_userId_contentResourceId_idx").on(crp.userId, crp.contentResourceId),
|
|
9752
|
+
pk: (0, import_mysql_core31.primaryKey)({
|
|
9648
9753
|
columns: [
|
|
9649
9754
|
crp.userId,
|
|
9650
9755
|
crp.contentResourceId
|
|
9651
9756
|
]
|
|
9652
9757
|
}),
|
|
9653
|
-
contentResourceIdIdx: (0,
|
|
9654
|
-
userIdIdx: (0,
|
|
9758
|
+
contentResourceIdIdx: (0, import_mysql_core31.index)("contentResourceId_idx").on(crp.contentResourceId),
|
|
9759
|
+
userIdIdx: (0, import_mysql_core31.index)("resourceId_idx").on(crp.userId)
|
|
9655
9760
|
};
|
|
9656
9761
|
});
|
|
9657
9762
|
}
|
|
@@ -9704,7 +9809,10 @@ function getCourseBuilderSchema(mysqlTable) {
|
|
|
9704
9809
|
contributionTypesRelations: getContributionTypesRelationsSchema(mysqlTable),
|
|
9705
9810
|
resourceProgress: getResourceProgressSchema(mysqlTable),
|
|
9706
9811
|
upgradableProducts: getUpgradableProductsSchema(mysqlTable),
|
|
9707
|
-
upgradableProductsRelations: getUpgradableProductsRelationsSchema(mysqlTable)
|
|
9812
|
+
upgradableProductsRelations: getUpgradableProductsRelationsSchema(mysqlTable),
|
|
9813
|
+
contentResourceProduct: getContentResourceProductSchema(mysqlTable),
|
|
9814
|
+
contentResourceProductRelations: getContentResourceProductRelationsSchema(mysqlTable),
|
|
9815
|
+
productRelations: getProductRelationsSchema(mysqlTable)
|
|
9708
9816
|
};
|
|
9709
9817
|
}
|
|
9710
9818
|
__name(getCourseBuilderSchema, "getCourseBuilderSchema");
|
|
@@ -9712,12 +9820,15 @@ function createTables(mySqlTable) {
|
|
|
9712
9820
|
return getCourseBuilderSchema(mySqlTable);
|
|
9713
9821
|
}
|
|
9714
9822
|
__name(createTables, "createTables");
|
|
9715
|
-
function mySqlDrizzleAdapter(client, tableFn =
|
|
9823
|
+
function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
9716
9824
|
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts } = createTables(tableFn);
|
|
9717
9825
|
return {
|
|
9718
9826
|
client,
|
|
9719
9827
|
availableUpgradesForProduct(purchases, productId) {
|
|
9720
|
-
|
|
9828
|
+
const previousPurchaseProductIds = purchases.map(({ productId: productId2 }) => productId2);
|
|
9829
|
+
return client.query.upgradableProducts.findMany({
|
|
9830
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(upgradableProducts.upgradableToId, productId), (0, import_drizzle_orm27.inArray)(upgradableProducts.upgradableFromId, previousPurchaseProductIds))
|
|
9831
|
+
});
|
|
9721
9832
|
},
|
|
9722
9833
|
clearLessonProgressForUser(options) {
|
|
9723
9834
|
throw new Error("Method not implemented.");
|
|
@@ -9733,10 +9844,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9733
9844
|
try {
|
|
9734
9845
|
const { userId, stripeChargeId, stripeCouponId, merchantAccountId, merchantProductId, merchantCustomerId, productId, stripeChargeAmount, quantity = 1, checkoutSessionId, appliedPPPStripeCouponId, upgradedFromPurchaseId, country, usedCouponId } = options;
|
|
9735
9846
|
const existingMerchantCharge = merchantChargeSchema.nullable().parse(await client.query.merchantCharge.findFirst({
|
|
9736
|
-
where: (0,
|
|
9847
|
+
where: (0, import_drizzle_orm27.eq)(merchantCharge.identifier, stripeChargeId)
|
|
9737
9848
|
}) || null);
|
|
9738
9849
|
const existingPurchaseForCharge = existingMerchantCharge ? await client.query.purchase.findFirst({
|
|
9739
|
-
where: (0,
|
|
9850
|
+
where: (0, import_drizzle_orm27.eq)(purchaseTable.merchantChargeId, existingMerchantCharge.id),
|
|
9740
9851
|
with: {
|
|
9741
9852
|
user: true,
|
|
9742
9853
|
product: true,
|
|
@@ -9757,12 +9868,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9757
9868
|
merchantCustomerId
|
|
9758
9869
|
});
|
|
9759
9870
|
const existingPurchase = purchaseSchema.nullable().parse(await client.query.purchases.findFirst({
|
|
9760
|
-
where: (0,
|
|
9871
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.productId, productId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm27.inArray)(purchaseTable.status, [
|
|
9761
9872
|
"Valid",
|
|
9762
9873
|
"Restricted"
|
|
9763
9874
|
]))
|
|
9764
9875
|
}) || null);
|
|
9765
|
-
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, (0,
|
|
9876
|
+
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(coupon.id, purchaseTable.bulkCouponId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId))).then((res) => res[0] ?? null));
|
|
9766
9877
|
const isBulkPurchase = quantity > 1 || Boolean(existingBulkCoupon) || options.bulk || Boolean(existingPurchase?.status === "Valid");
|
|
9767
9878
|
let bulkCouponId = null;
|
|
9768
9879
|
let couponToUpdate = null;
|
|
@@ -9771,10 +9882,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9771
9882
|
if (existingBulkCoupon !== null) {
|
|
9772
9883
|
couponToUpdate = trx.update(coupon).set({
|
|
9773
9884
|
maxUses: (existingBulkCoupon?.maxUses || 0) + quantity
|
|
9774
|
-
}).where((0,
|
|
9885
|
+
}).where((0, import_drizzle_orm27.eq)(coupon.id, bulkCouponId));
|
|
9775
9886
|
} else {
|
|
9776
9887
|
const merchantCouponToUse = stripeCouponId ? merchantCouponSchema.nullable().parse(await client.query.merchantCoupon.findFirst({
|
|
9777
|
-
where: (0,
|
|
9888
|
+
where: (0, import_drizzle_orm27.eq)(merchantCoupon.identifier, stripeCouponId)
|
|
9778
9889
|
})) : null;
|
|
9779
9890
|
couponToUpdate = await trx.insert(coupon).values({
|
|
9780
9891
|
id: bulkCouponId,
|
|
@@ -9795,10 +9906,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9795
9906
|
merchantAccountId
|
|
9796
9907
|
});
|
|
9797
9908
|
const merchantCouponUsed = stripeCouponId ? await client.query.merchantCoupon.findFirst({
|
|
9798
|
-
where: (0,
|
|
9909
|
+
where: (0, import_drizzle_orm27.eq)(merchantCoupon.identifier, stripeCouponId)
|
|
9799
9910
|
}) : null;
|
|
9800
9911
|
const pppMerchantCoupon = appliedPPPStripeCouponId ? await client.query.merchantCoupon.findFirst({
|
|
9801
|
-
where: (0,
|
|
9912
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCoupon.identifier, appliedPPPStripeCouponId), (0, import_drizzle_orm27.eq)(merchantCoupon.type, "ppp"))
|
|
9802
9913
|
}) : null;
|
|
9803
9914
|
const newPurchaseStatus = merchantCouponUsed?.type === "ppp" || pppMerchantCoupon ? "Restricted" : "Valid";
|
|
9804
9915
|
const newPurchase = trx.insert(purchaseTable).values({
|
|
@@ -9838,7 +9949,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9838
9949
|
}
|
|
9839
9950
|
});
|
|
9840
9951
|
return purchaseSchema.parse(await client.query.purchases.findFirst({
|
|
9841
|
-
where: (0,
|
|
9952
|
+
where: (0, import_drizzle_orm27.eq)(purchaseTable.id, purchaseId)
|
|
9842
9953
|
}));
|
|
9843
9954
|
},
|
|
9844
9955
|
findOrCreateMerchantCustomer(options) {
|
|
@@ -9847,8 +9958,8 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9847
9958
|
findOrCreateUser(email, name) {
|
|
9848
9959
|
throw new Error("Method not implemented.");
|
|
9849
9960
|
},
|
|
9850
|
-
getCoupon(couponIdOrCode) {
|
|
9851
|
-
|
|
9961
|
+
async getCoupon(couponIdOrCode) {
|
|
9962
|
+
return couponSchema.nullable().parse(await client.select().from(coupon).where((0, import_drizzle_orm27.or)((0, import_drizzle_orm27.eq)(coupon.id, couponIdOrCode), (0, import_drizzle_orm27.eq)(coupon.code, couponIdOrCode))).then((res) => res[0] ?? null));
|
|
9852
9963
|
},
|
|
9853
9964
|
getCouponWithBulkPurchases(couponId) {
|
|
9854
9965
|
throw new Error("Method not implemented.");
|
|
@@ -9868,28 +9979,58 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9868
9979
|
getMerchantCharge(merchantChargeId) {
|
|
9869
9980
|
throw new Error("Method not implemented.");
|
|
9870
9981
|
},
|
|
9871
|
-
|
|
9872
|
-
|
|
9982
|
+
async getMerchantCouponsForTypeAndPercent(params) {
|
|
9983
|
+
return z.array(merchantCouponSchema).parse(await client.query.merchantCoupon.findMany({
|
|
9984
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCoupon.type, params.type), (0, import_drizzle_orm27.eq)(merchantCoupon.percentageDiscount, params.percentageDiscount.toString()))
|
|
9985
|
+
}));
|
|
9873
9986
|
},
|
|
9874
|
-
|
|
9875
|
-
|
|
9987
|
+
async getMerchantCouponForTypeAndPercent(params) {
|
|
9988
|
+
const foundMerchantCoupon = await client.query.merchantCoupon.findFirst({
|
|
9989
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCoupon.type, params.type), (0, import_drizzle_orm27.eq)(merchantCoupon.percentageDiscount, params.percentageDiscount.toString()))
|
|
9990
|
+
});
|
|
9991
|
+
const parsed = merchantCouponSchema.nullable().safeParse(foundMerchantCoupon);
|
|
9992
|
+
if (parsed.success) {
|
|
9993
|
+
return parsed.data;
|
|
9994
|
+
}
|
|
9995
|
+
return null;
|
|
9996
|
+
},
|
|
9997
|
+
async getMerchantCoupon(merchantCouponId) {
|
|
9998
|
+
const foundMerchantCoupon = await client.query.merchantCoupon.findFirst({
|
|
9999
|
+
where: (0, import_drizzle_orm27.eq)(merchantCoupon.id, merchantCouponId)
|
|
10000
|
+
});
|
|
10001
|
+
const parsed = merchantCouponSchema.nullable().safeParse(foundMerchantCoupon);
|
|
10002
|
+
if (parsed.success) {
|
|
10003
|
+
return parsed.data;
|
|
10004
|
+
}
|
|
10005
|
+
return null;
|
|
10006
|
+
},
|
|
10007
|
+
async getMerchantProduct(stripeProductId) {
|
|
10008
|
+
return merchantProductSchema.nullable().parse(await client.query.merchantProduct.findFirst({
|
|
10009
|
+
where: (0, import_drizzle_orm27.eq)(merchantProduct.identifier, stripeProductId)
|
|
10010
|
+
}));
|
|
9876
10011
|
},
|
|
9877
10012
|
getPrice(productId) {
|
|
9878
10013
|
throw new Error("Method not implemented.");
|
|
9879
10014
|
},
|
|
9880
|
-
|
|
9881
|
-
|
|
10015
|
+
async getPriceForProduct(productId) {
|
|
10016
|
+
return priceSchema.nullable().parse(await client.query.prices.findFirst({
|
|
10017
|
+
where: (0, import_drizzle_orm27.eq)(prices.productId, productId)
|
|
10018
|
+
}));
|
|
10019
|
+
},
|
|
10020
|
+
async getProduct(productId) {
|
|
10021
|
+
return productSchema.nullable().parse(await client.query.products.findFirst({
|
|
10022
|
+
where: (0, import_drizzle_orm27.eq)(products.id, productId)
|
|
10023
|
+
}));
|
|
9882
10024
|
},
|
|
9883
10025
|
async getPurchase(purchaseId) {
|
|
9884
10026
|
const purchase = await client.query.purchases.findFirst({
|
|
9885
|
-
where: (0,
|
|
10027
|
+
where: (0, import_drizzle_orm27.eq)(purchaseTable.id, purchaseId)
|
|
9886
10028
|
});
|
|
9887
10029
|
return purchase ? purchaseSchema.parse(purchase) : null;
|
|
9888
10030
|
},
|
|
9889
10031
|
async createPurchase(options) {
|
|
9890
10032
|
const newPurchaseId = options.id || `purchase-${(0, import_uuid.v4)()}`;
|
|
9891
10033
|
await client.insert(purchaseTable).values({
|
|
9892
|
-
state: "Valid",
|
|
9893
10034
|
...options,
|
|
9894
10035
|
id: newPurchaseId
|
|
9895
10036
|
});
|
|
@@ -9899,7 +10040,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9899
10040
|
async getPurchaseDetails(purchaseId, userId) {
|
|
9900
10041
|
const allPurchases = await this.getPurchasesForUser(userId);
|
|
9901
10042
|
const thePurchase = await client.query.purchases.findFirst({
|
|
9902
|
-
where: (0,
|
|
10043
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.id, purchaseId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId)),
|
|
9903
10044
|
with: {
|
|
9904
10045
|
user: true,
|
|
9905
10046
|
product: true,
|
|
@@ -9923,7 +10064,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9923
10064
|
};
|
|
9924
10065
|
}
|
|
9925
10066
|
const availableUpgrades = await client.query.upgradableProducts.findMany({
|
|
9926
|
-
where: (0,
|
|
10067
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(upgradableProducts.upgradableFromId, parsedPurchase.data.product?.id), (0, import_drizzle_orm27.not)((0, import_drizzle_orm27.inArray)(upgradableProducts.upgradableToId, allPurchases.map((p) => p.product?.id)))),
|
|
9927
10068
|
with: {
|
|
9928
10069
|
upgradableTo: true,
|
|
9929
10070
|
upgradableFrom: true
|
|
@@ -9937,7 +10078,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9937
10078
|
});
|
|
9938
10079
|
},
|
|
9939
10080
|
async getPurchaseForStripeCharge(stripeChargeId) {
|
|
9940
|
-
const purchase = purchaseSchema.safeParse(await client.select().from(purchaseTable).leftJoin(merchantCharge, (0,
|
|
10081
|
+
const purchase = purchaseSchema.safeParse(await client.select().from(purchaseTable).leftJoin(merchantCharge, (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCharge.identifier, stripeChargeId), (0, import_drizzle_orm27.eq)(merchantCharge.id, purchaseTable.merchantChargeId))).then((res) => res[0] ?? null));
|
|
9941
10082
|
if (!purchase.success) {
|
|
9942
10083
|
return null;
|
|
9943
10084
|
}
|
|
@@ -9959,13 +10100,13 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9959
10100
|
"Restricted"
|
|
9960
10101
|
];
|
|
9961
10102
|
const userPurchases = await client.query.purchases.findMany({
|
|
9962
|
-
where: (0,
|
|
10103
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm27.inArray)(purchaseTable.status, visiblePurchaseStates)),
|
|
9963
10104
|
with: {
|
|
9964
10105
|
user: true,
|
|
9965
10106
|
product: true,
|
|
9966
10107
|
bulkCoupon: true
|
|
9967
10108
|
},
|
|
9968
|
-
orderBy: (0,
|
|
10109
|
+
orderBy: (0, import_drizzle_orm27.asc)(purchaseTable.createdAt)
|
|
9969
10110
|
});
|
|
9970
10111
|
const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
|
|
9971
10112
|
if (!parsedPurchases.success) {
|
|
@@ -9976,11 +10117,30 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9976
10117
|
},
|
|
9977
10118
|
async getUserById(userId) {
|
|
9978
10119
|
return userSchema.nullable().parse(await client.query.users.findFirst({
|
|
9979
|
-
where: (0,
|
|
10120
|
+
where: (0, import_drizzle_orm27.eq)(users.id, userId)
|
|
9980
10121
|
}));
|
|
9981
10122
|
},
|
|
9982
|
-
pricesOfPurchasesTowardOneBundle(
|
|
9983
|
-
|
|
10123
|
+
async pricesOfPurchasesTowardOneBundle({ userId, bundleId }) {
|
|
10124
|
+
if (userId === void 0)
|
|
10125
|
+
return [];
|
|
10126
|
+
const canUpgradeProducts = await client.query.upgradableProducts.findMany({
|
|
10127
|
+
where: (0, import_drizzle_orm27.eq)(upgradableProducts.upgradableToId, bundleId)
|
|
10128
|
+
});
|
|
10129
|
+
const upgradableFrom = z.array(z.string()).parse(canUpgradeProducts.map((product) => {
|
|
10130
|
+
return product.upgradableFromId;
|
|
10131
|
+
}));
|
|
10132
|
+
const purchases = await client.query.purchases.findMany({
|
|
10133
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm27.inArray)(purchaseTable.productId, upgradableFrom))
|
|
10134
|
+
});
|
|
10135
|
+
const purchasesMade = z.array(z.string()).parse(purchases.map((purchase) => {
|
|
10136
|
+
return purchase.productId;
|
|
10137
|
+
}));
|
|
10138
|
+
if (purchasesMade.length === 0)
|
|
10139
|
+
return [];
|
|
10140
|
+
const foundPrices = await client.query.prices.findMany({
|
|
10141
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(prices.productId, bundleId), (0, import_drizzle_orm27.inArray)(prices.productId, purchasesMade))
|
|
10142
|
+
});
|
|
10143
|
+
return z.array(priceSchema).parse(foundPrices);
|
|
9984
10144
|
},
|
|
9985
10145
|
toggleLessonProgressForUser(options) {
|
|
9986
10146
|
throw new Error("Method not implemented.");
|
|
@@ -9997,7 +10157,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
9997
10157
|
addResourceToResource: async function(options) {
|
|
9998
10158
|
const { parentResourceId, childResourceId } = options;
|
|
9999
10159
|
const parentResourceData = await client.query.contentResource.findFirst({
|
|
10000
|
-
where: (0,
|
|
10160
|
+
where: (0, import_drizzle_orm27.or)((0, import_drizzle_orm27.eq)(import_drizzle_orm27.sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, parentResourceId), (0, import_drizzle_orm27.eq)(contentResource.id, parentResourceId)),
|
|
10001
10161
|
with: {
|
|
10002
10162
|
resources: true
|
|
10003
10163
|
}
|
|
@@ -10009,7 +10169,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10009
10169
|
position: parentResource.resources?.length || 0
|
|
10010
10170
|
});
|
|
10011
10171
|
const resourceJoin = client.query.contentResourceResource.findFirst({
|
|
10012
|
-
where: (0,
|
|
10172
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(contentResourceResource.resourceOfId, parentResourceId), (0, import_drizzle_orm27.eq)(contentResourceResource.resourceId, childResourceId)),
|
|
10013
10173
|
with: {
|
|
10014
10174
|
resource: true
|
|
10015
10175
|
}
|
|
@@ -10024,15 +10184,15 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10024
10184
|
if (!options.id) {
|
|
10025
10185
|
throw new Error("No content resource id.");
|
|
10026
10186
|
}
|
|
10027
|
-
const currentResource = await client.select().from(contentResource).where((0,
|
|
10187
|
+
const currentResource = await client.select().from(contentResource).where((0, import_drizzle_orm27.eq)(contentResource.id, options.id)).then((res) => res[0]);
|
|
10028
10188
|
await client.update(contentResource).set({
|
|
10029
10189
|
fields: {
|
|
10030
10190
|
...currentResource.fields,
|
|
10031
10191
|
...options.fields
|
|
10032
10192
|
}
|
|
10033
|
-
}).where((0,
|
|
10193
|
+
}).where((0, import_drizzle_orm27.eq)(contentResource.id, options.id));
|
|
10034
10194
|
const resource = await client.query.contentResource.findFirst({
|
|
10035
|
-
where: (0,
|
|
10195
|
+
where: (0, import_drizzle_orm27.eq)(contentResource.id, options.id),
|
|
10036
10196
|
with: {
|
|
10037
10197
|
resources: {
|
|
10038
10198
|
with: {
|
|
@@ -10042,12 +10202,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10042
10202
|
with: {
|
|
10043
10203
|
resource: true
|
|
10044
10204
|
},
|
|
10045
|
-
orderBy: (0,
|
|
10205
|
+
orderBy: (0, import_drizzle_orm27.asc)(contentResourceResource.position)
|
|
10046
10206
|
}
|
|
10047
10207
|
}
|
|
10048
10208
|
}
|
|
10049
10209
|
},
|
|
10050
|
-
orderBy: (0,
|
|
10210
|
+
orderBy: (0, import_drizzle_orm27.asc)(contentResourceResource.position)
|
|
10051
10211
|
}
|
|
10052
10212
|
}
|
|
10053
10213
|
});
|
|
@@ -10062,7 +10222,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10062
10222
|
if (!id) {
|
|
10063
10223
|
return null;
|
|
10064
10224
|
}
|
|
10065
|
-
const query =
|
|
10225
|
+
const query = import_drizzle_orm27.sql`
|
|
10066
10226
|
SELECT
|
|
10067
10227
|
id as id,
|
|
10068
10228
|
CAST(updatedAt AS DATETIME) as updatedAt,
|
|
@@ -10077,7 +10237,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10077
10237
|
WHERE
|
|
10078
10238
|
type = 'videoResource'
|
|
10079
10239
|
AND (id = ${id});
|
|
10080
|
-
|
|
10240
|
+
|
|
10081
10241
|
`;
|
|
10082
10242
|
return client.execute(query).then((result) => {
|
|
10083
10243
|
const parsedResource = VideoResourceSchema.safeParse(result.rows[0]);
|
|
@@ -10094,7 +10254,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10094
10254
|
id
|
|
10095
10255
|
});
|
|
10096
10256
|
const resource = await client.query.contentResource.findFirst({
|
|
10097
|
-
where: (0,
|
|
10257
|
+
where: (0, import_drizzle_orm27.eq)(contentResource.id, id),
|
|
10098
10258
|
with: {
|
|
10099
10259
|
resources: {
|
|
10100
10260
|
with: {
|
|
@@ -10104,12 +10264,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10104
10264
|
with: {
|
|
10105
10265
|
resource: true
|
|
10106
10266
|
},
|
|
10107
|
-
orderBy: (0,
|
|
10267
|
+
orderBy: (0, import_drizzle_orm27.asc)(contentResourceResource.position)
|
|
10108
10268
|
}
|
|
10109
10269
|
}
|
|
10110
10270
|
}
|
|
10111
10271
|
},
|
|
10112
|
-
orderBy: (0,
|
|
10272
|
+
orderBy: (0, import_drizzle_orm27.asc)(contentResourceResource.position)
|
|
10113
10273
|
}
|
|
10114
10274
|
}
|
|
10115
10275
|
});
|
|
@@ -10122,7 +10282,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10122
10282
|
},
|
|
10123
10283
|
async getContentResource(data) {
|
|
10124
10284
|
const resource = await client.query.contentResource.findFirst({
|
|
10125
|
-
where: (0,
|
|
10285
|
+
where: (0, import_drizzle_orm27.or)((0, import_drizzle_orm27.eq)(contentResource.id, data), (0, import_drizzle_orm27.eq)(import_drizzle_orm27.sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, `${data}`)),
|
|
10126
10286
|
with: {
|
|
10127
10287
|
resources: {
|
|
10128
10288
|
with: {
|
|
@@ -10132,12 +10292,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10132
10292
|
with: {
|
|
10133
10293
|
resource: true
|
|
10134
10294
|
},
|
|
10135
|
-
orderBy: (0,
|
|
10295
|
+
orderBy: (0, import_drizzle_orm27.asc)(contentResourceResource.position)
|
|
10136
10296
|
}
|
|
10137
10297
|
}
|
|
10138
10298
|
}
|
|
10139
10299
|
},
|
|
10140
|
-
orderBy: (0,
|
|
10300
|
+
orderBy: (0, import_drizzle_orm27.asc)(contentResourceResource.position)
|
|
10141
10301
|
}
|
|
10142
10302
|
}
|
|
10143
10303
|
});
|
|
@@ -10149,68 +10309,67 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10149
10309
|
return parsedResource.data;
|
|
10150
10310
|
},
|
|
10151
10311
|
async createUser(data) {
|
|
10152
|
-
console.log(data);
|
|
10153
10312
|
try {
|
|
10154
10313
|
const id = crypto.randomUUID();
|
|
10155
10314
|
await client.insert(users).values({
|
|
10156
10315
|
...data,
|
|
10157
10316
|
id
|
|
10158
10317
|
});
|
|
10159
|
-
return await client.select().from(users).where((0,
|
|
10318
|
+
return await client.select().from(users).where((0, import_drizzle_orm27.eq)(users.id, id)).then((res) => res[0]);
|
|
10160
10319
|
} catch (error) {
|
|
10161
10320
|
console.error(error);
|
|
10162
10321
|
throw error;
|
|
10163
10322
|
}
|
|
10164
10323
|
},
|
|
10165
10324
|
async getUser(data) {
|
|
10166
|
-
return await client.select().from(users).where((0,
|
|
10325
|
+
return await client.select().from(users).where((0, import_drizzle_orm27.eq)(users.id, data)).then((res) => res[0]) ?? null;
|
|
10167
10326
|
},
|
|
10168
10327
|
async getUserByEmail(data) {
|
|
10169
|
-
return await client.select().from(users).where((0,
|
|
10328
|
+
return await client.select().from(users).where((0, import_drizzle_orm27.eq)(users.email, data)).then((res) => res[0]) ?? null;
|
|
10170
10329
|
},
|
|
10171
10330
|
async createSession(data) {
|
|
10172
10331
|
await client.insert(sessions).values(data);
|
|
10173
|
-
return await client.select().from(sessions).where((0,
|
|
10332
|
+
return await client.select().from(sessions).where((0, import_drizzle_orm27.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
|
|
10174
10333
|
},
|
|
10175
10334
|
async getSessionAndUser(data) {
|
|
10176
10335
|
return await client.select({
|
|
10177
10336
|
session: sessions,
|
|
10178
10337
|
user: users
|
|
10179
|
-
}).from(sessions).where((0,
|
|
10338
|
+
}).from(sessions).where((0, import_drizzle_orm27.eq)(sessions.sessionToken, data)).innerJoin(users, (0, import_drizzle_orm27.eq)(users.id, sessions.userId)).then((res) => res[0]) ?? null;
|
|
10180
10339
|
},
|
|
10181
10340
|
async updateUser(data) {
|
|
10182
10341
|
if (!data.id) {
|
|
10183
10342
|
throw new Error("No user id.");
|
|
10184
10343
|
}
|
|
10185
|
-
await client.update(users).set(data).where((0,
|
|
10186
|
-
return await client.select().from(users).where((0,
|
|
10344
|
+
await client.update(users).set(data).where((0, import_drizzle_orm27.eq)(users.id, data.id));
|
|
10345
|
+
return await client.select().from(users).where((0, import_drizzle_orm27.eq)(users.id, data.id)).then((res) => res[0]);
|
|
10187
10346
|
},
|
|
10188
10347
|
async updateSession(data) {
|
|
10189
|
-
await client.update(sessions).set(data).where((0,
|
|
10190
|
-
return await client.select().from(sessions).where((0,
|
|
10348
|
+
await client.update(sessions).set(data).where((0, import_drizzle_orm27.eq)(sessions.sessionToken, data.sessionToken));
|
|
10349
|
+
return await client.select().from(sessions).where((0, import_drizzle_orm27.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
|
|
10191
10350
|
},
|
|
10192
10351
|
async linkAccount(rawAccount) {
|
|
10193
10352
|
await client.insert(accounts).values(rawAccount);
|
|
10194
10353
|
},
|
|
10195
10354
|
async getUserByAccount(account) {
|
|
10196
|
-
const dbAccount = await client.select().from(accounts).where((0,
|
|
10355
|
+
const dbAccount = await client.select().from(accounts).where((0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm27.eq)(accounts.provider, account.provider))).leftJoin(users, (0, import_drizzle_orm27.eq)(accounts.userId, users.id)).then((res) => res[0]) ?? null;
|
|
10197
10356
|
if (!dbAccount) {
|
|
10198
10357
|
return null;
|
|
10199
10358
|
}
|
|
10200
10359
|
return dbAccount.user;
|
|
10201
10360
|
},
|
|
10202
10361
|
async deleteSession(sessionToken) {
|
|
10203
|
-
const session = await client.select().from(sessions).where((0,
|
|
10204
|
-
await client.delete(sessions).where((0,
|
|
10362
|
+
const session = await client.select().from(sessions).where((0, import_drizzle_orm27.eq)(sessions.sessionToken, sessionToken)).then((res) => res[0]) ?? null;
|
|
10363
|
+
await client.delete(sessions).where((0, import_drizzle_orm27.eq)(sessions.sessionToken, sessionToken));
|
|
10205
10364
|
return session;
|
|
10206
10365
|
},
|
|
10207
10366
|
async createVerificationToken(token) {
|
|
10208
10367
|
await client.insert(verificationTokens).values(token);
|
|
10209
|
-
return await client.select().from(verificationTokens).where((0,
|
|
10368
|
+
return await client.select().from(verificationTokens).where((0, import_drizzle_orm27.eq)(verificationTokens.identifier, token.identifier)).then((res) => res[0]);
|
|
10210
10369
|
},
|
|
10211
10370
|
async useVerificationToken(token) {
|
|
10212
10371
|
try {
|
|
10213
|
-
const deletedToken = await client.select().from(verificationTokens).where((0,
|
|
10372
|
+
const deletedToken = await client.select().from(verificationTokens).where((0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm27.eq)(verificationTokens.token, token.token))).then((res) => res[0]) ?? null;
|
|
10214
10373
|
if (deletedToken?.createdAt) {
|
|
10215
10374
|
const TIMEOUT_IN_SECONDS = 90;
|
|
10216
10375
|
const expireMultipleClicks = (0, import_date_fns.addSeconds)(deletedToken.createdAt, TIMEOUT_IN_SECONDS);
|
|
@@ -10219,7 +10378,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10219
10378
|
const { id: _, ...verificationToken } = token;
|
|
10220
10379
|
return deletedToken;
|
|
10221
10380
|
} else {
|
|
10222
|
-
await client.delete(verificationTokens).where((0,
|
|
10381
|
+
await client.delete(verificationTokens).where((0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm27.eq)(verificationTokens.token, token.token)));
|
|
10223
10382
|
return deletedToken;
|
|
10224
10383
|
}
|
|
10225
10384
|
}
|
|
@@ -10229,14 +10388,14 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10229
10388
|
}
|
|
10230
10389
|
},
|
|
10231
10390
|
async deleteUser(id) {
|
|
10232
|
-
const user = await client.select().from(users).where((0,
|
|
10233
|
-
await client.delete(users).where((0,
|
|
10234
|
-
await client.delete(sessions).where((0,
|
|
10235
|
-
await client.delete(accounts).where((0,
|
|
10391
|
+
const user = await client.select().from(users).where((0, import_drizzle_orm27.eq)(users.id, id)).then((res) => res[0] ?? null);
|
|
10392
|
+
await client.delete(users).where((0, import_drizzle_orm27.eq)(users.id, id));
|
|
10393
|
+
await client.delete(sessions).where((0, import_drizzle_orm27.eq)(sessions.userId, id));
|
|
10394
|
+
await client.delete(accounts).where((0, import_drizzle_orm27.eq)(accounts.userId, id));
|
|
10236
10395
|
return user;
|
|
10237
10396
|
},
|
|
10238
10397
|
async unlinkAccount(account) {
|
|
10239
|
-
await client.delete(accounts).where((0,
|
|
10398
|
+
await client.delete(accounts).where((0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm27.eq)(accounts.provider, account.provider)));
|
|
10240
10399
|
return void 0;
|
|
10241
10400
|
}
|
|
10242
10401
|
};
|