@coursebuilder/adapter-drizzle 0.5.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QQA7STVO.js → chunk-3WYG5OE7.js} +2 -2
- package/dist/{chunk-6SLQW6OM.js → chunk-5XTOCFDB.js} +5 -2
- package/dist/{chunk-2UU2F4DM.js → chunk-6MRFUIH5.js} +6 -2
- package/dist/{chunk-XIGJFVUM.js → chunk-6YPHJWS2.js} +9 -2
- package/dist/{chunk-EFVZ7IN4.js → chunk-A6XPL665.js} +2 -2
- package/dist/{chunk-3NUCFLQJ.js → chunk-BLDW3QUS.js} +7 -3
- package/dist/{chunk-QP6YMUQX.js → chunk-DKJO4Y3K.js} +7 -3
- package/dist/{chunk-P4VXXTVA.js → chunk-EHRARBRS.js} +4 -1
- package/dist/{chunk-YVVXDJHI.js → chunk-ET3QAIY7.js} +9 -2
- package/dist/{chunk-YMFPIZMO.js → chunk-GAKWXOAY.js} +2 -2
- package/dist/{chunk-4ZWS76VQ.js → chunk-KPBVZ44W.js} +7 -3
- package/dist/{chunk-ZYQYJNLK.js → chunk-L5ZAWSTN.js} +51 -29
- package/dist/{chunk-6ON2O6UD.js → chunk-MGZMGDQ5.js} +7 -3
- package/dist/{chunk-KDEWFXEP.js → chunk-MP4CUWYC.js} +6 -2
- package/dist/{chunk-JW2PFVLO.js → chunk-QGZ2F5SW.js} +1387 -868
- package/dist/{chunk-XJXCDN7B.js → chunk-RCL6HPBL.js} +8 -4
- package/dist/chunk-RP66NZN3.js +81 -0
- package/dist/{chunk-27UC2HEP.js → chunk-WFC55BSF.js} +7 -3
- package/dist/{chunk-GINRTL6J.js → chunk-WJWJ6E5Y.js} +6 -2
- package/dist/{chunk-YGRYHMCG.js → chunk-WPJZAYX7.js} +7 -3
- package/dist/index.js +20 -20
- package/dist/lib/mysql/index.cjs +1355 -787
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +4201 -1667
- package/dist/lib/mysql/index.d.ts +4201 -1667
- package/dist/lib/mysql/index.js +20 -20
- package/dist/lib/mysql/schemas/auth/accounts.cjs +109 -93
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.js +10 -11
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs +104 -85
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.js +11 -12
- package/dist/lib/mysql/schemas/auth/device-verification.cjs +103 -87
- package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-verification.js +11 -12
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +102 -82
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.js +11 -12
- package/dist/lib/mysql/schemas/auth/roles.cjs +106 -82
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/roles.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/roles.js +10 -11
- package/dist/lib/mysql/schemas/auth/sessions.cjs +99 -83
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.js +11 -12
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +104 -84
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.js +10 -11
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs +108 -88
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.js +10 -11
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +109 -85
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.cts +16 -0
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +16 -0
- package/dist/lib/mysql/schemas/auth/user-roles.js +10 -11
- package/dist/lib/mysql/schemas/auth/users.cjs +288 -192
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +1 -0
- package/dist/lib/mysql/schemas/auth/users.d.ts +1 -0
- package/dist/lib/mysql/schemas/auth/users.js +10 -11
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +134 -98
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/coupon.js +10 -11
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +210 -17
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +33 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +33 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +11 -4
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +5 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs +315 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs.map +1 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.cts +161 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.ts +161 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +20 -0
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js.map +1 -0
- package/dist/lib/mysql/schemas/commerce/price.cjs +108 -80
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/price.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/price.js +10 -11
- package/dist/lib/mysql/schemas/commerce/product.cjs +134 -102
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/product.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/product.js +10 -11
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +141 -113
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +11 -12
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +293 -175
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.cts +34 -0
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +34 -0
- package/dist/lib/mysql/schemas/commerce/purchase.js +10 -11
- package/dist/lib/mysql/schemas/commerce/subscription.cjs +343 -0
- package/dist/lib/mysql/schemas/commerce/subscription.cjs.map +1 -0
- package/dist/lib/mysql/schemas/commerce/subscription.d.cts +130 -0
- package/dist/lib/mysql/schemas/commerce/subscription.d.ts +130 -0
- package/dist/lib/mysql/schemas/commerce/subscription.js +20 -0
- package/dist/lib/mysql/schemas/commerce/subscription.js.map +1 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +109 -85
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +16 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +16 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -12
- package/dist/lib/mysql/schemas/communication/comment.cjs +148 -87
- package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/comment.d.cts +17 -0
- package/dist/lib/mysql/schemas/communication/comment.d.ts +17 -0
- package/dist/lib/mysql/schemas/communication/comment.js +10 -11
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs +5 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +3 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +16 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +176 -105
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +33 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +33 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +10 -11
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +186 -111
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.cts +33 -0
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +33 -0
- package/dist/lib/mysql/schemas/content/content-contributions.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +110 -79
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +115 -88
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +127 -96
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-tag.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-tag.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs +130 -103
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-version.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/content-resource-version.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource.cjs +248 -157
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.cts +33 -0
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +33 -0
- package/dist/lib/mysql/schemas/content/content-resource.js +10 -11
- package/dist/lib/mysql/schemas/content/contribution-types.cjs +5 -1
- package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/contribution-types.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/contribution-types.js +1 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.cjs +8 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +32 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +32 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.js +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs +8 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.d.cts +32 -0
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +32 -0
- package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
- package/dist/lib/mysql/schemas/content/tag-tag.cjs +108 -84
- package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag-tag.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/tag-tag.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/tag-tag.js +10 -11
- package/dist/lib/mysql/schemas/content/tag.cjs +123 -95
- package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag.d.cts +16 -0
- package/dist/lib/mysql/schemas/content/tag.d.ts +16 -0
- package/dist/lib/mysql/schemas/content/tag.js +10 -11
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs +301 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs.map +1 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.d.cts +129 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.d.ts +129 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js +21 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js.map +1 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs +370 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs.map +1 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.d.cts +131 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.d.ts +131 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.js +20 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.js.map +1 -0
- package/dist/lib/mysql/schemas/org/organizations.cjs +349 -0
- package/dist/lib/mysql/schemas/org/organizations.cjs.map +1 -0
- package/dist/lib/mysql/schemas/org/organizations.d.cts +98 -0
- package/dist/lib/mysql/schemas/org/organizations.d.ts +98 -0
- package/dist/lib/mysql/schemas/org/organizations.js +20 -0
- package/dist/lib/mysql/schemas/org/organizations.js.map +1 -0
- package/package.json +2 -2
- package/src/lib/mysql/index.ts +34 -0
- package/src/lib/mysql/schemas/auth/device-access-token.ts +3 -0
- package/src/lib/mysql/schemas/auth/roles.ts +3 -0
- package/src/lib/mysql/schemas/auth/user-permissions.ts +2 -0
- package/src/lib/mysql/schemas/auth/user-prefs.ts +2 -0
- package/src/lib/mysql/schemas/auth/user-roles.ts +2 -0
- package/src/lib/mysql/schemas/auth/users.ts +5 -0
- package/src/lib/mysql/schemas/commerce/coupon.ts +2 -0
- package/src/lib/mysql/schemas/commerce/merchant-account.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-charge.ts +16 -0
- package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -0
- package/src/lib/mysql/schemas/commerce/merchant-price.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-product.ts +3 -0
- package/src/lib/mysql/schemas/commerce/merchant-session.ts +8 -1
- package/src/lib/mysql/schemas/commerce/merchant-subscription.ts +64 -0
- package/src/lib/mysql/schemas/commerce/price.ts +3 -0
- package/src/lib/mysql/schemas/commerce/product.ts +3 -0
- package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +3 -0
- package/src/lib/mysql/schemas/commerce/purchase.ts +22 -0
- package/src/lib/mysql/schemas/commerce/subscription.ts +71 -0
- package/src/lib/mysql/schemas/commerce/upgradable-products.ts +2 -0
- package/src/lib/mysql/schemas/communication/comment.ts +13 -0
- package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -0
- package/src/lib/mysql/schemas/communication/communication-preference-types.ts +1 -0
- package/src/lib/mysql/schemas/communication/communication-preferences.ts +14 -0
- package/src/lib/mysql/schemas/content/content-contributions.ts +14 -0
- package/src/lib/mysql/schemas/content/content-resource-product.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource-resource.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource-tag.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource-version.ts +2 -0
- package/src/lib/mysql/schemas/content/content-resource.ts +17 -0
- package/src/lib/mysql/schemas/content/contribution-types.ts +2 -0
- package/src/lib/mysql/schemas/content/lesson-progress.ts +7 -0
- package/src/lib/mysql/schemas/content/resource-progress.ts +7 -0
- package/src/lib/mysql/schemas/content/tag-tag.ts +2 -0
- package/src/lib/mysql/schemas/content/tag.ts +2 -0
- package/src/lib/mysql/schemas/org/organization-membership-roles.ts +68 -0
- package/src/lib/mysql/schemas/org/organization-memberships.ts +69 -0
- package/src/lib/mysql/schemas/org/organizations.ts +50 -0
- package/dist/chunk-SRTIWWLG.js +0 -96
package/dist/lib/mysql/index.cjs
CHANGED
|
@@ -39,8 +39,8 @@ __export(mysql_exports, {
|
|
|
39
39
|
module.exports = __toCommonJS(mysql_exports);
|
|
40
40
|
var import_slugify = __toESM(require("@sindresorhus/slugify"), 1);
|
|
41
41
|
var import_date_fns2 = require("date-fns");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
42
|
+
var import_drizzle_orm41 = require("drizzle-orm");
|
|
43
|
+
var import_mysql_core46 = require("drizzle-orm/mysql-core");
|
|
44
44
|
var import_nanoid = require("nanoid");
|
|
45
45
|
var import_uuid = require("uuid");
|
|
46
46
|
|
|
@@ -198,8 +198,8 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
198
198
|
"not_finite"
|
|
199
199
|
]);
|
|
200
200
|
var quotelessJson = /* @__PURE__ */ __name((obj) => {
|
|
201
|
-
const
|
|
202
|
-
return
|
|
201
|
+
const json19 = JSON.stringify(obj, null, 2);
|
|
202
|
+
return json19.replace(/"([^"]+)":/g, "$1:");
|
|
203
203
|
}, "quotelessJson");
|
|
204
204
|
var _ZodError = class _ZodError extends Error {
|
|
205
205
|
constructor(issues) {
|
|
@@ -2318,10 +2318,10 @@ var _ZodObject = class _ZodObject extends ZodType {
|
|
|
2318
2318
|
// }) as any;
|
|
2319
2319
|
// return merged;
|
|
2320
2320
|
// }
|
|
2321
|
-
catchall(
|
|
2321
|
+
catchall(index43) {
|
|
2322
2322
|
return new _ZodObject({
|
|
2323
2323
|
...this._def,
|
|
2324
|
-
catchall:
|
|
2324
|
+
catchall: index43
|
|
2325
2325
|
});
|
|
2326
2326
|
}
|
|
2327
2327
|
pick(mask) {
|
|
@@ -2636,9 +2636,9 @@ function mergeValues(a, b) {
|
|
|
2636
2636
|
return { valid: false };
|
|
2637
2637
|
}
|
|
2638
2638
|
const newArray = [];
|
|
2639
|
-
for (let
|
|
2640
|
-
const itemA = a[
|
|
2641
|
-
const itemB = b[
|
|
2639
|
+
for (let index43 = 0; index43 < a.length; index43++) {
|
|
2640
|
+
const itemA = a[index43];
|
|
2641
|
+
const itemB = b[index43];
|
|
2642
2642
|
const sharedValue = mergeValues(itemA, itemB);
|
|
2643
2643
|
if (!sharedValue.valid) {
|
|
2644
2644
|
return { valid: false };
|
|
@@ -2850,10 +2850,10 @@ var _ZodMap = class _ZodMap extends ZodType {
|
|
|
2850
2850
|
}
|
|
2851
2851
|
const keyType = this._def.keyType;
|
|
2852
2852
|
const valueType = this._def.valueType;
|
|
2853
|
-
const pairs = [...ctx.data.entries()].map(([key, value],
|
|
2853
|
+
const pairs = [...ctx.data.entries()].map(([key, value], index43) => {
|
|
2854
2854
|
return {
|
|
2855
|
-
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
|
|
2856
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [
|
|
2855
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index43, "key"])),
|
|
2856
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index43, "value"]))
|
|
2857
2857
|
};
|
|
2858
2858
|
});
|
|
2859
2859
|
if (ctx.common.async) {
|
|
@@ -4046,8 +4046,8 @@ var ZodIssueCode2 = util2.arrayToEnum([
|
|
|
4046
4046
|
"not_finite"
|
|
4047
4047
|
]);
|
|
4048
4048
|
var quotelessJson2 = /* @__PURE__ */ __name2((obj) => {
|
|
4049
|
-
const
|
|
4050
|
-
return
|
|
4049
|
+
const json19 = JSON.stringify(obj, null, 2);
|
|
4050
|
+
return json19.replace(/"([^"]+)":/g, "$1:");
|
|
4051
4051
|
}, "quotelessJson");
|
|
4052
4052
|
var _a;
|
|
4053
4053
|
var _ZodError2 = (_a = class extends Error {
|
|
@@ -6351,10 +6351,10 @@ var _ZodObject2 = (_a18 = class extends ZodType2 {
|
|
|
6351
6351
|
// }) as any;
|
|
6352
6352
|
// return merged;
|
|
6353
6353
|
// }
|
|
6354
|
-
catchall(
|
|
6354
|
+
catchall(index43) {
|
|
6355
6355
|
return new _a18({
|
|
6356
6356
|
...this._def,
|
|
6357
|
-
catchall:
|
|
6357
|
+
catchall: index43
|
|
6358
6358
|
});
|
|
6359
6359
|
}
|
|
6360
6360
|
pick(mask) {
|
|
@@ -6696,9 +6696,9 @@ function mergeValues2(a, b) {
|
|
|
6696
6696
|
};
|
|
6697
6697
|
}
|
|
6698
6698
|
const newArray = [];
|
|
6699
|
-
for (let
|
|
6700
|
-
const itemA = a[
|
|
6701
|
-
const itemB = b[
|
|
6699
|
+
for (let index43 = 0; index43 < a.length; index43++) {
|
|
6700
|
+
const itemA = a[index43];
|
|
6701
|
+
const itemB = b[index43];
|
|
6702
6702
|
const sharedValue = mergeValues2(itemA, itemB);
|
|
6703
6703
|
if (!sharedValue.valid) {
|
|
6704
6704
|
return {
|
|
@@ -6932,14 +6932,14 @@ var _ZodMap2 = (_a24 = class extends ZodType2 {
|
|
|
6932
6932
|
const valueType = this._def.valueType;
|
|
6933
6933
|
const pairs = [
|
|
6934
6934
|
...ctx.data.entries()
|
|
6935
|
-
].map(([key, value],
|
|
6935
|
+
].map(([key, value], index43) => {
|
|
6936
6936
|
return {
|
|
6937
6937
|
key: keyType._parse(new ParseInputLazyPath2(ctx, key, ctx.path, [
|
|
6938
|
-
|
|
6938
|
+
index43,
|
|
6939
6939
|
"key"
|
|
6940
6940
|
])),
|
|
6941
6941
|
value: valueType._parse(new ParseInputLazyPath2(ctx, value, ctx.path, [
|
|
6942
|
-
|
|
6942
|
+
index43,
|
|
6943
6943
|
"value"
|
|
6944
6944
|
]))
|
|
6945
6945
|
};
|
|
@@ -8114,7 +8114,7 @@ var priceSchema = z2.object({
|
|
|
8114
8114
|
fields: z2.record(z2.any()).default({})
|
|
8115
8115
|
});
|
|
8116
8116
|
|
|
8117
|
-
// ../core/dist/chunk-
|
|
8117
|
+
// ../core/dist/chunk-SCKAG5RT.js
|
|
8118
8118
|
var ContentResourceResourceSchema = z2.object({
|
|
8119
8119
|
resourceId: z2.string(),
|
|
8120
8120
|
resourceOfId: z2.string(),
|
|
@@ -8134,7 +8134,9 @@ var ContentResourceSchema = z2.object({
|
|
|
8134
8134
|
createdAt: z2.coerce.date().nullable(),
|
|
8135
8135
|
updatedAt: z2.coerce.date().nullable(),
|
|
8136
8136
|
deletedAt: z2.coerce.date().nullable(),
|
|
8137
|
-
resources: z2.array(ContentResourceResourceSchema).default([]).nullable()
|
|
8137
|
+
resources: z2.array(ContentResourceResourceSchema).default([]).nullable(),
|
|
8138
|
+
organizationId: z2.string().nullable(),
|
|
8139
|
+
createdByOrganizationMembershipId: z2.string().nullable()
|
|
8138
8140
|
});
|
|
8139
8141
|
var ContentResourceProductSchema = z2.object({
|
|
8140
8142
|
resourceId: z2.string(),
|
|
@@ -8159,7 +8161,7 @@ var ResourceVisibilitySchema = z2.union([
|
|
|
8159
8161
|
z2.literal("unlisted")
|
|
8160
8162
|
]);
|
|
8161
8163
|
|
|
8162
|
-
// ../core/dist/chunk-
|
|
8164
|
+
// ../core/dist/chunk-E56UB2X2.js
|
|
8163
8165
|
var productSchema = z2.object({
|
|
8164
8166
|
id: z2.string().max(191),
|
|
8165
8167
|
name: z2.string().max(191),
|
|
@@ -8225,7 +8227,7 @@ var couponSchema = z2.object({
|
|
|
8225
8227
|
bulkPurchaseId: z2.string().max(191).optional().nullable()
|
|
8226
8228
|
});
|
|
8227
8229
|
|
|
8228
|
-
// ../core/dist/chunk-
|
|
8230
|
+
// ../core/dist/chunk-GZ7YLWVN.js
|
|
8229
8231
|
var purchaseSchema = z2.object({
|
|
8230
8232
|
id: z2.string().max(191),
|
|
8231
8233
|
userId: z2.string().max(191).optional().nullable(),
|
|
@@ -8274,7 +8276,7 @@ var purchaseUserTransferSchema = z2.object({
|
|
|
8274
8276
|
completedAt: z2.date().nullable()
|
|
8275
8277
|
});
|
|
8276
8278
|
|
|
8277
|
-
// ../core/dist/chunk-
|
|
8279
|
+
// ../core/dist/chunk-PG6VF2O6.js
|
|
8278
8280
|
var resourceProgressSchema = z2.object({
|
|
8279
8281
|
userId: z2.string().max(191),
|
|
8280
8282
|
resourceId: z2.string().max(191).optional().nullable(),
|
|
@@ -8494,144 +8496,410 @@ var validateCoupon = /* @__PURE__ */ __name2((coupon, productIds = []) => {
|
|
|
8494
8496
|
}, "validateCoupon");
|
|
8495
8497
|
|
|
8496
8498
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
8497
|
-
var
|
|
8498
|
-
var
|
|
8499
|
+
var import_drizzle_orm31 = require("drizzle-orm");
|
|
8500
|
+
var import_mysql_core35 = require("drizzle-orm/mysql-core");
|
|
8499
8501
|
|
|
8500
8502
|
// src/lib/mysql/schemas/auth/users.ts
|
|
8501
|
-
var
|
|
8502
|
-
var
|
|
8503
|
+
var import_drizzle_orm30 = require("drizzle-orm");
|
|
8504
|
+
var import_mysql_core34 = require("drizzle-orm/mysql-core");
|
|
8503
8505
|
|
|
8504
8506
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
8505
|
-
var
|
|
8507
|
+
var import_drizzle_orm22 = require("drizzle-orm");
|
|
8508
|
+
var import_mysql_core24 = require("drizzle-orm/mysql-core");
|
|
8509
|
+
|
|
8510
|
+
// src/lib/mysql/schemas/org/organization-memberships.ts
|
|
8511
|
+
var import_drizzle_orm20 = require("drizzle-orm");
|
|
8506
8512
|
var import_mysql_core20 = require("drizzle-orm/mysql-core");
|
|
8507
8513
|
|
|
8508
|
-
// src/lib/mysql/schemas/
|
|
8509
|
-
var
|
|
8510
|
-
var
|
|
8514
|
+
// src/lib/mysql/schemas/org/organizations.ts
|
|
8515
|
+
var import_drizzle_orm19 = require("drizzle-orm");
|
|
8516
|
+
var import_mysql_core19 = require("drizzle-orm/mysql-core");
|
|
8511
8517
|
|
|
8512
|
-
// src/lib/mysql/schemas/commerce/
|
|
8518
|
+
// src/lib/mysql/schemas/commerce/subscription.ts
|
|
8519
|
+
var import_drizzle_orm18 = require("drizzle-orm");
|
|
8520
|
+
var import_mysql_core18 = require("drizzle-orm/mysql-core");
|
|
8521
|
+
|
|
8522
|
+
// src/lib/mysql/schemas/commerce/merchant-subscription.ts
|
|
8523
|
+
var import_drizzle_orm5 = require("drizzle-orm");
|
|
8524
|
+
var import_mysql_core5 = require("drizzle-orm/mysql-core");
|
|
8525
|
+
|
|
8526
|
+
// src/lib/mysql/schemas/commerce/merchant-charge.ts
|
|
8527
|
+
var import_drizzle_orm4 = require("drizzle-orm");
|
|
8528
|
+
var import_mysql_core4 = require("drizzle-orm/mysql-core");
|
|
8529
|
+
|
|
8530
|
+
// src/lib/mysql/schemas/commerce/merchant-account.ts
|
|
8531
|
+
var import_drizzle_orm = require("drizzle-orm");
|
|
8513
8532
|
var import_mysql_core = require("drizzle-orm/mysql-core");
|
|
8514
|
-
function
|
|
8515
|
-
return mysqlTable("
|
|
8533
|
+
function getMerchantAccountSchema(mysqlTable) {
|
|
8534
|
+
return mysqlTable("MerchantAccount", {
|
|
8516
8535
|
id: (0, import_mysql_core.varchar)("id", {
|
|
8517
8536
|
length: 191
|
|
8518
8537
|
}).notNull(),
|
|
8519
|
-
|
|
8538
|
+
organizationId: (0, import_mysql_core.varchar)("organizationId", {
|
|
8520
8539
|
length: 191
|
|
8521
8540
|
}),
|
|
8522
8541
|
status: (0, import_mysql_core.int)("status").default(0).notNull(),
|
|
8523
|
-
|
|
8542
|
+
createdAt: (0, import_mysql_core.timestamp)("createdAt", {
|
|
8543
|
+
mode: "date",
|
|
8544
|
+
fsp: 3
|
|
8545
|
+
}).default(import_drizzle_orm.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8546
|
+
label: (0, import_mysql_core.varchar)("label", {
|
|
8547
|
+
length: 191
|
|
8548
|
+
}),
|
|
8549
|
+
identifier: (0, import_mysql_core.varchar)("identifier", {
|
|
8550
|
+
length: 191
|
|
8551
|
+
})
|
|
8552
|
+
}, (table) => {
|
|
8553
|
+
return {
|
|
8554
|
+
merchantAccountId: (0, import_mysql_core.primaryKey)({
|
|
8555
|
+
columns: [
|
|
8556
|
+
table.id
|
|
8557
|
+
],
|
|
8558
|
+
name: "MerchantAccount_id"
|
|
8559
|
+
}),
|
|
8560
|
+
organizationIdIdx: (0, import_mysql_core.index)("organizationId_idx").on(table.organizationId)
|
|
8561
|
+
};
|
|
8562
|
+
});
|
|
8563
|
+
}
|
|
8564
|
+
__name(getMerchantAccountSchema, "getMerchantAccountSchema");
|
|
8565
|
+
|
|
8566
|
+
// src/lib/mysql/schemas/commerce/merchant-customer.ts
|
|
8567
|
+
var import_drizzle_orm2 = require("drizzle-orm");
|
|
8568
|
+
var import_mysql_core2 = require("drizzle-orm/mysql-core");
|
|
8569
|
+
function getMerchantCustomerSchema(mysqlTable) {
|
|
8570
|
+
return mysqlTable("MerchantCustomer", {
|
|
8571
|
+
id: (0, import_mysql_core2.varchar)("id", {
|
|
8524
8572
|
length: 191
|
|
8525
8573
|
}).notNull(),
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8574
|
+
organizationId: (0, import_mysql_core2.varchar)("organizationId", {
|
|
8575
|
+
length: 191
|
|
8576
|
+
}),
|
|
8577
|
+
userId: (0, import_mysql_core2.varchar)("userId", {
|
|
8578
|
+
length: 191
|
|
8579
|
+
}).notNull(),
|
|
8580
|
+
merchantAccountId: (0, import_mysql_core2.varchar)("merchantAccountId", {
|
|
8581
|
+
length: 191
|
|
8582
|
+
}).notNull(),
|
|
8583
|
+
identifier: (0, import_mysql_core2.varchar)("identifier", {
|
|
8584
|
+
length: 191
|
|
8585
|
+
}).notNull(),
|
|
8586
|
+
createdAt: (0, import_mysql_core2.timestamp)("createdAt", {
|
|
8587
|
+
mode: "date",
|
|
8588
|
+
fsp: 3
|
|
8589
|
+
}).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8590
|
+
status: (0, import_mysql_core2.int)("status").default(0)
|
|
8591
|
+
}, (table) => {
|
|
8592
|
+
return {
|
|
8593
|
+
merchantCustomerId: (0, import_mysql_core2.primaryKey)({
|
|
8594
|
+
columns: [
|
|
8595
|
+
table.id
|
|
8596
|
+
],
|
|
8597
|
+
name: "MerchantCustomer_id"
|
|
8598
|
+
}),
|
|
8599
|
+
merchantCustomerIdentifierKey: (0, import_mysql_core2.unique)("MerchantCustomer_identifier_key").on(table.identifier),
|
|
8600
|
+
userIdIdx: (0, import_mysql_core2.index)("idx_MerchantCustomer_on_userId").on(table.userId),
|
|
8601
|
+
organizationIdIdx: (0, import_mysql_core2.index)("organizationId_idx").on(table.organizationId)
|
|
8602
|
+
};
|
|
8603
|
+
});
|
|
8604
|
+
}
|
|
8605
|
+
__name(getMerchantCustomerSchema, "getMerchantCustomerSchema");
|
|
8606
|
+
|
|
8607
|
+
// src/lib/mysql/schemas/commerce/merchant-product.ts
|
|
8608
|
+
var import_drizzle_orm3 = require("drizzle-orm");
|
|
8609
|
+
var import_mysql_core3 = require("drizzle-orm/mysql-core");
|
|
8610
|
+
function getMerchantProductSchema(mysqlTable) {
|
|
8611
|
+
return mysqlTable("MerchantProduct", {
|
|
8612
|
+
id: (0, import_mysql_core3.varchar)("id", {
|
|
8613
|
+
length: 191
|
|
8614
|
+
}).notNull(),
|
|
8615
|
+
organizationId: (0, import_mysql_core3.varchar)("organizationId", {
|
|
8616
|
+
length: 191
|
|
8617
|
+
}),
|
|
8618
|
+
merchantAccountId: (0, import_mysql_core3.varchar)("merchantAccountId", {
|
|
8619
|
+
length: 191
|
|
8620
|
+
}).notNull(),
|
|
8621
|
+
productId: (0, import_mysql_core3.varchar)("productId", {
|
|
8622
|
+
length: 191
|
|
8623
|
+
}).notNull(),
|
|
8624
|
+
status: (0, import_mysql_core3.int)("status").default(0).notNull(),
|
|
8625
|
+
identifier: (0, import_mysql_core3.varchar)("identifier", {
|
|
8626
|
+
length: 191
|
|
8627
|
+
}),
|
|
8628
|
+
createdAt: (0, import_mysql_core3.timestamp)("createdAt", {
|
|
8629
|
+
mode: "date",
|
|
8630
|
+
fsp: 3
|
|
8631
|
+
}).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
8632
|
+
}, (table) => {
|
|
8633
|
+
return {
|
|
8634
|
+
merchantProductId: (0, import_mysql_core3.primaryKey)({
|
|
8635
|
+
columns: [
|
|
8636
|
+
table.id
|
|
8637
|
+
],
|
|
8638
|
+
name: "MerchantProduct_id"
|
|
8639
|
+
}),
|
|
8640
|
+
merchantProductIdentifierKey: (0, import_mysql_core3.unique)("MerchantProduct_identifier_key").on(table.identifier),
|
|
8641
|
+
organizationIdIdx: (0, import_mysql_core3.index)("organizationId_idx").on(table.organizationId)
|
|
8642
|
+
};
|
|
8643
|
+
});
|
|
8644
|
+
}
|
|
8645
|
+
__name(getMerchantProductSchema, "getMerchantProductSchema");
|
|
8646
|
+
|
|
8647
|
+
// src/lib/mysql/schemas/commerce/merchant-charge.ts
|
|
8648
|
+
function getMerchantChargeSchema(mysqlTable) {
|
|
8649
|
+
return mysqlTable("MerchantCharge", {
|
|
8650
|
+
id: (0, import_mysql_core4.varchar)("id", {
|
|
8651
|
+
length: 191
|
|
8652
|
+
}).notNull(),
|
|
8653
|
+
organizationId: (0, import_mysql_core4.varchar)("organizationId", {
|
|
8654
|
+
length: 191
|
|
8655
|
+
}),
|
|
8656
|
+
status: (0, import_mysql_core4.int)("status").default(0).notNull(),
|
|
8657
|
+
identifier: (0, import_mysql_core4.varchar)("identifier", {
|
|
8658
|
+
length: 191
|
|
8659
|
+
}).notNull(),
|
|
8660
|
+
userId: (0, import_mysql_core4.varchar)("userId", {
|
|
8661
|
+
length: 191
|
|
8662
|
+
}).notNull(),
|
|
8663
|
+
merchantAccountId: (0, import_mysql_core4.varchar)("merchantAccountId", {
|
|
8664
|
+
length: 191
|
|
8665
|
+
}).notNull(),
|
|
8666
|
+
merchantProductId: (0, import_mysql_core4.varchar)("merchantProductId", {
|
|
8667
|
+
length: 191
|
|
8529
8668
|
}).notNull(),
|
|
8530
|
-
|
|
8669
|
+
merchantSubscriptionId: (0, import_mysql_core4.varchar)("merchantSubscriptionId", {
|
|
8670
|
+
length: 191
|
|
8671
|
+
}),
|
|
8672
|
+
createdAt: (0, import_mysql_core4.timestamp)("createdAt", {
|
|
8673
|
+
mode: "date",
|
|
8674
|
+
fsp: 3
|
|
8675
|
+
}).default(import_drizzle_orm4.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8676
|
+
merchantCustomerId: (0, import_mysql_core4.varchar)("merchantCustomerId", {
|
|
8531
8677
|
length: 191
|
|
8678
|
+
}).notNull()
|
|
8679
|
+
}, (table) => {
|
|
8680
|
+
return {
|
|
8681
|
+
merchantChargeId: (0, import_mysql_core4.primaryKey)({
|
|
8682
|
+
columns: [
|
|
8683
|
+
table.id
|
|
8684
|
+
],
|
|
8685
|
+
name: "MerchantCharge_id"
|
|
8686
|
+
}),
|
|
8687
|
+
merchantChargeIdentifierKey: (0, import_mysql_core4.unique)("MerchantCharge_identifier_key").on(table.identifier),
|
|
8688
|
+
merchantSubscriptionIdIdx: (0, import_mysql_core4.index)("merchantSubscriptionId_idx").on(table.merchantSubscriptionId),
|
|
8689
|
+
organizationIdIdx: (0, import_mysql_core4.index)("organizationId_idx").on(table.organizationId)
|
|
8690
|
+
};
|
|
8691
|
+
});
|
|
8692
|
+
}
|
|
8693
|
+
__name(getMerchantChargeSchema, "getMerchantChargeSchema");
|
|
8694
|
+
function getMerchantChargeRelationsSchema(mysqlTable) {
|
|
8695
|
+
const merchantCharge = getMerchantChargeSchema(mysqlTable);
|
|
8696
|
+
const merchantAccount = getMerchantAccountSchema(mysqlTable);
|
|
8697
|
+
const merchantProduct = getMerchantProductSchema(mysqlTable);
|
|
8698
|
+
const merchantCustomer = getMerchantCustomerSchema(mysqlTable);
|
|
8699
|
+
const merchantSubscription = getMerchantSubscriptionSchema(mysqlTable);
|
|
8700
|
+
return (0, import_drizzle_orm4.relations)(merchantCharge, ({ one }) => ({
|
|
8701
|
+
merchantAccount: one(merchantAccount, {
|
|
8702
|
+
fields: [
|
|
8703
|
+
merchantCharge.merchantAccountId
|
|
8704
|
+
],
|
|
8705
|
+
references: [
|
|
8706
|
+
merchantAccount.id
|
|
8707
|
+
],
|
|
8708
|
+
relationName: "merchantAccount"
|
|
8709
|
+
}),
|
|
8710
|
+
merchantProduct: one(merchantProduct, {
|
|
8711
|
+
fields: [
|
|
8712
|
+
merchantCharge.merchantProductId
|
|
8713
|
+
],
|
|
8714
|
+
references: [
|
|
8715
|
+
merchantProduct.id
|
|
8716
|
+
],
|
|
8717
|
+
relationName: "merchantProduct"
|
|
8718
|
+
}),
|
|
8719
|
+
merchantCustomer: one(merchantCustomer, {
|
|
8720
|
+
fields: [
|
|
8721
|
+
merchantCharge.merchantCustomerId
|
|
8722
|
+
],
|
|
8723
|
+
references: [
|
|
8724
|
+
merchantCustomer.id
|
|
8725
|
+
],
|
|
8726
|
+
relationName: "merchantCustomer"
|
|
8727
|
+
}),
|
|
8728
|
+
merchantSubscription: one(merchantSubscription, {
|
|
8729
|
+
fields: [
|
|
8730
|
+
merchantCharge.merchantSubscriptionId
|
|
8731
|
+
],
|
|
8732
|
+
references: [
|
|
8733
|
+
merchantSubscription.id
|
|
8734
|
+
],
|
|
8735
|
+
relationName: "merchantSubscription"
|
|
8532
8736
|
})
|
|
8737
|
+
}));
|
|
8738
|
+
}
|
|
8739
|
+
__name(getMerchantChargeRelationsSchema, "getMerchantChargeRelationsSchema");
|
|
8740
|
+
|
|
8741
|
+
// src/lib/mysql/schemas/commerce/merchant-subscription.ts
|
|
8742
|
+
function getMerchantSubscriptionSchema(mysqlTable) {
|
|
8743
|
+
return mysqlTable("MerchantSubscription", {
|
|
8744
|
+
id: (0, import_mysql_core5.varchar)("id", {
|
|
8745
|
+
length: 191
|
|
8746
|
+
}).notNull(),
|
|
8747
|
+
organizationId: (0, import_mysql_core5.varchar)("organizationId", {
|
|
8748
|
+
length: 191
|
|
8749
|
+
}),
|
|
8750
|
+
merchantAccountId: (0, import_mysql_core5.varchar)("merchantAccountId", {
|
|
8751
|
+
length: 191
|
|
8752
|
+
}).notNull(),
|
|
8753
|
+
status: (0, import_mysql_core5.int)("status").default(0).notNull(),
|
|
8754
|
+
createdAt: (0, import_mysql_core5.timestamp)("createdAt", {
|
|
8755
|
+
mode: "date",
|
|
8756
|
+
fsp: 3
|
|
8757
|
+
}).default(import_drizzle_orm5.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8758
|
+
label: (0, import_mysql_core5.varchar)("label", {
|
|
8759
|
+
length: 191
|
|
8760
|
+
}),
|
|
8761
|
+
identifier: (0, import_mysql_core5.varchar)("identifier", {
|
|
8762
|
+
length: 191
|
|
8763
|
+
}),
|
|
8764
|
+
merchantCustomerId: (0, import_mysql_core5.varchar)("merchantCustomerId", {
|
|
8765
|
+
length: 191
|
|
8766
|
+
}).notNull(),
|
|
8767
|
+
merchantProductId: (0, import_mysql_core5.varchar)("merchantProductId", {
|
|
8768
|
+
length: 191
|
|
8769
|
+
}).notNull()
|
|
8533
8770
|
}, (table) => {
|
|
8534
8771
|
return {
|
|
8535
|
-
|
|
8772
|
+
merchantSubscriptionId: (0, import_mysql_core5.primaryKey)({
|
|
8536
8773
|
columns: [
|
|
8537
8774
|
table.id
|
|
8538
8775
|
],
|
|
8539
|
-
name: "
|
|
8776
|
+
name: "MerchantSubscription_id"
|
|
8540
8777
|
}),
|
|
8541
|
-
|
|
8778
|
+
organizationIdIdx: (0, import_mysql_core5.index)("organizationId_idx").on(table.organizationId)
|
|
8542
8779
|
};
|
|
8543
8780
|
});
|
|
8544
8781
|
}
|
|
8545
|
-
__name(
|
|
8782
|
+
__name(getMerchantSubscriptionSchema, "getMerchantSubscriptionSchema");
|
|
8783
|
+
function getMerchantSubscriptionRelationsSchema(mysqlTable) {
|
|
8784
|
+
const merchantSubscription = getMerchantSubscriptionSchema(mysqlTable);
|
|
8785
|
+
const merchantCharge = getMerchantChargeSchema(mysqlTable);
|
|
8786
|
+
const subscription = getSubscriptionSchema(mysqlTable);
|
|
8787
|
+
return (0, import_drizzle_orm5.relations)(merchantSubscription, ({ many, one }) => ({
|
|
8788
|
+
merchantCharges: many(merchantCharge, {
|
|
8789
|
+
relationName: "merchantSubscription"
|
|
8790
|
+
}),
|
|
8791
|
+
subscription: one(subscription, {
|
|
8792
|
+
fields: [
|
|
8793
|
+
merchantSubscription.id
|
|
8794
|
+
],
|
|
8795
|
+
references: [
|
|
8796
|
+
subscription.merchantSubscriptionId
|
|
8797
|
+
],
|
|
8798
|
+
relationName: "subscription"
|
|
8799
|
+
})
|
|
8800
|
+
}));
|
|
8801
|
+
}
|
|
8802
|
+
__name(getMerchantSubscriptionRelationsSchema, "getMerchantSubscriptionRelationsSchema");
|
|
8546
8803
|
|
|
8547
8804
|
// src/lib/mysql/schemas/commerce/product.ts
|
|
8548
|
-
var
|
|
8549
|
-
var
|
|
8805
|
+
var import_drizzle_orm17 = require("drizzle-orm");
|
|
8806
|
+
var import_mysql_core17 = require("drizzle-orm/mysql-core");
|
|
8550
8807
|
|
|
8551
8808
|
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
8552
|
-
var
|
|
8553
|
-
var
|
|
8809
|
+
var import_drizzle_orm14 = require("drizzle-orm");
|
|
8810
|
+
var import_mysql_core14 = require("drizzle-orm/mysql-core");
|
|
8554
8811
|
|
|
8555
8812
|
// src/lib/mysql/schemas/content/content-resource.ts
|
|
8556
|
-
var
|
|
8557
|
-
var
|
|
8813
|
+
var import_drizzle_orm13 = require("drizzle-orm");
|
|
8814
|
+
var import_mysql_core13 = require("drizzle-orm/mysql-core");
|
|
8558
8815
|
|
|
8559
8816
|
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
8560
|
-
var
|
|
8561
|
-
var
|
|
8817
|
+
var import_drizzle_orm7 = require("drizzle-orm");
|
|
8818
|
+
var import_mysql_core7 = require("drizzle-orm/mysql-core");
|
|
8562
8819
|
|
|
8563
8820
|
// src/lib/mysql/schemas/content/contribution-types.ts
|
|
8564
|
-
var
|
|
8565
|
-
var
|
|
8821
|
+
var import_drizzle_orm6 = require("drizzle-orm");
|
|
8822
|
+
var import_mysql_core6 = require("drizzle-orm/mysql-core");
|
|
8566
8823
|
function getContributionTypesSchema(mysqlTable) {
|
|
8567
8824
|
return mysqlTable("ContributionType", {
|
|
8568
|
-
id: (0,
|
|
8825
|
+
id: (0, import_mysql_core6.varchar)("id", {
|
|
8569
8826
|
length: 255
|
|
8570
8827
|
}).notNull().primaryKey(),
|
|
8571
|
-
|
|
8828
|
+
organizationId: (0, import_mysql_core6.varchar)("organizationId", {
|
|
8829
|
+
length: 191
|
|
8830
|
+
}),
|
|
8831
|
+
slug: (0, import_mysql_core6.varchar)("slug", {
|
|
8572
8832
|
length: 255
|
|
8573
8833
|
}).notNull().unique(),
|
|
8574
|
-
name: (0,
|
|
8834
|
+
name: (0, import_mysql_core6.varchar)("name", {
|
|
8575
8835
|
length: 255
|
|
8576
8836
|
}).notNull(),
|
|
8577
|
-
description: (0,
|
|
8578
|
-
active: (0,
|
|
8579
|
-
createdAt: (0,
|
|
8837
|
+
description: (0, import_mysql_core6.text)("description"),
|
|
8838
|
+
active: (0, import_mysql_core6.boolean)("active").notNull().default(true),
|
|
8839
|
+
createdAt: (0, import_mysql_core6.timestamp)("createdAt", {
|
|
8580
8840
|
mode: "date",
|
|
8581
8841
|
fsp: 3
|
|
8582
8842
|
}).defaultNow(),
|
|
8583
|
-
updatedAt: (0,
|
|
8843
|
+
updatedAt: (0, import_mysql_core6.timestamp)("updatedAt", {
|
|
8584
8844
|
mode: "date",
|
|
8585
8845
|
fsp: 3
|
|
8586
8846
|
}).defaultNow(),
|
|
8587
|
-
deletedAt: (0,
|
|
8847
|
+
deletedAt: (0, import_mysql_core6.timestamp)("deletedAt", {
|
|
8588
8848
|
mode: "date",
|
|
8589
8849
|
fsp: 3
|
|
8590
8850
|
})
|
|
8591
8851
|
}, (ct) => ({
|
|
8592
|
-
nameIdx: (0,
|
|
8593
|
-
slugIdx: (0,
|
|
8852
|
+
nameIdx: (0, import_mysql_core6.index)("name_idx").on(ct.name),
|
|
8853
|
+
slugIdx: (0, import_mysql_core6.index)("slug_idx").on(ct.slug),
|
|
8854
|
+
organizationIdIdx: (0, import_mysql_core6.index)("organizationId_idx").on(ct.organizationId)
|
|
8594
8855
|
}));
|
|
8595
8856
|
}
|
|
8596
8857
|
__name(getContributionTypesSchema, "getContributionTypesSchema");
|
|
8597
8858
|
function getContributionTypesRelationsSchema(mysqlTable) {
|
|
8598
8859
|
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
8599
|
-
return (0,
|
|
8860
|
+
return (0, import_drizzle_orm6.relations)(contributionTypes, ({ many }) => ({}));
|
|
8600
8861
|
}
|
|
8601
8862
|
__name(getContributionTypesRelationsSchema, "getContributionTypesRelationsSchema");
|
|
8602
8863
|
|
|
8603
8864
|
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
8604
8865
|
function getContentContributionsSchema(mysqlTable) {
|
|
8605
8866
|
return mysqlTable("ContentContribution", {
|
|
8606
|
-
id: (0,
|
|
8867
|
+
id: (0, import_mysql_core7.varchar)("id", {
|
|
8607
8868
|
length: 255
|
|
8608
8869
|
}).notNull().primaryKey(),
|
|
8609
|
-
userId: (0,
|
|
8870
|
+
userId: (0, import_mysql_core7.varchar)("userId", {
|
|
8610
8871
|
length: 255
|
|
8611
8872
|
}).notNull(),
|
|
8612
|
-
|
|
8873
|
+
organizationId: (0, import_mysql_core7.varchar)("organizationId", {
|
|
8874
|
+
length: 191
|
|
8875
|
+
}),
|
|
8876
|
+
organizationMembershipId: (0, import_mysql_core7.varchar)("organizationMembershipId", {
|
|
8877
|
+
length: 255
|
|
8878
|
+
}),
|
|
8879
|
+
contentId: (0, import_mysql_core7.varchar)("contentId", {
|
|
8613
8880
|
length: 255
|
|
8614
8881
|
}).notNull(),
|
|
8615
|
-
contributionTypeId: (0,
|
|
8882
|
+
contributionTypeId: (0, import_mysql_core7.varchar)("contributionTypeId", {
|
|
8616
8883
|
length: 255
|
|
8617
8884
|
}).notNull(),
|
|
8618
|
-
active: (0,
|
|
8619
|
-
createdAt: (0,
|
|
8885
|
+
active: (0, import_mysql_core7.boolean)("active").notNull().default(true),
|
|
8886
|
+
createdAt: (0, import_mysql_core7.timestamp)("createdAt", {
|
|
8620
8887
|
mode: "date",
|
|
8621
8888
|
fsp: 3
|
|
8622
8889
|
}).defaultNow(),
|
|
8623
|
-
updatedAt: (0,
|
|
8890
|
+
updatedAt: (0, import_mysql_core7.timestamp)("updatedAt", {
|
|
8624
8891
|
mode: "date",
|
|
8625
8892
|
fsp: 3
|
|
8626
8893
|
}).defaultNow(),
|
|
8627
|
-
deletedAt: (0,
|
|
8894
|
+
deletedAt: (0, import_mysql_core7.timestamp)("deletedAt", {
|
|
8628
8895
|
mode: "date",
|
|
8629
8896
|
fsp: 3
|
|
8630
8897
|
})
|
|
8631
8898
|
}, (cc) => ({
|
|
8632
|
-
userIdIdx: (0,
|
|
8633
|
-
contentIdIdx: (0,
|
|
8634
|
-
contributionTypeIdIdx: (0,
|
|
8899
|
+
userIdIdx: (0, import_mysql_core7.index)("userId_idx").on(cc.userId),
|
|
8900
|
+
contentIdIdx: (0, import_mysql_core7.index)("contentId_idx").on(cc.contentId),
|
|
8901
|
+
contributionTypeIdIdx: (0, import_mysql_core7.index)("contributionTypeId_idx").on(cc.contributionTypeId),
|
|
8902
|
+
organizationMembershipIdIdx: (0, import_mysql_core7.index)("organizationMembershipId_idx").on(cc.organizationMembershipId)
|
|
8635
8903
|
}));
|
|
8636
8904
|
}
|
|
8637
8905
|
__name(getContentContributionsSchema, "getContentContributionsSchema");
|
|
@@ -8640,7 +8908,8 @@ function getContentContributionRelationsSchema(mysqlTable) {
|
|
|
8640
8908
|
const users = getUsersSchema(mysqlTable);
|
|
8641
8909
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8642
8910
|
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
8643
|
-
|
|
8911
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
8912
|
+
return (0, import_drizzle_orm7.relations)(contentContributions, ({ one }) => ({
|
|
8644
8913
|
user: one(users, {
|
|
8645
8914
|
fields: [
|
|
8646
8915
|
contentContributions.userId
|
|
@@ -8667,52 +8936,65 @@ function getContentContributionRelationsSchema(mysqlTable) {
|
|
|
8667
8936
|
contributionTypes.id
|
|
8668
8937
|
],
|
|
8669
8938
|
relationName: "contributionType"
|
|
8670
|
-
})
|
|
8671
|
-
|
|
8939
|
+
}),
|
|
8940
|
+
organizationMembership: one(organizationMemberships, {
|
|
8941
|
+
fields: [
|
|
8942
|
+
contentContributions.organizationMembershipId
|
|
8943
|
+
],
|
|
8944
|
+
references: [
|
|
8945
|
+
organizationMemberships.id
|
|
8946
|
+
],
|
|
8947
|
+
relationName: "organizationMembership"
|
|
8948
|
+
})
|
|
8949
|
+
}));
|
|
8672
8950
|
}
|
|
8673
8951
|
__name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
|
|
8674
8952
|
|
|
8675
8953
|
// src/lib/mysql/schemas/content/content-resource-resource.ts
|
|
8676
|
-
var
|
|
8677
|
-
var
|
|
8954
|
+
var import_drizzle_orm8 = require("drizzle-orm");
|
|
8955
|
+
var import_mysql_core8 = require("drizzle-orm/mysql-core");
|
|
8678
8956
|
function getContentResourceResourceSchema(mysqlTable) {
|
|
8679
8957
|
return mysqlTable("ContentResourceResource", {
|
|
8680
|
-
resourceOfId: (0,
|
|
8958
|
+
resourceOfId: (0, import_mysql_core8.varchar)("resourceOfId", {
|
|
8681
8959
|
length: 255
|
|
8682
8960
|
}).notNull(),
|
|
8683
|
-
resourceId: (0,
|
|
8961
|
+
resourceId: (0, import_mysql_core8.varchar)("resourceId", {
|
|
8684
8962
|
length: 255
|
|
8685
8963
|
}).notNull(),
|
|
8686
|
-
position: (0,
|
|
8687
|
-
metadata: (0,
|
|
8688
|
-
|
|
8964
|
+
position: (0, import_mysql_core8.double)("position").notNull().default(0),
|
|
8965
|
+
metadata: (0, import_mysql_core8.json)("metadata").$type().default({}),
|
|
8966
|
+
organizationId: (0, import_mysql_core8.varchar)("organizationId", {
|
|
8967
|
+
length: 191
|
|
8968
|
+
}),
|
|
8969
|
+
createdAt: (0, import_mysql_core8.timestamp)("createdAt", {
|
|
8689
8970
|
mode: "date",
|
|
8690
8971
|
fsp: 3
|
|
8691
|
-
}).default(
|
|
8692
|
-
updatedAt: (0,
|
|
8972
|
+
}).default(import_drizzle_orm8.sql`CURRENT_TIMESTAMP(3)`),
|
|
8973
|
+
updatedAt: (0, import_mysql_core8.timestamp)("updatedAt", {
|
|
8693
8974
|
mode: "date",
|
|
8694
8975
|
fsp: 3
|
|
8695
|
-
}).default(
|
|
8696
|
-
deletedAt: (0,
|
|
8976
|
+
}).default(import_drizzle_orm8.sql`CURRENT_TIMESTAMP(3)`),
|
|
8977
|
+
deletedAt: (0, import_mysql_core8.timestamp)("deletedAt", {
|
|
8697
8978
|
mode: "date",
|
|
8698
8979
|
fsp: 3
|
|
8699
8980
|
})
|
|
8700
8981
|
}, (crr) => ({
|
|
8701
|
-
pk: (0,
|
|
8982
|
+
pk: (0, import_mysql_core8.primaryKey)({
|
|
8702
8983
|
columns: [
|
|
8703
8984
|
crr.resourceOfId,
|
|
8704
8985
|
crr.resourceId
|
|
8705
8986
|
]
|
|
8706
8987
|
}),
|
|
8707
|
-
contentResourceIdIdx: (0,
|
|
8708
|
-
resourceIdIdx: (0,
|
|
8988
|
+
contentResourceIdIdx: (0, import_mysql_core8.index)("contentResourceId_idx").on(crr.resourceOfId),
|
|
8989
|
+
resourceIdIdx: (0, import_mysql_core8.index)("resourceId_idx").on(crr.resourceId),
|
|
8990
|
+
organizationIdIdx: (0, import_mysql_core8.index)("organizationId_idx").on(crr.organizationId)
|
|
8709
8991
|
}));
|
|
8710
8992
|
}
|
|
8711
8993
|
__name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
|
|
8712
8994
|
function getContentResourceResourceRelationsSchema(mysqlTable) {
|
|
8713
8995
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8714
8996
|
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
8715
|
-
return (0,
|
|
8997
|
+
return (0, import_drizzle_orm8.relations)(contentResourceResource, ({ one }) => ({
|
|
8716
8998
|
resourceOf: one(contentResource, {
|
|
8717
8999
|
fields: [
|
|
8718
9000
|
contentResourceResource.resourceOfId
|
|
@@ -8736,55 +9018,59 @@ function getContentResourceResourceRelationsSchema(mysqlTable) {
|
|
|
8736
9018
|
__name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
|
|
8737
9019
|
|
|
8738
9020
|
// src/lib/mysql/schemas/content/content-resource-tag.ts
|
|
8739
|
-
var
|
|
8740
|
-
var
|
|
9021
|
+
var import_drizzle_orm11 = require("drizzle-orm");
|
|
9022
|
+
var import_mysql_core11 = require("drizzle-orm/mysql-core");
|
|
8741
9023
|
|
|
8742
9024
|
// src/lib/mysql/schemas/content/tag.ts
|
|
8743
|
-
var
|
|
8744
|
-
var
|
|
9025
|
+
var import_drizzle_orm10 = require("drizzle-orm");
|
|
9026
|
+
var import_mysql_core10 = require("drizzle-orm/mysql-core");
|
|
8745
9027
|
|
|
8746
9028
|
// src/lib/mysql/schemas/content/tag-tag.ts
|
|
8747
|
-
var
|
|
8748
|
-
var
|
|
9029
|
+
var import_drizzle_orm9 = require("drizzle-orm");
|
|
9030
|
+
var import_mysql_core9 = require("drizzle-orm/mysql-core");
|
|
8749
9031
|
function getTagTagSchema(mysqlTable) {
|
|
8750
9032
|
return mysqlTable("TagTag", {
|
|
8751
|
-
parentTagId: (0,
|
|
9033
|
+
parentTagId: (0, import_mysql_core9.varchar)("parentTagId", {
|
|
8752
9034
|
length: 255
|
|
8753
9035
|
}).notNull(),
|
|
8754
|
-
childTagId: (0,
|
|
9036
|
+
childTagId: (0, import_mysql_core9.varchar)("childTagId", {
|
|
8755
9037
|
length: 255
|
|
8756
9038
|
}).notNull(),
|
|
8757
|
-
position: (0,
|
|
8758
|
-
metadata: (0,
|
|
8759
|
-
|
|
9039
|
+
position: (0, import_mysql_core9.double)("position").notNull().default(0),
|
|
9040
|
+
metadata: (0, import_mysql_core9.json)("metadata").$type().default({}),
|
|
9041
|
+
organizationId: (0, import_mysql_core9.varchar)("organizationId", {
|
|
9042
|
+
length: 191
|
|
9043
|
+
}),
|
|
9044
|
+
createdAt: (0, import_mysql_core9.timestamp)("createdAt", {
|
|
8760
9045
|
mode: "date",
|
|
8761
9046
|
fsp: 3
|
|
8762
|
-
}).default(
|
|
8763
|
-
updatedAt: (0,
|
|
9047
|
+
}).default(import_drizzle_orm9.sql`CURRENT_TIMESTAMP(3)`),
|
|
9048
|
+
updatedAt: (0, import_mysql_core9.timestamp)("updatedAt", {
|
|
8764
9049
|
mode: "date",
|
|
8765
9050
|
fsp: 3
|
|
8766
|
-
}).default(
|
|
8767
|
-
deletedAt: (0,
|
|
9051
|
+
}).default(import_drizzle_orm9.sql`CURRENT_TIMESTAMP(3)`),
|
|
9052
|
+
deletedAt: (0, import_mysql_core9.timestamp)("deletedAt", {
|
|
8768
9053
|
mode: "date",
|
|
8769
9054
|
fsp: 3
|
|
8770
9055
|
})
|
|
8771
9056
|
}, (tt) => ({
|
|
8772
|
-
pk: (0,
|
|
9057
|
+
pk: (0, import_mysql_core9.primaryKey)({
|
|
8773
9058
|
columns: [
|
|
8774
9059
|
tt.parentTagId,
|
|
8775
9060
|
tt.childTagId
|
|
8776
9061
|
]
|
|
8777
9062
|
}),
|
|
8778
|
-
parentTagIdIdx: (0,
|
|
8779
|
-
childTagIdIdx: (0,
|
|
8780
|
-
positionIdx: (0,
|
|
9063
|
+
parentTagIdIdx: (0, import_mysql_core9.index)("parentTagId_idx").on(tt.parentTagId),
|
|
9064
|
+
childTagIdIdx: (0, import_mysql_core9.index)("childTagId_idx").on(tt.childTagId),
|
|
9065
|
+
positionIdx: (0, import_mysql_core9.index)("position_idx").on(tt.position),
|
|
9066
|
+
organizationIdIdx: (0, import_mysql_core9.index)("organizationId_idx").on(tt.organizationId)
|
|
8781
9067
|
}));
|
|
8782
9068
|
}
|
|
8783
9069
|
__name(getTagTagSchema, "getTagTagSchema");
|
|
8784
9070
|
function getTagTagRelationsSchema(mysqlTable) {
|
|
8785
9071
|
const tag = getTagSchema(mysqlTable);
|
|
8786
9072
|
const tagTag = getTagTagSchema(mysqlTable);
|
|
8787
|
-
return (0,
|
|
9073
|
+
return (0, import_drizzle_orm9.relations)(tagTag, ({ one }) => ({
|
|
8788
9074
|
parentTag: one(tag, {
|
|
8789
9075
|
fields: [
|
|
8790
9076
|
tagTag.parentTagId
|
|
@@ -8810,27 +9096,31 @@ __name(getTagTagRelationsSchema, "getTagTagRelationsSchema");
|
|
|
8810
9096
|
// src/lib/mysql/schemas/content/tag.ts
|
|
8811
9097
|
function getTagSchema(mysqlTable) {
|
|
8812
9098
|
return mysqlTable("Tag", {
|
|
8813
|
-
id: (0,
|
|
9099
|
+
id: (0, import_mysql_core10.varchar)("id", {
|
|
8814
9100
|
length: 255
|
|
8815
9101
|
}).notNull().primaryKey(),
|
|
8816
|
-
|
|
9102
|
+
organizationId: (0, import_mysql_core10.varchar)("organizationId", {
|
|
9103
|
+
length: 191
|
|
9104
|
+
}),
|
|
9105
|
+
type: (0, import_mysql_core10.varchar)("type", {
|
|
8817
9106
|
length: 255
|
|
8818
9107
|
}).notNull(),
|
|
8819
|
-
fields: (0,
|
|
8820
|
-
createdAt: (0,
|
|
9108
|
+
fields: (0, import_mysql_core10.json)("fields").$type().default({}),
|
|
9109
|
+
createdAt: (0, import_mysql_core10.timestamp)("createdAt", {
|
|
8821
9110
|
mode: "date",
|
|
8822
9111
|
fsp: 3
|
|
8823
|
-
}).default(
|
|
8824
|
-
updatedAt: (0,
|
|
9112
|
+
}).default(import_drizzle_orm10.sql`CURRENT_TIMESTAMP(3)`),
|
|
9113
|
+
updatedAt: (0, import_mysql_core10.timestamp)("updatedAt", {
|
|
8825
9114
|
mode: "date",
|
|
8826
9115
|
fsp: 3
|
|
8827
|
-
}).default(
|
|
8828
|
-
deletedAt: (0,
|
|
9116
|
+
}).default(import_drizzle_orm10.sql`CURRENT_TIMESTAMP(3)`),
|
|
9117
|
+
deletedAt: (0, import_mysql_core10.timestamp)("deletedAt", {
|
|
8829
9118
|
mode: "date",
|
|
8830
9119
|
fsp: 3
|
|
8831
9120
|
})
|
|
8832
9121
|
}, (t) => ({
|
|
8833
|
-
typeIdx: (0,
|
|
9122
|
+
typeIdx: (0, import_mysql_core10.index)("type_idx").on(t.type),
|
|
9123
|
+
organizationIdIdx: (0, import_mysql_core10.index)("organizationId_idx").on(t.organizationId)
|
|
8834
9124
|
}));
|
|
8835
9125
|
}
|
|
8836
9126
|
__name(getTagSchema, "getTagSchema");
|
|
@@ -8838,7 +9128,7 @@ function getTagRelationsSchema(mysqlTable) {
|
|
|
8838
9128
|
const tag = getTagSchema(mysqlTable);
|
|
8839
9129
|
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
8840
9130
|
const tagTag = getTagTagSchema(mysqlTable);
|
|
8841
|
-
return (0,
|
|
9131
|
+
return (0, import_drizzle_orm10.relations)(tag, ({ many }) => ({
|
|
8842
9132
|
resources: many(contentResourceTag, {
|
|
8843
9133
|
relationName: "contentResource"
|
|
8844
9134
|
}),
|
|
@@ -8855,31 +9145,35 @@ __name(getTagRelationsSchema, "getTagRelationsSchema");
|
|
|
8855
9145
|
// src/lib/mysql/schemas/content/content-resource-tag.ts
|
|
8856
9146
|
function getContentResourceTagSchema(mysqlTable) {
|
|
8857
9147
|
return mysqlTable("ContentResourceTag", {
|
|
8858
|
-
contentResourceId: (0,
|
|
9148
|
+
contentResourceId: (0, import_mysql_core11.varchar)("contentResourceId", {
|
|
8859
9149
|
length: 255
|
|
8860
9150
|
}).notNull(),
|
|
8861
|
-
|
|
9151
|
+
organizationId: (0, import_mysql_core11.varchar)("organizationId", {
|
|
9152
|
+
length: 191
|
|
9153
|
+
}),
|
|
9154
|
+
tagId: (0, import_mysql_core11.varchar)("tagId", {
|
|
8862
9155
|
length: 255
|
|
8863
9156
|
}).notNull(),
|
|
8864
|
-
position: (0,
|
|
8865
|
-
createdAt: (0,
|
|
9157
|
+
position: (0, import_mysql_core11.double)("position").notNull().default(0),
|
|
9158
|
+
createdAt: (0, import_mysql_core11.timestamp)("createdAt", {
|
|
8866
9159
|
mode: "date",
|
|
8867
9160
|
fsp: 3
|
|
8868
|
-
}).default(
|
|
8869
|
-
updatedAt: (0,
|
|
9161
|
+
}).default(import_drizzle_orm11.sql`CURRENT_TIMESTAMP(3)`),
|
|
9162
|
+
updatedAt: (0, import_mysql_core11.timestamp)("updatedAt", {
|
|
8870
9163
|
mode: "date",
|
|
8871
9164
|
fsp: 3
|
|
8872
|
-
}).default(
|
|
9165
|
+
}).default(import_drizzle_orm11.sql`CURRENT_TIMESTAMP(3)`)
|
|
8873
9166
|
}, (crt) => ({
|
|
8874
|
-
pk: (0,
|
|
9167
|
+
pk: (0, import_mysql_core11.primaryKey)({
|
|
8875
9168
|
columns: [
|
|
8876
9169
|
crt.contentResourceId,
|
|
8877
9170
|
crt.tagId
|
|
8878
9171
|
]
|
|
8879
9172
|
}),
|
|
8880
|
-
contentResourceIdIdx: (0,
|
|
8881
|
-
tagIdIdx: (0,
|
|
8882
|
-
positionIdx: (0,
|
|
9173
|
+
contentResourceIdIdx: (0, import_mysql_core11.index)("contentResourceId_idx").on(crt.contentResourceId),
|
|
9174
|
+
tagIdIdx: (0, import_mysql_core11.index)("tagId_idx").on(crt.tagId),
|
|
9175
|
+
positionIdx: (0, import_mysql_core11.index)("position_idx").on(crt.position),
|
|
9176
|
+
organizationIdIdx: (0, import_mysql_core11.index)("organizationId_idx").on(crt.organizationId)
|
|
8883
9177
|
}));
|
|
8884
9178
|
}
|
|
8885
9179
|
__name(getContentResourceTagSchema, "getContentResourceTagSchema");
|
|
@@ -8887,7 +9181,7 @@ function getContentResourceTagRelationsSchema(mysqlTable) {
|
|
|
8887
9181
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8888
9182
|
const tag = getTagSchema(mysqlTable);
|
|
8889
9183
|
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
8890
|
-
return (0,
|
|
9184
|
+
return (0, import_drizzle_orm11.relations)(contentResourceTag, ({ one }) => ({
|
|
8891
9185
|
contentResource: one(contentResource, {
|
|
8892
9186
|
fields: [
|
|
8893
9187
|
contentResourceTag.contentResourceId
|
|
@@ -8911,33 +9205,37 @@ function getContentResourceTagRelationsSchema(mysqlTable) {
|
|
|
8911
9205
|
__name(getContentResourceTagRelationsSchema, "getContentResourceTagRelationsSchema");
|
|
8912
9206
|
|
|
8913
9207
|
// src/lib/mysql/schemas/content/content-resource-version.ts
|
|
8914
|
-
var
|
|
8915
|
-
var
|
|
9208
|
+
var import_drizzle_orm12 = require("drizzle-orm");
|
|
9209
|
+
var import_mysql_core12 = require("drizzle-orm/mysql-core");
|
|
8916
9210
|
function getContentResourceVersionSchema(mysqlTable) {
|
|
8917
9211
|
return mysqlTable("ContentResourceVersion", {
|
|
8918
|
-
id: (0,
|
|
9212
|
+
id: (0, import_mysql_core12.varchar)("id", {
|
|
8919
9213
|
length: 255
|
|
8920
9214
|
}).notNull().primaryKey(),
|
|
8921
|
-
|
|
9215
|
+
organizationId: (0, import_mysql_core12.varchar)("organizationId", {
|
|
9216
|
+
length: 191
|
|
9217
|
+
}),
|
|
9218
|
+
resourceId: (0, import_mysql_core12.varchar)("resourceId", {
|
|
8922
9219
|
length: 255
|
|
8923
9220
|
}).notNull(),
|
|
8924
|
-
parentVersionId: (0,
|
|
9221
|
+
parentVersionId: (0, import_mysql_core12.varchar)("parentVersionId", {
|
|
8925
9222
|
length: 255
|
|
8926
9223
|
}),
|
|
8927
|
-
versionNumber: (0,
|
|
8928
|
-
fields: (0,
|
|
8929
|
-
createdAt: (0,
|
|
9224
|
+
versionNumber: (0, import_mysql_core12.int)("versionNumber").notNull(),
|
|
9225
|
+
fields: (0, import_mysql_core12.json)("fields").$type().default({}),
|
|
9226
|
+
createdAt: (0, import_mysql_core12.timestamp)("createdAt", {
|
|
8930
9227
|
mode: "date",
|
|
8931
9228
|
fsp: 3
|
|
8932
|
-
}).default(
|
|
8933
|
-
createdById: (0,
|
|
9229
|
+
}).default(import_drizzle_orm12.sql`CURRENT_TIMESTAMP(3)`),
|
|
9230
|
+
createdById: (0, import_mysql_core12.varchar)("createdById", {
|
|
8934
9231
|
length: 255
|
|
8935
9232
|
}).notNull()
|
|
8936
9233
|
}, (crv) => ({
|
|
8937
|
-
resourceIdIdx: (0,
|
|
8938
|
-
parentVersionIdIdx: (0,
|
|
8939
|
-
resourceIdVersionNumberIdx: (0,
|
|
8940
|
-
uniqueResourceVersion: (0,
|
|
9234
|
+
resourceIdIdx: (0, import_mysql_core12.index)("resourceId_idx").on(crv.resourceId),
|
|
9235
|
+
parentVersionIdIdx: (0, import_mysql_core12.index)("parentVersionId_idx").on(crv.parentVersionId),
|
|
9236
|
+
resourceIdVersionNumberIdx: (0, import_mysql_core12.index)("resourceId_versionNumber_idx").on(crv.resourceId, crv.versionNumber),
|
|
9237
|
+
uniqueResourceVersion: (0, import_mysql_core12.unique)("uq_resource_version_number").on(crv.resourceId, crv.versionNumber),
|
|
9238
|
+
organizationIdIdx: (0, import_mysql_core12.index)("organizationId_idx").on(crv.organizationId)
|
|
8941
9239
|
}));
|
|
8942
9240
|
}
|
|
8943
9241
|
__name(getContentResourceVersionSchema, "getContentResourceVersionSchema");
|
|
@@ -8945,7 +9243,7 @@ function getContentResourceVersionRelationsSchema(mysqlTable) {
|
|
|
8945
9243
|
const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
|
|
8946
9244
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
8947
9245
|
const users = getUsersSchema(mysqlTable);
|
|
8948
|
-
return (0,
|
|
9246
|
+
return (0, import_drizzle_orm12.relations)(contentResourceVersion, ({ one }) => ({
|
|
8949
9247
|
resource: one(contentResource, {
|
|
8950
9248
|
fields: [
|
|
8951
9249
|
contentResourceVersion.resourceId
|
|
@@ -8980,36 +9278,43 @@ __name(getContentResourceVersionRelationsSchema, "getContentResourceVersionRelat
|
|
|
8980
9278
|
// src/lib/mysql/schemas/content/content-resource.ts
|
|
8981
9279
|
function getContentResourceSchema(mysqlTable) {
|
|
8982
9280
|
return mysqlTable("ContentResource", {
|
|
8983
|
-
id: (0,
|
|
9281
|
+
id: (0, import_mysql_core13.varchar)("id", {
|
|
8984
9282
|
length: 255
|
|
8985
9283
|
}).notNull().primaryKey(),
|
|
8986
|
-
|
|
9284
|
+
organizationId: (0, import_mysql_core13.varchar)("organizationId", {
|
|
9285
|
+
length: 191
|
|
9286
|
+
}),
|
|
9287
|
+
createdByOrganizationMembershipId: (0, import_mysql_core13.varchar)("createdByOrganizationMembershipId", {
|
|
9288
|
+
length: 191
|
|
9289
|
+
}),
|
|
9290
|
+
type: (0, import_mysql_core13.varchar)("type", {
|
|
8987
9291
|
length: 255
|
|
8988
9292
|
}).notNull(),
|
|
8989
|
-
createdById: (0,
|
|
9293
|
+
createdById: (0, import_mysql_core13.varchar)("createdById", {
|
|
8990
9294
|
length: 255
|
|
8991
9295
|
}).notNull(),
|
|
8992
|
-
fields: (0,
|
|
8993
|
-
currentVersionId: (0,
|
|
9296
|
+
fields: (0, import_mysql_core13.json)("fields").$type().default({}),
|
|
9297
|
+
currentVersionId: (0, import_mysql_core13.varchar)("currentVersionId", {
|
|
8994
9298
|
length: 255
|
|
8995
9299
|
}),
|
|
8996
|
-
createdAt: (0,
|
|
9300
|
+
createdAt: (0, import_mysql_core13.timestamp)("createdAt", {
|
|
8997
9301
|
mode: "date",
|
|
8998
9302
|
fsp: 3
|
|
8999
|
-
}).default(
|
|
9000
|
-
updatedAt: (0,
|
|
9303
|
+
}).default(import_drizzle_orm13.sql`CURRENT_TIMESTAMP(3)`),
|
|
9304
|
+
updatedAt: (0, import_mysql_core13.timestamp)("updatedAt", {
|
|
9001
9305
|
mode: "date",
|
|
9002
9306
|
fsp: 3
|
|
9003
|
-
}).default(
|
|
9004
|
-
deletedAt: (0,
|
|
9307
|
+
}).default(import_drizzle_orm13.sql`CURRENT_TIMESTAMP(3)`),
|
|
9308
|
+
deletedAt: (0, import_mysql_core13.timestamp)("deletedAt", {
|
|
9005
9309
|
mode: "date",
|
|
9006
9310
|
fsp: 3
|
|
9007
9311
|
})
|
|
9008
9312
|
}, (cm) => ({
|
|
9009
|
-
typeIdx: (0,
|
|
9010
|
-
createdByIdx: (0,
|
|
9011
|
-
createdAtIdx: (0,
|
|
9012
|
-
currentVersionIdIdx: (0,
|
|
9313
|
+
typeIdx: (0, import_mysql_core13.index)("type_idx").on(cm.type),
|
|
9314
|
+
createdByIdx: (0, import_mysql_core13.index)("createdById_idx").on(cm.createdById),
|
|
9315
|
+
createdAtIdx: (0, import_mysql_core13.index)("createdAt_idx").on(cm.createdAt),
|
|
9316
|
+
currentVersionIdIdx: (0, import_mysql_core13.index)("currentVersionId_idx").on(cm.currentVersionId),
|
|
9317
|
+
createdByOrganizationMembershipIdIdx: (0, import_mysql_core13.index)("createdByOrganizationMembershipId_idx").on(cm.createdByOrganizationMembershipId)
|
|
9013
9318
|
}));
|
|
9014
9319
|
}
|
|
9015
9320
|
__name(getContentResourceSchema, "getContentResourceSchema");
|
|
@@ -9021,8 +9326,9 @@ function getContentResourceRelationsSchema(mysqlTable) {
|
|
|
9021
9326
|
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
9022
9327
|
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
9023
9328
|
const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
|
|
9329
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
9024
9330
|
const tag = getTagSchema(mysqlTable);
|
|
9025
|
-
return (0,
|
|
9331
|
+
return (0, import_drizzle_orm13.relations)(contentResource, ({ one, many }) => ({
|
|
9026
9332
|
createdBy: one(users, {
|
|
9027
9333
|
fields: [
|
|
9028
9334
|
contentResource.createdById
|
|
@@ -9032,6 +9338,15 @@ function getContentResourceRelationsSchema(mysqlTable) {
|
|
|
9032
9338
|
],
|
|
9033
9339
|
relationName: "creator"
|
|
9034
9340
|
}),
|
|
9341
|
+
createdByOrganizationMembership: one(organizationMemberships, {
|
|
9342
|
+
fields: [
|
|
9343
|
+
contentResource.createdByOrganizationMembershipId
|
|
9344
|
+
],
|
|
9345
|
+
references: [
|
|
9346
|
+
organizationMemberships.id
|
|
9347
|
+
],
|
|
9348
|
+
relationName: "createdByOrganizationMembership"
|
|
9349
|
+
}),
|
|
9035
9350
|
tags: many(contentResourceTag, {
|
|
9036
9351
|
relationName: "contentResource"
|
|
9037
9352
|
}),
|
|
@@ -9066,35 +9381,39 @@ __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
|
|
|
9066
9381
|
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
9067
9382
|
function getContentResourceProductSchema(mysqlTable) {
|
|
9068
9383
|
return mysqlTable("ContentResourceProduct", {
|
|
9069
|
-
productId: (0,
|
|
9384
|
+
productId: (0, import_mysql_core14.varchar)("productId", {
|
|
9070
9385
|
length: 255
|
|
9071
9386
|
}).notNull(),
|
|
9072
|
-
resourceId: (0,
|
|
9387
|
+
resourceId: (0, import_mysql_core14.varchar)("resourceId", {
|
|
9073
9388
|
length: 255
|
|
9074
9389
|
}).notNull(),
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9390
|
+
organizationId: (0, import_mysql_core14.varchar)("organizationId", {
|
|
9391
|
+
length: 191
|
|
9392
|
+
}),
|
|
9393
|
+
position: (0, import_mysql_core14.double)("position").notNull().default(0),
|
|
9394
|
+
metadata: (0, import_mysql_core14.json)("metadata").$type().default({}),
|
|
9395
|
+
createdAt: (0, import_mysql_core14.timestamp)("createdAt", {
|
|
9078
9396
|
mode: "date",
|
|
9079
9397
|
fsp: 3
|
|
9080
|
-
}).default(
|
|
9081
|
-
updatedAt: (0,
|
|
9398
|
+
}).default(import_drizzle_orm14.sql`CURRENT_TIMESTAMP(3)`),
|
|
9399
|
+
updatedAt: (0, import_mysql_core14.timestamp)("updatedAt", {
|
|
9082
9400
|
mode: "date",
|
|
9083
9401
|
fsp: 3
|
|
9084
|
-
}).default(
|
|
9085
|
-
deletedAt: (0,
|
|
9402
|
+
}).default(import_drizzle_orm14.sql`CURRENT_TIMESTAMP(3)`),
|
|
9403
|
+
deletedAt: (0, import_mysql_core14.timestamp)("deletedAt", {
|
|
9086
9404
|
mode: "date",
|
|
9087
9405
|
fsp: 3
|
|
9088
9406
|
})
|
|
9089
9407
|
}, (crr) => ({
|
|
9090
|
-
pk: (0,
|
|
9408
|
+
pk: (0, import_mysql_core14.primaryKey)({
|
|
9091
9409
|
columns: [
|
|
9092
9410
|
crr.productId,
|
|
9093
9411
|
crr.resourceId
|
|
9094
9412
|
]
|
|
9095
9413
|
}),
|
|
9096
|
-
contentResourceIdIdx: (0,
|
|
9097
|
-
resourceIdIdx: (0,
|
|
9414
|
+
contentResourceIdIdx: (0, import_mysql_core14.index)("contentResourceId_idx").on(crr.productId),
|
|
9415
|
+
resourceIdIdx: (0, import_mysql_core14.index)("resourceId_idx").on(crr.resourceId),
|
|
9416
|
+
organizationIdIdx: (0, import_mysql_core14.index)("organizationId_idx").on(crr.organizationId)
|
|
9098
9417
|
}));
|
|
9099
9418
|
}
|
|
9100
9419
|
__name(getContentResourceProductSchema, "getContentResourceProductSchema");
|
|
@@ -9102,7 +9421,7 @@ function getContentResourceProductRelationsSchema(mysqlTable) {
|
|
|
9102
9421
|
const contentResource = getContentResourceSchema(mysqlTable);
|
|
9103
9422
|
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
9104
9423
|
const product = getProductSchema(mysqlTable);
|
|
9105
|
-
return (0,
|
|
9424
|
+
return (0, import_drizzle_orm14.relations)(contentResourceProduct, ({ one }) => ({
|
|
9106
9425
|
product: one(product, {
|
|
9107
9426
|
fields: [
|
|
9108
9427
|
contentResourceProduct.productId
|
|
@@ -9125,80 +9444,48 @@ function getContentResourceProductRelationsSchema(mysqlTable) {
|
|
|
9125
9444
|
}
|
|
9126
9445
|
__name(getContentResourceProductRelationsSchema, "getContentResourceProductRelationsSchema");
|
|
9127
9446
|
|
|
9128
|
-
// src/lib/mysql/schemas/commerce/merchant-product.ts
|
|
9129
|
-
var import_drizzle_orm10 = require("drizzle-orm");
|
|
9130
|
-
var import_mysql_core11 = require("drizzle-orm/mysql-core");
|
|
9131
|
-
function getMerchantProductSchema(mysqlTable) {
|
|
9132
|
-
return mysqlTable("MerchantProduct", {
|
|
9133
|
-
id: (0, import_mysql_core11.varchar)("id", {
|
|
9134
|
-
length: 191
|
|
9135
|
-
}).notNull(),
|
|
9136
|
-
merchantAccountId: (0, import_mysql_core11.varchar)("merchantAccountId", {
|
|
9137
|
-
length: 191
|
|
9138
|
-
}).notNull(),
|
|
9139
|
-
productId: (0, import_mysql_core11.varchar)("productId", {
|
|
9140
|
-
length: 191
|
|
9141
|
-
}).notNull(),
|
|
9142
|
-
status: (0, import_mysql_core11.int)("status").default(0).notNull(),
|
|
9143
|
-
identifier: (0, import_mysql_core11.varchar)("identifier", {
|
|
9144
|
-
length: 191
|
|
9145
|
-
}),
|
|
9146
|
-
createdAt: (0, import_mysql_core11.timestamp)("createdAt", {
|
|
9147
|
-
mode: "date",
|
|
9148
|
-
fsp: 3
|
|
9149
|
-
}).default(import_drizzle_orm10.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
9150
|
-
}, (table) => {
|
|
9151
|
-
return {
|
|
9152
|
-
merchantProductId: (0, import_mysql_core11.primaryKey)({
|
|
9153
|
-
columns: [
|
|
9154
|
-
table.id
|
|
9155
|
-
],
|
|
9156
|
-
name: "MerchantProduct_id"
|
|
9157
|
-
}),
|
|
9158
|
-
merchantProductIdentifierKey: (0, import_mysql_core11.unique)("MerchantProduct_identifier_key").on(table.identifier)
|
|
9159
|
-
};
|
|
9160
|
-
});
|
|
9161
|
-
}
|
|
9162
|
-
__name(getMerchantProductSchema, "getMerchantProductSchema");
|
|
9163
|
-
|
|
9164
9447
|
// src/lib/mysql/schemas/commerce/price.ts
|
|
9165
|
-
var
|
|
9166
|
-
var
|
|
9448
|
+
var import_drizzle_orm16 = require("drizzle-orm");
|
|
9449
|
+
var import_mysql_core16 = require("drizzle-orm/mysql-core");
|
|
9167
9450
|
|
|
9168
9451
|
// src/lib/mysql/schemas/commerce/merchant-price.ts
|
|
9169
|
-
var
|
|
9170
|
-
var
|
|
9452
|
+
var import_drizzle_orm15 = require("drizzle-orm");
|
|
9453
|
+
var import_mysql_core15 = require("drizzle-orm/mysql-core");
|
|
9171
9454
|
function getMerchantPriceSchema(mysqlTable) {
|
|
9172
9455
|
return mysqlTable("MerchantPrice", {
|
|
9173
|
-
id: (0,
|
|
9456
|
+
id: (0, import_mysql_core15.varchar)("id", {
|
|
9174
9457
|
length: 191
|
|
9175
9458
|
}).notNull(),
|
|
9176
|
-
|
|
9459
|
+
organizationId: (0, import_mysql_core15.varchar)("organizationId", {
|
|
9460
|
+
length: 191
|
|
9461
|
+
}),
|
|
9462
|
+
merchantAccountId: (0, import_mysql_core15.varchar)("merchantAccountId", {
|
|
9177
9463
|
length: 191
|
|
9178
9464
|
}).notNull(),
|
|
9179
|
-
merchantProductId: (0,
|
|
9465
|
+
merchantProductId: (0, import_mysql_core15.varchar)("merchantProductId", {
|
|
9180
9466
|
length: 191
|
|
9181
9467
|
}).notNull(),
|
|
9182
|
-
status: (0,
|
|
9183
|
-
identifier: (0,
|
|
9468
|
+
status: (0, import_mysql_core15.int)("status").default(0),
|
|
9469
|
+
identifier: (0, import_mysql_core15.varchar)("identifier", {
|
|
9184
9470
|
length: 191
|
|
9185
9471
|
}),
|
|
9186
|
-
createdAt: (0,
|
|
9472
|
+
createdAt: (0, import_mysql_core15.timestamp)("createdAt", {
|
|
9187
9473
|
mode: "date",
|
|
9188
9474
|
fsp: 3
|
|
9189
|
-
}).default(
|
|
9190
|
-
priceId: (0,
|
|
9475
|
+
}).default(import_drizzle_orm15.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9476
|
+
priceId: (0, import_mysql_core15.varchar)("priceId", {
|
|
9191
9477
|
length: 191
|
|
9192
9478
|
})
|
|
9193
9479
|
}, (table) => {
|
|
9194
9480
|
return {
|
|
9195
|
-
merchantPriceId: (0,
|
|
9481
|
+
merchantPriceId: (0, import_mysql_core15.primaryKey)({
|
|
9196
9482
|
columns: [
|
|
9197
9483
|
table.id
|
|
9198
9484
|
],
|
|
9199
9485
|
name: "MerchantPrice_id"
|
|
9200
9486
|
}),
|
|
9201
|
-
merchantPriceIdentifierKey: (0,
|
|
9487
|
+
merchantPriceIdentifierKey: (0, import_mysql_core15.unique)("MerchantPrice_identifier_key").on(table.identifier),
|
|
9488
|
+
organizationIdIdx: (0, import_mysql_core15.index)("organizationId_idx").on(table.organizationId)
|
|
9202
9489
|
};
|
|
9203
9490
|
});
|
|
9204
9491
|
}
|
|
@@ -9207,33 +9494,37 @@ __name(getMerchantPriceSchema, "getMerchantPriceSchema");
|
|
|
9207
9494
|
// src/lib/mysql/schemas/commerce/price.ts
|
|
9208
9495
|
function getPriceSchema(mysqlTable) {
|
|
9209
9496
|
return mysqlTable("Price", {
|
|
9210
|
-
id: (0,
|
|
9497
|
+
id: (0, import_mysql_core16.varchar)("id", {
|
|
9211
9498
|
length: 191
|
|
9212
9499
|
}).notNull(),
|
|
9213
|
-
productId: (0,
|
|
9500
|
+
productId: (0, import_mysql_core16.varchar)("productId", {
|
|
9501
|
+
length: 191
|
|
9502
|
+
}),
|
|
9503
|
+
organizationId: (0, import_mysql_core16.varchar)("organizationId", {
|
|
9214
9504
|
length: 191
|
|
9215
9505
|
}),
|
|
9216
|
-
nickname: (0,
|
|
9506
|
+
nickname: (0, import_mysql_core16.varchar)("nickname", {
|
|
9217
9507
|
length: 191
|
|
9218
9508
|
}),
|
|
9219
|
-
status: (0,
|
|
9220
|
-
unitAmount: (0,
|
|
9509
|
+
status: (0, import_mysql_core16.int)("status").default(0).notNull(),
|
|
9510
|
+
unitAmount: (0, import_mysql_core16.decimal)("unitAmount", {
|
|
9221
9511
|
precision: 10,
|
|
9222
9512
|
scale: 2
|
|
9223
9513
|
}).notNull(),
|
|
9224
|
-
createdAt: (0,
|
|
9514
|
+
createdAt: (0, import_mysql_core16.timestamp)("createdAt", {
|
|
9225
9515
|
mode: "date",
|
|
9226
9516
|
fsp: 3
|
|
9227
|
-
}).default(
|
|
9228
|
-
fields: (0,
|
|
9517
|
+
}).default(import_drizzle_orm16.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9518
|
+
fields: (0, import_mysql_core16.json)("fields").$type().default({})
|
|
9229
9519
|
}, (table) => {
|
|
9230
9520
|
return {
|
|
9231
|
-
priceId: (0,
|
|
9521
|
+
priceId: (0, import_mysql_core16.primaryKey)({
|
|
9232
9522
|
columns: [
|
|
9233
9523
|
table.id
|
|
9234
9524
|
],
|
|
9235
9525
|
name: "Price_id"
|
|
9236
|
-
})
|
|
9526
|
+
}),
|
|
9527
|
+
organizationIdIdx: (0, import_mysql_core16.index)("organizationId_idx").on(table.organizationId)
|
|
9237
9528
|
};
|
|
9238
9529
|
});
|
|
9239
9530
|
}
|
|
@@ -9242,33 +9533,37 @@ __name(getPriceSchema, "getPriceSchema");
|
|
|
9242
9533
|
// src/lib/mysql/schemas/commerce/product.ts
|
|
9243
9534
|
function getProductSchema(mysqlTable) {
|
|
9244
9535
|
return mysqlTable("Product", {
|
|
9245
|
-
id: (0,
|
|
9536
|
+
id: (0, import_mysql_core17.varchar)("id", {
|
|
9246
9537
|
length: 191
|
|
9247
9538
|
}).notNull(),
|
|
9248
|
-
|
|
9539
|
+
organizationId: (0, import_mysql_core17.varchar)("organizationId", {
|
|
9540
|
+
length: 191
|
|
9541
|
+
}),
|
|
9542
|
+
name: (0, import_mysql_core17.varchar)("name", {
|
|
9249
9543
|
length: 191
|
|
9250
9544
|
}).notNull(),
|
|
9251
|
-
key: (0,
|
|
9545
|
+
key: (0, import_mysql_core17.varchar)("key", {
|
|
9252
9546
|
length: 191
|
|
9253
9547
|
}),
|
|
9254
|
-
type: (0,
|
|
9548
|
+
type: (0, import_mysql_core17.varchar)("type", {
|
|
9255
9549
|
length: 191
|
|
9256
9550
|
}),
|
|
9257
|
-
fields: (0,
|
|
9258
|
-
createdAt: (0,
|
|
9551
|
+
fields: (0, import_mysql_core17.json)("fields").$type().default({}),
|
|
9552
|
+
createdAt: (0, import_mysql_core17.timestamp)("createdAt", {
|
|
9259
9553
|
mode: "date",
|
|
9260
9554
|
fsp: 3
|
|
9261
|
-
}).default(
|
|
9262
|
-
status: (0,
|
|
9263
|
-
quantityAvailable: (0,
|
|
9555
|
+
}).default(import_drizzle_orm17.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9556
|
+
status: (0, import_mysql_core17.int)("status").default(0).notNull(),
|
|
9557
|
+
quantityAvailable: (0, import_mysql_core17.int)("quantityAvailable").default(-1).notNull()
|
|
9264
9558
|
}, (table) => {
|
|
9265
9559
|
return {
|
|
9266
|
-
productId: (0,
|
|
9560
|
+
productId: (0, import_mysql_core17.primaryKey)({
|
|
9267
9561
|
columns: [
|
|
9268
9562
|
table.id
|
|
9269
9563
|
],
|
|
9270
9564
|
name: "Product_id"
|
|
9271
|
-
})
|
|
9565
|
+
}),
|
|
9566
|
+
organizationIdIdx: (0, import_mysql_core17.index)("organizationId_idx").on(table.organizationId)
|
|
9272
9567
|
};
|
|
9273
9568
|
});
|
|
9274
9569
|
}
|
|
@@ -9278,7 +9573,7 @@ function getProductRelationsSchema(mysqlTable) {
|
|
|
9278
9573
|
const price = getPriceSchema(mysqlTable);
|
|
9279
9574
|
const merchantProduct = getMerchantProductSchema(mysqlTable);
|
|
9280
9575
|
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
9281
|
-
return (0,
|
|
9576
|
+
return (0, import_drizzle_orm17.relations)(product, ({ one, many }) => ({
|
|
9282
9577
|
price: one(price, {
|
|
9283
9578
|
fields: [
|
|
9284
9579
|
product.id
|
|
@@ -9304,255 +9599,339 @@ function getProductRelationsSchema(mysqlTable) {
|
|
|
9304
9599
|
}
|
|
9305
9600
|
__name(getProductRelationsSchema, "getProductRelationsSchema");
|
|
9306
9601
|
|
|
9307
|
-
// src/lib/mysql/schemas/commerce/
|
|
9308
|
-
function
|
|
9309
|
-
return mysqlTable("
|
|
9310
|
-
id: (0,
|
|
9602
|
+
// src/lib/mysql/schemas/commerce/subscription.ts
|
|
9603
|
+
function getSubscriptionSchema(mysqlTable) {
|
|
9604
|
+
return mysqlTable("Subscription", {
|
|
9605
|
+
id: (0, import_mysql_core18.varchar)("id", {
|
|
9311
9606
|
length: 191
|
|
9312
9607
|
}).notNull(),
|
|
9313
|
-
|
|
9608
|
+
organizationId: (0, import_mysql_core18.varchar)("organizationId", {
|
|
9314
9609
|
length: 191
|
|
9315
9610
|
}),
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
expires: (0, import_mysql_core15.timestamp)("expires", {
|
|
9611
|
+
productId: (0, import_mysql_core18.varchar)("productId", {
|
|
9612
|
+
length: 191
|
|
9613
|
+
}).notNull(),
|
|
9614
|
+
createdAt: (0, import_mysql_core18.timestamp)("createdAt", {
|
|
9321
9615
|
mode: "date",
|
|
9322
9616
|
fsp: 3
|
|
9323
|
-
}),
|
|
9324
|
-
|
|
9325
|
-
maxUses: (0, import_mysql_core15.int)("maxUses").default(-1).notNull(),
|
|
9326
|
-
default: (0, import_mysql_core15.boolean)("default").default(false).notNull(),
|
|
9327
|
-
merchantCouponId: (0, import_mysql_core15.varchar)("merchantCouponId", {
|
|
9617
|
+
}).default(import_drizzle_orm18.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9618
|
+
merchantSubscriptionId: (0, import_mysql_core18.varchar)("merchantSubscriptionId", {
|
|
9328
9619
|
length: 191
|
|
9329
|
-
}),
|
|
9330
|
-
status: (0, import_mysql_core15.int)("status").default(0).notNull(),
|
|
9331
|
-
usedCount: (0, import_mysql_core15.int)("usedCount").default(0).notNull(),
|
|
9332
|
-
percentageDiscount: (0, import_mysql_core15.decimal)("percentageDiscount", {
|
|
9333
|
-
precision: 3,
|
|
9334
|
-
scale: 2
|
|
9335
9620
|
}).notNull(),
|
|
9336
|
-
|
|
9621
|
+
status: (0, import_mysql_core18.varchar)("status", {
|
|
9337
9622
|
length: 191
|
|
9338
|
-
})
|
|
9623
|
+
}).default("Valid").notNull(),
|
|
9624
|
+
fields: (0, import_mysql_core18.json)("fields").$type().default({})
|
|
9339
9625
|
}, (table) => {
|
|
9340
9626
|
return {
|
|
9341
|
-
|
|
9342
|
-
couponId: (0, import_mysql_core15.primaryKey)({
|
|
9627
|
+
subscriptionId: (0, import_mysql_core18.primaryKey)({
|
|
9343
9628
|
columns: [
|
|
9344
9629
|
table.id
|
|
9345
9630
|
],
|
|
9346
|
-
name: "
|
|
9631
|
+
name: "Subscription_id"
|
|
9347
9632
|
}),
|
|
9348
|
-
|
|
9633
|
+
organizationIdIdx: (0, import_mysql_core18.index)("organizationId_idx").on(table.organizationId)
|
|
9349
9634
|
};
|
|
9350
9635
|
});
|
|
9351
9636
|
}
|
|
9352
|
-
__name(
|
|
9353
|
-
function
|
|
9354
|
-
const
|
|
9355
|
-
const
|
|
9356
|
-
const
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
}),
|
|
9361
|
-
merchantCoupon: one(merchantCoupon, {
|
|
9637
|
+
__name(getSubscriptionSchema, "getSubscriptionSchema");
|
|
9638
|
+
function getSubscriptionRelationsSchema(mysqlTable) {
|
|
9639
|
+
const subscriptions = getSubscriptionSchema(mysqlTable);
|
|
9640
|
+
const products = getProductSchema(mysqlTable);
|
|
9641
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
9642
|
+
const merchantSubscriptions = getMerchantSubscriptionSchema(mysqlTable);
|
|
9643
|
+
return (0, import_drizzle_orm18.relations)(subscriptions, ({ many, one }) => ({
|
|
9644
|
+
organization: one(organizations, {
|
|
9362
9645
|
fields: [
|
|
9363
|
-
|
|
9646
|
+
subscriptions.organizationId
|
|
9364
9647
|
],
|
|
9365
9648
|
references: [
|
|
9366
|
-
|
|
9649
|
+
organizations.id
|
|
9367
9650
|
],
|
|
9368
|
-
relationName: "
|
|
9651
|
+
relationName: "organization"
|
|
9369
9652
|
}),
|
|
9370
|
-
product: one(
|
|
9653
|
+
product: one(products, {
|
|
9371
9654
|
fields: [
|
|
9372
|
-
|
|
9655
|
+
subscriptions.productId
|
|
9373
9656
|
],
|
|
9374
9657
|
references: [
|
|
9375
|
-
|
|
9658
|
+
products.id
|
|
9376
9659
|
],
|
|
9377
9660
|
relationName: "product"
|
|
9378
9661
|
}),
|
|
9379
|
-
|
|
9380
|
-
|
|
9662
|
+
merchantSubscription: one(merchantSubscriptions, {
|
|
9663
|
+
fields: [
|
|
9664
|
+
subscriptions.merchantSubscriptionId
|
|
9665
|
+
],
|
|
9666
|
+
references: [
|
|
9667
|
+
merchantSubscriptions.id
|
|
9668
|
+
],
|
|
9669
|
+
relationName: "merchantSubscription"
|
|
9381
9670
|
})
|
|
9382
9671
|
}));
|
|
9383
9672
|
}
|
|
9384
|
-
__name(
|
|
9673
|
+
__name(getSubscriptionRelationsSchema, "getSubscriptionRelationsSchema");
|
|
9385
9674
|
|
|
9386
|
-
// src/lib/mysql/schemas/
|
|
9387
|
-
|
|
9388
|
-
|
|
9675
|
+
// src/lib/mysql/schemas/org/organizations.ts
|
|
9676
|
+
function getOrganizationsSchema(mysqlTable) {
|
|
9677
|
+
return mysqlTable("Organization", {
|
|
9678
|
+
id: (0, import_mysql_core19.varchar)("id", {
|
|
9679
|
+
length: 255
|
|
9680
|
+
}).notNull().primaryKey(),
|
|
9681
|
+
name: (0, import_mysql_core19.varchar)("name", {
|
|
9682
|
+
length: 255
|
|
9683
|
+
}),
|
|
9684
|
+
fields: (0, import_mysql_core19.json)("fields").$type().default({}),
|
|
9685
|
+
image: (0, import_mysql_core19.varchar)("image", {
|
|
9686
|
+
length: 255
|
|
9687
|
+
}),
|
|
9688
|
+
createdAt: (0, import_mysql_core19.timestamp)("createdAt", {
|
|
9689
|
+
mode: "date",
|
|
9690
|
+
fsp: 3
|
|
9691
|
+
}).default(import_drizzle_orm19.sql`CURRENT_TIMESTAMP(3)`)
|
|
9692
|
+
}, (organization) => ({
|
|
9693
|
+
createdAtIdx: (0, import_mysql_core19.index)("created_at_idx").on(organization.createdAt)
|
|
9694
|
+
}));
|
|
9695
|
+
}
|
|
9696
|
+
__name(getOrganizationsSchema, "getOrganizationsSchema");
|
|
9697
|
+
function getOrganizationsRelationsSchema(mysqlTable) {
|
|
9698
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
9699
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
9700
|
+
const subscriptions = getSubscriptionSchema(mysqlTable);
|
|
9701
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
9702
|
+
return (0, import_drizzle_orm19.relations)(organizations, ({ many }) => ({
|
|
9703
|
+
purchases: many(purchases, {
|
|
9704
|
+
relationName: "organization"
|
|
9705
|
+
}),
|
|
9706
|
+
subscriptions: many(subscriptions, {
|
|
9707
|
+
relationName: "organization"
|
|
9708
|
+
}),
|
|
9709
|
+
members: many(organizationMemberships, {
|
|
9710
|
+
relationName: "organization"
|
|
9711
|
+
})
|
|
9712
|
+
}));
|
|
9713
|
+
}
|
|
9714
|
+
__name(getOrganizationsRelationsSchema, "getOrganizationsRelationsSchema");
|
|
9389
9715
|
|
|
9390
|
-
// src/lib/mysql/schemas/
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9716
|
+
// src/lib/mysql/schemas/org/organization-memberships.ts
|
|
9717
|
+
function getOrganizationMembershipsSchema(mysqlTable) {
|
|
9718
|
+
return mysqlTable("OrganizationMembership", {
|
|
9719
|
+
id: (0, import_mysql_core20.varchar)("id", {
|
|
9720
|
+
length: 255
|
|
9721
|
+
}).notNull().primaryKey(),
|
|
9722
|
+
organizationId: (0, import_mysql_core20.varchar)("organizationId", {
|
|
9396
9723
|
length: 191
|
|
9724
|
+
}),
|
|
9725
|
+
role: (0, import_mysql_core20.varchar)("role", {
|
|
9726
|
+
length: 191
|
|
9727
|
+
}).notNull().default("user"),
|
|
9728
|
+
invitedById: (0, import_mysql_core20.varchar)("invitedById", {
|
|
9729
|
+
length: 255
|
|
9397
9730
|
}).notNull(),
|
|
9398
|
-
|
|
9399
|
-
|
|
9731
|
+
userId: (0, import_mysql_core20.varchar)("userId", {
|
|
9732
|
+
length: 255
|
|
9733
|
+
}).notNull(),
|
|
9734
|
+
fields: (0, import_mysql_core20.json)("fields").$type().default({}),
|
|
9735
|
+
createdAt: (0, import_mysql_core20.timestamp)("createdAt", {
|
|
9400
9736
|
mode: "date",
|
|
9401
9737
|
fsp: 3
|
|
9402
|
-
}).default(
|
|
9403
|
-
|
|
9404
|
-
|
|
9738
|
+
}).default(import_drizzle_orm20.sql`CURRENT_TIMESTAMP(3)`)
|
|
9739
|
+
}, (organizationMembership) => ({
|
|
9740
|
+
roleIdx: (0, import_mysql_core20.index)("role_idx").on(organizationMembership.role),
|
|
9741
|
+
createdAtIdx: (0, import_mysql_core20.index)("created_at_idx").on(organizationMembership.createdAt),
|
|
9742
|
+
organizationIdIdx: (0, import_mysql_core20.index)("organizationId_idx").on(organizationMembership.organizationId)
|
|
9743
|
+
}));
|
|
9744
|
+
}
|
|
9745
|
+
__name(getOrganizationMembershipsSchema, "getOrganizationMembershipsSchema");
|
|
9746
|
+
function getOrganizationMembershipsRelationsSchema(mysqlTable) {
|
|
9747
|
+
const users = getUsersSchema(mysqlTable);
|
|
9748
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
9749
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
9750
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
9751
|
+
return (0, import_drizzle_orm20.relations)(organizationMemberships, ({ one, many }) => ({
|
|
9752
|
+
user: one(users, {
|
|
9753
|
+
fields: [
|
|
9754
|
+
organizationMemberships.userId
|
|
9755
|
+
],
|
|
9756
|
+
references: [
|
|
9757
|
+
users.id
|
|
9758
|
+
],
|
|
9759
|
+
relationName: "user"
|
|
9405
9760
|
}),
|
|
9406
|
-
|
|
9407
|
-
|
|
9761
|
+
invitedBy: one(users, {
|
|
9762
|
+
fields: [
|
|
9763
|
+
organizationMemberships.invitedById
|
|
9764
|
+
],
|
|
9765
|
+
references: [
|
|
9766
|
+
users.id
|
|
9767
|
+
],
|
|
9768
|
+
relationName: "invitedBy"
|
|
9769
|
+
}),
|
|
9770
|
+
purchases: many(purchases),
|
|
9771
|
+
organization: one(organizations, {
|
|
9772
|
+
fields: [
|
|
9773
|
+
organizationMemberships.organizationId
|
|
9774
|
+
],
|
|
9775
|
+
references: [
|
|
9776
|
+
organizations.id
|
|
9777
|
+
],
|
|
9778
|
+
relationName: "organization"
|
|
9408
9779
|
})
|
|
9409
|
-
}
|
|
9410
|
-
return {
|
|
9411
|
-
merchantAccountId: (0, import_mysql_core16.primaryKey)({
|
|
9412
|
-
columns: [
|
|
9413
|
-
table.id
|
|
9414
|
-
],
|
|
9415
|
-
name: "MerchantAccount_id"
|
|
9416
|
-
})
|
|
9417
|
-
};
|
|
9418
|
-
});
|
|
9780
|
+
}));
|
|
9419
9781
|
}
|
|
9420
|
-
__name(
|
|
9782
|
+
__name(getOrganizationMembershipsRelationsSchema, "getOrganizationMembershipsRelationsSchema");
|
|
9421
9783
|
|
|
9422
|
-
// src/lib/mysql/schemas/commerce/
|
|
9423
|
-
var
|
|
9424
|
-
var
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9784
|
+
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
9785
|
+
var import_drizzle_orm21 = require("drizzle-orm");
|
|
9786
|
+
var import_mysql_core22 = require("drizzle-orm/mysql-core");
|
|
9787
|
+
|
|
9788
|
+
// src/lib/mysql/schemas/commerce/merchant-coupon.ts
|
|
9789
|
+
var import_mysql_core21 = require("drizzle-orm/mysql-core");
|
|
9790
|
+
function getMerchantCouponSchema(mysqlTable) {
|
|
9791
|
+
return mysqlTable("MerchantCoupon", {
|
|
9792
|
+
id: (0, import_mysql_core21.varchar)("id", {
|
|
9428
9793
|
length: 191
|
|
9429
9794
|
}).notNull(),
|
|
9430
|
-
|
|
9795
|
+
identifier: (0, import_mysql_core21.varchar)("identifier", {
|
|
9431
9796
|
length: 191
|
|
9432
|
-
})
|
|
9433
|
-
|
|
9797
|
+
}),
|
|
9798
|
+
organizationId: (0, import_mysql_core21.varchar)("organizationId", {
|
|
9434
9799
|
length: 191
|
|
9435
|
-
})
|
|
9436
|
-
|
|
9800
|
+
}),
|
|
9801
|
+
status: (0, import_mysql_core21.int)("status").default(0).notNull(),
|
|
9802
|
+
merchantAccountId: (0, import_mysql_core21.varchar)("merchantAccountId", {
|
|
9437
9803
|
length: 191
|
|
9438
9804
|
}).notNull(),
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
}).
|
|
9443
|
-
|
|
9805
|
+
percentageDiscount: (0, import_mysql_core21.decimal)("percentageDiscount", {
|
|
9806
|
+
precision: 3,
|
|
9807
|
+
scale: 2
|
|
9808
|
+
}).notNull(),
|
|
9809
|
+
type: (0, import_mysql_core21.varchar)("type", {
|
|
9810
|
+
length: 191
|
|
9811
|
+
})
|
|
9444
9812
|
}, (table) => {
|
|
9445
9813
|
return {
|
|
9446
|
-
|
|
9814
|
+
merchantCouponId: (0, import_mysql_core21.primaryKey)({
|
|
9447
9815
|
columns: [
|
|
9448
9816
|
table.id
|
|
9449
9817
|
],
|
|
9450
|
-
name: "
|
|
9818
|
+
name: "MerchantCoupon_id"
|
|
9451
9819
|
}),
|
|
9452
|
-
|
|
9453
|
-
|
|
9820
|
+
merchantCouponIdentifierKey: (0, import_mysql_core21.unique)("MerchantCoupon_identifier_key").on(table.identifier),
|
|
9821
|
+
organizationIdIdx: (0, import_mysql_core21.index)("organizationId_idx").on(table.organizationId)
|
|
9454
9822
|
};
|
|
9455
9823
|
});
|
|
9456
9824
|
}
|
|
9457
|
-
__name(
|
|
9825
|
+
__name(getMerchantCouponSchema, "getMerchantCouponSchema");
|
|
9458
9826
|
|
|
9459
|
-
// src/lib/mysql/schemas/commerce/
|
|
9460
|
-
function
|
|
9461
|
-
return mysqlTable("
|
|
9462
|
-
id: (0,
|
|
9463
|
-
length: 191
|
|
9464
|
-
}).notNull(),
|
|
9465
|
-
status: (0, import_mysql_core18.int)("status").default(0).notNull(),
|
|
9466
|
-
identifier: (0, import_mysql_core18.varchar)("identifier", {
|
|
9467
|
-
length: 191
|
|
9468
|
-
}).notNull(),
|
|
9469
|
-
userId: (0, import_mysql_core18.varchar)("userId", {
|
|
9827
|
+
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
9828
|
+
function getCouponSchema(mysqlTable) {
|
|
9829
|
+
return mysqlTable("Coupon", {
|
|
9830
|
+
id: (0, import_mysql_core22.varchar)("id", {
|
|
9470
9831
|
length: 191
|
|
9471
9832
|
}).notNull(),
|
|
9472
|
-
|
|
9833
|
+
organizationId: (0, import_mysql_core22.varchar)("organizationId", {
|
|
9473
9834
|
length: 191
|
|
9474
|
-
})
|
|
9475
|
-
|
|
9835
|
+
}),
|
|
9836
|
+
code: (0, import_mysql_core22.varchar)("code", {
|
|
9476
9837
|
length: 191
|
|
9477
|
-
})
|
|
9478
|
-
createdAt: (0,
|
|
9838
|
+
}),
|
|
9839
|
+
createdAt: (0, import_mysql_core22.timestamp)("createdAt", {
|
|
9479
9840
|
mode: "date",
|
|
9480
9841
|
fsp: 3
|
|
9481
|
-
}).default(
|
|
9482
|
-
|
|
9842
|
+
}).default(import_drizzle_orm21.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9843
|
+
expires: (0, import_mysql_core22.timestamp)("expires", {
|
|
9844
|
+
mode: "date",
|
|
9845
|
+
fsp: 3
|
|
9846
|
+
}),
|
|
9847
|
+
fields: (0, import_mysql_core22.json)("fields").$type().default({}),
|
|
9848
|
+
maxUses: (0, import_mysql_core22.int)("maxUses").default(-1).notNull(),
|
|
9849
|
+
default: (0, import_mysql_core22.boolean)("default").default(false).notNull(),
|
|
9850
|
+
merchantCouponId: (0, import_mysql_core22.varchar)("merchantCouponId", {
|
|
9483
9851
|
length: 191
|
|
9484
|
-
})
|
|
9852
|
+
}),
|
|
9853
|
+
status: (0, import_mysql_core22.int)("status").default(0).notNull(),
|
|
9854
|
+
usedCount: (0, import_mysql_core22.int)("usedCount").default(0).notNull(),
|
|
9855
|
+
percentageDiscount: (0, import_mysql_core22.decimal)("percentageDiscount", {
|
|
9856
|
+
precision: 3,
|
|
9857
|
+
scale: 2
|
|
9858
|
+
}).notNull(),
|
|
9859
|
+
restrictedToProductId: (0, import_mysql_core22.varchar)("restrictedToProductId", {
|
|
9860
|
+
length: 191
|
|
9861
|
+
})
|
|
9485
9862
|
}, (table) => {
|
|
9486
9863
|
return {
|
|
9487
|
-
|
|
9864
|
+
couponIdCodeIndex: (0, import_mysql_core22.index)("Coupon_id_code_index").on(table.id, table.code),
|
|
9865
|
+
couponId: (0, import_mysql_core22.primaryKey)({
|
|
9488
9866
|
columns: [
|
|
9489
9867
|
table.id
|
|
9490
9868
|
],
|
|
9491
|
-
name: "
|
|
9869
|
+
name: "Coupon_id"
|
|
9492
9870
|
}),
|
|
9493
|
-
|
|
9871
|
+
couponCodeKey: (0, import_mysql_core22.unique)("Coupon_code_key").on(table.code),
|
|
9872
|
+
organizationIdIdx: (0, import_mysql_core22.index)("organizationId_idx").on(table.organizationId)
|
|
9494
9873
|
};
|
|
9495
9874
|
});
|
|
9496
9875
|
}
|
|
9497
|
-
__name(
|
|
9498
|
-
function
|
|
9499
|
-
const
|
|
9500
|
-
const
|
|
9501
|
-
const
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
fields: [
|
|
9506
|
-
merchantCharge.merchantAccountId
|
|
9507
|
-
],
|
|
9508
|
-
references: [
|
|
9509
|
-
merchantAccount.id
|
|
9510
|
-
],
|
|
9511
|
-
relationName: "merchantAccount"
|
|
9876
|
+
__name(getCouponSchema, "getCouponSchema");
|
|
9877
|
+
function getCouponRelationsSchema(mysqlTable) {
|
|
9878
|
+
const purchase = getPurchaseSchema(mysqlTable);
|
|
9879
|
+
const coupon = getCouponSchema(mysqlTable);
|
|
9880
|
+
const merchantCoupon = getMerchantCouponSchema(mysqlTable);
|
|
9881
|
+
return (0, import_drizzle_orm21.relations)(coupon, ({ many, one }) => ({
|
|
9882
|
+
redeemedBulkCouponPurchases: many(purchase, {
|
|
9883
|
+
relationName: "redeemedBulkCoupon"
|
|
9512
9884
|
}),
|
|
9513
|
-
|
|
9885
|
+
merchantCoupon: one(merchantCoupon, {
|
|
9514
9886
|
fields: [
|
|
9515
|
-
|
|
9887
|
+
coupon.merchantCouponId
|
|
9516
9888
|
],
|
|
9517
9889
|
references: [
|
|
9518
|
-
|
|
9890
|
+
merchantCoupon.id
|
|
9519
9891
|
],
|
|
9520
|
-
relationName: "
|
|
9892
|
+
relationName: "merchantCoupon"
|
|
9521
9893
|
}),
|
|
9522
|
-
|
|
9894
|
+
product: one(getProductSchema(mysqlTable), {
|
|
9523
9895
|
fields: [
|
|
9524
|
-
|
|
9896
|
+
coupon.restrictedToProductId
|
|
9525
9897
|
],
|
|
9526
9898
|
references: [
|
|
9527
|
-
|
|
9899
|
+
getProductSchema(mysqlTable).id
|
|
9528
9900
|
],
|
|
9529
|
-
relationName: "
|
|
9901
|
+
relationName: "product"
|
|
9902
|
+
}),
|
|
9903
|
+
bulkPurchases: many(purchase, {
|
|
9904
|
+
relationName: "bulkCoupon"
|
|
9530
9905
|
})
|
|
9531
9906
|
}));
|
|
9532
9907
|
}
|
|
9533
|
-
__name(
|
|
9908
|
+
__name(getCouponRelationsSchema, "getCouponRelationsSchema");
|
|
9534
9909
|
|
|
9535
9910
|
// src/lib/mysql/schemas/commerce/merchant-session.ts
|
|
9536
|
-
var
|
|
9911
|
+
var import_mysql_core23 = require("drizzle-orm/mysql-core");
|
|
9537
9912
|
function getMerchantSessionSchema(mysqlTable) {
|
|
9538
9913
|
return mysqlTable("MerchantSession", {
|
|
9539
|
-
id: (0,
|
|
9914
|
+
id: (0, import_mysql_core23.varchar)("id", {
|
|
9540
9915
|
length: 191
|
|
9541
9916
|
}).notNull(),
|
|
9542
|
-
|
|
9917
|
+
organizationId: (0, import_mysql_core23.varchar)("organizationId", {
|
|
9918
|
+
length: 191
|
|
9919
|
+
}),
|
|
9920
|
+
identifier: (0, import_mysql_core23.varchar)("identifier", {
|
|
9543
9921
|
length: 191
|
|
9544
9922
|
}).notNull(),
|
|
9545
|
-
merchantAccountId: (0,
|
|
9923
|
+
merchantAccountId: (0, import_mysql_core23.varchar)("merchantAccountId", {
|
|
9546
9924
|
length: 191
|
|
9547
9925
|
}).notNull()
|
|
9548
9926
|
}, (table) => {
|
|
9549
9927
|
return {
|
|
9550
|
-
merchantSessionId: (0,
|
|
9928
|
+
merchantSessionId: (0, import_mysql_core23.primaryKey)({
|
|
9551
9929
|
columns: [
|
|
9552
9930
|
table.id
|
|
9553
9931
|
],
|
|
9554
9932
|
name: "MerchantSession_id"
|
|
9555
|
-
})
|
|
9933
|
+
}),
|
|
9934
|
+
organizationIdIdx: (0, import_mysql_core23.index)("organizationId_idx").on(table.organizationId)
|
|
9556
9935
|
};
|
|
9557
9936
|
});
|
|
9558
9937
|
}
|
|
@@ -9561,67 +9940,75 @@ __name(getMerchantSessionSchema, "getMerchantSessionSchema");
|
|
|
9561
9940
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
9562
9941
|
function getPurchaseSchema(mysqlTable) {
|
|
9563
9942
|
return mysqlTable("Purchase", {
|
|
9564
|
-
id: (0,
|
|
9943
|
+
id: (0, import_mysql_core24.varchar)("id", {
|
|
9565
9944
|
length: 191
|
|
9566
9945
|
}).notNull(),
|
|
9567
|
-
userId: (0,
|
|
9946
|
+
userId: (0, import_mysql_core24.varchar)("userId", {
|
|
9568
9947
|
length: 191
|
|
9569
9948
|
}),
|
|
9570
|
-
|
|
9949
|
+
purchasedByorganizationMembershipId: (0, import_mysql_core24.varchar)("organizationMembershipId", {
|
|
9950
|
+
length: 191
|
|
9951
|
+
}),
|
|
9952
|
+
organizationId: (0, import_mysql_core24.varchar)("organizationId", {
|
|
9953
|
+
length: 191
|
|
9954
|
+
}),
|
|
9955
|
+
createdAt: (0, import_mysql_core24.timestamp)("createdAt", {
|
|
9571
9956
|
mode: "date",
|
|
9572
9957
|
fsp: 3
|
|
9573
|
-
}).default(
|
|
9574
|
-
totalAmount: (0,
|
|
9958
|
+
}).default(import_drizzle_orm22.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
9959
|
+
totalAmount: (0, import_mysql_core24.decimal)("totalAmount", {
|
|
9575
9960
|
precision: 65,
|
|
9576
9961
|
scale: 30
|
|
9577
9962
|
}).notNull(),
|
|
9578
|
-
ipAddress: (0,
|
|
9963
|
+
ipAddress: (0, import_mysql_core24.varchar)("ip_address", {
|
|
9579
9964
|
length: 191
|
|
9580
9965
|
}),
|
|
9581
|
-
city: (0,
|
|
9966
|
+
city: (0, import_mysql_core24.varchar)("city", {
|
|
9582
9967
|
length: 191
|
|
9583
9968
|
}),
|
|
9584
|
-
state: (0,
|
|
9969
|
+
state: (0, import_mysql_core24.varchar)("state", {
|
|
9585
9970
|
length: 191
|
|
9586
9971
|
}),
|
|
9587
|
-
country: (0,
|
|
9972
|
+
country: (0, import_mysql_core24.varchar)("country", {
|
|
9588
9973
|
length: 191
|
|
9589
9974
|
}),
|
|
9590
|
-
couponId: (0,
|
|
9975
|
+
couponId: (0, import_mysql_core24.varchar)("couponId", {
|
|
9591
9976
|
length: 191
|
|
9592
9977
|
}),
|
|
9593
|
-
productId: (0,
|
|
9978
|
+
productId: (0, import_mysql_core24.varchar)("productId", {
|
|
9594
9979
|
length: 191
|
|
9595
9980
|
}).notNull(),
|
|
9596
|
-
merchantChargeId: (0,
|
|
9981
|
+
merchantChargeId: (0, import_mysql_core24.varchar)("merchantChargeId", {
|
|
9597
9982
|
length: 191
|
|
9598
9983
|
}),
|
|
9599
|
-
upgradedFromId: (0,
|
|
9984
|
+
upgradedFromId: (0, import_mysql_core24.varchar)("upgradedFromId", {
|
|
9600
9985
|
length: 191
|
|
9601
9986
|
}),
|
|
9602
|
-
status: (0,
|
|
9987
|
+
status: (0, import_mysql_core24.varchar)("status", {
|
|
9603
9988
|
length: 191
|
|
9604
9989
|
}).default("Valid").notNull(),
|
|
9605
|
-
bulkCouponId: (0,
|
|
9990
|
+
bulkCouponId: (0, import_mysql_core24.varchar)("bulkCouponId", {
|
|
9606
9991
|
length: 191
|
|
9607
9992
|
}),
|
|
9608
|
-
merchantSessionId: (0,
|
|
9993
|
+
merchantSessionId: (0, import_mysql_core24.varchar)("merchantSessionId", {
|
|
9609
9994
|
length: 191
|
|
9610
9995
|
}),
|
|
9611
|
-
redeemedBulkCouponId: (0,
|
|
9996
|
+
redeemedBulkCouponId: (0, import_mysql_core24.varchar)("redeemedBulkCouponId", {
|
|
9612
9997
|
length: 191
|
|
9613
9998
|
}),
|
|
9614
|
-
fields: (0,
|
|
9999
|
+
fields: (0, import_mysql_core24.json)("fields").$type().default({})
|
|
9615
10000
|
}, (table) => {
|
|
9616
10001
|
return {
|
|
9617
|
-
purchaseId: (0,
|
|
10002
|
+
purchaseId: (0, import_mysql_core24.primaryKey)({
|
|
9618
10003
|
columns: [
|
|
9619
10004
|
table.id
|
|
9620
10005
|
],
|
|
9621
10006
|
name: "Purchase_id"
|
|
9622
10007
|
}),
|
|
9623
|
-
merchantChargeIdIdx: (0,
|
|
9624
|
-
purchaseUpgradedFromIdKey: (0,
|
|
10008
|
+
merchantChargeIdIdx: (0, import_mysql_core24.index)("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
|
|
10009
|
+
purchaseUpgradedFromIdKey: (0, import_mysql_core24.unique)("Purchase_upgradedFromId_key").on(table.upgradedFromId),
|
|
10010
|
+
organizationIdIdx: (0, import_mysql_core24.index)("organizationId_idx").on(table.organizationId),
|
|
10011
|
+
organizationMembershipIdIdx: (0, import_mysql_core24.index)("organizationMembershipId_idx").on(table.purchasedByorganizationMembershipId)
|
|
9625
10012
|
};
|
|
9626
10013
|
});
|
|
9627
10014
|
}
|
|
@@ -9633,7 +10020,9 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
9633
10020
|
const merchantCharges = getMerchantChargeSchema(mysqlTable);
|
|
9634
10021
|
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
9635
10022
|
const coupons = getCouponSchema(mysqlTable);
|
|
9636
|
-
|
|
10023
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
10024
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
10025
|
+
return (0, import_drizzle_orm22.relations)(purchases, ({ many, one }) => ({
|
|
9637
10026
|
redeemedBulkCoupon: one(coupons, {
|
|
9638
10027
|
fields: [
|
|
9639
10028
|
purchases.redeemedBulkCouponId
|
|
@@ -9652,6 +10041,24 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
9652
10041
|
],
|
|
9653
10042
|
relationName: "user"
|
|
9654
10043
|
}),
|
|
10044
|
+
organization: one(organizations, {
|
|
10045
|
+
fields: [
|
|
10046
|
+
purchases.organizationId
|
|
10047
|
+
],
|
|
10048
|
+
references: [
|
|
10049
|
+
organizations.id
|
|
10050
|
+
],
|
|
10051
|
+
relationName: "organization"
|
|
10052
|
+
}),
|
|
10053
|
+
purchasedBy: one(organizationMemberships, {
|
|
10054
|
+
fields: [
|
|
10055
|
+
purchases.purchasedByorganizationMembershipId
|
|
10056
|
+
],
|
|
10057
|
+
references: [
|
|
10058
|
+
organizationMemberships.id
|
|
10059
|
+
],
|
|
10060
|
+
relationName: "organizationMembership"
|
|
10061
|
+
}),
|
|
9655
10062
|
product: one(products, {
|
|
9656
10063
|
fields: [
|
|
9657
10064
|
purchases.productId
|
|
@@ -9693,44 +10100,49 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
9693
10100
|
__name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
|
|
9694
10101
|
|
|
9695
10102
|
// src/lib/mysql/schemas/communication/comment.ts
|
|
9696
|
-
var
|
|
9697
|
-
var
|
|
10103
|
+
var import_drizzle_orm23 = require("drizzle-orm");
|
|
10104
|
+
var import_mysql_core25 = require("drizzle-orm/mysql-core");
|
|
9698
10105
|
function getCommentsSchema(mysqlTable) {
|
|
9699
10106
|
return mysqlTable("Comment", {
|
|
9700
|
-
id: (0,
|
|
10107
|
+
id: (0, import_mysql_core25.varchar)("id", {
|
|
9701
10108
|
length: 191
|
|
9702
10109
|
}).notNull(),
|
|
9703
|
-
userId: (0,
|
|
10110
|
+
userId: (0, import_mysql_core25.varchar)("userId", {
|
|
9704
10111
|
length: 255
|
|
9705
10112
|
}).notNull(),
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
10113
|
+
organizationMembershipId: (0, import_mysql_core25.varchar)("organizationMembershipId", {
|
|
10114
|
+
length: 255
|
|
10115
|
+
}),
|
|
10116
|
+
context: (0, import_mysql_core25.json)("context").$type().default({}),
|
|
10117
|
+
text: (0, import_mysql_core25.text)("text").notNull(),
|
|
10118
|
+
createdAt: (0, import_mysql_core25.timestamp)("createdAt", {
|
|
9709
10119
|
mode: "date",
|
|
9710
10120
|
fsp: 3
|
|
9711
|
-
}).default(
|
|
9712
|
-
updatedAt: (0,
|
|
10121
|
+
}).default(import_drizzle_orm23.sql`CURRENT_TIMESTAMP(3)`),
|
|
10122
|
+
updatedAt: (0, import_mysql_core25.timestamp)("updatedAt", {
|
|
9713
10123
|
mode: "date",
|
|
9714
10124
|
fsp: 3
|
|
9715
|
-
}).default(
|
|
9716
|
-
deletedAt: (0,
|
|
10125
|
+
}).default(import_drizzle_orm23.sql`CURRENT_TIMESTAMP(3)`),
|
|
10126
|
+
deletedAt: (0, import_mysql_core25.timestamp)("deletedAt", {
|
|
9717
10127
|
mode: "date",
|
|
9718
10128
|
fsp: 3
|
|
9719
10129
|
})
|
|
9720
10130
|
}, (crr) => ({
|
|
9721
|
-
pk: (0,
|
|
10131
|
+
pk: (0, import_mysql_core25.primaryKey)({
|
|
9722
10132
|
columns: [
|
|
9723
10133
|
crr.id
|
|
9724
10134
|
]
|
|
9725
10135
|
}),
|
|
9726
|
-
crrUserIdIdKey: (0,
|
|
10136
|
+
crrUserIdIdKey: (0, import_mysql_core25.index)("crr_userIdId_idx").on(crr.userId),
|
|
10137
|
+
organizationMembershipIdIdx: (0, import_mysql_core25.index)("organizationMembershipId_idx").on(crr.organizationMembershipId)
|
|
9727
10138
|
}));
|
|
9728
10139
|
}
|
|
9729
10140
|
__name(getCommentsSchema, "getCommentsSchema");
|
|
9730
10141
|
function getCommentRelationsSchema(mysqlTable) {
|
|
9731
10142
|
const comment = getCommentsSchema(mysqlTable);
|
|
9732
10143
|
const user = getUsersSchema(mysqlTable);
|
|
9733
|
-
|
|
10144
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
10145
|
+
return (0, import_drizzle_orm23.relations)(comment, ({ one }) => ({
|
|
9734
10146
|
user: one(user, {
|
|
9735
10147
|
fields: [
|
|
9736
10148
|
comment.userId
|
|
@@ -9739,66 +10151,82 @@ function getCommentRelationsSchema(mysqlTable) {
|
|
|
9739
10151
|
user.id
|
|
9740
10152
|
],
|
|
9741
10153
|
relationName: "user"
|
|
10154
|
+
}),
|
|
10155
|
+
organizationMembership: one(organizationMemberships, {
|
|
10156
|
+
fields: [
|
|
10157
|
+
comment.organizationMembershipId
|
|
10158
|
+
],
|
|
10159
|
+
references: [
|
|
10160
|
+
organizationMemberships.id
|
|
10161
|
+
],
|
|
10162
|
+
relationName: "organizationMembership"
|
|
9742
10163
|
})
|
|
9743
10164
|
}));
|
|
9744
10165
|
}
|
|
9745
10166
|
__name(getCommentRelationsSchema, "getCommentRelationsSchema");
|
|
9746
10167
|
|
|
9747
10168
|
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
9748
|
-
var
|
|
9749
|
-
var
|
|
10169
|
+
var import_drizzle_orm24 = require("drizzle-orm");
|
|
10170
|
+
var import_mysql_core28 = require("drizzle-orm/mysql-core");
|
|
9750
10171
|
|
|
9751
10172
|
// src/lib/mysql/schemas/communication/communication-channel.ts
|
|
9752
|
-
var
|
|
10173
|
+
var import_mysql_core26 = require("drizzle-orm/mysql-core");
|
|
9753
10174
|
function getCommunicationChannelSchema(mysqlTable) {
|
|
9754
10175
|
return mysqlTable("CommunicationChannel", {
|
|
9755
|
-
id: (0,
|
|
10176
|
+
id: (0, import_mysql_core26.varchar)("id", {
|
|
9756
10177
|
length: 255
|
|
9757
10178
|
}).notNull().primaryKey(),
|
|
9758
|
-
|
|
10179
|
+
organizationId: (0, import_mysql_core26.varchar)("organizationId", {
|
|
10180
|
+
length: 191
|
|
10181
|
+
}),
|
|
10182
|
+
name: (0, import_mysql_core26.varchar)("name", {
|
|
9759
10183
|
length: 255
|
|
9760
10184
|
}).notNull(),
|
|
9761
|
-
description: (0,
|
|
9762
|
-
active: (0,
|
|
9763
|
-
createdAt: (0,
|
|
10185
|
+
description: (0, import_mysql_core26.text)("description"),
|
|
10186
|
+
active: (0, import_mysql_core26.boolean)("active").notNull().default(true),
|
|
10187
|
+
createdAt: (0, import_mysql_core26.timestamp)("createdAt", {
|
|
9764
10188
|
mode: "date",
|
|
9765
10189
|
fsp: 3
|
|
9766
10190
|
}).defaultNow(),
|
|
9767
|
-
updatedAt: (0,
|
|
10191
|
+
updatedAt: (0, import_mysql_core26.timestamp)("updatedAt", {
|
|
9768
10192
|
mode: "date",
|
|
9769
10193
|
fsp: 3
|
|
9770
10194
|
}).defaultNow(),
|
|
9771
|
-
deletedAt: (0,
|
|
10195
|
+
deletedAt: (0, import_mysql_core26.timestamp)("deletedAt", {
|
|
9772
10196
|
mode: "date",
|
|
9773
10197
|
fsp: 3
|
|
9774
10198
|
})
|
|
9775
10199
|
}, (cc) => ({
|
|
9776
|
-
nameIdx: (0,
|
|
10200
|
+
nameIdx: (0, import_mysql_core26.index)("name_idx").on(cc.name),
|
|
10201
|
+
organizationIdIdx: (0, import_mysql_core26.index)("organizationId_idx").on(cc.organizationId)
|
|
9777
10202
|
}));
|
|
9778
10203
|
}
|
|
9779
10204
|
__name(getCommunicationChannelSchema, "getCommunicationChannelSchema");
|
|
9780
10205
|
|
|
9781
10206
|
// src/lib/mysql/schemas/communication/communication-preference-types.ts
|
|
9782
|
-
var
|
|
10207
|
+
var import_mysql_core27 = require("drizzle-orm/mysql-core");
|
|
9783
10208
|
function getCommunicationPreferenceTypesSchema(mysqlTable) {
|
|
9784
10209
|
return mysqlTable("CommunicationPreferenceType", {
|
|
9785
|
-
id: (0,
|
|
10210
|
+
id: (0, import_mysql_core27.varchar)("id", {
|
|
9786
10211
|
length: 255
|
|
9787
10212
|
}).notNull().primaryKey(),
|
|
9788
|
-
|
|
10213
|
+
organizationId: (0, import_mysql_core27.varchar)("organizationId", {
|
|
10214
|
+
length: 191
|
|
10215
|
+
}),
|
|
10216
|
+
name: (0, import_mysql_core27.varchar)("name", {
|
|
9789
10217
|
length: 255
|
|
9790
10218
|
}).notNull(),
|
|
9791
|
-
description: (0,
|
|
9792
|
-
active: (0,
|
|
9793
|
-
createdAt: (0,
|
|
10219
|
+
description: (0, import_mysql_core27.text)("description"),
|
|
10220
|
+
active: (0, import_mysql_core27.boolean)("active").notNull().default(true),
|
|
10221
|
+
createdAt: (0, import_mysql_core27.timestamp)("createdAt", {
|
|
9794
10222
|
mode: "date",
|
|
9795
10223
|
fsp: 3
|
|
9796
10224
|
}).defaultNow(),
|
|
9797
|
-
updatedAt: (0,
|
|
10225
|
+
updatedAt: (0, import_mysql_core27.timestamp)("updatedAt", {
|
|
9798
10226
|
mode: "date",
|
|
9799
10227
|
fsp: 3
|
|
9800
10228
|
}),
|
|
9801
|
-
deletedAt: (0,
|
|
10229
|
+
deletedAt: (0, import_mysql_core27.timestamp)("deletedAt", {
|
|
9802
10230
|
mode: "date",
|
|
9803
10231
|
fsp: 3
|
|
9804
10232
|
})
|
|
@@ -9809,48 +10237,55 @@ __name(getCommunicationPreferenceTypesSchema, "getCommunicationPreferenceTypesSc
|
|
|
9809
10237
|
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
9810
10238
|
function getCommunicationPreferencesSchema(mysqlTable) {
|
|
9811
10239
|
return mysqlTable("CommunicationPreference", {
|
|
9812
|
-
id: (0,
|
|
10240
|
+
id: (0, import_mysql_core28.varchar)("id", {
|
|
9813
10241
|
length: 255
|
|
9814
10242
|
}).notNull().primaryKey(),
|
|
9815
|
-
|
|
10243
|
+
organizationId: (0, import_mysql_core28.varchar)("organizationId", {
|
|
10244
|
+
length: 191
|
|
10245
|
+
}),
|
|
10246
|
+
userId: (0, import_mysql_core28.varchar)("userId", {
|
|
9816
10247
|
length: 255
|
|
9817
10248
|
}).notNull(),
|
|
9818
|
-
|
|
10249
|
+
organizationMembershipId: (0, import_mysql_core28.varchar)("organizationMembershipId", {
|
|
10250
|
+
length: 255
|
|
10251
|
+
}),
|
|
10252
|
+
channelId: (0, import_mysql_core28.varchar)("channelId", {
|
|
9819
10253
|
length: 255
|
|
9820
10254
|
}).notNull(),
|
|
9821
|
-
preferenceLevel: (0,
|
|
10255
|
+
preferenceLevel: (0, import_mysql_core28.mysqlEnum)("preferenceLevel", [
|
|
9822
10256
|
"low",
|
|
9823
10257
|
"medium",
|
|
9824
10258
|
"high"
|
|
9825
10259
|
]).notNull().default("medium"),
|
|
9826
|
-
preferenceTypeId: (0,
|
|
10260
|
+
preferenceTypeId: (0, import_mysql_core28.varchar)("preferenceTypeId", {
|
|
9827
10261
|
length: 255
|
|
9828
10262
|
}).notNull(),
|
|
9829
|
-
active: (0,
|
|
9830
|
-
createdAt: (0,
|
|
10263
|
+
active: (0, import_mysql_core28.boolean)("active").notNull().default(true),
|
|
10264
|
+
createdAt: (0, import_mysql_core28.timestamp)("createdAt", {
|
|
9831
10265
|
mode: "date",
|
|
9832
10266
|
fsp: 3
|
|
9833
10267
|
}).defaultNow(),
|
|
9834
|
-
optInAt: (0,
|
|
10268
|
+
optInAt: (0, import_mysql_core28.timestamp)("optInAt", {
|
|
9835
10269
|
mode: "date",
|
|
9836
10270
|
fsp: 3
|
|
9837
10271
|
}),
|
|
9838
|
-
optOutAt: (0,
|
|
10272
|
+
optOutAt: (0, import_mysql_core28.timestamp)("optOutAt", {
|
|
9839
10273
|
mode: "date",
|
|
9840
10274
|
fsp: 3
|
|
9841
10275
|
}),
|
|
9842
|
-
updatedAt: (0,
|
|
10276
|
+
updatedAt: (0, import_mysql_core28.timestamp)("updatedAt", {
|
|
9843
10277
|
mode: "date",
|
|
9844
10278
|
fsp: 3
|
|
9845
10279
|
}).defaultNow(),
|
|
9846
|
-
deletedAt: (0,
|
|
10280
|
+
deletedAt: (0, import_mysql_core28.timestamp)("deletedAt", {
|
|
9847
10281
|
mode: "date",
|
|
9848
10282
|
fsp: 3
|
|
9849
10283
|
})
|
|
9850
10284
|
}, (cp) => ({
|
|
9851
|
-
userIdIdx: (0,
|
|
9852
|
-
preferenceTypeIdx: (0,
|
|
9853
|
-
channelIdIdx: (0,
|
|
10285
|
+
userIdIdx: (0, import_mysql_core28.index)("userId_idx").on(cp.userId),
|
|
10286
|
+
preferenceTypeIdx: (0, import_mysql_core28.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
10287
|
+
channelIdIdx: (0, import_mysql_core28.index)("channelId_idx").on(cp.channelId),
|
|
10288
|
+
organizationMembershipIdIdx: (0, import_mysql_core28.index)("organizationMembershipId_idx").on(cp.organizationMembershipId)
|
|
9854
10289
|
}));
|
|
9855
10290
|
}
|
|
9856
10291
|
__name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
|
|
@@ -9859,7 +10294,8 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
9859
10294
|
const users = getUsersSchema(mysqlTable);
|
|
9860
10295
|
const communicationChannel = getCommunicationChannelSchema(mysqlTable);
|
|
9861
10296
|
const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
|
|
9862
|
-
|
|
10297
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
10298
|
+
return (0, import_drizzle_orm24.relations)(communicationPreferences, ({ one }) => ({
|
|
9863
10299
|
user: one(users, {
|
|
9864
10300
|
fields: [
|
|
9865
10301
|
communicationPreferences.userId
|
|
@@ -9869,6 +10305,15 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
9869
10305
|
],
|
|
9870
10306
|
relationName: "user"
|
|
9871
10307
|
}),
|
|
10308
|
+
organizationMembership: one(organizationMemberships, {
|
|
10309
|
+
fields: [
|
|
10310
|
+
communicationPreferences.organizationMembershipId
|
|
10311
|
+
],
|
|
10312
|
+
references: [
|
|
10313
|
+
organizationMemberships.id
|
|
10314
|
+
],
|
|
10315
|
+
relationName: "organizationMembership"
|
|
10316
|
+
}),
|
|
9872
10317
|
channel: one(communicationChannel, {
|
|
9873
10318
|
fields: [
|
|
9874
10319
|
communicationPreferences.channelId
|
|
@@ -9892,75 +10337,79 @@ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
|
9892
10337
|
__name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
|
|
9893
10338
|
|
|
9894
10339
|
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
9895
|
-
var
|
|
9896
|
-
var
|
|
10340
|
+
var import_drizzle_orm26 = require("drizzle-orm");
|
|
10341
|
+
var import_mysql_core30 = require("drizzle-orm/mysql-core");
|
|
9897
10342
|
|
|
9898
10343
|
// src/lib/mysql/schemas/auth/permissions.ts
|
|
9899
|
-
var
|
|
9900
|
-
var
|
|
10344
|
+
var import_drizzle_orm25 = require("drizzle-orm");
|
|
10345
|
+
var import_mysql_core29 = require("drizzle-orm/mysql-core");
|
|
9901
10346
|
function getPermissionsSchema(mysqlTable) {
|
|
9902
10347
|
return mysqlTable("Permission", {
|
|
9903
|
-
id: (0,
|
|
10348
|
+
id: (0, import_mysql_core29.varchar)("id", {
|
|
9904
10349
|
length: 255
|
|
9905
10350
|
}).notNull().primaryKey(),
|
|
9906
|
-
name: (0,
|
|
10351
|
+
name: (0, import_mysql_core29.varchar)("name", {
|
|
9907
10352
|
length: 255
|
|
9908
10353
|
}).notNull().unique(),
|
|
9909
|
-
description: (0,
|
|
9910
|
-
active: (0,
|
|
9911
|
-
createdAt: (0,
|
|
10354
|
+
description: (0, import_mysql_core29.text)("description"),
|
|
10355
|
+
active: (0, import_mysql_core29.boolean)("active").notNull().default(true),
|
|
10356
|
+
createdAt: (0, import_mysql_core29.timestamp)("createdAt", {
|
|
9912
10357
|
mode: "date",
|
|
9913
10358
|
fsp: 3
|
|
9914
10359
|
}).defaultNow(),
|
|
9915
|
-
updatedAt: (0,
|
|
10360
|
+
updatedAt: (0, import_mysql_core29.timestamp)("updatedAt", {
|
|
9916
10361
|
mode: "date",
|
|
9917
10362
|
fsp: 3
|
|
9918
10363
|
}).defaultNow(),
|
|
9919
|
-
deletedAt: (0,
|
|
10364
|
+
deletedAt: (0, import_mysql_core29.timestamp)("deletedAt", {
|
|
9920
10365
|
mode: "date",
|
|
9921
10366
|
fsp: 3
|
|
9922
10367
|
})
|
|
9923
10368
|
}, (permission) => ({
|
|
9924
|
-
nameIdx: (0,
|
|
10369
|
+
nameIdx: (0, import_mysql_core29.index)("name_idx").on(permission.name)
|
|
9925
10370
|
}));
|
|
9926
10371
|
}
|
|
9927
10372
|
__name(getPermissionsSchema, "getPermissionsSchema");
|
|
9928
10373
|
function getPermissionsRelationsSchema(mysqlTable) {
|
|
9929
|
-
return (0,
|
|
10374
|
+
return (0, import_drizzle_orm25.relations)(getPermissionsSchema(mysqlTable), ({ many }) => ({}));
|
|
9930
10375
|
}
|
|
9931
10376
|
__name(getPermissionsRelationsSchema, "getPermissionsRelationsSchema");
|
|
9932
10377
|
|
|
9933
10378
|
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
9934
10379
|
function getUserPermissionsSchema(mysqlTable) {
|
|
9935
10380
|
return mysqlTable("UserPermission", {
|
|
9936
|
-
userId: (0,
|
|
10381
|
+
userId: (0, import_mysql_core30.varchar)("userId", {
|
|
9937
10382
|
length: 255
|
|
9938
10383
|
}).notNull(),
|
|
9939
|
-
|
|
10384
|
+
organizationId: (0, import_mysql_core30.varchar)("organizationId", {
|
|
10385
|
+
length: 191
|
|
10386
|
+
}),
|
|
10387
|
+
permissionId: (0, import_mysql_core30.varchar)("permissionId", {
|
|
9940
10388
|
length: 255
|
|
9941
10389
|
}).notNull(),
|
|
9942
|
-
active: (0,
|
|
9943
|
-
createdAt: (0,
|
|
10390
|
+
active: (0, import_mysql_core30.boolean)("active").notNull().default(true),
|
|
10391
|
+
createdAt: (0, import_mysql_core30.timestamp)("createdAt", {
|
|
9944
10392
|
mode: "date",
|
|
9945
10393
|
fsp: 3
|
|
9946
10394
|
}).defaultNow(),
|
|
9947
|
-
updatedAt: (0,
|
|
10395
|
+
updatedAt: (0, import_mysql_core30.timestamp)("updatedAt", {
|
|
9948
10396
|
mode: "date",
|
|
9949
10397
|
fsp: 3
|
|
9950
10398
|
}).defaultNow(),
|
|
9951
|
-
deletedAt: (0,
|
|
10399
|
+
deletedAt: (0, import_mysql_core30.timestamp)("deletedAt", {
|
|
9952
10400
|
mode: "date",
|
|
9953
10401
|
fsp: 3
|
|
9954
10402
|
})
|
|
9955
10403
|
}, (up) => ({
|
|
9956
|
-
pk: (0,
|
|
10404
|
+
pk: (0, import_mysql_core30.primaryKey)({
|
|
9957
10405
|
columns: [
|
|
9958
10406
|
up.userId,
|
|
9959
10407
|
up.permissionId
|
|
9960
10408
|
]
|
|
9961
10409
|
}),
|
|
9962
|
-
userIdIdx: (0,
|
|
9963
|
-
permissionIdIdx: (0,
|
|
10410
|
+
userIdIdx: (0, import_mysql_core30.index)("userId_idx").on(up.userId),
|
|
10411
|
+
permissionIdIdx: (0, import_mysql_core30.index)("permissionId_idx").on(up.permissionId),
|
|
10412
|
+
organizationIdIdx: (0, import_mysql_core30.index)("organizationId_idx").on(up.organizationId)
|
|
9964
10413
|
}));
|
|
9965
10414
|
}
|
|
9966
10415
|
__name(getUserPermissionsSchema, "getUserPermissionsSchema");
|
|
@@ -9968,7 +10417,7 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
9968
10417
|
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
9969
10418
|
const users = getUsersSchema(mysqlTable);
|
|
9970
10419
|
const permissions = getPermissionsSchema(mysqlTable);
|
|
9971
|
-
return (0,
|
|
10420
|
+
return (0, import_drizzle_orm26.relations)(userPermissions, ({ one }) => ({
|
|
9972
10421
|
user: one(users, {
|
|
9973
10422
|
fields: [
|
|
9974
10423
|
userPermissions.userId
|
|
@@ -9992,46 +10441,50 @@ function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
|
9992
10441
|
__name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
|
|
9993
10442
|
|
|
9994
10443
|
// src/lib/mysql/schemas/auth/user-prefs.ts
|
|
9995
|
-
var
|
|
9996
|
-
var
|
|
10444
|
+
var import_drizzle_orm27 = require("drizzle-orm");
|
|
10445
|
+
var import_mysql_core31 = require("drizzle-orm/mysql-core");
|
|
9997
10446
|
function getUserPrefsSchema(mysqlTable) {
|
|
9998
10447
|
return mysqlTable("UserPrefs", {
|
|
9999
|
-
id: (0,
|
|
10448
|
+
id: (0, import_mysql_core31.varchar)("id", {
|
|
10000
10449
|
length: 191
|
|
10001
10450
|
}).notNull(),
|
|
10002
|
-
|
|
10451
|
+
organizationId: (0, import_mysql_core31.varchar)("organizationId", {
|
|
10452
|
+
length: 191
|
|
10453
|
+
}),
|
|
10454
|
+
type: (0, import_mysql_core31.varchar)("type", {
|
|
10003
10455
|
length: 191
|
|
10004
10456
|
}).default("Global").notNull(),
|
|
10005
|
-
userId: (0,
|
|
10457
|
+
userId: (0, import_mysql_core31.varchar)("userId", {
|
|
10006
10458
|
length: 255
|
|
10007
10459
|
}).notNull(),
|
|
10008
|
-
fields: (0,
|
|
10009
|
-
createdAt: (0,
|
|
10460
|
+
fields: (0, import_mysql_core31.json)("fields").$type().default({}),
|
|
10461
|
+
createdAt: (0, import_mysql_core31.timestamp)("createdAt", {
|
|
10010
10462
|
mode: "date",
|
|
10011
10463
|
fsp: 3
|
|
10012
|
-
}).default(
|
|
10013
|
-
updatedAt: (0,
|
|
10464
|
+
}).default(import_drizzle_orm27.sql`CURRENT_TIMESTAMP(3)`),
|
|
10465
|
+
updatedAt: (0, import_mysql_core31.timestamp)("updatedAt", {
|
|
10014
10466
|
mode: "date",
|
|
10015
10467
|
fsp: 3
|
|
10016
|
-
}).default(
|
|
10017
|
-
deletedAt: (0,
|
|
10468
|
+
}).default(import_drizzle_orm27.sql`CURRENT_TIMESTAMP(3)`),
|
|
10469
|
+
deletedAt: (0, import_mysql_core31.timestamp)("deletedAt", {
|
|
10018
10470
|
mode: "date",
|
|
10019
10471
|
fsp: 3
|
|
10020
10472
|
})
|
|
10021
10473
|
}, (crr) => ({
|
|
10022
|
-
pk: (0,
|
|
10474
|
+
pk: (0, import_mysql_core31.primaryKey)({
|
|
10023
10475
|
columns: [
|
|
10024
10476
|
crr.id
|
|
10025
10477
|
]
|
|
10026
10478
|
}),
|
|
10027
|
-
crrUserIdIdKey: (0,
|
|
10479
|
+
crrUserIdIdKey: (0, import_mysql_core31.index)("crr_userIdId_idx").on(crr.userId),
|
|
10480
|
+
organizationIdIdx: (0, import_mysql_core31.index)("organizationId_idx").on(crr.organizationId)
|
|
10028
10481
|
}));
|
|
10029
10482
|
}
|
|
10030
10483
|
__name(getUserPrefsSchema, "getUserPrefsSchema");
|
|
10031
10484
|
function getUserPrefsRelationsSchema(mysqlTable) {
|
|
10032
10485
|
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
10033
10486
|
const user = getUsersSchema(mysqlTable);
|
|
10034
|
-
return (0,
|
|
10487
|
+
return (0, import_drizzle_orm27.relations)(userPrefs, ({ one }) => ({
|
|
10035
10488
|
user: one(user, {
|
|
10036
10489
|
fields: [
|
|
10037
10490
|
userPrefs.userId
|
|
@@ -10046,43 +10499,47 @@ function getUserPrefsRelationsSchema(mysqlTable) {
|
|
|
10046
10499
|
__name(getUserPrefsRelationsSchema, "getUserPrefsRelationsSchema");
|
|
10047
10500
|
|
|
10048
10501
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
10049
|
-
var
|
|
10050
|
-
var
|
|
10502
|
+
var import_drizzle_orm29 = require("drizzle-orm");
|
|
10503
|
+
var import_mysql_core33 = require("drizzle-orm/mysql-core");
|
|
10051
10504
|
|
|
10052
10505
|
// src/lib/mysql/schemas/auth/roles.ts
|
|
10053
|
-
var
|
|
10054
|
-
var
|
|
10506
|
+
var import_drizzle_orm28 = require("drizzle-orm");
|
|
10507
|
+
var import_mysql_core32 = require("drizzle-orm/mysql-core");
|
|
10055
10508
|
function getRolesSchema(mysqlTable) {
|
|
10056
10509
|
return mysqlTable("Role", {
|
|
10057
|
-
id: (0,
|
|
10510
|
+
id: (0, import_mysql_core32.varchar)("id", {
|
|
10058
10511
|
length: 255
|
|
10059
10512
|
}).notNull().primaryKey(),
|
|
10060
|
-
|
|
10513
|
+
organizationId: (0, import_mysql_core32.varchar)("organizationId", {
|
|
10514
|
+
length: 191
|
|
10515
|
+
}),
|
|
10516
|
+
name: (0, import_mysql_core32.varchar)("name", {
|
|
10061
10517
|
length: 255
|
|
10062
10518
|
}).notNull().unique(),
|
|
10063
|
-
description: (0,
|
|
10064
|
-
active: (0,
|
|
10065
|
-
createdAt: (0,
|
|
10519
|
+
description: (0, import_mysql_core32.text)("description"),
|
|
10520
|
+
active: (0, import_mysql_core32.boolean)("active").notNull().default(true),
|
|
10521
|
+
createdAt: (0, import_mysql_core32.timestamp)("createdAt", {
|
|
10066
10522
|
mode: "date",
|
|
10067
10523
|
fsp: 3
|
|
10068
10524
|
}).defaultNow(),
|
|
10069
|
-
updatedAt: (0,
|
|
10525
|
+
updatedAt: (0, import_mysql_core32.timestamp)("updatedAt", {
|
|
10070
10526
|
mode: "date",
|
|
10071
10527
|
fsp: 3
|
|
10072
10528
|
}).defaultNow(),
|
|
10073
|
-
deletedAt: (0,
|
|
10529
|
+
deletedAt: (0, import_mysql_core32.timestamp)("deletedAt", {
|
|
10074
10530
|
mode: "date",
|
|
10075
10531
|
fsp: 3
|
|
10076
10532
|
})
|
|
10077
10533
|
}, (role) => ({
|
|
10078
|
-
nameIdx: (0,
|
|
10534
|
+
nameIdx: (0, import_mysql_core32.index)("name_idx").on(role.name),
|
|
10535
|
+
organizationIdIdx: (0, import_mysql_core32.index)("organizationId_idx").on(role.organizationId)
|
|
10079
10536
|
}));
|
|
10080
10537
|
}
|
|
10081
10538
|
__name(getRolesSchema, "getRolesSchema");
|
|
10082
10539
|
function getRolesRelationsSchema(mysqlTable) {
|
|
10083
10540
|
const roles = getRolesSchema(mysqlTable);
|
|
10084
10541
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
10085
|
-
return (0,
|
|
10542
|
+
return (0, import_drizzle_orm28.relations)(roles, ({ many }) => ({
|
|
10086
10543
|
userRoles: many(userRoles, {
|
|
10087
10544
|
relationName: "role"
|
|
10088
10545
|
})
|
|
@@ -10093,34 +10550,38 @@ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
|
|
|
10093
10550
|
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
10094
10551
|
function getUserRolesSchema(mysqlTable) {
|
|
10095
10552
|
return mysqlTable("UserRole", {
|
|
10096
|
-
userId: (0,
|
|
10553
|
+
userId: (0, import_mysql_core33.varchar)("userId", {
|
|
10097
10554
|
length: 255
|
|
10098
10555
|
}).notNull(),
|
|
10099
|
-
roleId: (0,
|
|
10556
|
+
roleId: (0, import_mysql_core33.varchar)("roleId", {
|
|
10100
10557
|
length: 255
|
|
10101
10558
|
}).notNull(),
|
|
10102
|
-
active: (0,
|
|
10103
|
-
|
|
10559
|
+
active: (0, import_mysql_core33.boolean)("active").notNull().default(true),
|
|
10560
|
+
organizationId: (0, import_mysql_core33.varchar)("organizationId", {
|
|
10561
|
+
length: 191
|
|
10562
|
+
}),
|
|
10563
|
+
createdAt: (0, import_mysql_core33.timestamp)("createdAt", {
|
|
10104
10564
|
mode: "date",
|
|
10105
10565
|
fsp: 3
|
|
10106
10566
|
}).defaultNow(),
|
|
10107
|
-
updatedAt: (0,
|
|
10567
|
+
updatedAt: (0, import_mysql_core33.timestamp)("updatedAt", {
|
|
10108
10568
|
mode: "date",
|
|
10109
10569
|
fsp: 3
|
|
10110
10570
|
}).defaultNow(),
|
|
10111
|
-
deletedAt: (0,
|
|
10571
|
+
deletedAt: (0, import_mysql_core33.timestamp)("deletedAt", {
|
|
10112
10572
|
mode: "date",
|
|
10113
10573
|
fsp: 3
|
|
10114
10574
|
})
|
|
10115
10575
|
}, (ur) => ({
|
|
10116
|
-
pk: (0,
|
|
10576
|
+
pk: (0, import_mysql_core33.primaryKey)({
|
|
10117
10577
|
columns: [
|
|
10118
10578
|
ur.userId,
|
|
10119
10579
|
ur.roleId
|
|
10120
10580
|
]
|
|
10121
10581
|
}),
|
|
10122
|
-
userIdIdx: (0,
|
|
10123
|
-
roleIdIdx: (0,
|
|
10582
|
+
userIdIdx: (0, import_mysql_core33.index)("userId_idx").on(ur.userId),
|
|
10583
|
+
roleIdIdx: (0, import_mysql_core33.index)("roleId_idx").on(ur.roleId),
|
|
10584
|
+
organizationIdIdx: (0, import_mysql_core33.index)("organizationId_idx").on(ur.organizationId)
|
|
10124
10585
|
}));
|
|
10125
10586
|
}
|
|
10126
10587
|
__name(getUserRolesSchema, "getUserRolesSchema");
|
|
@@ -10128,7 +10589,7 @@ function getUserRolesRelationsSchema(mysqlTable) {
|
|
|
10128
10589
|
const userRoles = getUserRolesSchema(mysqlTable);
|
|
10129
10590
|
const users = getUsersSchema(mysqlTable);
|
|
10130
10591
|
const roles = getRolesSchema(mysqlTable);
|
|
10131
|
-
return (0,
|
|
10592
|
+
return (0, import_drizzle_orm29.relations)(userRoles, ({ one }) => ({
|
|
10132
10593
|
user: one(users, {
|
|
10133
10594
|
fields: [
|
|
10134
10595
|
userRoles.userId
|
|
@@ -10154,34 +10615,34 @@ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
|
|
|
10154
10615
|
// src/lib/mysql/schemas/auth/users.ts
|
|
10155
10616
|
function getUsersSchema(mysqlTable) {
|
|
10156
10617
|
return mysqlTable("User", {
|
|
10157
|
-
id: (0,
|
|
10618
|
+
id: (0, import_mysql_core34.varchar)("id", {
|
|
10158
10619
|
length: 255
|
|
10159
10620
|
}).notNull().primaryKey(),
|
|
10160
|
-
name: (0,
|
|
10621
|
+
name: (0, import_mysql_core34.varchar)("name", {
|
|
10161
10622
|
length: 255
|
|
10162
10623
|
}),
|
|
10163
|
-
role: (0,
|
|
10624
|
+
role: (0, import_mysql_core34.varchar)("role", {
|
|
10164
10625
|
length: 191
|
|
10165
10626
|
}).notNull().default("user"),
|
|
10166
|
-
email: (0,
|
|
10627
|
+
email: (0, import_mysql_core34.varchar)("email", {
|
|
10167
10628
|
length: 255
|
|
10168
10629
|
}).notNull().unique(),
|
|
10169
|
-
fields: (0,
|
|
10170
|
-
emailVerified: (0,
|
|
10630
|
+
fields: (0, import_mysql_core34.json)("fields").$type().default({}),
|
|
10631
|
+
emailVerified: (0, import_mysql_core34.timestamp)("emailVerified", {
|
|
10171
10632
|
mode: "date",
|
|
10172
10633
|
fsp: 3
|
|
10173
10634
|
}),
|
|
10174
|
-
image: (0,
|
|
10635
|
+
image: (0, import_mysql_core34.varchar)("image", {
|
|
10175
10636
|
length: 255
|
|
10176
10637
|
}),
|
|
10177
|
-
createdAt: (0,
|
|
10638
|
+
createdAt: (0, import_mysql_core34.timestamp)("createdAt", {
|
|
10178
10639
|
mode: "date",
|
|
10179
10640
|
fsp: 3
|
|
10180
|
-
}).default(
|
|
10641
|
+
}).default(import_drizzle_orm30.sql`CURRENT_TIMESTAMP(3)`)
|
|
10181
10642
|
}, (user) => ({
|
|
10182
|
-
emailIdx: (0,
|
|
10183
|
-
roleIdx: (0,
|
|
10184
|
-
createdAtIdx: (0,
|
|
10643
|
+
emailIdx: (0, import_mysql_core34.index)("email_idx").on(user.email),
|
|
10644
|
+
roleIdx: (0, import_mysql_core34.index)("role_idx").on(user.role),
|
|
10645
|
+
createdAtIdx: (0, import_mysql_core34.index)("created_at_idx").on(user.createdAt)
|
|
10185
10646
|
}));
|
|
10186
10647
|
}
|
|
10187
10648
|
__name(getUsersSchema, "getUsersSchema");
|
|
@@ -10196,7 +10657,8 @@ function getUsersRelationsSchema(mysqlTable) {
|
|
|
10196
10657
|
const purchases = getPurchaseSchema(mysqlTable);
|
|
10197
10658
|
const comments = getCommentsSchema(mysqlTable);
|
|
10198
10659
|
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
10199
|
-
|
|
10660
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
10661
|
+
return (0, import_drizzle_orm30.relations)(users, ({ many }) => ({
|
|
10200
10662
|
accounts: many(accounts, {
|
|
10201
10663
|
relationName: "user"
|
|
10202
10664
|
}),
|
|
@@ -10223,6 +10685,9 @@ function getUsersRelationsSchema(mysqlTable) {
|
|
|
10223
10685
|
}),
|
|
10224
10686
|
prefs: many(userPrefs, {
|
|
10225
10687
|
relationName: "user"
|
|
10688
|
+
}),
|
|
10689
|
+
organizationMemberships: many(organizationMemberships, {
|
|
10690
|
+
relationName: "user"
|
|
10226
10691
|
})
|
|
10227
10692
|
}));
|
|
10228
10693
|
}
|
|
@@ -10231,49 +10696,49 @@ __name(getUsersRelationsSchema, "getUsersRelationsSchema");
|
|
|
10231
10696
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
10232
10697
|
function getAccountsSchema(mysqlTable) {
|
|
10233
10698
|
return mysqlTable("Account", {
|
|
10234
|
-
userId: (0,
|
|
10699
|
+
userId: (0, import_mysql_core35.varchar)("userId", {
|
|
10235
10700
|
length: 255
|
|
10236
10701
|
}).notNull(),
|
|
10237
|
-
type: (0,
|
|
10702
|
+
type: (0, import_mysql_core35.varchar)("type", {
|
|
10238
10703
|
length: 255
|
|
10239
10704
|
}).$type().notNull(),
|
|
10240
|
-
provider: (0,
|
|
10705
|
+
provider: (0, import_mysql_core35.varchar)("provider", {
|
|
10241
10706
|
length: 255
|
|
10242
10707
|
}).notNull(),
|
|
10243
|
-
providerAccountId: (0,
|
|
10708
|
+
providerAccountId: (0, import_mysql_core35.varchar)("providerAccountId", {
|
|
10244
10709
|
length: 255
|
|
10245
10710
|
}).notNull(),
|
|
10246
|
-
refresh_token: (0,
|
|
10247
|
-
access_token: (0,
|
|
10248
|
-
oauth_token: (0,
|
|
10249
|
-
oauth_token_secret: (0,
|
|
10250
|
-
expires_at: (0,
|
|
10251
|
-
token_type: (0,
|
|
10711
|
+
refresh_token: (0, import_mysql_core35.text)("refresh_token"),
|
|
10712
|
+
access_token: (0, import_mysql_core35.text)("access_token"),
|
|
10713
|
+
oauth_token: (0, import_mysql_core35.text)("oauth_token"),
|
|
10714
|
+
oauth_token_secret: (0, import_mysql_core35.text)("oauth_token_secret"),
|
|
10715
|
+
expires_at: (0, import_mysql_core35.int)("expires_at"),
|
|
10716
|
+
token_type: (0, import_mysql_core35.varchar)("token_type", {
|
|
10252
10717
|
length: 255
|
|
10253
10718
|
}),
|
|
10254
|
-
scope: (0,
|
|
10719
|
+
scope: (0, import_mysql_core35.varchar)("scope", {
|
|
10255
10720
|
length: 255
|
|
10256
10721
|
}),
|
|
10257
|
-
id_token: (0,
|
|
10258
|
-
session_state: (0,
|
|
10722
|
+
id_token: (0, import_mysql_core35.text)("id_token"),
|
|
10723
|
+
session_state: (0, import_mysql_core35.varchar)("session_state", {
|
|
10259
10724
|
length: 255
|
|
10260
10725
|
}),
|
|
10261
|
-
refresh_token_expires_in: (0,
|
|
10726
|
+
refresh_token_expires_in: (0, import_mysql_core35.int)("refresh_token_expires_in")
|
|
10262
10727
|
}, (account) => ({
|
|
10263
|
-
pk: (0,
|
|
10728
|
+
pk: (0, import_mysql_core35.primaryKey)({
|
|
10264
10729
|
columns: [
|
|
10265
10730
|
account.provider,
|
|
10266
10731
|
account.providerAccountId
|
|
10267
10732
|
]
|
|
10268
10733
|
}),
|
|
10269
|
-
userIdIdx: (0,
|
|
10734
|
+
userIdIdx: (0, import_mysql_core35.index)("userId_idx").on(account.userId)
|
|
10270
10735
|
}));
|
|
10271
10736
|
}
|
|
10272
10737
|
__name(getAccountsSchema, "getAccountsSchema");
|
|
10273
10738
|
function getAccountsRelationsSchema(mysqlTable) {
|
|
10274
10739
|
const accounts = getAccountsSchema(mysqlTable);
|
|
10275
10740
|
const users = getUsersSchema(mysqlTable);
|
|
10276
|
-
return (0,
|
|
10741
|
+
return (0, import_drizzle_orm31.relations)(accounts, ({ one }) => ({
|
|
10277
10742
|
user: one(users, {
|
|
10278
10743
|
fields: [
|
|
10279
10744
|
accounts.userId
|
|
@@ -10288,34 +10753,37 @@ function getAccountsRelationsSchema(mysqlTable) {
|
|
|
10288
10753
|
__name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
|
|
10289
10754
|
|
|
10290
10755
|
// src/lib/mysql/schemas/auth/device-access-token.ts
|
|
10291
|
-
var
|
|
10292
|
-
var
|
|
10756
|
+
var import_drizzle_orm32 = require("drizzle-orm");
|
|
10757
|
+
var import_mysql_core36 = require("drizzle-orm/mysql-core");
|
|
10293
10758
|
function getDeviceAccessTokenSchema(mysqlTable) {
|
|
10294
10759
|
return mysqlTable("DeviceAccessToken", {
|
|
10295
|
-
token: (0,
|
|
10760
|
+
token: (0, import_mysql_core36.varchar)("token", {
|
|
10296
10761
|
length: 191
|
|
10297
10762
|
}).notNull(),
|
|
10298
|
-
userId: (0,
|
|
10763
|
+
userId: (0, import_mysql_core36.varchar)("userId", {
|
|
10299
10764
|
length: 191
|
|
10300
10765
|
}).notNull(),
|
|
10301
|
-
|
|
10766
|
+
organizationMembershipId: (0, import_mysql_core36.varchar)("organizationMembershipId", {
|
|
10767
|
+
length: 191
|
|
10768
|
+
}),
|
|
10769
|
+
createdAt: (0, import_mysql_core36.timestamp)("createdAt", {
|
|
10302
10770
|
mode: "date",
|
|
10303
10771
|
fsp: 3
|
|
10304
|
-
}).default(
|
|
10772
|
+
}).default(import_drizzle_orm32.sql`CURRENT_TIMESTAMP(3)`)
|
|
10305
10773
|
}, (crr) => ({
|
|
10306
|
-
pk: (0,
|
|
10774
|
+
pk: (0, import_mysql_core36.primaryKey)({
|
|
10307
10775
|
columns: [
|
|
10308
10776
|
crr.token
|
|
10309
10777
|
]
|
|
10310
10778
|
}),
|
|
10311
|
-
userIdIdx: (0,
|
|
10779
|
+
userIdIdx: (0, import_mysql_core36.index)("userId_idx").on(crr.userId)
|
|
10312
10780
|
}));
|
|
10313
10781
|
}
|
|
10314
10782
|
__name(getDeviceAccessTokenSchema, "getDeviceAccessTokenSchema");
|
|
10315
10783
|
function getDeviceAccessTokenRelationsSchema(mysqlTable) {
|
|
10316
10784
|
const deviceAccessToken = getDeviceAccessTokenSchema(mysqlTable);
|
|
10317
10785
|
const user = getUsersSchema(mysqlTable);
|
|
10318
|
-
return (0,
|
|
10786
|
+
return (0, import_drizzle_orm32.relations)(deviceAccessToken, ({ one }) => ({
|
|
10319
10787
|
verifiedBy: one(user, {
|
|
10320
10788
|
fields: [
|
|
10321
10789
|
deviceAccessToken.userId
|
|
@@ -10330,31 +10798,31 @@ function getDeviceAccessTokenRelationsSchema(mysqlTable) {
|
|
|
10330
10798
|
__name(getDeviceAccessTokenRelationsSchema, "getDeviceAccessTokenRelationsSchema");
|
|
10331
10799
|
|
|
10332
10800
|
// src/lib/mysql/schemas/auth/device-verification.ts
|
|
10333
|
-
var
|
|
10334
|
-
var
|
|
10801
|
+
var import_drizzle_orm33 = require("drizzle-orm");
|
|
10802
|
+
var import_mysql_core37 = require("drizzle-orm/mysql-core");
|
|
10335
10803
|
function getDeviceVerificationSchema(mysqlTable) {
|
|
10336
10804
|
return mysqlTable("DeviceVerification", {
|
|
10337
|
-
verifiedByUserId: (0,
|
|
10805
|
+
verifiedByUserId: (0, import_mysql_core37.varchar)("verifiedByUserId", {
|
|
10338
10806
|
length: 255
|
|
10339
10807
|
}),
|
|
10340
|
-
deviceCode: (0,
|
|
10808
|
+
deviceCode: (0, import_mysql_core37.varchar)("deviceCode", {
|
|
10341
10809
|
length: 191
|
|
10342
10810
|
}).notNull(),
|
|
10343
|
-
userCode: (0,
|
|
10344
|
-
expires: (0,
|
|
10811
|
+
userCode: (0, import_mysql_core37.text)("userCode").notNull(),
|
|
10812
|
+
expires: (0, import_mysql_core37.timestamp)("expires", {
|
|
10345
10813
|
mode: "date",
|
|
10346
10814
|
fsp: 3
|
|
10347
10815
|
}).notNull(),
|
|
10348
|
-
createdAt: (0,
|
|
10816
|
+
createdAt: (0, import_mysql_core37.timestamp)("createdAt", {
|
|
10349
10817
|
mode: "date",
|
|
10350
10818
|
fsp: 3
|
|
10351
|
-
}).default(
|
|
10352
|
-
verifiedAt: (0,
|
|
10819
|
+
}).default(import_drizzle_orm33.sql`CURRENT_TIMESTAMP(3)`),
|
|
10820
|
+
verifiedAt: (0, import_mysql_core37.timestamp)("verifiedAt", {
|
|
10353
10821
|
mode: "date",
|
|
10354
10822
|
fsp: 3
|
|
10355
10823
|
})
|
|
10356
10824
|
}, (crr) => ({
|
|
10357
|
-
pk: (0,
|
|
10825
|
+
pk: (0, import_mysql_core37.primaryKey)({
|
|
10358
10826
|
columns: [
|
|
10359
10827
|
crr.deviceCode
|
|
10360
10828
|
]
|
|
@@ -10365,7 +10833,7 @@ __name(getDeviceVerificationSchema, "getDeviceVerificationSchema");
|
|
|
10365
10833
|
function getDeviceVerificationRelationsSchema(mysqlTable) {
|
|
10366
10834
|
const deviceVerification = getDeviceVerificationSchema(mysqlTable);
|
|
10367
10835
|
const user = getUsersSchema(mysqlTable);
|
|
10368
|
-
return (0,
|
|
10836
|
+
return (0, import_drizzle_orm33.relations)(deviceVerification, ({ one }) => ({
|
|
10369
10837
|
verifiedBy: one(user, {
|
|
10370
10838
|
fields: [
|
|
10371
10839
|
deviceVerification.verifiedByUserId
|
|
@@ -10380,38 +10848,38 @@ function getDeviceVerificationRelationsSchema(mysqlTable) {
|
|
|
10380
10848
|
__name(getDeviceVerificationRelationsSchema, "getDeviceVerificationRelationsSchema");
|
|
10381
10849
|
|
|
10382
10850
|
// src/lib/mysql/schemas/auth/role-permissions.ts
|
|
10383
|
-
var
|
|
10384
|
-
var
|
|
10851
|
+
var import_drizzle_orm34 = require("drizzle-orm");
|
|
10852
|
+
var import_mysql_core38 = require("drizzle-orm/mysql-core");
|
|
10385
10853
|
function getRolePermissionsSchema(mysqlTable) {
|
|
10386
10854
|
return mysqlTable("RolePermission", {
|
|
10387
|
-
roleId: (0,
|
|
10855
|
+
roleId: (0, import_mysql_core38.varchar)("roleId", {
|
|
10388
10856
|
length: 255
|
|
10389
10857
|
}).notNull(),
|
|
10390
|
-
permissionId: (0,
|
|
10858
|
+
permissionId: (0, import_mysql_core38.varchar)("permissionId", {
|
|
10391
10859
|
length: 255
|
|
10392
10860
|
}).notNull(),
|
|
10393
|
-
active: (0,
|
|
10394
|
-
createdAt: (0,
|
|
10861
|
+
active: (0, import_mysql_core38.boolean)("active").notNull().default(true),
|
|
10862
|
+
createdAt: (0, import_mysql_core38.timestamp)("createdAt", {
|
|
10395
10863
|
mode: "date",
|
|
10396
10864
|
fsp: 3
|
|
10397
10865
|
}).defaultNow(),
|
|
10398
|
-
updatedAt: (0,
|
|
10866
|
+
updatedAt: (0, import_mysql_core38.timestamp)("updatedAt", {
|
|
10399
10867
|
mode: "date",
|
|
10400
10868
|
fsp: 3
|
|
10401
10869
|
}).defaultNow(),
|
|
10402
|
-
deletedAt: (0,
|
|
10870
|
+
deletedAt: (0, import_mysql_core38.timestamp)("deletedAt", {
|
|
10403
10871
|
mode: "date",
|
|
10404
10872
|
fsp: 3
|
|
10405
10873
|
})
|
|
10406
10874
|
}, (rp) => ({
|
|
10407
|
-
pk: (0,
|
|
10875
|
+
pk: (0, import_mysql_core38.primaryKey)({
|
|
10408
10876
|
columns: [
|
|
10409
10877
|
rp.roleId,
|
|
10410
10878
|
rp.permissionId
|
|
10411
10879
|
]
|
|
10412
10880
|
}),
|
|
10413
|
-
roleIdIdx: (0,
|
|
10414
|
-
permissionIdIdx: (0,
|
|
10881
|
+
roleIdIdx: (0, import_mysql_core38.index)("roleId_idx").on(rp.roleId),
|
|
10882
|
+
permissionIdIdx: (0, import_mysql_core38.index)("permissionId_idx").on(rp.permissionId)
|
|
10415
10883
|
}));
|
|
10416
10884
|
}
|
|
10417
10885
|
__name(getRolePermissionsSchema, "getRolePermissionsSchema");
|
|
@@ -10419,7 +10887,7 @@ function getRolePermissionsRelationsSchema(mysqlTable) {
|
|
|
10419
10887
|
const permissions = getPermissionsSchema(mysqlTable);
|
|
10420
10888
|
const roles = getRolesSchema(mysqlTable);
|
|
10421
10889
|
const rolePermissions = getRolePermissionsSchema(mysqlTable);
|
|
10422
|
-
return (0,
|
|
10890
|
+
return (0, import_drizzle_orm34.relations)(rolePermissions, ({ one }) => ({
|
|
10423
10891
|
role: one(roles, {
|
|
10424
10892
|
fields: [
|
|
10425
10893
|
rolePermissions.roleId
|
|
@@ -10443,28 +10911,28 @@ function getRolePermissionsRelationsSchema(mysqlTable) {
|
|
|
10443
10911
|
__name(getRolePermissionsRelationsSchema, "getRolePermissionsRelationsSchema");
|
|
10444
10912
|
|
|
10445
10913
|
// src/lib/mysql/schemas/auth/sessions.ts
|
|
10446
|
-
var
|
|
10447
|
-
var
|
|
10914
|
+
var import_drizzle_orm35 = require("drizzle-orm");
|
|
10915
|
+
var import_mysql_core39 = require("drizzle-orm/mysql-core");
|
|
10448
10916
|
function getSessionsSchema(mysqlTable) {
|
|
10449
10917
|
return mysqlTable("Session", {
|
|
10450
|
-
sessionToken: (0,
|
|
10918
|
+
sessionToken: (0, import_mysql_core39.varchar)("sessionToken", {
|
|
10451
10919
|
length: 255
|
|
10452
10920
|
}).notNull().primaryKey(),
|
|
10453
|
-
userId: (0,
|
|
10921
|
+
userId: (0, import_mysql_core39.varchar)("userId", {
|
|
10454
10922
|
length: 255
|
|
10455
10923
|
}).notNull(),
|
|
10456
|
-
expires: (0,
|
|
10924
|
+
expires: (0, import_mysql_core39.timestamp)("expires", {
|
|
10457
10925
|
mode: "date"
|
|
10458
10926
|
}).notNull()
|
|
10459
10927
|
}, (session) => ({
|
|
10460
|
-
userIdIdx: (0,
|
|
10928
|
+
userIdIdx: (0, import_mysql_core39.index)("userId_idx").on(session.userId)
|
|
10461
10929
|
}));
|
|
10462
10930
|
}
|
|
10463
10931
|
__name(getSessionsSchema, "getSessionsSchema");
|
|
10464
10932
|
function getSessionRelationsSchema(mysqlTable) {
|
|
10465
10933
|
const sessions = getSessionsSchema(mysqlTable);
|
|
10466
10934
|
const users = getUsersSchema(mysqlTable);
|
|
10467
|
-
return (0,
|
|
10935
|
+
return (0, import_drizzle_orm35.relations)(sessions, ({ one }) => ({
|
|
10468
10936
|
user: one(users, {
|
|
10469
10937
|
fields: [
|
|
10470
10938
|
sessions.userId
|
|
@@ -10479,24 +10947,24 @@ function getSessionRelationsSchema(mysqlTable) {
|
|
|
10479
10947
|
__name(getSessionRelationsSchema, "getSessionRelationsSchema");
|
|
10480
10948
|
|
|
10481
10949
|
// src/lib/mysql/schemas/auth/verification-tokens.ts
|
|
10482
|
-
var
|
|
10950
|
+
var import_mysql_core40 = require("drizzle-orm/mysql-core");
|
|
10483
10951
|
function getVerificationTokensSchema(mysqlTable) {
|
|
10484
10952
|
return mysqlTable("VerificationToken", {
|
|
10485
|
-
identifier: (0,
|
|
10953
|
+
identifier: (0, import_mysql_core40.varchar)("identifier", {
|
|
10486
10954
|
length: 255
|
|
10487
10955
|
}).notNull(),
|
|
10488
|
-
token: (0,
|
|
10956
|
+
token: (0, import_mysql_core40.varchar)("token", {
|
|
10489
10957
|
length: 255
|
|
10490
10958
|
}).notNull(),
|
|
10491
|
-
expires: (0,
|
|
10959
|
+
expires: (0, import_mysql_core40.timestamp)("expires", {
|
|
10492
10960
|
mode: "date"
|
|
10493
10961
|
}).notNull(),
|
|
10494
|
-
createdAt: (0,
|
|
10962
|
+
createdAt: (0, import_mysql_core40.timestamp)("createdAt", {
|
|
10495
10963
|
mode: "date",
|
|
10496
10964
|
fsp: 3
|
|
10497
10965
|
}).defaultNow()
|
|
10498
10966
|
}, (vt) => ({
|
|
10499
|
-
pk: (0,
|
|
10967
|
+
pk: (0, import_mysql_core40.primaryKey)({
|
|
10500
10968
|
columns: [
|
|
10501
10969
|
vt.identifier,
|
|
10502
10970
|
vt.token
|
|
@@ -10507,14 +10975,14 @@ function getVerificationTokensSchema(mysqlTable) {
|
|
|
10507
10975
|
__name(getVerificationTokensSchema, "getVerificationTokensSchema");
|
|
10508
10976
|
|
|
10509
10977
|
// src/lib/mysql/schemas/commerce/purchase-user-transfer.ts
|
|
10510
|
-
var
|
|
10511
|
-
var
|
|
10978
|
+
var import_drizzle_orm36 = require("drizzle-orm");
|
|
10979
|
+
var import_mysql_core41 = require("drizzle-orm/mysql-core");
|
|
10512
10980
|
function getPurchaseUserTransferSchema(mysqlTable) {
|
|
10513
10981
|
return mysqlTable("PurchaseUserTransfer", {
|
|
10514
|
-
id: (0,
|
|
10982
|
+
id: (0, import_mysql_core41.varchar)("id", {
|
|
10515
10983
|
length: 191
|
|
10516
10984
|
}).notNull(),
|
|
10517
|
-
transferState: (0,
|
|
10985
|
+
transferState: (0, import_mysql_core41.mysqlEnum)("transferState", [
|
|
10518
10986
|
"AVAILABLE",
|
|
10519
10987
|
"INITIATED",
|
|
10520
10988
|
"VERIFIED",
|
|
@@ -10523,43 +10991,47 @@ function getPurchaseUserTransferSchema(mysqlTable) {
|
|
|
10523
10991
|
"CONFIRMED",
|
|
10524
10992
|
"COMPLETED"
|
|
10525
10993
|
]).default("AVAILABLE").notNull(),
|
|
10526
|
-
purchaseId: (0,
|
|
10994
|
+
purchaseId: (0, import_mysql_core41.varchar)("purchaseId", {
|
|
10527
10995
|
length: 191
|
|
10528
10996
|
}).notNull(),
|
|
10529
|
-
|
|
10997
|
+
organizationId: (0, import_mysql_core41.varchar)("organizationId", {
|
|
10998
|
+
length: 191
|
|
10999
|
+
}),
|
|
11000
|
+
sourceUserId: (0, import_mysql_core41.varchar)("sourceUserId", {
|
|
10530
11001
|
length: 191
|
|
10531
11002
|
}).notNull(),
|
|
10532
|
-
targetUserId: (0,
|
|
11003
|
+
targetUserId: (0, import_mysql_core41.varchar)("targetUserId", {
|
|
10533
11004
|
length: 191
|
|
10534
11005
|
}),
|
|
10535
|
-
createdAt: (0,
|
|
11006
|
+
createdAt: (0, import_mysql_core41.timestamp)("createdAt", {
|
|
10536
11007
|
mode: "date",
|
|
10537
11008
|
fsp: 3
|
|
10538
|
-
}).default(
|
|
10539
|
-
expiresAt: (0,
|
|
11009
|
+
}).default(import_drizzle_orm36.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
11010
|
+
expiresAt: (0, import_mysql_core41.timestamp)("expiresAt", {
|
|
10540
11011
|
mode: "date",
|
|
10541
11012
|
fsp: 3
|
|
10542
11013
|
}),
|
|
10543
|
-
canceledAt: (0,
|
|
11014
|
+
canceledAt: (0, import_mysql_core41.timestamp)("canceledAt", {
|
|
10544
11015
|
mode: "date",
|
|
10545
11016
|
fsp: 3
|
|
10546
11017
|
}),
|
|
10547
|
-
confirmedAt: (0,
|
|
11018
|
+
confirmedAt: (0, import_mysql_core41.timestamp)("confirmedAt", {
|
|
10548
11019
|
mode: "date",
|
|
10549
11020
|
fsp: 3
|
|
10550
11021
|
}),
|
|
10551
|
-
completedAt: (0,
|
|
11022
|
+
completedAt: (0, import_mysql_core41.timestamp)("completedAt", {
|
|
10552
11023
|
mode: "date",
|
|
10553
11024
|
fsp: 3
|
|
10554
11025
|
})
|
|
10555
11026
|
}, (table) => {
|
|
10556
11027
|
return {
|
|
10557
|
-
purchaseUserTransferId: (0,
|
|
11028
|
+
purchaseUserTransferId: (0, import_mysql_core41.primaryKey)({
|
|
10558
11029
|
columns: [
|
|
10559
11030
|
table.id
|
|
10560
11031
|
],
|
|
10561
11032
|
name: "PurchaseUserTransfer_id"
|
|
10562
|
-
})
|
|
11033
|
+
}),
|
|
11034
|
+
organizationIdIdx: (0, import_mysql_core41.index)("organizationId_idx").on(table.organizationId)
|
|
10563
11035
|
};
|
|
10564
11036
|
});
|
|
10565
11037
|
}
|
|
@@ -10568,7 +11040,7 @@ function getPurchaseUserTransferRelationsSchema(mysqlTable) {
|
|
|
10568
11040
|
const purchaseUserTransfer = getPurchaseUserTransferSchema(mysqlTable);
|
|
10569
11041
|
const user = getUsersSchema(mysqlTable);
|
|
10570
11042
|
const purchase = getPurchaseSchema(mysqlTable);
|
|
10571
|
-
return (0,
|
|
11043
|
+
return (0, import_drizzle_orm36.relations)(purchaseUserTransfer, ({ one }) => ({
|
|
10572
11044
|
sourceUser: one(user, {
|
|
10573
11045
|
fields: [
|
|
10574
11046
|
purchaseUserTransfer.sourceUserId
|
|
@@ -10601,46 +11073,50 @@ function getPurchaseUserTransferRelationsSchema(mysqlTable) {
|
|
|
10601
11073
|
__name(getPurchaseUserTransferRelationsSchema, "getPurchaseUserTransferRelationsSchema");
|
|
10602
11074
|
|
|
10603
11075
|
// src/lib/mysql/schemas/commerce/upgradable-products.ts
|
|
10604
|
-
var
|
|
10605
|
-
var
|
|
11076
|
+
var import_drizzle_orm37 = require("drizzle-orm");
|
|
11077
|
+
var import_mysql_core42 = require("drizzle-orm/mysql-core");
|
|
10606
11078
|
function getUpgradableProductsSchema(mysqlTable) {
|
|
10607
11079
|
return mysqlTable("UpgradableProducts", {
|
|
10608
|
-
upgradableToId: (0,
|
|
11080
|
+
upgradableToId: (0, import_mysql_core42.varchar)("upgradableToId", {
|
|
10609
11081
|
length: 255
|
|
10610
11082
|
}).notNull(),
|
|
10611
|
-
upgradableFromId: (0,
|
|
11083
|
+
upgradableFromId: (0, import_mysql_core42.varchar)("upgradableFrom", {
|
|
10612
11084
|
length: 255
|
|
10613
11085
|
}).notNull(),
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
11086
|
+
organizationId: (0, import_mysql_core42.varchar)("organizationId", {
|
|
11087
|
+
length: 191
|
|
11088
|
+
}),
|
|
11089
|
+
position: (0, import_mysql_core42.double)("position").notNull().default(0),
|
|
11090
|
+
metadata: (0, import_mysql_core42.json)("metadata").$type().default({}),
|
|
11091
|
+
createdAt: (0, import_mysql_core42.timestamp)("createdAt", {
|
|
10617
11092
|
mode: "date",
|
|
10618
11093
|
fsp: 3
|
|
10619
|
-
}).default(
|
|
10620
|
-
updatedAt: (0,
|
|
11094
|
+
}).default(import_drizzle_orm37.sql`CURRENT_TIMESTAMP(3)`),
|
|
11095
|
+
updatedAt: (0, import_mysql_core42.timestamp)("updatedAt", {
|
|
10621
11096
|
mode: "date",
|
|
10622
11097
|
fsp: 3
|
|
10623
|
-
}).default(
|
|
10624
|
-
deletedAt: (0,
|
|
11098
|
+
}).default(import_drizzle_orm37.sql`CURRENT_TIMESTAMP(3)`),
|
|
11099
|
+
deletedAt: (0, import_mysql_core42.timestamp)("deletedAt", {
|
|
10625
11100
|
mode: "date",
|
|
10626
11101
|
fsp: 3
|
|
10627
11102
|
})
|
|
10628
11103
|
}, (crr) => ({
|
|
10629
|
-
pk: (0,
|
|
11104
|
+
pk: (0, import_mysql_core42.primaryKey)({
|
|
10630
11105
|
columns: [
|
|
10631
11106
|
crr.upgradableToId,
|
|
10632
11107
|
crr.upgradableFromId
|
|
10633
11108
|
]
|
|
10634
11109
|
}),
|
|
10635
|
-
upgradableToIdIdx: (0,
|
|
10636
|
-
upgradableFromIdIdx: (0,
|
|
11110
|
+
upgradableToIdIdx: (0, import_mysql_core42.index)("upgradableFromId_idx").on(crr.upgradableToId),
|
|
11111
|
+
upgradableFromIdIdx: (0, import_mysql_core42.index)("upgradableToId_idx").on(crr.upgradableFromId),
|
|
11112
|
+
organizationIdIdx: (0, import_mysql_core42.index)("organizationId_idx").on(crr.organizationId)
|
|
10637
11113
|
}));
|
|
10638
11114
|
}
|
|
10639
11115
|
__name(getUpgradableProductsSchema, "getUpgradableProductsSchema");
|
|
10640
11116
|
function getUpgradableProductsRelationsSchema(mysqlTable) {
|
|
10641
11117
|
const product = getProductSchema(mysqlTable);
|
|
10642
11118
|
const upgradableProduct = getUpgradableProductsSchema(mysqlTable);
|
|
10643
|
-
return (0,
|
|
11119
|
+
return (0, import_drizzle_orm37.relations)(upgradableProduct, ({ one }) => ({
|
|
10644
11120
|
upgradableTo: one(product, {
|
|
10645
11121
|
fields: [
|
|
10646
11122
|
upgradableProduct.upgradableToId
|
|
@@ -10664,93 +11140,175 @@ function getUpgradableProductsRelationsSchema(mysqlTable) {
|
|
|
10664
11140
|
__name(getUpgradableProductsRelationsSchema, "getUpgradableProductsRelationsSchema");
|
|
10665
11141
|
|
|
10666
11142
|
// src/lib/mysql/schemas/content/lesson-progress.ts
|
|
10667
|
-
var
|
|
10668
|
-
var
|
|
11143
|
+
var import_drizzle_orm38 = require("drizzle-orm");
|
|
11144
|
+
var import_mysql_core43 = require("drizzle-orm/mysql-core");
|
|
10669
11145
|
function getLessonProgressSchema(mysqlTable) {
|
|
10670
11146
|
return mysqlTable("LessonProgress", {
|
|
10671
|
-
id: (0,
|
|
11147
|
+
id: (0, import_mysql_core43.varchar)("id", {
|
|
10672
11148
|
length: 191
|
|
10673
11149
|
}).notNull().primaryKey(),
|
|
10674
|
-
userId: (0,
|
|
11150
|
+
userId: (0, import_mysql_core43.varchar)("userId", {
|
|
10675
11151
|
length: 191
|
|
10676
11152
|
}).notNull(),
|
|
10677
|
-
|
|
11153
|
+
organizationId: (0, import_mysql_core43.varchar)("organizationId", {
|
|
11154
|
+
length: 191
|
|
11155
|
+
}),
|
|
11156
|
+
organizationMembershipId: (0, import_mysql_core43.varchar)("organizationMembershipId", {
|
|
11157
|
+
length: 191
|
|
11158
|
+
}),
|
|
11159
|
+
lessonId: (0, import_mysql_core43.varchar)("lessonId", {
|
|
10678
11160
|
length: 191
|
|
10679
11161
|
}),
|
|
10680
|
-
lessonSlug: (0,
|
|
11162
|
+
lessonSlug: (0, import_mysql_core43.varchar)("lessonSlug", {
|
|
10681
11163
|
length: 191
|
|
10682
11164
|
}),
|
|
10683
|
-
lessonVersion: (0,
|
|
11165
|
+
lessonVersion: (0, import_mysql_core43.varchar)("lessonVersion", {
|
|
10684
11166
|
length: 191
|
|
10685
11167
|
}),
|
|
10686
|
-
sectionId: (0,
|
|
11168
|
+
sectionId: (0, import_mysql_core43.varchar)("sectionId", {
|
|
10687
11169
|
length: 191
|
|
10688
11170
|
}),
|
|
10689
|
-
moduleId: (0,
|
|
11171
|
+
moduleId: (0, import_mysql_core43.varchar)("moduleId", {
|
|
10690
11172
|
length: 191
|
|
10691
11173
|
}),
|
|
10692
|
-
completedAt: (0,
|
|
11174
|
+
completedAt: (0, import_mysql_core43.datetime)("completedAt", {
|
|
10693
11175
|
mode: "date",
|
|
10694
11176
|
fsp: 3
|
|
10695
11177
|
}),
|
|
10696
|
-
updatedAt: (0,
|
|
11178
|
+
updatedAt: (0, import_mysql_core43.datetime)("updatedAt", {
|
|
10697
11179
|
mode: "date",
|
|
10698
11180
|
fsp: 3
|
|
10699
11181
|
}),
|
|
10700
|
-
createdAt: (0,
|
|
11182
|
+
createdAt: (0, import_mysql_core43.datetime)("createdAt", {
|
|
10701
11183
|
mode: "date",
|
|
10702
11184
|
fsp: 3
|
|
10703
|
-
}).default(
|
|
11185
|
+
}).default(import_drizzle_orm38.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
10704
11186
|
}, (crp) => {
|
|
10705
11187
|
return {
|
|
10706
|
-
userIdLessonIdIdx: (0,
|
|
10707
|
-
userIdIdx: (0,
|
|
10708
|
-
lessonIdIdx: (0,
|
|
11188
|
+
userIdLessonIdIdx: (0, import_mysql_core43.index)("crp_userId_contentResourceId_idx").on(crp.userId, crp.lessonId),
|
|
11189
|
+
userIdIdx: (0, import_mysql_core43.index)("userId_idx").on(crp.userId),
|
|
11190
|
+
lessonIdIdx: (0, import_mysql_core43.index)("lessonId_idx").on(crp.lessonId),
|
|
11191
|
+
organizationMembershipIdIdx: (0, import_mysql_core43.index)("organizationMembershipId_idx").on(crp.organizationMembershipId)
|
|
10709
11192
|
};
|
|
10710
11193
|
});
|
|
10711
11194
|
}
|
|
10712
11195
|
__name(getLessonProgressSchema, "getLessonProgressSchema");
|
|
10713
11196
|
|
|
10714
11197
|
// src/lib/mysql/schemas/content/resource-progress.ts
|
|
10715
|
-
var
|
|
10716
|
-
var
|
|
11198
|
+
var import_drizzle_orm39 = require("drizzle-orm");
|
|
11199
|
+
var import_mysql_core44 = require("drizzle-orm/mysql-core");
|
|
10717
11200
|
function getResourceProgressSchema(mysqlTable) {
|
|
10718
11201
|
return mysqlTable("ResourceProgress", {
|
|
10719
|
-
userId: (0,
|
|
11202
|
+
userId: (0, import_mysql_core44.varchar)("userId", {
|
|
10720
11203
|
length: 255
|
|
10721
11204
|
}).notNull(),
|
|
10722
|
-
|
|
11205
|
+
organizationId: (0, import_mysql_core44.varchar)("organizationId", {
|
|
11206
|
+
length: 191
|
|
11207
|
+
}),
|
|
11208
|
+
organizationMembershipId: (0, import_mysql_core44.varchar)("organizationMembershipId", {
|
|
11209
|
+
length: 191
|
|
11210
|
+
}),
|
|
11211
|
+
resourceId: (0, import_mysql_core44.varchar)("resourceId", {
|
|
10723
11212
|
length: 255
|
|
10724
11213
|
}),
|
|
10725
|
-
fields: (0,
|
|
10726
|
-
completedAt: (0,
|
|
11214
|
+
fields: (0, import_mysql_core44.json)("fields").$type().default({}),
|
|
11215
|
+
completedAt: (0, import_mysql_core44.datetime)("completedAt", {
|
|
10727
11216
|
mode: "date",
|
|
10728
11217
|
fsp: 3
|
|
10729
11218
|
}),
|
|
10730
|
-
updatedAt: (0,
|
|
11219
|
+
updatedAt: (0, import_mysql_core44.datetime)("updatedAt", {
|
|
10731
11220
|
mode: "date",
|
|
10732
11221
|
fsp: 3
|
|
10733
11222
|
}),
|
|
10734
|
-
createdAt: (0,
|
|
11223
|
+
createdAt: (0, import_mysql_core44.datetime)("createdAt", {
|
|
10735
11224
|
mode: "date",
|
|
10736
11225
|
fsp: 3
|
|
10737
|
-
}).default(
|
|
11226
|
+
}).default(import_drizzle_orm39.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
10738
11227
|
}, (crp) => {
|
|
10739
11228
|
return {
|
|
10740
|
-
userIdLessonIdIdx: (0,
|
|
10741
|
-
pk: (0,
|
|
11229
|
+
userIdLessonIdIdx: (0, import_mysql_core44.index)("crp_userId_contentResourceId_idx").on(crp.userId, crp.resourceId),
|
|
11230
|
+
pk: (0, import_mysql_core44.primaryKey)({
|
|
10742
11231
|
columns: [
|
|
10743
11232
|
crp.userId,
|
|
10744
11233
|
crp.resourceId
|
|
10745
11234
|
]
|
|
10746
11235
|
}),
|
|
10747
|
-
contentResourceIdIdx: (0,
|
|
10748
|
-
userIdIdx: (0,
|
|
11236
|
+
contentResourceIdIdx: (0, import_mysql_core44.index)("contentResourceId_idx").on(crp.resourceId),
|
|
11237
|
+
userIdIdx: (0, import_mysql_core44.index)("resourceId_idx").on(crp.userId),
|
|
11238
|
+
organizationMembershipIdIdx: (0, import_mysql_core44.index)("organizationMembershipId_idx").on(crp.organizationMembershipId)
|
|
10749
11239
|
};
|
|
10750
11240
|
});
|
|
10751
11241
|
}
|
|
10752
11242
|
__name(getResourceProgressSchema, "getResourceProgressSchema");
|
|
10753
11243
|
|
|
11244
|
+
// src/lib/mysql/schemas/org/organization-membership-roles.ts
|
|
11245
|
+
var import_drizzle_orm40 = require("drizzle-orm");
|
|
11246
|
+
var import_mysql_core45 = require("drizzle-orm/mysql-core");
|
|
11247
|
+
function getOrganizationMembershipRolesSchema(mysqlTable) {
|
|
11248
|
+
return mysqlTable("OrganizationMembershipRole", {
|
|
11249
|
+
organizationMembershipId: (0, import_mysql_core45.varchar)("organizationMembershipId", {
|
|
11250
|
+
length: 255
|
|
11251
|
+
}).notNull(),
|
|
11252
|
+
roleId: (0, import_mysql_core45.varchar)("roleId", {
|
|
11253
|
+
length: 255
|
|
11254
|
+
}).notNull(),
|
|
11255
|
+
active: (0, import_mysql_core45.boolean)("active").notNull().default(true),
|
|
11256
|
+
organizationId: (0, import_mysql_core45.varchar)("organizationId", {
|
|
11257
|
+
length: 191
|
|
11258
|
+
}),
|
|
11259
|
+
createdAt: (0, import_mysql_core45.timestamp)("createdAt", {
|
|
11260
|
+
mode: "date",
|
|
11261
|
+
fsp: 3
|
|
11262
|
+
}).defaultNow(),
|
|
11263
|
+
updatedAt: (0, import_mysql_core45.timestamp)("updatedAt", {
|
|
11264
|
+
mode: "date",
|
|
11265
|
+
fsp: 3
|
|
11266
|
+
}).defaultNow(),
|
|
11267
|
+
deletedAt: (0, import_mysql_core45.timestamp)("deletedAt", {
|
|
11268
|
+
mode: "date",
|
|
11269
|
+
fsp: 3
|
|
11270
|
+
})
|
|
11271
|
+
}, (ur) => ({
|
|
11272
|
+
pk: (0, import_mysql_core45.primaryKey)({
|
|
11273
|
+
columns: [
|
|
11274
|
+
ur.organizationMembershipId,
|
|
11275
|
+
ur.roleId
|
|
11276
|
+
],
|
|
11277
|
+
name: "pk"
|
|
11278
|
+
}),
|
|
11279
|
+
orgMemberIdIdx: (0, import_mysql_core45.index)("orgMemberId_idx").on(ur.organizationMembershipId),
|
|
11280
|
+
roleIdIdx: (0, import_mysql_core45.index)("roleId_idx").on(ur.roleId),
|
|
11281
|
+
organizationIdIdx: (0, import_mysql_core45.index)("organizationId_idx").on(ur.organizationId)
|
|
11282
|
+
}));
|
|
11283
|
+
}
|
|
11284
|
+
__name(getOrganizationMembershipRolesSchema, "getOrganizationMembershipRolesSchema");
|
|
11285
|
+
function getOrganizationMembershipRolesRelationsSchema(mysqlTable) {
|
|
11286
|
+
const organizationMembershipRoles = getOrganizationMembershipRolesSchema(mysqlTable);
|
|
11287
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
11288
|
+
const roles = getRolesSchema(mysqlTable);
|
|
11289
|
+
return (0, import_drizzle_orm40.relations)(organizationMembershipRoles, ({ one }) => ({
|
|
11290
|
+
organizationMembership: one(organizationMemberships, {
|
|
11291
|
+
fields: [
|
|
11292
|
+
organizationMembershipRoles.organizationMembershipId
|
|
11293
|
+
],
|
|
11294
|
+
references: [
|
|
11295
|
+
organizationMemberships.id
|
|
11296
|
+
],
|
|
11297
|
+
relationName: "organizationMembership"
|
|
11298
|
+
}),
|
|
11299
|
+
role: one(roles, {
|
|
11300
|
+
fields: [
|
|
11301
|
+
organizationMembershipRoles.roleId
|
|
11302
|
+
],
|
|
11303
|
+
references: [
|
|
11304
|
+
roles.id
|
|
11305
|
+
],
|
|
11306
|
+
relationName: "role"
|
|
11307
|
+
})
|
|
11308
|
+
}));
|
|
11309
|
+
}
|
|
11310
|
+
__name(getOrganizationMembershipRolesRelationsSchema, "getOrganizationMembershipRolesRelationsSchema");
|
|
11311
|
+
|
|
10754
11312
|
// src/lib/mysql/index.ts
|
|
10755
11313
|
var guid = (0, import_nanoid.customAlphabet)("1234567890abcdefghijklmnopqrstuvwxyz", 5);
|
|
10756
11314
|
function getCourseBuilderSchema(mysqlTable) {
|
|
@@ -10822,7 +11380,17 @@ function getCourseBuilderSchema(mysqlTable) {
|
|
|
10822
11380
|
tagTag: getTagTagSchema(mysqlTable),
|
|
10823
11381
|
tagTagRelations: getTagTagRelationsSchema(mysqlTable),
|
|
10824
11382
|
userPrefs: getUserPrefsSchema(mysqlTable),
|
|
10825
|
-
userPrefsRelations: getUserPrefsRelationsSchema(mysqlTable)
|
|
11383
|
+
userPrefsRelations: getUserPrefsRelationsSchema(mysqlTable),
|
|
11384
|
+
organization: getOrganizationsSchema(mysqlTable),
|
|
11385
|
+
organizationRelations: getOrganizationsRelationsSchema(mysqlTable),
|
|
11386
|
+
organizationMemberships: getOrganizationMembershipsSchema(mysqlTable),
|
|
11387
|
+
organizationMembershipRelations: getOrganizationMembershipsRelationsSchema(mysqlTable),
|
|
11388
|
+
organizationMembershipRoles: getOrganizationMembershipRolesSchema(mysqlTable),
|
|
11389
|
+
organizationMembershipRolesRelations: getOrganizationMembershipRolesRelationsSchema(mysqlTable),
|
|
11390
|
+
merchantSubscription: getMerchantSubscriptionSchema(mysqlTable),
|
|
11391
|
+
merchantSubscriptionRelations: getMerchantSubscriptionRelationsSchema(mysqlTable),
|
|
11392
|
+
subscription: getSubscriptionSchema(mysqlTable),
|
|
11393
|
+
subscriptionRelations: getSubscriptionRelationsSchema(mysqlTable)
|
|
10826
11394
|
};
|
|
10827
11395
|
}
|
|
10828
11396
|
__name(getCourseBuilderSchema, "getCourseBuilderSchema");
|
|
@@ -10830,7 +11398,7 @@ function createTables(mySqlTable) {
|
|
|
10830
11398
|
return getCourseBuilderSchema(mySqlTable);
|
|
10831
11399
|
}
|
|
10832
11400
|
__name(createTables, "createTables");
|
|
10833
|
-
function mySqlDrizzleAdapter(client, tableFn =
|
|
11401
|
+
function mySqlDrizzleAdapter(client, tableFn = import_mysql_core46.mysqlTable, paymentProvider) {
|
|
10834
11402
|
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, contentResourceProduct, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress, comments } = createTables(tableFn);
|
|
10835
11403
|
const adapter = {
|
|
10836
11404
|
client,
|
|
@@ -10902,12 +11470,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10902
11470
|
},
|
|
10903
11471
|
incrementCouponUsedCount: async (couponId) => {
|
|
10904
11472
|
await client.update(coupon).set({
|
|
10905
|
-
usedCount:
|
|
10906
|
-
}).where((0,
|
|
11473
|
+
usedCount: import_drizzle_orm41.sql`${coupon.usedCount} + 1`
|
|
11474
|
+
}).where((0, import_drizzle_orm41.eq)(coupon.id, couponId));
|
|
10907
11475
|
},
|
|
10908
11476
|
getExistingNonBulkValidPurchasesOfProduct: async ({ userId, productId }) => {
|
|
10909
11477
|
const existingPurchases = await client.query.purchases.findMany({
|
|
10910
|
-
where: (0,
|
|
11478
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.userId, userId), productId ? (0, import_drizzle_orm41.eq)(purchaseTable.productId, productId) : void 0, (0, import_drizzle_orm41.eq)(purchaseTable.status, "Valid"), (0, import_drizzle_orm41.isNull)(purchaseTable.bulkCouponId))
|
|
10911
11479
|
});
|
|
10912
11480
|
return z.array(purchaseSchema).parse(existingPurchases);
|
|
10913
11481
|
},
|
|
@@ -10920,17 +11488,17 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10920
11488
|
status: 1
|
|
10921
11489
|
});
|
|
10922
11490
|
return merchantCustomerSchema.parse(await client.query.merchantCustomer.findFirst({
|
|
10923
|
-
where: (0,
|
|
11491
|
+
where: (0, import_drizzle_orm41.eq)(merchantCustomer.identifier, options.identifier)
|
|
10924
11492
|
}));
|
|
10925
11493
|
},
|
|
10926
11494
|
getMerchantAccount: async (options) => {
|
|
10927
11495
|
return merchantAccountSchema.parse(await client.query.merchantAccount.findFirst({
|
|
10928
|
-
where: (0,
|
|
11496
|
+
where: (0, import_drizzle_orm41.eq)(merchantAccount.label, options.provider)
|
|
10929
11497
|
}));
|
|
10930
11498
|
},
|
|
10931
11499
|
getMerchantPriceForProductId: async (productId) => {
|
|
10932
11500
|
const merchantPriceData = await client.query.merchantPrice.findFirst({
|
|
10933
|
-
where: (0,
|
|
11501
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(merchantPrice.merchantProductId, productId), (0, import_drizzle_orm41.eq)(merchantPrice.status, 1))
|
|
10934
11502
|
});
|
|
10935
11503
|
const parsedMerchantPrice = merchantPriceSchema.safeParse(merchantPriceData);
|
|
10936
11504
|
if (!parsedMerchantPrice.success) {
|
|
@@ -10941,7 +11509,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10941
11509
|
},
|
|
10942
11510
|
getMerchantProductForProductId: async (productId) => {
|
|
10943
11511
|
const merchantProductData = await client.query.merchantProduct.findFirst({
|
|
10944
|
-
where: (0,
|
|
11512
|
+
where: (0, import_drizzle_orm41.eq)(merchantProduct.productId, productId)
|
|
10945
11513
|
});
|
|
10946
11514
|
if (!merchantProductData)
|
|
10947
11515
|
return null;
|
|
@@ -10949,7 +11517,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10949
11517
|
},
|
|
10950
11518
|
getMerchantCustomerForUserId: async (userId) => {
|
|
10951
11519
|
const merchantCustomerData = await client.query.merchantCustomer.findFirst({
|
|
10952
|
-
where: (0,
|
|
11520
|
+
where: (0, import_drizzle_orm41.eq)(merchantCustomer.userId, userId)
|
|
10953
11521
|
});
|
|
10954
11522
|
if (!merchantCustomerData)
|
|
10955
11523
|
return null;
|
|
@@ -10958,14 +11526,14 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10958
11526
|
getUpgradableProducts: async (options) => {
|
|
10959
11527
|
const { upgradableFromId, upgradableToId } = options;
|
|
10960
11528
|
return z.array(upgradableProductSchema).parse(await client.query.upgradableProducts.findMany({
|
|
10961
|
-
where: (0,
|
|
11529
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(upgradableProducts.upgradableFromId, upgradableFromId), (0, import_drizzle_orm41.eq)(upgradableProducts.upgradableToId, upgradableToId))
|
|
10962
11530
|
}));
|
|
10963
11531
|
},
|
|
10964
11532
|
async availableUpgradesForProduct(purchases, productId) {
|
|
10965
11533
|
const previousPurchaseProductIds = purchases.map(({ productId: productId2 }) => productId2);
|
|
10966
11534
|
if (previousPurchaseProductIds.length > 0) {
|
|
10967
11535
|
return client.query.upgradableProducts.findMany({
|
|
10968
|
-
where: (0,
|
|
11536
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(upgradableProducts.upgradableToId, productId), (0, import_drizzle_orm41.inArray)(upgradableProducts.upgradableFromId, previousPurchaseProductIds))
|
|
10969
11537
|
});
|
|
10970
11538
|
}
|
|
10971
11539
|
return [];
|
|
@@ -10978,7 +11546,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10978
11546
|
throw new Error("No lessonId provided");
|
|
10979
11547
|
}
|
|
10980
11548
|
let lessonProgress = await client.query.resourceProgress.findFirst({
|
|
10981
|
-
where: (0,
|
|
11549
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(resourceProgress.userId, options.userId), (0, import_drizzle_orm41.eq)(resourceProgress.resourceId, options.lessonId))
|
|
10982
11550
|
});
|
|
10983
11551
|
const now = /* @__PURE__ */ new Date();
|
|
10984
11552
|
if (lessonProgress) {
|
|
@@ -10986,7 +11554,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10986
11554
|
await client.update(resourceProgress).set({
|
|
10987
11555
|
completedAt: now,
|
|
10988
11556
|
updatedAt: now
|
|
10989
|
-
}).where((0,
|
|
11557
|
+
}).where((0, import_drizzle_orm41.eq)(resourceProgress.resourceId, options.lessonId));
|
|
10990
11558
|
}
|
|
10991
11559
|
} else {
|
|
10992
11560
|
await client.insert(resourceProgress).values({
|
|
@@ -10997,7 +11565,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
10997
11565
|
});
|
|
10998
11566
|
}
|
|
10999
11567
|
lessonProgress = await client.query.resourceProgress.findFirst({
|
|
11000
|
-
where: (0,
|
|
11568
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(resourceProgress.userId, options.userId), (0, import_drizzle_orm41.eq)(resourceProgress.resourceId, options.lessonId))
|
|
11001
11569
|
});
|
|
11002
11570
|
const parsedLessonProgress = resourceProgressSchema.safeParse(lessonProgress);
|
|
11003
11571
|
if (!parsedLessonProgress.success) {
|
|
@@ -11010,7 +11578,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11010
11578
|
if (!options.couponId && !options.code)
|
|
11011
11579
|
return null;
|
|
11012
11580
|
const couponForIdOrCode = await client.query.coupon.findFirst({
|
|
11013
|
-
where: (0,
|
|
11581
|
+
where: (0, import_drizzle_orm41.or)((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.or)(options.code ? (0, import_drizzle_orm41.eq)(coupon.code, options.code) : void 0, options.couponId ? (0, import_drizzle_orm41.eq)(coupon.id, options.couponId) : void 0), (0, import_drizzle_orm41.gte)(coupon.expires, /* @__PURE__ */ new Date())), (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.or)(options.code ? (0, import_drizzle_orm41.eq)(coupon.code, options.code) : void 0, options.couponId ? (0, import_drizzle_orm41.eq)(coupon.id, options.couponId) : void 0), (0, import_drizzle_orm41.isNull)(coupon.expires))),
|
|
11014
11582
|
with: {
|
|
11015
11583
|
merchantCoupon: true
|
|
11016
11584
|
}
|
|
@@ -11031,10 +11599,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11031
11599
|
try {
|
|
11032
11600
|
const { userId, stripeChargeId, stripeCouponId, merchantAccountId, merchantProductId, merchantCustomerId, productId, stripeChargeAmount, quantity = 1, checkoutSessionId, appliedPPPStripeCouponId, upgradedFromPurchaseId, country, usedCouponId } = options;
|
|
11033
11601
|
const existingMerchantCharge = merchantChargeSchema.nullable().parse(await client.query.merchantCharge.findFirst({
|
|
11034
|
-
where: (0,
|
|
11602
|
+
where: (0, import_drizzle_orm41.eq)(merchantCharge.identifier, stripeChargeId)
|
|
11035
11603
|
}) || null);
|
|
11036
11604
|
const existingPurchaseForCharge = existingMerchantCharge ? await client.query.purchases.findFirst({
|
|
11037
|
-
where: (0,
|
|
11605
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.merchantChargeId, existingMerchantCharge.id),
|
|
11038
11606
|
with: {
|
|
11039
11607
|
user: true,
|
|
11040
11608
|
product: true,
|
|
@@ -11055,12 +11623,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11055
11623
|
merchantCustomerId
|
|
11056
11624
|
});
|
|
11057
11625
|
const existingPurchase = purchaseSchema.nullable().parse(await client.query.purchases.findFirst({
|
|
11058
|
-
where: (0,
|
|
11626
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.productId, productId), (0, import_drizzle_orm41.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm41.inArray)(purchaseTable.status, [
|
|
11059
11627
|
"Valid",
|
|
11060
11628
|
"Restricted"
|
|
11061
11629
|
]))
|
|
11062
11630
|
}) || null);
|
|
11063
|
-
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, (0,
|
|
11631
|
+
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(coupon.id, purchaseTable.bulkCouponId), (0, import_drizzle_orm41.eq)(purchaseTable.userId, userId))).where((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(coupon.restrictedToProductId, productId), (0, import_drizzle_orm41.eq)(purchaseTable.userId, userId))).then((res) => {
|
|
11064
11632
|
return res[0]?.Coupon ?? null;
|
|
11065
11633
|
}));
|
|
11066
11634
|
const isBulkPurchase = quantity > 1 || Boolean(existingBulkCoupon) || options.bulk || Boolean(existingPurchase?.status === "Valid");
|
|
@@ -11071,10 +11639,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11071
11639
|
if (existingBulkCoupon !== null) {
|
|
11072
11640
|
couponToUpdate = await client.update(coupon).set({
|
|
11073
11641
|
maxUses: (existingBulkCoupon?.maxUses || 0) + quantity
|
|
11074
|
-
}).where((0,
|
|
11642
|
+
}).where((0, import_drizzle_orm41.eq)(coupon.id, bulkCouponId));
|
|
11075
11643
|
} else {
|
|
11076
11644
|
const merchantCouponToUse = stripeCouponId ? merchantCouponSchema.nullable().parse(await client.query.merchantCoupon.findFirst({
|
|
11077
|
-
where: (0,
|
|
11645
|
+
where: (0, import_drizzle_orm41.eq)(merchantCoupon.identifier, stripeCouponId)
|
|
11078
11646
|
})) : null;
|
|
11079
11647
|
couponToUpdate = await client.insert(coupon).values({
|
|
11080
11648
|
id: bulkCouponId,
|
|
@@ -11095,10 +11663,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11095
11663
|
merchantAccountId
|
|
11096
11664
|
});
|
|
11097
11665
|
const merchantCouponUsed = stripeCouponId ? await client.query.merchantCoupon.findFirst({
|
|
11098
|
-
where: (0,
|
|
11666
|
+
where: (0, import_drizzle_orm41.eq)(merchantCoupon.identifier, stripeCouponId)
|
|
11099
11667
|
}) : null;
|
|
11100
11668
|
const pppMerchantCoupon = appliedPPPStripeCouponId ? await client.query.merchantCoupon.findFirst({
|
|
11101
|
-
where: (0,
|
|
11669
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(merchantCoupon.identifier, appliedPPPStripeCouponId), (0, import_drizzle_orm41.eq)(merchantCoupon.type, "ppp"))
|
|
11102
11670
|
}) : null;
|
|
11103
11671
|
const newPurchaseStatus = merchantCouponUsed?.type === "ppp" || pppMerchantCoupon ? "Restricted" : "Valid";
|
|
11104
11672
|
const newPurchase = await client.insert(purchaseTable).values({
|
|
@@ -11129,7 +11697,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11129
11697
|
}
|
|
11130
11698
|
});
|
|
11131
11699
|
const parsedPurchase = purchaseSchema.safeParse(await client.query.purchases.findFirst({
|
|
11132
|
-
where: (0,
|
|
11700
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.id, purchaseId)
|
|
11133
11701
|
}));
|
|
11134
11702
|
if (!parsedPurchase.success) {
|
|
11135
11703
|
console.error("Error parsing purchase", parsedPurchase, JSON.stringify(parsedPurchase, null, 2));
|
|
@@ -11174,7 +11742,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11174
11742
|
},
|
|
11175
11743
|
async getCoupon(couponIdOrCode) {
|
|
11176
11744
|
const loadedCoupon = await client.query.coupon.findFirst({
|
|
11177
|
-
where: (0,
|
|
11745
|
+
where: (0, import_drizzle_orm41.or)((0, import_drizzle_orm41.eq)(coupon.id, couponIdOrCode), (0, import_drizzle_orm41.eq)(coupon.code, couponIdOrCode))
|
|
11178
11746
|
}) || null;
|
|
11179
11747
|
logger.debug("loadedCoupon", {
|
|
11180
11748
|
loadedCoupon
|
|
@@ -11189,7 +11757,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11189
11757
|
let bulkCouponPurchases;
|
|
11190
11758
|
try {
|
|
11191
11759
|
couponData = await client.query.coupon.findFirst({
|
|
11192
|
-
where: (0,
|
|
11760
|
+
where: (0, import_drizzle_orm41.eq)(coupon.id, couponId),
|
|
11193
11761
|
with: {
|
|
11194
11762
|
bulkPurchases: true,
|
|
11195
11763
|
redeemedBulkCouponPurchases: true
|
|
@@ -11201,7 +11769,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11201
11769
|
}
|
|
11202
11770
|
try {
|
|
11203
11771
|
bulkCouponPurchases = await client.query.purchases.findMany({
|
|
11204
|
-
where: (0,
|
|
11772
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.redeemedBulkCouponId, couponId),
|
|
11205
11773
|
with: {
|
|
11206
11774
|
user: true
|
|
11207
11775
|
}
|
|
@@ -11233,8 +11801,8 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11233
11801
|
},
|
|
11234
11802
|
async getDefaultCoupon(productIds) {
|
|
11235
11803
|
const activeSaleCoupon = await client.query.coupon.findFirst({
|
|
11236
|
-
where: (0,
|
|
11237
|
-
orderBy: (0,
|
|
11804
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(coupon.status, 1), (0, import_drizzle_orm41.eq)(coupon.default, true), (0, import_drizzle_orm41.gte)(coupon.expires, /* @__PURE__ */ new Date()), (0, import_drizzle_orm41.or)(productIds ? (0, import_drizzle_orm41.inArray)(coupon.restrictedToProductId, productIds) : void 0, (0, import_drizzle_orm41.isNull)(coupon.restrictedToProductId))),
|
|
11805
|
+
orderBy: (0, import_drizzle_orm41.desc)(coupon.percentageDiscount),
|
|
11238
11806
|
with: {
|
|
11239
11807
|
merchantCoupon: true,
|
|
11240
11808
|
product: true
|
|
@@ -11258,7 +11826,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11258
11826
|
},
|
|
11259
11827
|
async getLessonProgressForUser(userId) {
|
|
11260
11828
|
const userProgress = await client.query.resourceProgress.findMany({
|
|
11261
|
-
where: (0,
|
|
11829
|
+
where: (0, import_drizzle_orm41.eq)(resourceProgress.userId, userId)
|
|
11262
11830
|
});
|
|
11263
11831
|
const parsed = z.array(resourceProgressSchema).safeParse(userProgress);
|
|
11264
11832
|
if (!parsed.success) {
|
|
@@ -11269,7 +11837,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11269
11837
|
},
|
|
11270
11838
|
async getModuleProgressForUser(userIdOrEmail, moduleIdOrSlug) {
|
|
11271
11839
|
const user = await client.query.users.findFirst({
|
|
11272
|
-
where: (0,
|
|
11840
|
+
where: (0, import_drizzle_orm41.or)((0, import_drizzle_orm41.eq)(users.id, userIdOrEmail), (0, import_drizzle_orm41.eq)(users.email, userIdOrEmail)),
|
|
11273
11841
|
columns: {
|
|
11274
11842
|
id: true
|
|
11275
11843
|
}
|
|
@@ -11286,7 +11854,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11286
11854
|
resource_slug: z.string().nullable(),
|
|
11287
11855
|
completed_at: z.string().nullable().transform((val) => val ? new Date(val) : null)
|
|
11288
11856
|
});
|
|
11289
|
-
const results = await client.execute(
|
|
11857
|
+
const results = await client.execute(import_drizzle_orm41.sql`
|
|
11290
11858
|
SELECT
|
|
11291
11859
|
cr.id AS resource_id,
|
|
11292
11860
|
cr.type AS resource_type,
|
|
@@ -11367,7 +11935,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11367
11935
|
},
|
|
11368
11936
|
async getMerchantCharge(merchantChargeId) {
|
|
11369
11937
|
const mCharge = await client.query.merchantCharge.findFirst({
|
|
11370
|
-
where: (0,
|
|
11938
|
+
where: (0, import_drizzle_orm41.eq)(merchantCharge.id, merchantChargeId)
|
|
11371
11939
|
});
|
|
11372
11940
|
const parsed = merchantChargeSchema.safeParse(mCharge);
|
|
11373
11941
|
if (!parsed.success) {
|
|
@@ -11378,12 +11946,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11378
11946
|
},
|
|
11379
11947
|
async getMerchantCouponsForTypeAndPercent(params) {
|
|
11380
11948
|
return z.array(merchantCouponSchema).parse(await client.query.merchantCoupon.findMany({
|
|
11381
|
-
where: (0,
|
|
11949
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(merchantCoupon.type, params.type), (0, import_drizzle_orm41.eq)(merchantCoupon.percentageDiscount, params.percentageDiscount.toString()))
|
|
11382
11950
|
}));
|
|
11383
11951
|
},
|
|
11384
11952
|
async getMerchantCouponForTypeAndPercent(params) {
|
|
11385
11953
|
const foundMerchantCoupon = await client.query.merchantCoupon.findFirst({
|
|
11386
|
-
where: (0,
|
|
11954
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(merchantCoupon.type, params.type), (0, import_drizzle_orm41.eq)(merchantCoupon.percentageDiscount, params.percentageDiscount.toString()))
|
|
11387
11955
|
});
|
|
11388
11956
|
const parsed = merchantCouponSchema.nullable().safeParse(foundMerchantCoupon);
|
|
11389
11957
|
if (parsed.success) {
|
|
@@ -11393,7 +11961,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11393
11961
|
},
|
|
11394
11962
|
async getMerchantCoupon(merchantCouponId) {
|
|
11395
11963
|
const foundMerchantCoupon = await client.query.merchantCoupon.findFirst({
|
|
11396
|
-
where: (0,
|
|
11964
|
+
where: (0, import_drizzle_orm41.eq)(merchantCoupon.id, merchantCouponId)
|
|
11397
11965
|
});
|
|
11398
11966
|
const parsed = merchantCouponSchema.nullable().safeParse(foundMerchantCoupon);
|
|
11399
11967
|
if (parsed.success) {
|
|
@@ -11403,7 +11971,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11403
11971
|
},
|
|
11404
11972
|
async getMerchantProduct(stripeProductId) {
|
|
11405
11973
|
return merchantProductSchema.nullable().parse(await client.query.merchantProduct.findFirst({
|
|
11406
|
-
where: (0,
|
|
11974
|
+
where: (0, import_drizzle_orm41.eq)(merchantProduct.identifier, stripeProductId)
|
|
11407
11975
|
}));
|
|
11408
11976
|
},
|
|
11409
11977
|
getPrice(productId) {
|
|
@@ -11411,7 +11979,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11411
11979
|
},
|
|
11412
11980
|
async getPriceForProduct(productId) {
|
|
11413
11981
|
return priceSchema.nullable().parse(await client.query.prices.findFirst({
|
|
11414
|
-
where: (0,
|
|
11982
|
+
where: (0, import_drizzle_orm41.eq)(prices.productId, productId)
|
|
11415
11983
|
}));
|
|
11416
11984
|
},
|
|
11417
11985
|
async archiveProduct(productId) {
|
|
@@ -11427,19 +11995,19 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11427
11995
|
await client.update(products).set({
|
|
11428
11996
|
status: 0,
|
|
11429
11997
|
name: `${product.name} (Archived)`
|
|
11430
|
-
}).where((0,
|
|
11998
|
+
}).where((0, import_drizzle_orm41.eq)(products.id, productId));
|
|
11431
11999
|
await client.update(prices).set({
|
|
11432
12000
|
status: 0,
|
|
11433
12001
|
nickname: `${product.name} (Archived)`
|
|
11434
|
-
}).where((0,
|
|
12002
|
+
}).where((0, import_drizzle_orm41.eq)(prices.productId, productId));
|
|
11435
12003
|
await client.update(merchantProduct).set({
|
|
11436
12004
|
status: 0
|
|
11437
|
-
}).where((0,
|
|
12005
|
+
}).where((0, import_drizzle_orm41.eq)(merchantProduct.productId, productId));
|
|
11438
12006
|
await client.update(merchantPrice).set({
|
|
11439
12007
|
status: 0
|
|
11440
|
-
}).where((0,
|
|
12008
|
+
}).where((0, import_drizzle_orm41.eq)(merchantPrice.priceId, product.price.id));
|
|
11441
12009
|
const currentMerchantProduct = merchantProductSchema.nullish().parse(await client.query.merchantProduct.findFirst({
|
|
11442
|
-
where: (0,
|
|
12010
|
+
where: (0, import_drizzle_orm41.eq)(merchantProduct.productId, productId)
|
|
11443
12011
|
}));
|
|
11444
12012
|
if (!currentMerchantProduct || !currentMerchantProduct.identifier) {
|
|
11445
12013
|
throw new Error(`Merchant product not found for id (${productId})`);
|
|
@@ -11448,7 +12016,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11448
12016
|
active: false
|
|
11449
12017
|
});
|
|
11450
12018
|
const currentMerchantPrice = merchantPriceSchema.nullish().parse(await client.query.merchantPrice.findFirst({
|
|
11451
|
-
where: (0,
|
|
12019
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(merchantPrice.priceId, product.price.id), (0, import_drizzle_orm41.eq)(merchantPrice.status, 1))
|
|
11452
12020
|
}));
|
|
11453
12021
|
if (!currentMerchantPrice || !currentMerchantPrice.identifier) {
|
|
11454
12022
|
throw new Error(`Merchant price not found for id (${productId})`);
|
|
@@ -11508,12 +12076,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11508
12076
|
if (currentMerchantPrice) {
|
|
11509
12077
|
await client.update(merchantPrice).set({
|
|
11510
12078
|
status: 0
|
|
11511
|
-
}).where((0,
|
|
12079
|
+
}).where((0, import_drizzle_orm41.eq)(merchantPrice.id, currentMerchantPrice.id));
|
|
11512
12080
|
}
|
|
11513
12081
|
await client.update(prices).set({
|
|
11514
12082
|
unitAmount: Math.floor(Number(input.price?.unitAmount || 0)).toString(),
|
|
11515
12083
|
nickname: input.name
|
|
11516
|
-
}).where((0,
|
|
12084
|
+
}).where((0, import_drizzle_orm41.eq)(prices.id, currentProduct.price.id));
|
|
11517
12085
|
if (currentStripePrice) {
|
|
11518
12086
|
await paymentProvider.updatePrice(currentStripePrice.id, {
|
|
11519
12087
|
active: false
|
|
@@ -11542,7 +12110,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11542
12110
|
image
|
|
11543
12111
|
}
|
|
11544
12112
|
}
|
|
11545
|
-
}).where((0,
|
|
12113
|
+
}).where((0, import_drizzle_orm41.eq)(products.id, currentProduct.id));
|
|
11546
12114
|
return adapter.getProduct(currentProduct.id);
|
|
11547
12115
|
},
|
|
11548
12116
|
async createProduct(input) {
|
|
@@ -11618,7 +12186,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11618
12186
|
}
|
|
11619
12187
|
try {
|
|
11620
12188
|
const productData = await client.query.products.findFirst({
|
|
11621
|
-
where: (0,
|
|
12189
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.or)((0, import_drizzle_orm41.eq)(import_drizzle_orm41.sql`JSON_EXTRACT (${products.fields}, "$.slug")`, `${productSlugOrId}`), (0, import_drizzle_orm41.eq)(products.id, productSlugOrId))),
|
|
11622
12190
|
with: {
|
|
11623
12191
|
price: true,
|
|
11624
12192
|
...withResources && {
|
|
@@ -11647,20 +12215,20 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11647
12215
|
},
|
|
11648
12216
|
async getProductResources(productId) {
|
|
11649
12217
|
const contentResourceProductsForProduct = z.array(ContentResourceProductSchema).nullable().parse(await client.query.contentResourceProduct.findMany({
|
|
11650
|
-
where: (0,
|
|
12218
|
+
where: (0, import_drizzle_orm41.eq)(contentResourceProduct.productId, productId)
|
|
11651
12219
|
}));
|
|
11652
12220
|
if (!contentResourceProductsForProduct) {
|
|
11653
12221
|
return null;
|
|
11654
12222
|
} else {
|
|
11655
12223
|
const contentResources = z.array(ContentResourceSchema).parse(await client.query.contentResource.findMany({
|
|
11656
|
-
where: (0,
|
|
12224
|
+
where: (0, import_drizzle_orm41.inArray)(contentResource.id, contentResourceProductsForProduct.map((crp) => crp.resourceId))
|
|
11657
12225
|
}));
|
|
11658
12226
|
return contentResources;
|
|
11659
12227
|
}
|
|
11660
12228
|
},
|
|
11661
12229
|
async getPurchaseCountForProduct(productId) {
|
|
11662
12230
|
return await client.query.purchases.findMany({
|
|
11663
|
-
where: (0,
|
|
12231
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.productId, productId), (0, import_drizzle_orm41.inArray)(purchaseTable.status, [
|
|
11664
12232
|
"Valid",
|
|
11665
12233
|
"Restricted"
|
|
11666
12234
|
]))
|
|
@@ -11668,7 +12236,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11668
12236
|
},
|
|
11669
12237
|
async getPurchase(purchaseId) {
|
|
11670
12238
|
const purchase = await client.query.purchases.findFirst({
|
|
11671
|
-
where: (0,
|
|
12239
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.id, purchaseId)
|
|
11672
12240
|
});
|
|
11673
12241
|
return purchase ? purchaseSchema.parse(purchase) : null;
|
|
11674
12242
|
},
|
|
@@ -11686,14 +12254,14 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11686
12254
|
stripeChargeId
|
|
11687
12255
|
});
|
|
11688
12256
|
const chargeForPurchase = merchantChargeSchema.nullable().parse(await client.query.merchantCharge.findFirst({
|
|
11689
|
-
where: (0,
|
|
12257
|
+
where: (0, import_drizzle_orm41.eq)(merchantCharge.identifier, stripeChargeId)
|
|
11690
12258
|
}) || null);
|
|
11691
12259
|
if (!chargeForPurchase) {
|
|
11692
12260
|
logger.error(new Error(`No charge found for purchase: Stripe Charge ID: ${stripeChargeId}`));
|
|
11693
12261
|
return null;
|
|
11694
12262
|
}
|
|
11695
12263
|
const purchase = purchaseSchema.safeParse(await client.query.purchases.findFirst({
|
|
11696
|
-
where: (0,
|
|
12264
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.merchantChargeId, chargeForPurchase.id),
|
|
11697
12265
|
with: {
|
|
11698
12266
|
user: true,
|
|
11699
12267
|
product: true,
|
|
@@ -11707,7 +12275,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11707
12275
|
},
|
|
11708
12276
|
async getPurchaseUserTransferById(options) {
|
|
11709
12277
|
const purchaseTransferData = await client.query.purchaseUserTransfer.findFirst({
|
|
11710
|
-
where: (0,
|
|
12278
|
+
where: (0, import_drizzle_orm41.eq)(purchaseUserTransfer.id, options.id),
|
|
11711
12279
|
with: {
|
|
11712
12280
|
sourceUser: true,
|
|
11713
12281
|
targetUser: true,
|
|
@@ -11722,7 +12290,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11722
12290
|
},
|
|
11723
12291
|
async getPurchaseWithUser(purchaseId) {
|
|
11724
12292
|
const purchaseData = await client.query.purchases.findFirst({
|
|
11725
|
-
where: (0,
|
|
12293
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.id, purchaseId),
|
|
11726
12294
|
with: {
|
|
11727
12295
|
user: true
|
|
11728
12296
|
}
|
|
@@ -11746,13 +12314,13 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11746
12314
|
"Restricted"
|
|
11747
12315
|
];
|
|
11748
12316
|
const userPurchases = await client.query.purchases.findMany({
|
|
11749
|
-
where: (0,
|
|
12317
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm41.inArray)(purchaseTable.status, visiblePurchaseStates)),
|
|
11750
12318
|
with: {
|
|
11751
12319
|
user: true,
|
|
11752
12320
|
product: true,
|
|
11753
12321
|
bulkCoupon: true
|
|
11754
12322
|
},
|
|
11755
|
-
orderBy: (0,
|
|
12323
|
+
orderBy: (0, import_drizzle_orm41.asc)(purchaseTable.createdAt)
|
|
11756
12324
|
});
|
|
11757
12325
|
const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
|
|
11758
12326
|
if (!parsedPurchases.success) {
|
|
@@ -11768,18 +12336,18 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11768
12336
|
"Restricted"
|
|
11769
12337
|
];
|
|
11770
12338
|
const userPurchases = await client.query.purchases.findMany({
|
|
11771
|
-
where: (0,
|
|
12339
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm41.inArray)(purchaseTable.status, visiblePurchaseStates)),
|
|
11772
12340
|
with: {
|
|
11773
12341
|
user: true,
|
|
11774
12342
|
product: true,
|
|
11775
12343
|
bulkCoupon: true
|
|
11776
12344
|
},
|
|
11777
|
-
orderBy: (0,
|
|
12345
|
+
orderBy: (0, import_drizzle_orm41.asc)(purchaseTable.createdAt)
|
|
11778
12346
|
});
|
|
11779
12347
|
const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
|
|
11780
12348
|
const allPurchases = parsedPurchases.success ? parsedPurchases.data : [];
|
|
11781
12349
|
const thePurchase = await client.query.purchases.findFirst({
|
|
11782
|
-
where: (0,
|
|
12350
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.id, purchaseId), (0, import_drizzle_orm41.eq)(purchaseTable.userId, userId)),
|
|
11783
12351
|
with: {
|
|
11784
12352
|
user: true,
|
|
11785
12353
|
product: true,
|
|
@@ -11800,7 +12368,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11800
12368
|
let availableUpgrades = [];
|
|
11801
12369
|
if (purchaseCanUpgrade) {
|
|
11802
12370
|
availableUpgrades = await client.query.upgradableProducts.findMany({
|
|
11803
|
-
where: (0,
|
|
12371
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(upgradableProducts.upgradableFromId, parsedPurchase.data.product?.id), (0, import_drizzle_orm41.not)((0, import_drizzle_orm41.inArray)(upgradableProducts.upgradableToId, allPurchases.map((p) => p.product?.id)))),
|
|
11804
12372
|
with: {
|
|
11805
12373
|
upgradableTo: true,
|
|
11806
12374
|
upgradableFrom: true
|
|
@@ -11808,10 +12376,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11808
12376
|
});
|
|
11809
12377
|
}
|
|
11810
12378
|
const existingPurchase = purchaseSchema.optional().nullable().parse(await client.query.purchases.findFirst({
|
|
11811
|
-
where: (0,
|
|
12379
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm41.eq)(purchaseTable.productId, parsedPurchase.data.productId), (0, import_drizzle_orm41.inArray)(purchaseTable.status, [
|
|
11812
12380
|
"Valid",
|
|
11813
12381
|
"Restricted"
|
|
11814
|
-
]), (0,
|
|
12382
|
+
]), (0, import_drizzle_orm41.isNull)(purchaseTable.bulkCouponId), (0, import_drizzle_orm41.not)((0, import_drizzle_orm41.eq)(purchaseTable.id, parsedPurchase.data.id))),
|
|
11815
12383
|
with: {
|
|
11816
12384
|
user: true,
|
|
11817
12385
|
product: true,
|
|
@@ -11826,7 +12394,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11826
12394
|
},
|
|
11827
12395
|
async getUserWithPurchasersByEmail(email) {
|
|
11828
12396
|
const user = await client.query.users.findFirst({
|
|
11829
|
-
where: (0,
|
|
12397
|
+
where: (0, import_drizzle_orm41.eq)(users.email, email.trim().toLowerCase()),
|
|
11830
12398
|
with: {
|
|
11831
12399
|
// merchantCustomer: true,
|
|
11832
12400
|
roles: {
|
|
@@ -11853,7 +12421,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11853
12421
|
},
|
|
11854
12422
|
async getUserById(userId) {
|
|
11855
12423
|
const user = await client.query.users.findFirst({
|
|
11856
|
-
where: (0,
|
|
12424
|
+
where: (0, import_drizzle_orm41.eq)(users.id, userId),
|
|
11857
12425
|
with: {
|
|
11858
12426
|
roles: {
|
|
11859
12427
|
with: {
|
|
@@ -11875,13 +12443,13 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11875
12443
|
if (userId === void 0)
|
|
11876
12444
|
return [];
|
|
11877
12445
|
const canUpgradeProducts = await client.query.upgradableProducts.findMany({
|
|
11878
|
-
where: (0,
|
|
12446
|
+
where: (0, import_drizzle_orm41.eq)(upgradableProducts.upgradableToId, bundleId)
|
|
11879
12447
|
});
|
|
11880
12448
|
const upgradableFrom = z.array(z.string()).parse(canUpgradeProducts.map((product) => {
|
|
11881
12449
|
return product.upgradableFromId;
|
|
11882
12450
|
}));
|
|
11883
12451
|
const purchases = await client.query.purchases.findMany({
|
|
11884
|
-
where: (0,
|
|
12452
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm41.inArray)(purchaseTable.productId, upgradableFrom))
|
|
11885
12453
|
});
|
|
11886
12454
|
const productsPurchased = z.array(z.string()).parse(purchases.map((purchase) => {
|
|
11887
12455
|
return purchase.productId;
|
|
@@ -11889,7 +12457,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11889
12457
|
if (productsPurchased.length === 0)
|
|
11890
12458
|
return [];
|
|
11891
12459
|
const foundPrices = await client.query.prices.findMany({
|
|
11892
|
-
where: (0,
|
|
12460
|
+
where: (0, import_drizzle_orm41.inArray)(prices.productId, productsPurchased)
|
|
11893
12461
|
});
|
|
11894
12462
|
return z.array(priceSchema).parse(foundPrices);
|
|
11895
12463
|
},
|
|
@@ -11898,14 +12466,14 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11898
12466
|
throw new Error("No lessonId provided");
|
|
11899
12467
|
}
|
|
11900
12468
|
let lessonProgress = await client.query.resourceProgress.findFirst({
|
|
11901
|
-
where: (0,
|
|
12469
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(resourceProgress.userId, options.userId), (0, import_drizzle_orm41.eq)(resourceProgress.resourceId, options.lessonId))
|
|
11902
12470
|
});
|
|
11903
12471
|
const now = /* @__PURE__ */ new Date();
|
|
11904
12472
|
if (lessonProgress) {
|
|
11905
12473
|
await client.update(resourceProgress).set({
|
|
11906
12474
|
completedAt: lessonProgress.completedAt ? null : now,
|
|
11907
12475
|
updatedAt: now
|
|
11908
|
-
}).where((0,
|
|
12476
|
+
}).where((0, import_drizzle_orm41.eq)(resourceProgress.resourceId, options.lessonId));
|
|
11909
12477
|
} else {
|
|
11910
12478
|
await client.insert(resourceProgress).values({
|
|
11911
12479
|
userId: options.userId,
|
|
@@ -11915,7 +12483,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11915
12483
|
});
|
|
11916
12484
|
}
|
|
11917
12485
|
lessonProgress = await client.query.resourceProgress.findFirst({
|
|
11918
|
-
where: (0,
|
|
12486
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(resourceProgress.userId, options.userId), (0, import_drizzle_orm41.eq)(resourceProgress.resourceId, options.lessonId))
|
|
11919
12487
|
});
|
|
11920
12488
|
const parsedLessonProgress = resourceProgressSchema.safeParse(lessonProgress);
|
|
11921
12489
|
if (!parsedLessonProgress.success) {
|
|
@@ -11937,7 +12505,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11937
12505
|
throw new Error("No purchase found");
|
|
11938
12506
|
await trx.update(purchaseTable).set({
|
|
11939
12507
|
userId: targetUserId
|
|
11940
|
-
}).where((0,
|
|
12508
|
+
}).where((0, import_drizzle_orm41.eq)(purchaseTable.id, purchase.id));
|
|
11941
12509
|
await trx.insert(purchaseUserTransfer).values({
|
|
11942
12510
|
id: transferId,
|
|
11943
12511
|
purchaseId: purchase.id,
|
|
@@ -11952,21 +12520,21 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11952
12520
|
if (paymentProvider && purchase.merchantChargeId) {
|
|
11953
12521
|
await trx.update(merchantCharge).set({
|
|
11954
12522
|
userId: targetUserId
|
|
11955
|
-
}).where((0,
|
|
12523
|
+
}).where((0, import_drizzle_orm41.eq)(merchantCharge.id, purchase.merchantChargeId));
|
|
11956
12524
|
const updatedMerchantCharge = await adapter.getMerchantCharge(purchase.merchantChargeId);
|
|
11957
12525
|
if (!updatedMerchantCharge)
|
|
11958
12526
|
throw new Error("No merchant charge found");
|
|
11959
12527
|
await trx.update(merchantCustomer).set({
|
|
11960
12528
|
userId: targetUserId
|
|
11961
|
-
}).where((0,
|
|
12529
|
+
}).where((0, import_drizzle_orm41.eq)(merchantCustomer.id, updatedMerchantCharge.merchantCustomerId));
|
|
11962
12530
|
const updatedMerchantCustomer = merchantCustomerSchema.parse(await client.query.merchantCustomer.findFirst({
|
|
11963
|
-
where: (0,
|
|
12531
|
+
where: (0, import_drizzle_orm41.eq)(merchantCustomer.id, updatedMerchantCharge.merchantCustomerId)
|
|
11964
12532
|
}));
|
|
11965
12533
|
const targetUser = userSchema.parse(await client.query.users.findFirst({
|
|
11966
|
-
where: (0,
|
|
12534
|
+
where: (0, import_drizzle_orm41.eq)(users.id, targetUserId)
|
|
11967
12535
|
}));
|
|
11968
12536
|
const sourceUser = userSchema.parse(await client.query.users.findFirst({
|
|
11969
|
-
where: (0,
|
|
12537
|
+
where: (0, import_drizzle_orm41.eq)(users.id, sourceUserId)
|
|
11970
12538
|
}));
|
|
11971
12539
|
await paymentProvider.updateCustomer(updatedMerchantCustomer.identifier, {
|
|
11972
12540
|
email: targetUser.email,
|
|
@@ -11993,7 +12561,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
11993
12561
|
status
|
|
11994
12562
|
});
|
|
11995
12563
|
const merchantChargeForPurchase = await client.query.merchantCharge.findFirst({
|
|
11996
|
-
where: (0,
|
|
12564
|
+
where: (0, import_drizzle_orm41.or)((0, import_drizzle_orm41.eq)(merchantCharge.identifier, chargeId), (0, import_drizzle_orm41.eq)(merchantCharge.id, chargeId))
|
|
11997
12565
|
});
|
|
11998
12566
|
console.log("merchantChargeForPurchase", {
|
|
11999
12567
|
merchantChargeForPurchase
|
|
@@ -12002,15 +12570,15 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12002
12570
|
if (!parsedMerchantChargeForPurchase)
|
|
12003
12571
|
throw new Error(`no-charge-found-for-purchase ${chargeId}`);
|
|
12004
12572
|
const purchase = await client.query.purchases.findFirst({
|
|
12005
|
-
where: (0,
|
|
12573
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.merchantChargeId, parsedMerchantChargeForPurchase.id)
|
|
12006
12574
|
});
|
|
12007
12575
|
const parsedPurchase = purchaseSchema.nullable().parse(purchase);
|
|
12008
12576
|
if (parsedPurchase) {
|
|
12009
12577
|
await client.update(purchaseTable).set({
|
|
12010
12578
|
status
|
|
12011
|
-
}).where((0,
|
|
12579
|
+
}).where((0, import_drizzle_orm41.eq)(purchaseTable.id, parsedPurchase.id));
|
|
12012
12580
|
const newPurchase = await client.query.purchases.findFirst({
|
|
12013
|
-
where: (0,
|
|
12581
|
+
where: (0, import_drizzle_orm41.eq)(purchaseTable.id, parsedPurchase.id)
|
|
12014
12582
|
});
|
|
12015
12583
|
return purchaseSchema.optional().parse(newPurchase);
|
|
12016
12584
|
} else {
|
|
@@ -12024,16 +12592,16 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12024
12592
|
async updatePurchaseUserTransferTransferState(options) {
|
|
12025
12593
|
await client.update(purchaseUserTransfer).set({
|
|
12026
12594
|
transferState: options.transferState
|
|
12027
|
-
}).where((0,
|
|
12595
|
+
}).where((0, import_drizzle_orm41.eq)(purchaseUserTransfer.id, options.id));
|
|
12028
12596
|
const purchaseUserTransferData = await client.query.purchaseUserTransfer.findFirst({
|
|
12029
|
-
where: (0,
|
|
12597
|
+
where: (0, import_drizzle_orm41.eq)(purchaseUserTransfer.id, options.id)
|
|
12030
12598
|
}) || null;
|
|
12031
12599
|
return purchaseUserTransferSchema.nullable().parse(purchaseUserTransferData);
|
|
12032
12600
|
},
|
|
12033
12601
|
addResourceToResource: async function(options) {
|
|
12034
12602
|
const { parentResourceId, childResourceId } = options;
|
|
12035
12603
|
const parentResourceData = await client.query.contentResource.findFirst({
|
|
12036
|
-
where: (0,
|
|
12604
|
+
where: (0, import_drizzle_orm41.or)((0, import_drizzle_orm41.eq)(import_drizzle_orm41.sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, parentResourceId), (0, import_drizzle_orm41.eq)(contentResource.id, parentResourceId)),
|
|
12037
12605
|
with: {
|
|
12038
12606
|
resources: true
|
|
12039
12607
|
}
|
|
@@ -12045,7 +12613,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12045
12613
|
position: parentResource.resources?.length || 0
|
|
12046
12614
|
});
|
|
12047
12615
|
const resourceJoin = client.query.contentResourceResource.findFirst({
|
|
12048
|
-
where: (0,
|
|
12616
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(contentResourceResource.resourceOfId, parentResourceId), (0, import_drizzle_orm41.eq)(contentResourceResource.resourceId, childResourceId)),
|
|
12049
12617
|
with: {
|
|
12050
12618
|
resource: true
|
|
12051
12619
|
}
|
|
@@ -12059,28 +12627,28 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12059
12627
|
async removeResourceFromResource(options) {
|
|
12060
12628
|
const { childResourceId, parentResourceId } = options;
|
|
12061
12629
|
const resourceJoin = await client.query.contentResourceResource.findFirst({
|
|
12062
|
-
where: (0,
|
|
12630
|
+
where: (0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(contentResourceResource.resourceOfId, parentResourceId), (0, import_drizzle_orm41.eq)(contentResourceResource.resourceId, childResourceId))
|
|
12063
12631
|
});
|
|
12064
12632
|
const parsedResourceJoin = ContentResourceResourceSchema.safeParse(resourceJoin);
|
|
12065
12633
|
if (!parsedResourceJoin.success) {
|
|
12066
12634
|
return null;
|
|
12067
12635
|
}
|
|
12068
|
-
await client.delete(contentResourceResource).where((0,
|
|
12636
|
+
await client.delete(contentResourceResource).where((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(contentResourceResource.resourceOfId, parentResourceId), (0, import_drizzle_orm41.eq)(contentResourceResource.resourceId, childResourceId)));
|
|
12069
12637
|
return parsedResourceJoin.data.resource;
|
|
12070
12638
|
},
|
|
12071
12639
|
async updateContentResourceFields(options) {
|
|
12072
12640
|
if (!options.id) {
|
|
12073
12641
|
throw new Error("No content resource id.");
|
|
12074
12642
|
}
|
|
12075
|
-
const currentResource = await client.select().from(contentResource).where((0,
|
|
12643
|
+
const currentResource = await client.select().from(contentResource).where((0, import_drizzle_orm41.eq)(contentResource.id, options.id)).then((res) => res[0]);
|
|
12076
12644
|
await client.update(contentResource).set({
|
|
12077
12645
|
fields: {
|
|
12078
12646
|
...currentResource.fields,
|
|
12079
12647
|
...options.fields
|
|
12080
12648
|
}
|
|
12081
|
-
}).where((0,
|
|
12649
|
+
}).where((0, import_drizzle_orm41.eq)(contentResource.id, options.id));
|
|
12082
12650
|
const resource = await client.query.contentResource.findFirst({
|
|
12083
|
-
where: (0,
|
|
12651
|
+
where: (0, import_drizzle_orm41.eq)(contentResource.id, options.id),
|
|
12084
12652
|
with: {
|
|
12085
12653
|
resources: {
|
|
12086
12654
|
with: {
|
|
@@ -12090,12 +12658,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12090
12658
|
with: {
|
|
12091
12659
|
resource: true
|
|
12092
12660
|
},
|
|
12093
|
-
orderBy: (0,
|
|
12661
|
+
orderBy: (0, import_drizzle_orm41.asc)(contentResourceResource.position)
|
|
12094
12662
|
}
|
|
12095
12663
|
}
|
|
12096
12664
|
}
|
|
12097
12665
|
},
|
|
12098
|
-
orderBy: (0,
|
|
12666
|
+
orderBy: (0, import_drizzle_orm41.asc)(contentResourceResource.position)
|
|
12099
12667
|
}
|
|
12100
12668
|
}
|
|
12101
12669
|
});
|
|
@@ -12110,7 +12678,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12110
12678
|
if (!id) {
|
|
12111
12679
|
return null;
|
|
12112
12680
|
}
|
|
12113
|
-
const query =
|
|
12681
|
+
const query = import_drizzle_orm41.sql`
|
|
12114
12682
|
SELECT
|
|
12115
12683
|
id as id,
|
|
12116
12684
|
CAST(updatedAt AS DATETIME) as updatedAt,
|
|
@@ -12142,7 +12710,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12142
12710
|
id
|
|
12143
12711
|
});
|
|
12144
12712
|
const resource = await client.query.contentResource.findFirst({
|
|
12145
|
-
where: (0,
|
|
12713
|
+
where: (0, import_drizzle_orm41.eq)(contentResource.id, id),
|
|
12146
12714
|
with: {
|
|
12147
12715
|
resources: {
|
|
12148
12716
|
with: {
|
|
@@ -12152,12 +12720,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12152
12720
|
with: {
|
|
12153
12721
|
resource: true
|
|
12154
12722
|
},
|
|
12155
|
-
orderBy: (0,
|
|
12723
|
+
orderBy: (0, import_drizzle_orm41.asc)(contentResourceResource.position)
|
|
12156
12724
|
}
|
|
12157
12725
|
}
|
|
12158
12726
|
}
|
|
12159
12727
|
},
|
|
12160
|
-
orderBy: (0,
|
|
12728
|
+
orderBy: (0, import_drizzle_orm41.asc)(contentResourceResource.position)
|
|
12161
12729
|
}
|
|
12162
12730
|
}
|
|
12163
12731
|
});
|
|
@@ -12170,7 +12738,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12170
12738
|
},
|
|
12171
12739
|
async getContentResource(data) {
|
|
12172
12740
|
const resource = await client.query.contentResource.findFirst({
|
|
12173
|
-
where: (0,
|
|
12741
|
+
where: (0, import_drizzle_orm41.or)((0, import_drizzle_orm41.eq)(contentResource.id, data), (0, import_drizzle_orm41.eq)(import_drizzle_orm41.sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, `${data}`)),
|
|
12174
12742
|
with: {
|
|
12175
12743
|
resources: {
|
|
12176
12744
|
with: {
|
|
@@ -12188,12 +12756,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12188
12756
|
}
|
|
12189
12757
|
}
|
|
12190
12758
|
},
|
|
12191
|
-
orderBy: (0,
|
|
12759
|
+
orderBy: (0, import_drizzle_orm41.asc)(contentResourceResource.position)
|
|
12192
12760
|
}
|
|
12193
12761
|
}
|
|
12194
12762
|
}
|
|
12195
12763
|
},
|
|
12196
|
-
orderBy: (0,
|
|
12764
|
+
orderBy: (0, import_drizzle_orm41.asc)(contentResourceResource.position)
|
|
12197
12765
|
}
|
|
12198
12766
|
}
|
|
12199
12767
|
});
|
|
@@ -12211,61 +12779,61 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12211
12779
|
...data,
|
|
12212
12780
|
id
|
|
12213
12781
|
});
|
|
12214
|
-
return await client.select().from(users).where((0,
|
|
12782
|
+
return await client.select().from(users).where((0, import_drizzle_orm41.eq)(users.id, id)).then((res) => res[0]);
|
|
12215
12783
|
} catch (error) {
|
|
12216
12784
|
console.error(error);
|
|
12217
12785
|
throw error;
|
|
12218
12786
|
}
|
|
12219
12787
|
},
|
|
12220
12788
|
async getUser(data) {
|
|
12221
|
-
return await client.select().from(users).where((0,
|
|
12789
|
+
return await client.select().from(users).where((0, import_drizzle_orm41.eq)(users.id, data)).then((res) => res[0]) ?? null;
|
|
12222
12790
|
},
|
|
12223
12791
|
async getUserByEmail(data) {
|
|
12224
|
-
return await client.select().from(users).where((0,
|
|
12792
|
+
return await client.select().from(users).where((0, import_drizzle_orm41.eq)(users.email, data)).then((res) => res[0]) ?? null;
|
|
12225
12793
|
},
|
|
12226
12794
|
async createSession(data) {
|
|
12227
12795
|
await client.insert(sessions).values(data);
|
|
12228
|
-
return await client.select().from(sessions).where((0,
|
|
12796
|
+
return await client.select().from(sessions).where((0, import_drizzle_orm41.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
|
|
12229
12797
|
},
|
|
12230
12798
|
async getSessionAndUser(data) {
|
|
12231
12799
|
return await client.select({
|
|
12232
12800
|
session: sessions,
|
|
12233
12801
|
user: users
|
|
12234
|
-
}).from(sessions).where((0,
|
|
12802
|
+
}).from(sessions).where((0, import_drizzle_orm41.eq)(sessions.sessionToken, data)).innerJoin(users, (0, import_drizzle_orm41.eq)(users.id, sessions.userId)).then((res) => res[0]) ?? null;
|
|
12235
12803
|
},
|
|
12236
12804
|
async updateUser(data) {
|
|
12237
12805
|
if (!data.id) {
|
|
12238
12806
|
throw new Error("No user id.");
|
|
12239
12807
|
}
|
|
12240
|
-
await client.update(users).set(data).where((0,
|
|
12241
|
-
return await client.select().from(users).where((0,
|
|
12808
|
+
await client.update(users).set(data).where((0, import_drizzle_orm41.eq)(users.id, data.id));
|
|
12809
|
+
return await client.select().from(users).where((0, import_drizzle_orm41.eq)(users.id, data.id)).then((res) => res[0]);
|
|
12242
12810
|
},
|
|
12243
12811
|
async updateSession(data) {
|
|
12244
|
-
await client.update(sessions).set(data).where((0,
|
|
12245
|
-
return await client.select().from(sessions).where((0,
|
|
12812
|
+
await client.update(sessions).set(data).where((0, import_drizzle_orm41.eq)(sessions.sessionToken, data.sessionToken));
|
|
12813
|
+
return await client.select().from(sessions).where((0, import_drizzle_orm41.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
|
|
12246
12814
|
},
|
|
12247
12815
|
async linkAccount(rawAccount) {
|
|
12248
12816
|
await client.insert(accounts).values(rawAccount);
|
|
12249
12817
|
},
|
|
12250
12818
|
async getUserByAccount(account) {
|
|
12251
|
-
const dbAccount = await client.select().from(accounts).where((0,
|
|
12819
|
+
const dbAccount = await client.select().from(accounts).where((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm41.eq)(accounts.provider, account.provider))).leftJoin(users, (0, import_drizzle_orm41.eq)(accounts.userId, users.id)).then((res) => res[0]) ?? null;
|
|
12252
12820
|
if (!dbAccount) {
|
|
12253
12821
|
return null;
|
|
12254
12822
|
}
|
|
12255
12823
|
return dbAccount.User;
|
|
12256
12824
|
},
|
|
12257
12825
|
async deleteSession(sessionToken) {
|
|
12258
|
-
const session = await client.select().from(sessions).where((0,
|
|
12259
|
-
await client.delete(sessions).where((0,
|
|
12826
|
+
const session = await client.select().from(sessions).where((0, import_drizzle_orm41.eq)(sessions.sessionToken, sessionToken)).then((res) => res[0]) ?? null;
|
|
12827
|
+
await client.delete(sessions).where((0, import_drizzle_orm41.eq)(sessions.sessionToken, sessionToken));
|
|
12260
12828
|
return session;
|
|
12261
12829
|
},
|
|
12262
12830
|
async createVerificationToken(token) {
|
|
12263
12831
|
await client.insert(verificationTokens).values(token);
|
|
12264
|
-
return await client.select().from(verificationTokens).where((0,
|
|
12832
|
+
return await client.select().from(verificationTokens).where((0, import_drizzle_orm41.eq)(verificationTokens.identifier, token.identifier)).then((res) => res[0]);
|
|
12265
12833
|
},
|
|
12266
12834
|
async useVerificationToken(token) {
|
|
12267
12835
|
try {
|
|
12268
|
-
const deletedToken = await client.select().from(verificationTokens).where((0,
|
|
12836
|
+
const deletedToken = await client.select().from(verificationTokens).where((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm41.eq)(verificationTokens.token, token.token))).then((res) => res[0]) ?? null;
|
|
12269
12837
|
if (deletedToken?.createdAt) {
|
|
12270
12838
|
const TIMEOUT_IN_SECONDS = 90;
|
|
12271
12839
|
const expireMultipleClicks = (0, import_date_fns2.addSeconds)(deletedToken.createdAt, TIMEOUT_IN_SECONDS);
|
|
@@ -12274,7 +12842,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12274
12842
|
const { id: _, ...verificationToken } = token;
|
|
12275
12843
|
return deletedToken;
|
|
12276
12844
|
} else {
|
|
12277
|
-
await client.delete(verificationTokens).where((0,
|
|
12845
|
+
await client.delete(verificationTokens).where((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm41.eq)(verificationTokens.token, token.token)));
|
|
12278
12846
|
return deletedToken;
|
|
12279
12847
|
}
|
|
12280
12848
|
}
|
|
@@ -12284,14 +12852,14 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core41.mysqlTable, p
|
|
|
12284
12852
|
}
|
|
12285
12853
|
},
|
|
12286
12854
|
async deleteUser(id) {
|
|
12287
|
-
const user = await client.select().from(users).where((0,
|
|
12288
|
-
await client.delete(users).where((0,
|
|
12289
|
-
await client.delete(sessions).where((0,
|
|
12290
|
-
await client.delete(accounts).where((0,
|
|
12855
|
+
const user = await client.select().from(users).where((0, import_drizzle_orm41.eq)(users.id, id)).then((res) => res[0] ?? null);
|
|
12856
|
+
await client.delete(users).where((0, import_drizzle_orm41.eq)(users.id, id));
|
|
12857
|
+
await client.delete(sessions).where((0, import_drizzle_orm41.eq)(sessions.userId, id));
|
|
12858
|
+
await client.delete(accounts).where((0, import_drizzle_orm41.eq)(accounts.userId, id));
|
|
12291
12859
|
return user;
|
|
12292
12860
|
},
|
|
12293
12861
|
async unlinkAccount(account) {
|
|
12294
|
-
await client.delete(accounts).where((0,
|
|
12862
|
+
await client.delete(accounts).where((0, import_drizzle_orm41.and)((0, import_drizzle_orm41.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm41.eq)(accounts.provider, account.provider)));
|
|
12295
12863
|
return void 0;
|
|
12296
12864
|
}
|
|
12297
12865
|
};
|