@coursebuilder/adapter-drizzle 0.0.4 → 0.0.5
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-QM6AYTGN.js → chunk-6CBAFOL3.js} +5 -7
- package/dist/{chunk-NCDVIRG4.js → chunk-AIDEJDKJ.js} +5 -7
- package/dist/{chunk-34QNODEZ.js → chunk-BRGTUNY2.js} +5 -7
- package/dist/{chunk-WULUGMHP.js → chunk-H4MXNDWO.js} +5 -7
- package/dist/{chunk-JWWIIUV3.js → chunk-ICL7XZ2Y.js} +5 -7
- package/dist/{chunk-SBGLYMAH.js → chunk-JD4KFACE.js} +5 -7
- package/dist/{chunk-VID6JINS.js → chunk-JQFZOCAU.js} +98 -45
- package/dist/{chunk-ZUKX3WXB.js → chunk-KI47TR7F.js} +5 -7
- package/dist/{chunk-FZHAOQVB.js → chunk-KVN3JV7C.js} +5 -7
- package/dist/{chunk-H7XEMCP4.js → chunk-MBQ3TMHH.js} +5 -7
- package/dist/chunk-NISOQSUL.js +47 -0
- package/dist/chunk-PUGK2AEH.js +746 -0
- package/dist/{chunk-ABVLEWR5.js → chunk-SFJM6FKE.js} +5 -7
- package/dist/{chunk-QRRP7Y2V.js → chunk-TA6VLEV5.js} +5 -7
- package/dist/{chunk-BZPXYS6A.js → chunk-TMQIGK3N.js} +5 -7
- package/dist/{chunk-VWMY6XV7.js → chunk-US2EXVMI.js} +5 -7
- package/dist/{chunk-KFQAWBFP.js → chunk-UY3DVPP3.js} +5 -7
- package/dist/{chunk-M5NL4CY4.js → chunk-VEFCDI73.js} +5 -7
- package/dist/{chunk-EFO2N6T7.js → chunk-VZABQCFH.js} +5 -7
- package/dist/index.d.ts +1 -29
- package/dist/index.js +19 -30
- package/dist/lib/mysql/index.cjs +967 -769
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.ts +4649 -745
- package/dist/lib/mysql/index.js +21 -117
- package/dist/lib/mysql/schemas/auth/accounts.cjs +124 -22
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.ts +180 -178
- package/dist/lib/mysql/schemas/auth/accounts.js +5 -1
- package/dist/lib/mysql/schemas/auth/permissions.cjs +108 -14
- package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/permissions.d.ts +96 -94
- package/dist/lib/mysql/schemas/auth/permissions.js +5 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +146 -13
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +85 -82
- package/dist/lib/mysql/schemas/auth/role-permissions.js +5 -1
- package/dist/lib/mysql/schemas/auth/roles.cjs +110 -14
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.ts +96 -94
- package/dist/lib/mysql/schemas/auth/roles.js +5 -1
- package/dist/lib/mysql/schemas/auth/sessions.cjs +116 -10
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.ts +48 -46
- package/dist/lib/mysql/schemas/auth/sessions.js +6 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +155 -15
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +85 -82
- package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -1
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +151 -13
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +85 -82
- package/dist/lib/mysql/schemas/auth/user-roles.js +5 -1
- package/dist/lib/mysql/schemas/auth/users.cjs +310 -14
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.ts +101 -94
- package/dist/lib/mysql/schemas/auth/users.js +5 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +4 -6
- package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +55 -57
- package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +163 -165
- package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +67 -69
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +103 -105
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +79 -81
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +79 -81
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +91 -93
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +79 -81
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +43 -45
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
- package/dist/lib/mysql/schemas/commerce/price.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.ts +91 -93
- package/dist/lib/mysql/schemas/commerce/price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/product.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.ts +91 -93
- package/dist/lib/mysql/schemas/commerce/product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +127 -129
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +211 -213
- package/dist/lib/mysql/schemas/commerce/purchase.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs +4 -6
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +91 -93
- package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +4 -6
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +91 -93
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +192 -20
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +146 -142
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -1
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +201 -17
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +110 -106
- package/dist/lib/mysql/schemas/content/content-contributions.js +5 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -18
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +97 -94
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -1
- package/dist/lib/mysql/schemas/content/content-resource.cjs +198 -18
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +99 -94
- package/dist/lib/mysql/schemas/content/content-resource.js +5 -1
- package/dist/lib/mysql/schemas/content/contribution-types.cjs +113 -16
- package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.d.ts +108 -106
- package/dist/lib/mysql/schemas/content/contribution-types.js +5 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs +4 -6
- package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +79 -81
- package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
- package/dist/lib/pg.d.ts +1 -1
- package/dist/lib/sqlite.d.ts +1 -1
- package/dist/lib/utils.d.ts +1 -29
- package/package.json +1 -1
- package/src/lib/mysql/index.ts +95 -65
- package/src/lib/mysql/schemas/auth/accounts.ts +12 -3
- package/src/lib/mysql/schemas/auth/permissions.ts +10 -3
- package/src/lib/mysql/schemas/auth/role-permissions.ts +21 -3
- package/src/lib/mysql/schemas/auth/roles.ts +12 -3
- package/src/lib/mysql/schemas/auth/sessions.ts +12 -3
- package/src/lib/mysql/schemas/auth/user-permissions.ts +21 -3
- package/src/lib/mysql/schemas/auth/user-roles.ts +21 -3
- package/src/lib/mysql/schemas/auth/users.ts +26 -3
- package/src/lib/mysql/schemas/auth/verification-tokens.ts +2 -4
- package/src/lib/mysql/schemas/commerce/coupon.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-account.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-charge.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-price.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-product.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-session.ts +2 -4
- package/src/lib/mysql/schemas/commerce/price.ts +2 -4
- package/src/lib/mysql/schemas/commerce/product.ts +2 -4
- package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +2 -4
- package/src/lib/mysql/schemas/commerce/purchase.ts +2 -4
- package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -4
- package/src/lib/mysql/schemas/communication/communication-preference-types.ts +20 -25
- package/src/lib/mysql/schemas/communication/communication-preferences.ts +30 -3
- package/src/lib/mysql/schemas/content/content-contributions.ts +31 -3
- package/src/lib/mysql/schemas/content/content-resource-resource.ts +23 -4
- package/src/lib/mysql/schemas/content/content-resource.ts +22 -4
- package/src/lib/mysql/schemas/content/contribution-types.ts +13 -3
- package/src/lib/mysql/schemas/content/resource-progress.ts +2 -4
- package/dist/chunk-7Z72PW3G.js +0 -60
- package/dist/chunk-C2G2KMWQ.js +0 -48
- package/dist/chunk-GJZCLS2Y.js +0 -29
- package/dist/chunk-HHQK736S.js +0 -40
- package/dist/chunk-I4NIW2NF.js +0 -46
- package/dist/chunk-IHQ3ARH4.js +0 -44
- package/dist/chunk-KEJBPPZC.js +0 -45
- package/dist/chunk-L3XBKPYA.js +0 -47
- package/dist/chunk-MHZHMZ5C.js +0 -47
- package/dist/chunk-MOO56C62.js +0 -46
- package/dist/chunk-RLTOQRJB.js +0 -40
- package/dist/chunk-SWOTLIQI.js +0 -46
- package/dist/chunk-XM4CEU6B.js +0 -54
package/dist/lib/mysql/index.cjs
CHANGED
|
@@ -22,40 +22,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var mysql_exports = {};
|
|
23
23
|
__export(mysql_exports, {
|
|
24
24
|
createTables: () => createTables,
|
|
25
|
-
|
|
26
|
-
getCommunicationChannelSchema: () => getCommunicationChannelSchema,
|
|
27
|
-
getCommunicationPreferenceTypesSchema: () => getCommunicationPreferenceTypesSchema,
|
|
28
|
-
getCommunicationPreferencesSchema: () => getCommunicationPreferencesSchema,
|
|
29
|
-
getContentContributionsSchema: () => getContentContributionsSchema,
|
|
30
|
-
getContentResourceResourceSchema: () => getContentResourceResourceSchema,
|
|
31
|
-
getContentResourceSchema: () => getContentResourceSchema,
|
|
32
|
-
getContributionTypesSchema: () => getContributionTypesSchema,
|
|
33
|
-
getCouponSchema: () => getCouponSchema,
|
|
34
|
-
getMerchantAccountSchema: () => getMerchantAccountSchema,
|
|
35
|
-
getMerchantChargeSchema: () => getMerchantChargeSchema,
|
|
36
|
-
getMerchantCouponSchema: () => getMerchantCouponSchema,
|
|
37
|
-
getMerchantCustomerSchema: () => getMerchantCustomerSchema,
|
|
38
|
-
getMerchantPriceSchema: () => getMerchantPriceSchema,
|
|
39
|
-
getMerchantProductSchema: () => getMerchantProductSchema,
|
|
40
|
-
getMerchantSessionSchema: () => getMerchantSessionSchema,
|
|
41
|
-
getPermissionsSchema: () => getPermissionsSchema,
|
|
42
|
-
getPriceSchema: () => getPriceSchema,
|
|
43
|
-
getProductSchema: () => getProductSchema,
|
|
44
|
-
getPurchaseSchema: () => getPurchaseSchema,
|
|
45
|
-
getPurchaseUserTransferSchema: () => getPurchaseUserTransferSchema,
|
|
46
|
-
getResourceProgressSchema: () => getResourceProgressSchema,
|
|
47
|
-
getRolePermissionsSchema: () => getRolePermissionsSchema,
|
|
48
|
-
getRolesSchema: () => getRolesSchema,
|
|
49
|
-
getSessionsSchema: () => getSessionsSchema,
|
|
50
|
-
getUserPermissionsSchema: () => getUserPermissionsSchema,
|
|
51
|
-
getUserRolesSchema: () => getUserRolesSchema,
|
|
52
|
-
getUsersSchema: () => getUsersSchema,
|
|
53
|
-
getVerificationTokensSchema: () => getVerificationTokensSchema,
|
|
25
|
+
getCourseBuilderSchema: () => getCourseBuilderSchema,
|
|
54
26
|
mySqlDrizzleAdapter: () => mySqlDrizzleAdapter
|
|
55
27
|
});
|
|
56
28
|
module.exports = __toCommonJS(mysql_exports);
|
|
57
29
|
var import_date_fns = require("date-fns");
|
|
58
|
-
var
|
|
30
|
+
var import_drizzle_orm25 = require("drizzle-orm");
|
|
59
31
|
var import_mysql_core30 = require("drizzle-orm/mysql-core");
|
|
60
32
|
|
|
61
33
|
// ../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
|
|
@@ -3870,61 +3842,57 @@ var VideoResourceSchema = z.object({
|
|
|
3870
3842
|
});
|
|
3871
3843
|
|
|
3872
3844
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
3845
|
+
var import_drizzle_orm12 = require("drizzle-orm");
|
|
3846
|
+
var import_mysql_core14 = require("drizzle-orm/mysql-core");
|
|
3847
|
+
|
|
3848
|
+
// src/lib/mysql/schemas/auth/users.ts
|
|
3849
|
+
var import_drizzle_orm11 = require("drizzle-orm");
|
|
3850
|
+
var import_mysql_core13 = require("drizzle-orm/mysql-core");
|
|
3851
|
+
|
|
3852
|
+
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
3853
|
+
var import_drizzle_orm = require("drizzle-orm");
|
|
3854
|
+
var import_mysql_core3 = require("drizzle-orm/mysql-core");
|
|
3855
|
+
|
|
3856
|
+
// src/lib/mysql/schemas/communication/communication-channel.ts
|
|
3873
3857
|
var import_mysql_core = require("drizzle-orm/mysql-core");
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
length: 255
|
|
3878
|
-
}).notNull(),
|
|
3879
|
-
type: (0, import_mysql_core.varchar)("type", {
|
|
3880
|
-
length: 255
|
|
3881
|
-
}).$type().notNull(),
|
|
3882
|
-
provider: (0, import_mysql_core.varchar)("provider", {
|
|
3858
|
+
function getCommunicationChannelSchema(mysqlTable) {
|
|
3859
|
+
return mysqlTable("communicationChannel", {
|
|
3860
|
+
id: (0, import_mysql_core.varchar)("id", {
|
|
3883
3861
|
length: 255
|
|
3884
|
-
}).notNull(),
|
|
3885
|
-
|
|
3862
|
+
}).notNull().primaryKey(),
|
|
3863
|
+
name: (0, import_mysql_core.varchar)("name", {
|
|
3886
3864
|
length: 255
|
|
3887
3865
|
}).notNull(),
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
}, (account) => ({
|
|
3905
|
-
pk: (0, import_mysql_core.primaryKey)({
|
|
3906
|
-
columns: [
|
|
3907
|
-
account.provider,
|
|
3908
|
-
account.providerAccountId
|
|
3909
|
-
]
|
|
3910
|
-
}),
|
|
3911
|
-
userIdIdx: (0, import_mysql_core.index)("userId_idx").on(account.userId)
|
|
3866
|
+
description: (0, import_mysql_core.text)("description"),
|
|
3867
|
+
active: (0, import_mysql_core.boolean)("active").notNull().default(true),
|
|
3868
|
+
createdAt: (0, import_mysql_core.timestamp)("createdAt", {
|
|
3869
|
+
mode: "date",
|
|
3870
|
+
fsp: 3
|
|
3871
|
+
}).defaultNow(),
|
|
3872
|
+
updatedAt: (0, import_mysql_core.timestamp)("updatedAt", {
|
|
3873
|
+
mode: "date",
|
|
3874
|
+
fsp: 3
|
|
3875
|
+
}).defaultNow(),
|
|
3876
|
+
deletedAt: (0, import_mysql_core.timestamp)("deletedAt", {
|
|
3877
|
+
mode: "date",
|
|
3878
|
+
fsp: 3
|
|
3879
|
+
})
|
|
3880
|
+
}, (cc) => ({
|
|
3881
|
+
nameIdx: (0, import_mysql_core.index)("name_idx").on(cc.name)
|
|
3912
3882
|
}));
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
};
|
|
3916
|
-
}, "getAccountsSchema");
|
|
3883
|
+
}
|
|
3884
|
+
__name(getCommunicationChannelSchema, "getCommunicationChannelSchema");
|
|
3917
3885
|
|
|
3918
|
-
// src/lib/mysql/schemas/
|
|
3886
|
+
// src/lib/mysql/schemas/communication/communication-preference-types.ts
|
|
3919
3887
|
var import_mysql_core2 = require("drizzle-orm/mysql-core");
|
|
3920
|
-
|
|
3921
|
-
|
|
3888
|
+
function getCommunicationPreferenceTypesSchema(mysqlTable) {
|
|
3889
|
+
return mysqlTable("communicationPreferenceType", {
|
|
3922
3890
|
id: (0, import_mysql_core2.varchar)("id", {
|
|
3923
3891
|
length: 255
|
|
3924
3892
|
}).notNull().primaryKey(),
|
|
3925
3893
|
name: (0, import_mysql_core2.varchar)("name", {
|
|
3926
3894
|
length: 255
|
|
3927
|
-
}).notNull()
|
|
3895
|
+
}).notNull(),
|
|
3928
3896
|
description: (0, import_mysql_core2.text)("description"),
|
|
3929
3897
|
active: (0, import_mysql_core2.boolean)("active").notNull().default(true),
|
|
3930
3898
|
createdAt: (0, import_mysql_core2.timestamp)("createdAt", {
|
|
@@ -3934,27 +3902,33 @@ var getPermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
3934
3902
|
updatedAt: (0, import_mysql_core2.timestamp)("updatedAt", {
|
|
3935
3903
|
mode: "date",
|
|
3936
3904
|
fsp: 3
|
|
3937
|
-
})
|
|
3905
|
+
}),
|
|
3938
3906
|
deletedAt: (0, import_mysql_core2.timestamp)("deletedAt", {
|
|
3939
3907
|
mode: "date",
|
|
3940
3908
|
fsp: 3
|
|
3941
3909
|
})
|
|
3942
|
-
}
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
return {
|
|
3946
|
-
permissions
|
|
3947
|
-
};
|
|
3948
|
-
}, "getPermissionsSchema");
|
|
3910
|
+
});
|
|
3911
|
+
}
|
|
3912
|
+
__name(getCommunicationPreferenceTypesSchema, "getCommunicationPreferenceTypesSchema");
|
|
3949
3913
|
|
|
3950
|
-
// src/lib/mysql/schemas/
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3914
|
+
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
3915
|
+
function getCommunicationPreferencesSchema(mysqlTable) {
|
|
3916
|
+
return mysqlTable("communicationPreference", {
|
|
3917
|
+
id: (0, import_mysql_core3.varchar)("id", {
|
|
3918
|
+
length: 255
|
|
3919
|
+
}).notNull().primaryKey(),
|
|
3920
|
+
userId: (0, import_mysql_core3.varchar)("userId", {
|
|
3921
|
+
length: 255
|
|
3922
|
+
}).notNull(),
|
|
3923
|
+
channelId: (0, import_mysql_core3.varchar)("channelId", {
|
|
3955
3924
|
length: 255
|
|
3956
3925
|
}).notNull(),
|
|
3957
|
-
|
|
3926
|
+
preferenceLevel: (0, import_mysql_core3.mysqlEnum)("preferenceLevel", [
|
|
3927
|
+
"low",
|
|
3928
|
+
"medium",
|
|
3929
|
+
"high"
|
|
3930
|
+
]).notNull().default("medium"),
|
|
3931
|
+
preferenceTypeId: (0, import_mysql_core3.varchar)("preferenceTypeId", {
|
|
3958
3932
|
length: 255
|
|
3959
3933
|
}).notNull(),
|
|
3960
3934
|
active: (0, import_mysql_core3.boolean)("active").notNull().default(true),
|
|
@@ -3962,6 +3936,14 @@ var getRolePermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
3962
3936
|
mode: "date",
|
|
3963
3937
|
fsp: 3
|
|
3964
3938
|
}).defaultNow(),
|
|
3939
|
+
optInAt: (0, import_mysql_core3.timestamp)("optInAt", {
|
|
3940
|
+
mode: "date",
|
|
3941
|
+
fsp: 3
|
|
3942
|
+
}),
|
|
3943
|
+
optOutAt: (0, import_mysql_core3.timestamp)("optOutAt", {
|
|
3944
|
+
mode: "date",
|
|
3945
|
+
fsp: 3
|
|
3946
|
+
}),
|
|
3965
3947
|
updatedAt: (0, import_mysql_core3.timestamp)("updatedAt", {
|
|
3966
3948
|
mode: "date",
|
|
3967
3949
|
fsp: 3
|
|
@@ -3970,84 +3952,190 @@ var getRolePermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
3970
3952
|
mode: "date",
|
|
3971
3953
|
fsp: 3
|
|
3972
3954
|
})
|
|
3973
|
-
}, (
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3955
|
+
}, (cp) => ({
|
|
3956
|
+
userIdIdx: (0, import_mysql_core3.index)("userId_idx").on(cp.userId),
|
|
3957
|
+
preferenceTypeIdx: (0, import_mysql_core3.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
3958
|
+
channelIdIdx: (0, import_mysql_core3.index)("channelId_idx").on(cp.channelId)
|
|
3959
|
+
}));
|
|
3960
|
+
}
|
|
3961
|
+
__name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
|
|
3962
|
+
function getCommunicationPreferencesRelationsSchema(mysqlTable) {
|
|
3963
|
+
const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
|
|
3964
|
+
const users = getUsersSchema(mysqlTable);
|
|
3965
|
+
const communicationChannel = getCommunicationChannelSchema(mysqlTable);
|
|
3966
|
+
const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
|
|
3967
|
+
return (0, import_drizzle_orm.relations)(communicationPreferences, ({ one }) => ({
|
|
3968
|
+
user: one(users, {
|
|
3969
|
+
fields: [
|
|
3970
|
+
communicationPreferences.userId
|
|
3971
|
+
],
|
|
3972
|
+
references: [
|
|
3973
|
+
users.id
|
|
3978
3974
|
]
|
|
3979
3975
|
}),
|
|
3980
|
-
|
|
3981
|
-
|
|
3976
|
+
channel: one(communicationChannel, {
|
|
3977
|
+
fields: [
|
|
3978
|
+
communicationPreferences.channelId
|
|
3979
|
+
],
|
|
3980
|
+
references: [
|
|
3981
|
+
communicationChannel.id
|
|
3982
|
+
]
|
|
3983
|
+
}),
|
|
3984
|
+
preferenceType: one(communicationPreferenceTypes, {
|
|
3985
|
+
fields: [
|
|
3986
|
+
communicationPreferences.preferenceTypeId
|
|
3987
|
+
],
|
|
3988
|
+
references: [
|
|
3989
|
+
communicationPreferenceTypes.id
|
|
3990
|
+
]
|
|
3991
|
+
})
|
|
3982
3992
|
}));
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
};
|
|
3986
|
-
}, "getRolePermissionsSchema");
|
|
3993
|
+
}
|
|
3994
|
+
__name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
|
|
3987
3995
|
|
|
3988
|
-
// src/lib/mysql/schemas/
|
|
3996
|
+
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
3997
|
+
var import_drizzle_orm5 = require("drizzle-orm");
|
|
3998
|
+
var import_mysql_core7 = require("drizzle-orm/mysql-core");
|
|
3999
|
+
|
|
4000
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
4001
|
+
var import_drizzle_orm3 = require("drizzle-orm");
|
|
4002
|
+
var import_mysql_core5 = require("drizzle-orm/mysql-core");
|
|
4003
|
+
|
|
4004
|
+
// src/lib/mysql/schemas/content/content-resource-resource.ts
|
|
4005
|
+
var import_drizzle_orm2 = require("drizzle-orm");
|
|
3989
4006
|
var import_mysql_core4 = require("drizzle-orm/mysql-core");
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
4007
|
+
function getContentResourceResourceSchema(mysqlTable) {
|
|
4008
|
+
return mysqlTable("contentResourceResource", {
|
|
4009
|
+
resourceOfId: (0, import_mysql_core4.varchar)("resourceOfId", {
|
|
3993
4010
|
length: 255
|
|
3994
|
-
}).notNull()
|
|
3995
|
-
|
|
4011
|
+
}).notNull(),
|
|
4012
|
+
resourceId: (0, import_mysql_core4.varchar)("resourceId", {
|
|
3996
4013
|
length: 255
|
|
3997
|
-
}).notNull()
|
|
3998
|
-
|
|
3999
|
-
|
|
4014
|
+
}).notNull(),
|
|
4015
|
+
position: (0, import_mysql_core4.double)("position").notNull().default(0),
|
|
4016
|
+
metadata: (0, import_mysql_core4.json)("fields").$type().default({}),
|
|
4000
4017
|
createdAt: (0, import_mysql_core4.timestamp)("createdAt", {
|
|
4001
4018
|
mode: "date",
|
|
4002
4019
|
fsp: 3
|
|
4003
|
-
}).
|
|
4020
|
+
}).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP(3)`),
|
|
4004
4021
|
updatedAt: (0, import_mysql_core4.timestamp)("updatedAt", {
|
|
4005
4022
|
mode: "date",
|
|
4006
4023
|
fsp: 3
|
|
4007
|
-
}).
|
|
4024
|
+
}).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP(3)`),
|
|
4008
4025
|
deletedAt: (0, import_mysql_core4.timestamp)("deletedAt", {
|
|
4009
4026
|
mode: "date",
|
|
4010
4027
|
fsp: 3
|
|
4011
4028
|
})
|
|
4012
|
-
}, (
|
|
4013
|
-
|
|
4029
|
+
}, (crr) => ({
|
|
4030
|
+
pk: (0, import_mysql_core4.primaryKey)({
|
|
4031
|
+
columns: [
|
|
4032
|
+
crr.resourceOfId,
|
|
4033
|
+
crr.resourceId
|
|
4034
|
+
]
|
|
4035
|
+
}),
|
|
4036
|
+
contentResourceIdIdx: (0, import_mysql_core4.index)("contentResourceId_idx").on(crr.resourceOfId),
|
|
4037
|
+
resourceIdIdx: (0, import_mysql_core4.index)("resourceId_idx").on(crr.resourceId)
|
|
4014
4038
|
}));
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4039
|
+
}
|
|
4040
|
+
__name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
|
|
4041
|
+
function getContentResourceResourceRelationsSchema(mysqlTable) {
|
|
4042
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
4043
|
+
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
4044
|
+
return (0, import_drizzle_orm2.relations)(contentResourceResource, ({ one }) => ({
|
|
4045
|
+
resourceOf: one(contentResource, {
|
|
4046
|
+
fields: [
|
|
4047
|
+
contentResourceResource.resourceOfId
|
|
4048
|
+
],
|
|
4049
|
+
references: [
|
|
4050
|
+
contentResource.id
|
|
4051
|
+
],
|
|
4052
|
+
relationName: "resourceOf"
|
|
4053
|
+
}),
|
|
4054
|
+
resource: one(contentResource, {
|
|
4055
|
+
fields: [
|
|
4056
|
+
contentResourceResource.resourceId
|
|
4057
|
+
],
|
|
4058
|
+
references: [
|
|
4059
|
+
contentResource.id
|
|
4060
|
+
],
|
|
4061
|
+
relationName: "resource"
|
|
4062
|
+
})
|
|
4063
|
+
}));
|
|
4064
|
+
}
|
|
4065
|
+
__name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
|
|
4019
4066
|
|
|
4020
|
-
// src/lib/mysql/schemas/
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
sessionToken: (0, import_mysql_core5.varchar)("sessionToken", {
|
|
4067
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
4068
|
+
function getContentResourceSchema(mysqlTable) {
|
|
4069
|
+
return mysqlTable("contentResource", {
|
|
4070
|
+
id: (0, import_mysql_core5.varchar)("id", {
|
|
4025
4071
|
length: 255
|
|
4026
4072
|
}).notNull().primaryKey(),
|
|
4027
|
-
|
|
4073
|
+
type: (0, import_mysql_core5.varchar)("type", {
|
|
4028
4074
|
length: 255
|
|
4029
4075
|
}).notNull(),
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
}).notNull()
|
|
4033
|
-
|
|
4034
|
-
|
|
4076
|
+
createdById: (0, import_mysql_core5.varchar)("createdById", {
|
|
4077
|
+
length: 255
|
|
4078
|
+
}).notNull(),
|
|
4079
|
+
fields: (0, import_mysql_core5.json)("fields").$type().default({}),
|
|
4080
|
+
createdAt: (0, import_mysql_core5.timestamp)("createdAt", {
|
|
4081
|
+
mode: "date",
|
|
4082
|
+
fsp: 3
|
|
4083
|
+
}).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`),
|
|
4084
|
+
updatedAt: (0, import_mysql_core5.timestamp)("updatedAt", {
|
|
4085
|
+
mode: "date",
|
|
4086
|
+
fsp: 3
|
|
4087
|
+
}).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`),
|
|
4088
|
+
deletedAt: (0, import_mysql_core5.timestamp)("deletedAt", {
|
|
4089
|
+
mode: "date",
|
|
4090
|
+
fsp: 3
|
|
4091
|
+
})
|
|
4092
|
+
}, (cm) => ({
|
|
4093
|
+
typeIdx: (0, import_mysql_core5.index)("type_idx").on(cm.type),
|
|
4094
|
+
createdByIdx: (0, import_mysql_core5.index)("createdById_idx").on(cm.createdById),
|
|
4095
|
+
createdAtIdx: (0, import_mysql_core5.index)("createdAt_idx").on(cm.createdAt)
|
|
4035
4096
|
}));
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4097
|
+
}
|
|
4098
|
+
__name(getContentResourceSchema, "getContentResourceSchema");
|
|
4099
|
+
function getContentResourceRelationsSchema(mysqlTable) {
|
|
4100
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
4101
|
+
const users = getUsersSchema(mysqlTable);
|
|
4102
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
4103
|
+
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
4104
|
+
return (0, import_drizzle_orm3.relations)(contentResource, ({ one, many }) => ({
|
|
4105
|
+
createdBy: one(users, {
|
|
4106
|
+
fields: [
|
|
4107
|
+
contentResource.createdById
|
|
4108
|
+
],
|
|
4109
|
+
references: [
|
|
4110
|
+
users.id
|
|
4111
|
+
]
|
|
4112
|
+
}),
|
|
4113
|
+
contributions: many(contentContributions),
|
|
4114
|
+
resources: many(contentResourceResource, {
|
|
4115
|
+
relationName: "resourceOf"
|
|
4116
|
+
}),
|
|
4117
|
+
resourceOf: many(contentResourceResource, {
|
|
4118
|
+
relationName: "resource"
|
|
4119
|
+
})
|
|
4120
|
+
}));
|
|
4121
|
+
}
|
|
4122
|
+
__name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
|
|
4040
4123
|
|
|
4041
|
-
// src/lib/mysql/schemas/
|
|
4124
|
+
// src/lib/mysql/schemas/content/contribution-types.ts
|
|
4125
|
+
var import_drizzle_orm4 = require("drizzle-orm");
|
|
4042
4126
|
var import_mysql_core6 = require("drizzle-orm/mysql-core");
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4127
|
+
function getContributionTypesSchema(mysqlTable) {
|
|
4128
|
+
return mysqlTable("contributionType", {
|
|
4129
|
+
id: (0, import_mysql_core6.varchar)("id", {
|
|
4046
4130
|
length: 255
|
|
4047
|
-
}).notNull(),
|
|
4048
|
-
|
|
4131
|
+
}).notNull().primaryKey(),
|
|
4132
|
+
slug: (0, import_mysql_core6.varchar)("slug", {
|
|
4133
|
+
length: 255
|
|
4134
|
+
}).notNull().unique(),
|
|
4135
|
+
name: (0, import_mysql_core6.varchar)("name", {
|
|
4049
4136
|
length: 255
|
|
4050
4137
|
}).notNull(),
|
|
4138
|
+
description: (0, import_mysql_core6.text)("description"),
|
|
4051
4139
|
active: (0, import_mysql_core6.boolean)("active").notNull().default(true),
|
|
4052
4140
|
createdAt: (0, import_mysql_core6.timestamp)("createdAt", {
|
|
4053
4141
|
mode: "date",
|
|
@@ -4061,29 +4149,34 @@ var getUserPermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4061
4149
|
mode: "date",
|
|
4062
4150
|
fsp: 3
|
|
4063
4151
|
})
|
|
4064
|
-
}, (
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
up.userId,
|
|
4068
|
-
up.permissionId
|
|
4069
|
-
]
|
|
4070
|
-
}),
|
|
4071
|
-
userIdIdx: (0, import_mysql_core6.index)("userId_idx").on(up.userId),
|
|
4072
|
-
permissionIdIdx: (0, import_mysql_core6.index)("permissionId_idx").on(up.permissionId)
|
|
4152
|
+
}, (ct) => ({
|
|
4153
|
+
nameIdx: (0, import_mysql_core6.index)("name_idx").on(ct.name),
|
|
4154
|
+
slugIdx: (0, import_mysql_core6.index)("slug_idx").on(ct.slug)
|
|
4073
4155
|
}));
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4156
|
+
}
|
|
4157
|
+
__name(getContributionTypesSchema, "getContributionTypesSchema");
|
|
4158
|
+
function getContributionTypesRelationsSchema(mysqlTable) {
|
|
4159
|
+
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
4160
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
4161
|
+
return (0, import_drizzle_orm4.relations)(contributionTypes, ({ many }) => ({
|
|
4162
|
+
contributions: many(contentContributions)
|
|
4163
|
+
}));
|
|
4164
|
+
}
|
|
4165
|
+
__name(getContributionTypesRelationsSchema, "getContributionTypesRelationsSchema");
|
|
4078
4166
|
|
|
4079
|
-
// src/lib/mysql/schemas/
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4167
|
+
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
4168
|
+
function getContentContributionsSchema(mysqlTable) {
|
|
4169
|
+
return mysqlTable("contentContribution", {
|
|
4170
|
+
id: (0, import_mysql_core7.varchar)("id", {
|
|
4171
|
+
length: 255
|
|
4172
|
+
}).notNull().primaryKey(),
|
|
4083
4173
|
userId: (0, import_mysql_core7.varchar)("userId", {
|
|
4084
4174
|
length: 255
|
|
4085
4175
|
}).notNull(),
|
|
4086
|
-
|
|
4176
|
+
contentId: (0, import_mysql_core7.varchar)("contentId", {
|
|
4177
|
+
length: 255
|
|
4178
|
+
}).notNull(),
|
|
4179
|
+
contributionTypeId: (0, import_mysql_core7.varchar)("contributionTypeId", {
|
|
4087
4180
|
length: 255
|
|
4088
4181
|
}).notNull(),
|
|
4089
4182
|
active: (0, import_mysql_core7.boolean)("active").notNull().default(true),
|
|
@@ -4099,166 +4192,561 @@ var getUserRolesSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4099
4192
|
mode: "date",
|
|
4100
4193
|
fsp: 3
|
|
4101
4194
|
})
|
|
4195
|
+
}, (cc) => ({
|
|
4196
|
+
userIdIdx: (0, import_mysql_core7.index)("userId_idx").on(cc.userId),
|
|
4197
|
+
contentIdIdx: (0, import_mysql_core7.index)("contentId_idx").on(cc.contentId),
|
|
4198
|
+
contributionTypeIdIdx: (0, import_mysql_core7.index)("contributionTypeId_idx").on(cc.contributionTypeId)
|
|
4199
|
+
}));
|
|
4200
|
+
}
|
|
4201
|
+
__name(getContentContributionsSchema, "getContentContributionsSchema");
|
|
4202
|
+
function getContentContributionRelationsSchema(mysqlTable) {
|
|
4203
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
4204
|
+
const users = getUsersSchema(mysqlTable);
|
|
4205
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
4206
|
+
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
4207
|
+
return (0, import_drizzle_orm5.relations)(contentContributions, ({ one }) => ({
|
|
4208
|
+
user: one(users, {
|
|
4209
|
+
fields: [
|
|
4210
|
+
contentContributions.userId
|
|
4211
|
+
],
|
|
4212
|
+
references: [
|
|
4213
|
+
users.id
|
|
4214
|
+
]
|
|
4215
|
+
}),
|
|
4216
|
+
content: one(contentResource, {
|
|
4217
|
+
fields: [
|
|
4218
|
+
contentContributions.contentId
|
|
4219
|
+
],
|
|
4220
|
+
references: [
|
|
4221
|
+
contentResource.id
|
|
4222
|
+
]
|
|
4223
|
+
}),
|
|
4224
|
+
contributionType: one(contributionTypes, {
|
|
4225
|
+
fields: [
|
|
4226
|
+
contentContributions.contributionTypeId
|
|
4227
|
+
],
|
|
4228
|
+
references: [
|
|
4229
|
+
contributionTypes.id
|
|
4230
|
+
]
|
|
4231
|
+
})
|
|
4232
|
+
}));
|
|
4233
|
+
}
|
|
4234
|
+
__name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
|
|
4235
|
+
|
|
4236
|
+
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
4237
|
+
var import_drizzle_orm10 = require("drizzle-orm");
|
|
4238
|
+
var import_mysql_core12 = require("drizzle-orm/mysql-core");
|
|
4239
|
+
|
|
4240
|
+
// src/lib/mysql/schemas/auth/permissions.ts
|
|
4241
|
+
var import_drizzle_orm9 = require("drizzle-orm");
|
|
4242
|
+
var import_mysql_core11 = require("drizzle-orm/mysql-core");
|
|
4243
|
+
|
|
4244
|
+
// src/lib/mysql/schemas/auth/role-permissions.ts
|
|
4245
|
+
var import_drizzle_orm8 = require("drizzle-orm");
|
|
4246
|
+
var import_mysql_core10 = require("drizzle-orm/mysql-core");
|
|
4247
|
+
|
|
4248
|
+
// src/lib/mysql/schemas/auth/roles.ts
|
|
4249
|
+
var import_drizzle_orm7 = require("drizzle-orm");
|
|
4250
|
+
var import_mysql_core9 = require("drizzle-orm/mysql-core");
|
|
4251
|
+
|
|
4252
|
+
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
4253
|
+
var import_drizzle_orm6 = require("drizzle-orm");
|
|
4254
|
+
var import_mysql_core8 = require("drizzle-orm/mysql-core");
|
|
4255
|
+
function getUserRolesSchema(mysqlTable) {
|
|
4256
|
+
return mysqlTable("userRole", {
|
|
4257
|
+
userId: (0, import_mysql_core8.varchar)("userId", {
|
|
4258
|
+
length: 255
|
|
4259
|
+
}).notNull(),
|
|
4260
|
+
roleId: (0, import_mysql_core8.varchar)("roleId", {
|
|
4261
|
+
length: 255
|
|
4262
|
+
}).notNull(),
|
|
4263
|
+
active: (0, import_mysql_core8.boolean)("active").notNull().default(true),
|
|
4264
|
+
createdAt: (0, import_mysql_core8.timestamp)("createdAt", {
|
|
4265
|
+
mode: "date",
|
|
4266
|
+
fsp: 3
|
|
4267
|
+
}).defaultNow(),
|
|
4268
|
+
updatedAt: (0, import_mysql_core8.timestamp)("updatedAt", {
|
|
4269
|
+
mode: "date",
|
|
4270
|
+
fsp: 3
|
|
4271
|
+
}).defaultNow(),
|
|
4272
|
+
deletedAt: (0, import_mysql_core8.timestamp)("deletedAt", {
|
|
4273
|
+
mode: "date",
|
|
4274
|
+
fsp: 3
|
|
4275
|
+
})
|
|
4102
4276
|
}, (ur) => ({
|
|
4103
|
-
pk: (0,
|
|
4277
|
+
pk: (0, import_mysql_core8.primaryKey)({
|
|
4104
4278
|
columns: [
|
|
4105
4279
|
ur.userId,
|
|
4106
4280
|
ur.roleId
|
|
4107
4281
|
]
|
|
4108
4282
|
}),
|
|
4109
|
-
userIdIdx: (0,
|
|
4110
|
-
roleIdIdx: (0,
|
|
4283
|
+
userIdIdx: (0, import_mysql_core8.index)("userId_idx").on(ur.userId),
|
|
4284
|
+
roleIdIdx: (0, import_mysql_core8.index)("roleId_idx").on(ur.roleId)
|
|
4111
4285
|
}));
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4286
|
+
}
|
|
4287
|
+
__name(getUserRolesSchema, "getUserRolesSchema");
|
|
4288
|
+
function getUserRolesRelationsSchema(mysqlTable) {
|
|
4289
|
+
const userRoles = getUserRolesSchema(mysqlTable);
|
|
4290
|
+
const users = getUsersSchema(mysqlTable);
|
|
4291
|
+
const roles = getRolesSchema(mysqlTable);
|
|
4292
|
+
return (0, import_drizzle_orm6.relations)(userRoles, ({ one }) => ({
|
|
4293
|
+
user: one(users, {
|
|
4294
|
+
fields: [
|
|
4295
|
+
userRoles.userId
|
|
4296
|
+
],
|
|
4297
|
+
references: [
|
|
4298
|
+
users.id
|
|
4299
|
+
]
|
|
4300
|
+
}),
|
|
4301
|
+
role: one(roles, {
|
|
4302
|
+
fields: [
|
|
4303
|
+
userRoles.roleId
|
|
4304
|
+
],
|
|
4305
|
+
references: [
|
|
4306
|
+
roles.id
|
|
4307
|
+
]
|
|
4308
|
+
})
|
|
4309
|
+
}));
|
|
4310
|
+
}
|
|
4311
|
+
__name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
|
|
4116
4312
|
|
|
4117
|
-
// src/lib/mysql/schemas/auth/
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
const users = mysqlTable("user", {
|
|
4122
|
-
id: (0, import_mysql_core8.varchar)("id", {
|
|
4313
|
+
// src/lib/mysql/schemas/auth/roles.ts
|
|
4314
|
+
function getRolesSchema(mysqlTable) {
|
|
4315
|
+
return mysqlTable("role", {
|
|
4316
|
+
id: (0, import_mysql_core9.varchar)("id", {
|
|
4123
4317
|
length: 255
|
|
4124
4318
|
}).notNull().primaryKey(),
|
|
4125
|
-
name: (0,
|
|
4126
|
-
length: 255
|
|
4127
|
-
}),
|
|
4128
|
-
role: (0, import_mysql_core8.mysqlEnum)("role", [
|
|
4129
|
-
"user",
|
|
4130
|
-
"admin"
|
|
4131
|
-
]).default("user"),
|
|
4132
|
-
email: (0, import_mysql_core8.varchar)("email", {
|
|
4319
|
+
name: (0, import_mysql_core9.varchar)("name", {
|
|
4133
4320
|
length: 255
|
|
4134
4321
|
}).notNull().unique(),
|
|
4135
|
-
|
|
4322
|
+
description: (0, import_mysql_core9.text)("description"),
|
|
4323
|
+
active: (0, import_mysql_core9.boolean)("active").notNull().default(true),
|
|
4324
|
+
createdAt: (0, import_mysql_core9.timestamp)("createdAt", {
|
|
4136
4325
|
mode: "date",
|
|
4137
4326
|
fsp: 3
|
|
4138
|
-
}),
|
|
4139
|
-
|
|
4140
|
-
length: 255
|
|
4141
|
-
}),
|
|
4142
|
-
createdAt: (0, import_mysql_core8.timestamp)("createdAt", {
|
|
4327
|
+
}).defaultNow(),
|
|
4328
|
+
updatedAt: (0, import_mysql_core9.timestamp)("updatedAt", {
|
|
4143
4329
|
mode: "date",
|
|
4144
4330
|
fsp: 3
|
|
4145
|
-
}).
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4331
|
+
}).defaultNow(),
|
|
4332
|
+
deletedAt: (0, import_mysql_core9.timestamp)("deletedAt", {
|
|
4333
|
+
mode: "date",
|
|
4334
|
+
fsp: 3
|
|
4335
|
+
})
|
|
4336
|
+
}, (role) => ({
|
|
4337
|
+
nameIdx: (0, import_mysql_core9.index)("name_idx").on(role.name)
|
|
4149
4338
|
}));
|
|
4150
|
-
return {
|
|
4151
|
-
users
|
|
4152
|
-
};
|
|
4153
4339
|
}
|
|
4154
|
-
__name(
|
|
4340
|
+
__name(getRolesSchema, "getRolesSchema");
|
|
4341
|
+
function getRolesRelationsSchema(mysqlTable) {
|
|
4342
|
+
const roles = getRolesSchema(mysqlTable);
|
|
4343
|
+
const userRoles = getUserRolesSchema(mysqlTable);
|
|
4344
|
+
return (0, import_drizzle_orm7.relations)(roles, ({ many }) => ({
|
|
4345
|
+
userRoles: many(userRoles)
|
|
4346
|
+
}));
|
|
4347
|
+
}
|
|
4348
|
+
__name(getRolesRelationsSchema, "getRolesRelationsSchema");
|
|
4155
4349
|
|
|
4156
|
-
// src/lib/mysql/schemas/auth/
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
identifier: (0, import_mysql_core9.varchar)("identifier", {
|
|
4350
|
+
// src/lib/mysql/schemas/auth/role-permissions.ts
|
|
4351
|
+
function getRolePermissionsSchema(mysqlTable) {
|
|
4352
|
+
return mysqlTable("rolePermission", {
|
|
4353
|
+
roleId: (0, import_mysql_core10.varchar)("roleId", {
|
|
4161
4354
|
length: 255
|
|
4162
4355
|
}).notNull(),
|
|
4163
|
-
|
|
4356
|
+
permissionId: (0, import_mysql_core10.varchar)("permissionId", {
|
|
4164
4357
|
length: 255
|
|
4165
4358
|
}).notNull(),
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4359
|
+
active: (0, import_mysql_core10.boolean)("active").notNull().default(true),
|
|
4360
|
+
createdAt: (0, import_mysql_core10.timestamp)("createdAt", {
|
|
4361
|
+
mode: "date",
|
|
4362
|
+
fsp: 3
|
|
4363
|
+
}).defaultNow(),
|
|
4364
|
+
updatedAt: (0, import_mysql_core10.timestamp)("updatedAt", {
|
|
4365
|
+
mode: "date",
|
|
4366
|
+
fsp: 3
|
|
4367
|
+
}).defaultNow(),
|
|
4368
|
+
deletedAt: (0, import_mysql_core10.timestamp)("deletedAt", {
|
|
4369
|
+
mode: "date",
|
|
4370
|
+
fsp: 3
|
|
4371
|
+
})
|
|
4372
|
+
}, (rp) => ({
|
|
4373
|
+
pk: (0, import_mysql_core10.primaryKey)({
|
|
4374
|
+
columns: [
|
|
4375
|
+
rp.roleId,
|
|
4376
|
+
rp.permissionId
|
|
4377
|
+
]
|
|
4378
|
+
}),
|
|
4379
|
+
roleIdIdx: (0, import_mysql_core10.index)("roleId_idx").on(rp.roleId),
|
|
4380
|
+
permissionIdIdx: (0, import_mysql_core10.index)("permissionId_idx").on(rp.permissionId)
|
|
4381
|
+
}));
|
|
4382
|
+
}
|
|
4383
|
+
__name(getRolePermissionsSchema, "getRolePermissionsSchema");
|
|
4384
|
+
function getRolePermissionsRelationsSchema(mysqlTable) {
|
|
4385
|
+
const permissions = getPermissionsSchema(mysqlTable);
|
|
4386
|
+
const roles = getRolesSchema(mysqlTable);
|
|
4387
|
+
const rolePermissions = getRolePermissionsSchema(mysqlTable);
|
|
4388
|
+
return (0, import_drizzle_orm8.relations)(rolePermissions, ({ one }) => ({
|
|
4389
|
+
role: one(roles, {
|
|
4390
|
+
fields: [
|
|
4391
|
+
rolePermissions.roleId
|
|
4392
|
+
],
|
|
4393
|
+
references: [
|
|
4394
|
+
roles.id
|
|
4395
|
+
]
|
|
4396
|
+
}),
|
|
4397
|
+
permission: one(permissions, {
|
|
4398
|
+
fields: [
|
|
4399
|
+
rolePermissions.permissionId
|
|
4400
|
+
],
|
|
4401
|
+
references: [
|
|
4402
|
+
permissions.id
|
|
4403
|
+
]
|
|
4404
|
+
})
|
|
4405
|
+
}));
|
|
4406
|
+
}
|
|
4407
|
+
__name(getRolePermissionsRelationsSchema, "getRolePermissionsRelationsSchema");
|
|
4408
|
+
|
|
4409
|
+
// src/lib/mysql/schemas/auth/permissions.ts
|
|
4410
|
+
function getPermissionsSchema(mysqlTable) {
|
|
4411
|
+
return mysqlTable("permission", {
|
|
4412
|
+
id: (0, import_mysql_core11.varchar)("id", {
|
|
4413
|
+
length: 255
|
|
4414
|
+
}).notNull().primaryKey(),
|
|
4415
|
+
name: (0, import_mysql_core11.varchar)("name", {
|
|
4416
|
+
length: 255
|
|
4417
|
+
}).notNull().unique(),
|
|
4418
|
+
description: (0, import_mysql_core11.text)("description"),
|
|
4419
|
+
active: (0, import_mysql_core11.boolean)("active").notNull().default(true),
|
|
4420
|
+
createdAt: (0, import_mysql_core11.timestamp)("createdAt", {
|
|
4421
|
+
mode: "date",
|
|
4422
|
+
fsp: 3
|
|
4423
|
+
}).defaultNow(),
|
|
4424
|
+
updatedAt: (0, import_mysql_core11.timestamp)("updatedAt", {
|
|
4425
|
+
mode: "date",
|
|
4426
|
+
fsp: 3
|
|
4427
|
+
}).defaultNow(),
|
|
4428
|
+
deletedAt: (0, import_mysql_core11.timestamp)("deletedAt", {
|
|
4429
|
+
mode: "date",
|
|
4430
|
+
fsp: 3
|
|
4431
|
+
})
|
|
4432
|
+
}, (permission) => ({
|
|
4433
|
+
nameIdx: (0, import_mysql_core11.index)("name_idx").on(permission.name)
|
|
4434
|
+
}));
|
|
4435
|
+
}
|
|
4436
|
+
__name(getPermissionsSchema, "getPermissionsSchema");
|
|
4437
|
+
function getPermissionsRelationsSchema(mysqlTable) {
|
|
4438
|
+
return (0, import_drizzle_orm9.relations)(getPermissionsSchema(mysqlTable), ({ many }) => ({
|
|
4439
|
+
rolePermissions: many(getRolePermissionsSchema(mysqlTable))
|
|
4440
|
+
}));
|
|
4441
|
+
}
|
|
4442
|
+
__name(getPermissionsRelationsSchema, "getPermissionsRelationsSchema");
|
|
4443
|
+
|
|
4444
|
+
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
4445
|
+
function getUserPermissionsSchema(mysqlTable) {
|
|
4446
|
+
return mysqlTable("userPermission", {
|
|
4447
|
+
userId: (0, import_mysql_core12.varchar)("userId", {
|
|
4448
|
+
length: 255
|
|
4449
|
+
}).notNull(),
|
|
4450
|
+
permissionId: (0, import_mysql_core12.varchar)("permissionId", {
|
|
4451
|
+
length: 255
|
|
4452
|
+
}).notNull(),
|
|
4453
|
+
active: (0, import_mysql_core12.boolean)("active").notNull().default(true),
|
|
4454
|
+
createdAt: (0, import_mysql_core12.timestamp)("createdAt", {
|
|
4455
|
+
mode: "date",
|
|
4456
|
+
fsp: 3
|
|
4457
|
+
}).defaultNow(),
|
|
4458
|
+
updatedAt: (0, import_mysql_core12.timestamp)("updatedAt", {
|
|
4459
|
+
mode: "date",
|
|
4460
|
+
fsp: 3
|
|
4461
|
+
}).defaultNow(),
|
|
4462
|
+
deletedAt: (0, import_mysql_core12.timestamp)("deletedAt", {
|
|
4463
|
+
mode: "date",
|
|
4464
|
+
fsp: 3
|
|
4465
|
+
})
|
|
4466
|
+
}, (up) => ({
|
|
4467
|
+
pk: (0, import_mysql_core12.primaryKey)({
|
|
4468
|
+
columns: [
|
|
4469
|
+
up.userId,
|
|
4470
|
+
up.permissionId
|
|
4471
|
+
]
|
|
4472
|
+
}),
|
|
4473
|
+
userIdIdx: (0, import_mysql_core12.index)("userId_idx").on(up.userId),
|
|
4474
|
+
permissionIdIdx: (0, import_mysql_core12.index)("permissionId_idx").on(up.permissionId)
|
|
4475
|
+
}));
|
|
4476
|
+
}
|
|
4477
|
+
__name(getUserPermissionsSchema, "getUserPermissionsSchema");
|
|
4478
|
+
function getUserPermissionsRelationsSchema(mysqlTable) {
|
|
4479
|
+
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
4480
|
+
const users = getUsersSchema(mysqlTable);
|
|
4481
|
+
const permissions = getPermissionsSchema(mysqlTable);
|
|
4482
|
+
return (0, import_drizzle_orm10.relations)(userPermissions, ({ one }) => ({
|
|
4483
|
+
user: one(users, {
|
|
4484
|
+
fields: [
|
|
4485
|
+
userPermissions.userId
|
|
4486
|
+
],
|
|
4487
|
+
references: [
|
|
4488
|
+
users.id
|
|
4489
|
+
]
|
|
4490
|
+
}),
|
|
4491
|
+
permission: one(permissions, {
|
|
4492
|
+
fields: [
|
|
4493
|
+
userPermissions.permissionId
|
|
4494
|
+
],
|
|
4495
|
+
references: [
|
|
4496
|
+
permissions.id
|
|
4497
|
+
]
|
|
4498
|
+
})
|
|
4499
|
+
}));
|
|
4500
|
+
}
|
|
4501
|
+
__name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
|
|
4502
|
+
|
|
4503
|
+
// src/lib/mysql/schemas/auth/users.ts
|
|
4504
|
+
function getUsersSchema(mysqlTable) {
|
|
4505
|
+
return mysqlTable("user", {
|
|
4506
|
+
id: (0, import_mysql_core13.varchar)("id", {
|
|
4507
|
+
length: 255
|
|
4508
|
+
}).notNull().primaryKey(),
|
|
4509
|
+
name: (0, import_mysql_core13.varchar)("name", {
|
|
4510
|
+
length: 255
|
|
4511
|
+
}),
|
|
4512
|
+
role: (0, import_mysql_core13.mysqlEnum)("role", [
|
|
4513
|
+
"user",
|
|
4514
|
+
"admin"
|
|
4515
|
+
]).default("user"),
|
|
4516
|
+
email: (0, import_mysql_core13.varchar)("email", {
|
|
4517
|
+
length: 255
|
|
4518
|
+
}).notNull().unique(),
|
|
4519
|
+
emailVerified: (0, import_mysql_core13.timestamp)("emailVerified", {
|
|
4520
|
+
mode: "date",
|
|
4521
|
+
fsp: 3
|
|
4522
|
+
}),
|
|
4523
|
+
image: (0, import_mysql_core13.varchar)("image", {
|
|
4524
|
+
length: 255
|
|
4525
|
+
}),
|
|
4526
|
+
createdAt: (0, import_mysql_core13.timestamp)("createdAt", {
|
|
4527
|
+
mode: "date",
|
|
4528
|
+
fsp: 3
|
|
4529
|
+
}).default(import_drizzle_orm11.sql`CURRENT_TIMESTAMP(3)`)
|
|
4530
|
+
}, (user) => ({
|
|
4531
|
+
emailIdx: (0, import_mysql_core13.index)("email_idx").on(user.email),
|
|
4532
|
+
roleIdx: (0, import_mysql_core13.index)("role_idx").on(user.role)
|
|
4533
|
+
}));
|
|
4534
|
+
}
|
|
4535
|
+
__name(getUsersSchema, "getUsersSchema");
|
|
4536
|
+
function getUsersRelationsSchema(mysqlTable) {
|
|
4537
|
+
const users = getUsersSchema(mysqlTable);
|
|
4538
|
+
const accounts = getAccountsSchema(mysqlTable);
|
|
4539
|
+
const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
|
|
4540
|
+
const userRoles = getUserRolesSchema(mysqlTable);
|
|
4541
|
+
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
4542
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
4543
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
4544
|
+
return (0, import_drizzle_orm11.relations)(users, ({ many }) => ({
|
|
4545
|
+
accounts: many(accounts),
|
|
4546
|
+
communicationPreferences: many(communicationPreferences),
|
|
4547
|
+
userRoles: many(userRoles),
|
|
4548
|
+
userPermissions: many(userPermissions),
|
|
4549
|
+
contributions: many(contentContributions),
|
|
4550
|
+
createdContent: many(contentResource)
|
|
4551
|
+
}));
|
|
4552
|
+
}
|
|
4553
|
+
__name(getUsersRelationsSchema, "getUsersRelationsSchema");
|
|
4554
|
+
|
|
4555
|
+
// src/lib/mysql/schemas/auth/accounts.ts
|
|
4556
|
+
function getAccountsSchema(mysqlTable) {
|
|
4557
|
+
return mysqlTable("account", {
|
|
4558
|
+
userId: (0, import_mysql_core14.varchar)("userId", {
|
|
4559
|
+
length: 255
|
|
4560
|
+
}).notNull(),
|
|
4561
|
+
type: (0, import_mysql_core14.varchar)("type", {
|
|
4562
|
+
length: 255
|
|
4563
|
+
}).$type().notNull(),
|
|
4564
|
+
provider: (0, import_mysql_core14.varchar)("provider", {
|
|
4565
|
+
length: 255
|
|
4566
|
+
}).notNull(),
|
|
4567
|
+
providerAccountId: (0, import_mysql_core14.varchar)("providerAccountId", {
|
|
4568
|
+
length: 255
|
|
4569
|
+
}).notNull(),
|
|
4570
|
+
refresh_token: (0, import_mysql_core14.text)("refresh_token"),
|
|
4571
|
+
access_token: (0, import_mysql_core14.text)("access_token"),
|
|
4572
|
+
oauth_token: (0, import_mysql_core14.text)("oauth_token"),
|
|
4573
|
+
oauth_token_secret: (0, import_mysql_core14.text)("oauth_token_secret"),
|
|
4574
|
+
expires_at: (0, import_mysql_core14.int)("expires_at"),
|
|
4575
|
+
token_type: (0, import_mysql_core14.varchar)("token_type", {
|
|
4576
|
+
length: 255
|
|
4577
|
+
}),
|
|
4578
|
+
scope: (0, import_mysql_core14.varchar)("scope", {
|
|
4579
|
+
length: 255
|
|
4580
|
+
}),
|
|
4581
|
+
id_token: (0, import_mysql_core14.text)("id_token"),
|
|
4582
|
+
session_state: (0, import_mysql_core14.varchar)("session_state", {
|
|
4583
|
+
length: 255
|
|
4584
|
+
}),
|
|
4585
|
+
refresh_token_expires_in: (0, import_mysql_core14.int)("refresh_token_expires_in")
|
|
4586
|
+
}, (account) => ({
|
|
4587
|
+
pk: (0, import_mysql_core14.primaryKey)({
|
|
4588
|
+
columns: [
|
|
4589
|
+
account.provider,
|
|
4590
|
+
account.providerAccountId
|
|
4591
|
+
]
|
|
4592
|
+
}),
|
|
4593
|
+
userIdIdx: (0, import_mysql_core14.index)("userId_idx").on(account.userId)
|
|
4594
|
+
}));
|
|
4595
|
+
}
|
|
4596
|
+
__name(getAccountsSchema, "getAccountsSchema");
|
|
4597
|
+
function getAccountsRelationsSchema(mysqlTable) {
|
|
4598
|
+
const accounts = getAccountsSchema(mysqlTable);
|
|
4599
|
+
const users = getUsersSchema(mysqlTable);
|
|
4600
|
+
return (0, import_drizzle_orm12.relations)(accounts, ({ one }) => ({
|
|
4601
|
+
user: one(users, {
|
|
4602
|
+
fields: [
|
|
4603
|
+
accounts.userId
|
|
4604
|
+
],
|
|
4605
|
+
references: [
|
|
4606
|
+
users.id
|
|
4607
|
+
]
|
|
4608
|
+
})
|
|
4609
|
+
}));
|
|
4610
|
+
}
|
|
4611
|
+
__name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
|
|
4612
|
+
|
|
4613
|
+
// src/lib/mysql/schemas/auth/sessions.ts
|
|
4614
|
+
var import_drizzle_orm13 = require("drizzle-orm");
|
|
4615
|
+
var import_mysql_core15 = require("drizzle-orm/mysql-core");
|
|
4616
|
+
function getSessionsSchema(mysqlTable) {
|
|
4617
|
+
return mysqlTable("session", {
|
|
4618
|
+
sessionToken: (0, import_mysql_core15.varchar)("sessionToken", {
|
|
4619
|
+
length: 255
|
|
4620
|
+
}).notNull().primaryKey(),
|
|
4621
|
+
userId: (0, import_mysql_core15.varchar)("userId", {
|
|
4622
|
+
length: 255
|
|
4623
|
+
}).notNull(),
|
|
4624
|
+
expires: (0, import_mysql_core15.timestamp)("expires", {
|
|
4625
|
+
mode: "date"
|
|
4626
|
+
}).notNull()
|
|
4627
|
+
}, (session) => ({
|
|
4628
|
+
userIdIdx: (0, import_mysql_core15.index)("userId_idx").on(session.userId)
|
|
4629
|
+
}));
|
|
4630
|
+
}
|
|
4631
|
+
__name(getSessionsSchema, "getSessionsSchema");
|
|
4632
|
+
function getSessionRelationsSchema(mysqlTable) {
|
|
4633
|
+
const sessions = getSessionsSchema(mysqlTable);
|
|
4634
|
+
const users = getUsersSchema(mysqlTable);
|
|
4635
|
+
return (0, import_drizzle_orm13.relations)(sessions, ({ one }) => ({
|
|
4636
|
+
user: one(users, {
|
|
4637
|
+
fields: [
|
|
4638
|
+
sessions.userId
|
|
4639
|
+
],
|
|
4640
|
+
references: [
|
|
4641
|
+
users.id
|
|
4642
|
+
]
|
|
4643
|
+
})
|
|
4644
|
+
}));
|
|
4645
|
+
}
|
|
4646
|
+
__name(getSessionRelationsSchema, "getSessionRelationsSchema");
|
|
4647
|
+
|
|
4648
|
+
// src/lib/mysql/schemas/auth/verification-tokens.ts
|
|
4649
|
+
var import_mysql_core16 = require("drizzle-orm/mysql-core");
|
|
4650
|
+
function getVerificationTokensSchema(mysqlTable) {
|
|
4651
|
+
return mysqlTable("verificationToken", {
|
|
4652
|
+
identifier: (0, import_mysql_core16.varchar)("identifier", {
|
|
4653
|
+
length: 255
|
|
4654
|
+
}).notNull(),
|
|
4655
|
+
token: (0, import_mysql_core16.varchar)("token", {
|
|
4656
|
+
length: 255
|
|
4657
|
+
}).notNull(),
|
|
4658
|
+
expires: (0, import_mysql_core16.timestamp)("expires", {
|
|
4659
|
+
mode: "date"
|
|
4660
|
+
}).notNull(),
|
|
4661
|
+
createdAt: (0, import_mysql_core16.timestamp)("createdAt", {
|
|
4170
4662
|
mode: "date",
|
|
4171
4663
|
fsp: 3
|
|
4172
4664
|
}).defaultNow()
|
|
4173
4665
|
}, (vt) => ({
|
|
4174
|
-
pk: (0,
|
|
4666
|
+
pk: (0, import_mysql_core16.primaryKey)({
|
|
4175
4667
|
columns: [
|
|
4176
4668
|
vt.identifier,
|
|
4177
4669
|
vt.token
|
|
4178
4670
|
]
|
|
4179
4671
|
})
|
|
4180
4672
|
}));
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
};
|
|
4184
|
-
}, "getVerificationTokensSchema");
|
|
4673
|
+
}
|
|
4674
|
+
__name(getVerificationTokensSchema, "getVerificationTokensSchema");
|
|
4185
4675
|
|
|
4186
4676
|
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
4187
|
-
var
|
|
4188
|
-
var
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
id: (0,
|
|
4677
|
+
var import_drizzle_orm14 = require("drizzle-orm");
|
|
4678
|
+
var import_mysql_core17 = require("drizzle-orm/mysql-core");
|
|
4679
|
+
function getCouponSchema(mysqlTable) {
|
|
4680
|
+
return mysqlTable("coupons", {
|
|
4681
|
+
id: (0, import_mysql_core17.varchar)("id", {
|
|
4192
4682
|
length: 191
|
|
4193
4683
|
}).notNull(),
|
|
4194
|
-
code: (0,
|
|
4684
|
+
code: (0, import_mysql_core17.varchar)("code", {
|
|
4195
4685
|
length: 191
|
|
4196
4686
|
}),
|
|
4197
|
-
createdAt: (0,
|
|
4687
|
+
createdAt: (0, import_mysql_core17.datetime)("createdAt", {
|
|
4198
4688
|
mode: "string",
|
|
4199
4689
|
fsp: 3
|
|
4200
|
-
}).default(
|
|
4201
|
-
expires: (0,
|
|
4690
|
+
}).default(import_drizzle_orm14.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
4691
|
+
expires: (0, import_mysql_core17.datetime)("expires", {
|
|
4202
4692
|
mode: "string",
|
|
4203
4693
|
fsp: 3
|
|
4204
4694
|
}),
|
|
4205
|
-
metadata: (0,
|
|
4206
|
-
maxUses: (0,
|
|
4207
|
-
default: (0,
|
|
4208
|
-
merchantCouponId: (0,
|
|
4695
|
+
metadata: (0, import_mysql_core17.json)("fields").$type().default({}),
|
|
4696
|
+
maxUses: (0, import_mysql_core17.int)("maxUses").default(-1).notNull(),
|
|
4697
|
+
default: (0, import_mysql_core17.tinyint)("default").default(0).notNull(),
|
|
4698
|
+
merchantCouponId: (0, import_mysql_core17.varchar)("merchantCouponId", {
|
|
4209
4699
|
length: 191
|
|
4210
4700
|
}),
|
|
4211
|
-
status: (0,
|
|
4212
|
-
usedCount: (0,
|
|
4213
|
-
percentageDiscount: (0,
|
|
4701
|
+
status: (0, import_mysql_core17.int)("status").default(0).notNull(),
|
|
4702
|
+
usedCount: (0, import_mysql_core17.int)("usedCount").default(0).notNull(),
|
|
4703
|
+
percentageDiscount: (0, import_mysql_core17.decimal)("percentageDiscount", {
|
|
4214
4704
|
precision: 3,
|
|
4215
4705
|
scale: 2
|
|
4216
4706
|
}).notNull(),
|
|
4217
|
-
restrictedToProductId: (0,
|
|
4707
|
+
restrictedToProductId: (0, import_mysql_core17.varchar)("restrictedToProductId", {
|
|
4218
4708
|
length: 191
|
|
4219
4709
|
}),
|
|
4220
|
-
bulkPurchaseId: (0,
|
|
4710
|
+
bulkPurchaseId: (0, import_mysql_core17.varchar)("bulkPurchaseId", {
|
|
4221
4711
|
length: 191
|
|
4222
4712
|
})
|
|
4223
4713
|
}, (table) => {
|
|
4224
4714
|
return {
|
|
4225
|
-
couponId: (0,
|
|
4715
|
+
couponId: (0, import_mysql_core17.primaryKey)({
|
|
4226
4716
|
columns: [
|
|
4227
4717
|
table.id
|
|
4228
4718
|
],
|
|
4229
4719
|
name: "Coupon_id"
|
|
4230
4720
|
}),
|
|
4231
|
-
couponBulkPurchaseIdKey: (0,
|
|
4232
|
-
couponCodeKey: (0,
|
|
4721
|
+
couponBulkPurchaseIdKey: (0, import_mysql_core17.unique)("Coupon_bulkPurchaseId_key").on(table.bulkPurchaseId),
|
|
4722
|
+
couponCodeKey: (0, import_mysql_core17.unique)("Coupon_code_key").on(table.code)
|
|
4233
4723
|
};
|
|
4234
4724
|
});
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
};
|
|
4238
|
-
}, "getCouponSchema");
|
|
4725
|
+
}
|
|
4726
|
+
__name(getCouponSchema, "getCouponSchema");
|
|
4239
4727
|
|
|
4240
4728
|
// src/lib/mysql/schemas/commerce/merchant-account.ts
|
|
4241
|
-
var
|
|
4242
|
-
var
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
id: (0,
|
|
4729
|
+
var import_drizzle_orm15 = require("drizzle-orm");
|
|
4730
|
+
var import_mysql_core18 = require("drizzle-orm/mysql-core");
|
|
4731
|
+
function getMerchantAccountSchema(mysqlTable) {
|
|
4732
|
+
return mysqlTable("merchantAccounts", {
|
|
4733
|
+
id: (0, import_mysql_core18.varchar)("id", {
|
|
4246
4734
|
length: 191
|
|
4247
4735
|
}).notNull(),
|
|
4248
|
-
status: (0,
|
|
4249
|
-
createdAt: (0,
|
|
4736
|
+
status: (0, import_mysql_core18.int)("status").default(0).notNull(),
|
|
4737
|
+
createdAt: (0, import_mysql_core18.datetime)("createdAt", {
|
|
4250
4738
|
mode: "string",
|
|
4251
4739
|
fsp: 3
|
|
4252
|
-
}).default(
|
|
4253
|
-
label: (0,
|
|
4740
|
+
}).default(import_drizzle_orm15.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
4741
|
+
label: (0, import_mysql_core18.varchar)("label", {
|
|
4254
4742
|
length: 191
|
|
4255
4743
|
}),
|
|
4256
|
-
identifier: (0,
|
|
4744
|
+
identifier: (0, import_mysql_core18.varchar)("identifier", {
|
|
4257
4745
|
length: 191
|
|
4258
4746
|
})
|
|
4259
4747
|
}, (table) => {
|
|
4260
4748
|
return {
|
|
4261
|
-
merchantAccountId: (0,
|
|
4749
|
+
merchantAccountId: (0, import_mysql_core18.primaryKey)({
|
|
4262
4750
|
columns: [
|
|
4263
4751
|
table.id
|
|
4264
4752
|
],
|
|
@@ -4266,225 +4754,213 @@ var getMerchantAccountSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4266
4754
|
})
|
|
4267
4755
|
};
|
|
4268
4756
|
});
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
};
|
|
4272
|
-
}, "getMerchantAccountSchema");
|
|
4757
|
+
}
|
|
4758
|
+
__name(getMerchantAccountSchema, "getMerchantAccountSchema");
|
|
4273
4759
|
|
|
4274
4760
|
// src/lib/mysql/schemas/commerce/merchant-charge.ts
|
|
4275
|
-
var
|
|
4276
|
-
var
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
id: (0,
|
|
4761
|
+
var import_drizzle_orm16 = require("drizzle-orm");
|
|
4762
|
+
var import_mysql_core19 = require("drizzle-orm/mysql-core");
|
|
4763
|
+
function getMerchantChargeSchema(mysqlTable) {
|
|
4764
|
+
return mysqlTable("merchantCharges", {
|
|
4765
|
+
id: (0, import_mysql_core19.varchar)("id", {
|
|
4280
4766
|
length: 191
|
|
4281
4767
|
}).notNull(),
|
|
4282
|
-
status: (0,
|
|
4283
|
-
identifier: (0,
|
|
4768
|
+
status: (0, import_mysql_core19.int)("status").default(0).notNull(),
|
|
4769
|
+
identifier: (0, import_mysql_core19.varchar)("identifier", {
|
|
4284
4770
|
length: 191
|
|
4285
4771
|
}).notNull(),
|
|
4286
|
-
userId: (0,
|
|
4772
|
+
userId: (0, import_mysql_core19.varchar)("userId", {
|
|
4287
4773
|
length: 191
|
|
4288
4774
|
}).notNull(),
|
|
4289
|
-
merchantAccountId: (0,
|
|
4775
|
+
merchantAccountId: (0, import_mysql_core19.varchar)("merchantAccountId", {
|
|
4290
4776
|
length: 191
|
|
4291
4777
|
}).notNull(),
|
|
4292
|
-
merchantProductId: (0,
|
|
4778
|
+
merchantProductId: (0, import_mysql_core19.varchar)("merchantProductId", {
|
|
4293
4779
|
length: 191
|
|
4294
4780
|
}).notNull(),
|
|
4295
|
-
createdAt: (0,
|
|
4781
|
+
createdAt: (0, import_mysql_core19.datetime)("createdAt", {
|
|
4296
4782
|
mode: "string",
|
|
4297
4783
|
fsp: 3
|
|
4298
|
-
}).default(
|
|
4299
|
-
merchantCustomerId: (0,
|
|
4784
|
+
}).default(import_drizzle_orm16.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
4785
|
+
merchantCustomerId: (0, import_mysql_core19.varchar)("merchantCustomerId", {
|
|
4300
4786
|
length: 191
|
|
4301
4787
|
}).notNull()
|
|
4302
4788
|
}, (table) => {
|
|
4303
4789
|
return {
|
|
4304
|
-
merchantChargeId: (0,
|
|
4790
|
+
merchantChargeId: (0, import_mysql_core19.primaryKey)({
|
|
4305
4791
|
columns: [
|
|
4306
4792
|
table.id
|
|
4307
4793
|
],
|
|
4308
4794
|
name: "MerchantCharge_id"
|
|
4309
4795
|
}),
|
|
4310
|
-
merchantChargeIdentifierKey: (0,
|
|
4796
|
+
merchantChargeIdentifierKey: (0, import_mysql_core19.unique)("MerchantCharge_identifier_key").on(table.identifier)
|
|
4311
4797
|
};
|
|
4312
4798
|
});
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
};
|
|
4316
|
-
}, "getMerchantChargeSchema");
|
|
4799
|
+
}
|
|
4800
|
+
__name(getMerchantChargeSchema, "getMerchantChargeSchema");
|
|
4317
4801
|
|
|
4318
4802
|
// src/lib/mysql/schemas/commerce/merchant-coupon.ts
|
|
4319
|
-
var
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
id: (0,
|
|
4803
|
+
var import_mysql_core20 = require("drizzle-orm/mysql-core");
|
|
4804
|
+
function getMerchantCouponSchema(mysqlTable) {
|
|
4805
|
+
return mysqlTable("merchantCoupons", {
|
|
4806
|
+
id: (0, import_mysql_core20.varchar)("id", {
|
|
4323
4807
|
length: 191
|
|
4324
4808
|
}).notNull(),
|
|
4325
|
-
identifier: (0,
|
|
4809
|
+
identifier: (0, import_mysql_core20.varchar)("identifier", {
|
|
4326
4810
|
length: 191
|
|
4327
4811
|
}),
|
|
4328
|
-
status: (0,
|
|
4329
|
-
merchantAccountId: (0,
|
|
4812
|
+
status: (0, import_mysql_core20.int)("status").default(0).notNull(),
|
|
4813
|
+
merchantAccountId: (0, import_mysql_core20.varchar)("merchantAccountId", {
|
|
4330
4814
|
length: 191
|
|
4331
4815
|
}).notNull(),
|
|
4332
|
-
percentageDiscount: (0,
|
|
4816
|
+
percentageDiscount: (0, import_mysql_core20.decimal)("percentageDiscount", {
|
|
4333
4817
|
precision: 3,
|
|
4334
4818
|
scale: 2
|
|
4335
4819
|
}).notNull(),
|
|
4336
|
-
type: (0,
|
|
4820
|
+
type: (0, import_mysql_core20.varchar)("type", {
|
|
4337
4821
|
length: 191
|
|
4338
4822
|
})
|
|
4339
4823
|
}, (table) => {
|
|
4340
4824
|
return {
|
|
4341
|
-
merchantCouponId: (0,
|
|
4825
|
+
merchantCouponId: (0, import_mysql_core20.primaryKey)({
|
|
4342
4826
|
columns: [
|
|
4343
4827
|
table.id
|
|
4344
4828
|
],
|
|
4345
4829
|
name: "MerchantCoupon_id"
|
|
4346
4830
|
}),
|
|
4347
|
-
merchantCouponIdentifierKey: (0,
|
|
4831
|
+
merchantCouponIdentifierKey: (0, import_mysql_core20.unique)("MerchantCoupon_identifier_key").on(table.identifier)
|
|
4348
4832
|
};
|
|
4349
4833
|
});
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
};
|
|
4353
|
-
}, "getMerchantCouponSchema");
|
|
4834
|
+
}
|
|
4835
|
+
__name(getMerchantCouponSchema, "getMerchantCouponSchema");
|
|
4354
4836
|
|
|
4355
4837
|
// src/lib/mysql/schemas/commerce/merchant-customer.ts
|
|
4356
|
-
var
|
|
4357
|
-
var
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
id: (0,
|
|
4838
|
+
var import_drizzle_orm17 = require("drizzle-orm");
|
|
4839
|
+
var import_mysql_core21 = require("drizzle-orm/mysql-core");
|
|
4840
|
+
function getMerchantCustomerSchema(mysqlTable) {
|
|
4841
|
+
return mysqlTable("merchantCustomers", {
|
|
4842
|
+
id: (0, import_mysql_core21.varchar)("id", {
|
|
4361
4843
|
length: 191
|
|
4362
4844
|
}).notNull(),
|
|
4363
|
-
userId: (0,
|
|
4845
|
+
userId: (0, import_mysql_core21.varchar)("userId", {
|
|
4364
4846
|
length: 191
|
|
4365
4847
|
}).notNull(),
|
|
4366
|
-
merchantAccountId: (0,
|
|
4848
|
+
merchantAccountId: (0, import_mysql_core21.varchar)("merchantAccountId", {
|
|
4367
4849
|
length: 191
|
|
4368
4850
|
}).notNull(),
|
|
4369
|
-
identifier: (0,
|
|
4851
|
+
identifier: (0, import_mysql_core21.varchar)("identifier", {
|
|
4370
4852
|
length: 191
|
|
4371
4853
|
}).notNull(),
|
|
4372
|
-
createdAt: (0,
|
|
4854
|
+
createdAt: (0, import_mysql_core21.datetime)("createdAt", {
|
|
4373
4855
|
mode: "string",
|
|
4374
4856
|
fsp: 3
|
|
4375
|
-
}).default(
|
|
4376
|
-
status: (0,
|
|
4857
|
+
}).default(import_drizzle_orm17.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
4858
|
+
status: (0, import_mysql_core21.int)("status").default(0)
|
|
4377
4859
|
}, (table) => {
|
|
4378
4860
|
return {
|
|
4379
|
-
merchantCustomerId: (0,
|
|
4861
|
+
merchantCustomerId: (0, import_mysql_core21.primaryKey)({
|
|
4380
4862
|
columns: [
|
|
4381
4863
|
table.id
|
|
4382
4864
|
],
|
|
4383
4865
|
name: "MerchantCustomer_id"
|
|
4384
4866
|
}),
|
|
4385
|
-
merchantCustomerIdentifierKey: (0,
|
|
4867
|
+
merchantCustomerIdentifierKey: (0, import_mysql_core21.unique)("MerchantCustomer_identifier_key").on(table.identifier)
|
|
4386
4868
|
};
|
|
4387
4869
|
});
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
};
|
|
4391
|
-
}, "getMerchantCustomerSchema");
|
|
4870
|
+
}
|
|
4871
|
+
__name(getMerchantCustomerSchema, "getMerchantCustomerSchema");
|
|
4392
4872
|
|
|
4393
4873
|
// src/lib/mysql/schemas/commerce/merchant-price.ts
|
|
4394
|
-
var
|
|
4395
|
-
var
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
id: (0,
|
|
4874
|
+
var import_drizzle_orm18 = require("drizzle-orm");
|
|
4875
|
+
var import_mysql_core22 = require("drizzle-orm/mysql-core");
|
|
4876
|
+
function getMerchantPriceSchema(mysqlTable) {
|
|
4877
|
+
return mysqlTable("merchantPrices", {
|
|
4878
|
+
id: (0, import_mysql_core22.varchar)("id", {
|
|
4399
4879
|
length: 191
|
|
4400
4880
|
}).notNull(),
|
|
4401
|
-
merchantAccountId: (0,
|
|
4881
|
+
merchantAccountId: (0, import_mysql_core22.varchar)("merchantAccountId", {
|
|
4402
4882
|
length: 191
|
|
4403
4883
|
}).notNull(),
|
|
4404
|
-
merchantProductId: (0,
|
|
4884
|
+
merchantProductId: (0, import_mysql_core22.varchar)("merchantProductId", {
|
|
4405
4885
|
length: 191
|
|
4406
4886
|
}).notNull(),
|
|
4407
|
-
status: (0,
|
|
4408
|
-
identifier: (0,
|
|
4887
|
+
status: (0, import_mysql_core22.int)("status").default(0),
|
|
4888
|
+
identifier: (0, import_mysql_core22.varchar)("identifier", {
|
|
4409
4889
|
length: 191
|
|
4410
4890
|
}),
|
|
4411
|
-
createdAt: (0,
|
|
4891
|
+
createdAt: (0, import_mysql_core22.datetime)("createdAt", {
|
|
4412
4892
|
mode: "string",
|
|
4413
4893
|
fsp: 3
|
|
4414
|
-
}).default(
|
|
4415
|
-
priceId: (0,
|
|
4894
|
+
}).default(import_drizzle_orm18.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
4895
|
+
priceId: (0, import_mysql_core22.varchar)("priceId", {
|
|
4416
4896
|
length: 191
|
|
4417
4897
|
})
|
|
4418
4898
|
}, (table) => {
|
|
4419
4899
|
return {
|
|
4420
|
-
merchantPriceId: (0,
|
|
4900
|
+
merchantPriceId: (0, import_mysql_core22.primaryKey)({
|
|
4421
4901
|
columns: [
|
|
4422
4902
|
table.id
|
|
4423
4903
|
],
|
|
4424
4904
|
name: "MerchantPrice_id"
|
|
4425
4905
|
}),
|
|
4426
|
-
merchantPriceIdentifierKey: (0,
|
|
4906
|
+
merchantPriceIdentifierKey: (0, import_mysql_core22.unique)("MerchantPrice_identifier_key").on(table.identifier)
|
|
4427
4907
|
};
|
|
4428
4908
|
});
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
};
|
|
4432
|
-
}, "getMerchantPriceSchema");
|
|
4909
|
+
}
|
|
4910
|
+
__name(getMerchantPriceSchema, "getMerchantPriceSchema");
|
|
4433
4911
|
|
|
4434
4912
|
// src/lib/mysql/schemas/commerce/merchant-product.ts
|
|
4435
|
-
var
|
|
4436
|
-
var
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
id: (0,
|
|
4913
|
+
var import_drizzle_orm19 = require("drizzle-orm");
|
|
4914
|
+
var import_mysql_core23 = require("drizzle-orm/mysql-core");
|
|
4915
|
+
function getMerchantProductSchema(mysqlTable) {
|
|
4916
|
+
return mysqlTable("merchantProducts", {
|
|
4917
|
+
id: (0, import_mysql_core23.varchar)("id", {
|
|
4440
4918
|
length: 191
|
|
4441
4919
|
}).notNull(),
|
|
4442
|
-
merchantAccountId: (0,
|
|
4920
|
+
merchantAccountId: (0, import_mysql_core23.varchar)("merchantAccountId", {
|
|
4443
4921
|
length: 191
|
|
4444
4922
|
}).notNull(),
|
|
4445
|
-
productId: (0,
|
|
4923
|
+
productId: (0, import_mysql_core23.varchar)("productId", {
|
|
4446
4924
|
length: 191
|
|
4447
4925
|
}).notNull(),
|
|
4448
|
-
status: (0,
|
|
4449
|
-
identifier: (0,
|
|
4926
|
+
status: (0, import_mysql_core23.int)("status").default(0).notNull(),
|
|
4927
|
+
identifier: (0, import_mysql_core23.varchar)("identifier", {
|
|
4450
4928
|
length: 191
|
|
4451
4929
|
}),
|
|
4452
|
-
createdAt: (0,
|
|
4930
|
+
createdAt: (0, import_mysql_core23.datetime)("createdAt", {
|
|
4453
4931
|
mode: "string",
|
|
4454
4932
|
fsp: 3
|
|
4455
|
-
}).default(
|
|
4933
|
+
}).default(import_drizzle_orm19.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
4456
4934
|
}, (table) => {
|
|
4457
4935
|
return {
|
|
4458
|
-
merchantProductId: (0,
|
|
4936
|
+
merchantProductId: (0, import_mysql_core23.primaryKey)({
|
|
4459
4937
|
columns: [
|
|
4460
4938
|
table.id
|
|
4461
4939
|
],
|
|
4462
4940
|
name: "MerchantProduct_id"
|
|
4463
4941
|
}),
|
|
4464
|
-
merchantProductIdentifierKey: (0,
|
|
4942
|
+
merchantProductIdentifierKey: (0, import_mysql_core23.unique)("MerchantProduct_identifier_key").on(table.identifier)
|
|
4465
4943
|
};
|
|
4466
4944
|
});
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
};
|
|
4470
|
-
}, "getMerchantProductSchema");
|
|
4945
|
+
}
|
|
4946
|
+
__name(getMerchantProductSchema, "getMerchantProductSchema");
|
|
4471
4947
|
|
|
4472
4948
|
// src/lib/mysql/schemas/commerce/merchant-session.ts
|
|
4473
|
-
var
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
id: (0,
|
|
4949
|
+
var import_mysql_core24 = require("drizzle-orm/mysql-core");
|
|
4950
|
+
function getMerchantSessionSchema(mysqlTable) {
|
|
4951
|
+
return mysqlTable("merchantSessions", {
|
|
4952
|
+
id: (0, import_mysql_core24.varchar)("id", {
|
|
4477
4953
|
length: 191
|
|
4478
4954
|
}).notNull(),
|
|
4479
|
-
identifier: (0,
|
|
4955
|
+
identifier: (0, import_mysql_core24.varchar)("identifier", {
|
|
4480
4956
|
length: 191
|
|
4481
4957
|
}).notNull(),
|
|
4482
|
-
merchantAccountId: (0,
|
|
4958
|
+
merchantAccountId: (0, import_mysql_core24.varchar)("merchantAccountId", {
|
|
4483
4959
|
length: 191
|
|
4484
4960
|
}).notNull()
|
|
4485
4961
|
}, (table) => {
|
|
4486
4962
|
return {
|
|
4487
|
-
merchantSessionId: (0,
|
|
4963
|
+
merchantSessionId: (0, import_mysql_core24.primaryKey)({
|
|
4488
4964
|
columns: [
|
|
4489
4965
|
table.id
|
|
4490
4966
|
],
|
|
@@ -4492,38 +4968,36 @@ var getMerchantSessionSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4492
4968
|
})
|
|
4493
4969
|
};
|
|
4494
4970
|
});
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
};
|
|
4498
|
-
}, "getMerchantSessionSchema");
|
|
4971
|
+
}
|
|
4972
|
+
__name(getMerchantSessionSchema, "getMerchantSessionSchema");
|
|
4499
4973
|
|
|
4500
4974
|
// src/lib/mysql/schemas/commerce/price.ts
|
|
4501
|
-
var
|
|
4502
|
-
var
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
id: (0,
|
|
4975
|
+
var import_drizzle_orm20 = require("drizzle-orm");
|
|
4976
|
+
var import_mysql_core25 = require("drizzle-orm/mysql-core");
|
|
4977
|
+
function getPriceSchema(mysqlTable) {
|
|
4978
|
+
return mysqlTable("prices", {
|
|
4979
|
+
id: (0, import_mysql_core25.varchar)("id", {
|
|
4506
4980
|
length: 191
|
|
4507
4981
|
}).notNull(),
|
|
4508
|
-
productId: (0,
|
|
4982
|
+
productId: (0, import_mysql_core25.varchar)("productId", {
|
|
4509
4983
|
length: 191
|
|
4510
4984
|
}),
|
|
4511
|
-
nickname: (0,
|
|
4985
|
+
nickname: (0, import_mysql_core25.varchar)("nickname", {
|
|
4512
4986
|
length: 191
|
|
4513
4987
|
}),
|
|
4514
|
-
status: (0,
|
|
4515
|
-
unitAmount: (0,
|
|
4988
|
+
status: (0, import_mysql_core25.int)("status").default(0).notNull(),
|
|
4989
|
+
unitAmount: (0, import_mysql_core25.decimal)("unitAmount", {
|
|
4516
4990
|
precision: 10,
|
|
4517
4991
|
scale: 2
|
|
4518
4992
|
}).notNull(),
|
|
4519
|
-
createdAt: (0,
|
|
4993
|
+
createdAt: (0, import_mysql_core25.datetime)("createdAt", {
|
|
4520
4994
|
mode: "string",
|
|
4521
4995
|
fsp: 3
|
|
4522
|
-
}).default(
|
|
4523
|
-
metadata: (0,
|
|
4996
|
+
}).default(import_drizzle_orm20.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
4997
|
+
metadata: (0, import_mysql_core25.json)("fields").$type().default({})
|
|
4524
4998
|
}, (table) => {
|
|
4525
4999
|
return {
|
|
4526
|
-
priceId: (0,
|
|
5000
|
+
priceId: (0, import_mysql_core25.primaryKey)({
|
|
4527
5001
|
columns: [
|
|
4528
5002
|
table.id
|
|
4529
5003
|
],
|
|
@@ -4531,35 +5005,33 @@ var getPriceSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4531
5005
|
})
|
|
4532
5006
|
};
|
|
4533
5007
|
});
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
};
|
|
4537
|
-
}, "getPriceSchema");
|
|
5008
|
+
}
|
|
5009
|
+
__name(getPriceSchema, "getPriceSchema");
|
|
4538
5010
|
|
|
4539
5011
|
// src/lib/mysql/schemas/commerce/product.ts
|
|
4540
|
-
var
|
|
4541
|
-
var
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
id: (0,
|
|
5012
|
+
var import_drizzle_orm21 = require("drizzle-orm");
|
|
5013
|
+
var import_mysql_core26 = require("drizzle-orm/mysql-core");
|
|
5014
|
+
function getProductSchema(mysqlTable) {
|
|
5015
|
+
return mysqlTable("products", {
|
|
5016
|
+
id: (0, import_mysql_core26.varchar)("id", {
|
|
4545
5017
|
length: 191
|
|
4546
5018
|
}).notNull(),
|
|
4547
|
-
name: (0,
|
|
5019
|
+
name: (0, import_mysql_core26.varchar)("name", {
|
|
4548
5020
|
length: 191
|
|
4549
5021
|
}).notNull(),
|
|
4550
|
-
key: (0,
|
|
5022
|
+
key: (0, import_mysql_core26.varchar)("key", {
|
|
4551
5023
|
length: 191
|
|
4552
5024
|
}),
|
|
4553
|
-
metadata: (0,
|
|
4554
|
-
createdAt: (0,
|
|
5025
|
+
metadata: (0, import_mysql_core26.json)("fields").$type().default({}),
|
|
5026
|
+
createdAt: (0, import_mysql_core26.datetime)("createdAt", {
|
|
4555
5027
|
mode: "string",
|
|
4556
5028
|
fsp: 3
|
|
4557
|
-
}).default(
|
|
4558
|
-
status: (0,
|
|
4559
|
-
quantityAvailable: (0,
|
|
5029
|
+
}).default(import_drizzle_orm21.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
5030
|
+
status: (0, import_mysql_core26.int)("status").default(0).notNull(),
|
|
5031
|
+
quantityAvailable: (0, import_mysql_core26.int)("quantityAvailable").default(-1).notNull()
|
|
4560
5032
|
}, (table) => {
|
|
4561
5033
|
return {
|
|
4562
|
-
productId: (0,
|
|
5034
|
+
productId: (0, import_mysql_core26.primaryKey)({
|
|
4563
5035
|
columns: [
|
|
4564
5036
|
table.id
|
|
4565
5037
|
],
|
|
@@ -4567,92 +5039,88 @@ var getProductSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4567
5039
|
})
|
|
4568
5040
|
};
|
|
4569
5041
|
});
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
};
|
|
4573
|
-
}, "getProductSchema");
|
|
5042
|
+
}
|
|
5043
|
+
__name(getProductSchema, "getProductSchema");
|
|
4574
5044
|
|
|
4575
5045
|
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
4576
|
-
var
|
|
4577
|
-
var
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
id: (0,
|
|
5046
|
+
var import_drizzle_orm22 = require("drizzle-orm");
|
|
5047
|
+
var import_mysql_core27 = require("drizzle-orm/mysql-core");
|
|
5048
|
+
function getPurchaseSchema(mysqlTable) {
|
|
5049
|
+
return mysqlTable("purchases", {
|
|
5050
|
+
id: (0, import_mysql_core27.varchar)("id", {
|
|
4581
5051
|
length: 191
|
|
4582
5052
|
}).notNull(),
|
|
4583
|
-
userId: (0,
|
|
5053
|
+
userId: (0, import_mysql_core27.varchar)("userId", {
|
|
4584
5054
|
length: 191
|
|
4585
5055
|
}),
|
|
4586
|
-
createdAt: (0,
|
|
5056
|
+
createdAt: (0, import_mysql_core27.datetime)("createdAt", {
|
|
4587
5057
|
mode: "string",
|
|
4588
5058
|
fsp: 3
|
|
4589
|
-
}).default(
|
|
4590
|
-
totalAmount: (0,
|
|
5059
|
+
}).default(import_drizzle_orm22.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
5060
|
+
totalAmount: (0, import_mysql_core27.decimal)("totalAmount", {
|
|
4591
5061
|
precision: 65,
|
|
4592
5062
|
scale: 30
|
|
4593
5063
|
}).notNull(),
|
|
4594
|
-
ipAddress: (0,
|
|
5064
|
+
ipAddress: (0, import_mysql_core27.varchar)("ip_address", {
|
|
4595
5065
|
length: 191
|
|
4596
5066
|
}),
|
|
4597
|
-
city: (0,
|
|
5067
|
+
city: (0, import_mysql_core27.varchar)("city", {
|
|
4598
5068
|
length: 191
|
|
4599
5069
|
}),
|
|
4600
|
-
state: (0,
|
|
5070
|
+
state: (0, import_mysql_core27.varchar)("state", {
|
|
4601
5071
|
length: 191
|
|
4602
5072
|
}),
|
|
4603
|
-
country: (0,
|
|
5073
|
+
country: (0, import_mysql_core27.varchar)("country", {
|
|
4604
5074
|
length: 191
|
|
4605
5075
|
}),
|
|
4606
|
-
couponId: (0,
|
|
5076
|
+
couponId: (0, import_mysql_core27.varchar)("couponId", {
|
|
4607
5077
|
length: 191
|
|
4608
5078
|
}),
|
|
4609
|
-
productId: (0,
|
|
5079
|
+
productId: (0, import_mysql_core27.varchar)("productId", {
|
|
4610
5080
|
length: 191
|
|
4611
5081
|
}).notNull(),
|
|
4612
|
-
merchantChargeId: (0,
|
|
5082
|
+
merchantChargeId: (0, import_mysql_core27.varchar)("merchantChargeId", {
|
|
4613
5083
|
length: 191
|
|
4614
5084
|
}),
|
|
4615
|
-
upgradedFromId: (0,
|
|
5085
|
+
upgradedFromId: (0, import_mysql_core27.varchar)("upgradedFromId", {
|
|
4616
5086
|
length: 191
|
|
4617
5087
|
}),
|
|
4618
|
-
status: (0,
|
|
5088
|
+
status: (0, import_mysql_core27.varchar)("status", {
|
|
4619
5089
|
length: 191
|
|
4620
5090
|
}).default("Valid").notNull(),
|
|
4621
|
-
bulkCouponId: (0,
|
|
5091
|
+
bulkCouponId: (0, import_mysql_core27.varchar)("bulkCouponId", {
|
|
4622
5092
|
length: 191
|
|
4623
5093
|
}),
|
|
4624
|
-
merchantSessionId: (0,
|
|
5094
|
+
merchantSessionId: (0, import_mysql_core27.varchar)("merchantSessionId", {
|
|
4625
5095
|
length: 191
|
|
4626
5096
|
}),
|
|
4627
|
-
redeemedBulkCouponId: (0,
|
|
5097
|
+
redeemedBulkCouponId: (0, import_mysql_core27.varchar)("redeemedBulkCouponId", {
|
|
4628
5098
|
length: 191
|
|
4629
5099
|
}),
|
|
4630
|
-
metadata: (0,
|
|
5100
|
+
metadata: (0, import_mysql_core27.json)("fields").$type().default({})
|
|
4631
5101
|
}, (table) => {
|
|
4632
5102
|
return {
|
|
4633
|
-
purchaseId: (0,
|
|
5103
|
+
purchaseId: (0, import_mysql_core27.primaryKey)({
|
|
4634
5104
|
columns: [
|
|
4635
5105
|
table.id
|
|
4636
5106
|
],
|
|
4637
5107
|
name: "Purchase_id"
|
|
4638
5108
|
}),
|
|
4639
|
-
purchaseUpgradedFromIdKey: (0,
|
|
5109
|
+
purchaseUpgradedFromIdKey: (0, import_mysql_core27.unique)("Purchase_upgradedFromId_key").on(table.upgradedFromId)
|
|
4640
5110
|
};
|
|
4641
5111
|
});
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
};
|
|
4645
|
-
}, "getPurchaseSchema");
|
|
5112
|
+
}
|
|
5113
|
+
__name(getPurchaseSchema, "getPurchaseSchema");
|
|
4646
5114
|
|
|
4647
5115
|
// src/lib/mysql/schemas/commerce/purchase-user-transfer.ts
|
|
4648
|
-
var
|
|
4649
|
-
var
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
id: (0,
|
|
5116
|
+
var import_drizzle_orm23 = require("drizzle-orm");
|
|
5117
|
+
var import_mysql_core28 = require("drizzle-orm/mysql-core");
|
|
5118
|
+
function getPurchaseUserTransferSchema(mysqlTable) {
|
|
5119
|
+
return mysqlTable("purchaseUserTransfers", {
|
|
5120
|
+
id: (0, import_mysql_core28.varchar)("id", {
|
|
4653
5121
|
length: 191
|
|
4654
5122
|
}).notNull(),
|
|
4655
|
-
transferState: (0,
|
|
5123
|
+
transferState: (0, import_mysql_core28.mysqlEnum)("transferState", [
|
|
4656
5124
|
"AVAILABLE",
|
|
4657
5125
|
"INITIATED",
|
|
4658
5126
|
"VERIFIED",
|
|
@@ -4661,38 +5129,38 @@ var getPurchaseUserTransferSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4661
5129
|
"CONFIRMED",
|
|
4662
5130
|
"COMPLETED"
|
|
4663
5131
|
]).default("AVAILABLE").notNull(),
|
|
4664
|
-
purchaseId: (0,
|
|
5132
|
+
purchaseId: (0, import_mysql_core28.varchar)("purchaseId", {
|
|
4665
5133
|
length: 191
|
|
4666
5134
|
}).notNull(),
|
|
4667
|
-
sourceUserId: (0,
|
|
5135
|
+
sourceUserId: (0, import_mysql_core28.varchar)("sourceUserId", {
|
|
4668
5136
|
length: 191
|
|
4669
5137
|
}).notNull(),
|
|
4670
|
-
targetUserId: (0,
|
|
5138
|
+
targetUserId: (0, import_mysql_core28.varchar)("targetUserId", {
|
|
4671
5139
|
length: 191
|
|
4672
5140
|
}),
|
|
4673
|
-
createdAt: (0,
|
|
5141
|
+
createdAt: (0, import_mysql_core28.datetime)("createdAt", {
|
|
4674
5142
|
mode: "string",
|
|
4675
5143
|
fsp: 3
|
|
4676
|
-
}).default(
|
|
4677
|
-
expiresAt: (0,
|
|
5144
|
+
}).default(import_drizzle_orm23.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
5145
|
+
expiresAt: (0, import_mysql_core28.datetime)("expiresAt", {
|
|
4678
5146
|
mode: "string",
|
|
4679
5147
|
fsp: 3
|
|
4680
5148
|
}),
|
|
4681
|
-
canceledAt: (0,
|
|
5149
|
+
canceledAt: (0, import_mysql_core28.datetime)("canceledAt", {
|
|
4682
5150
|
mode: "string",
|
|
4683
5151
|
fsp: 3
|
|
4684
5152
|
}),
|
|
4685
|
-
confirmedAt: (0,
|
|
5153
|
+
confirmedAt: (0, import_mysql_core28.datetime)("confirmedAt", {
|
|
4686
5154
|
mode: "string",
|
|
4687
5155
|
fsp: 3
|
|
4688
5156
|
}),
|
|
4689
|
-
completedAt: (0,
|
|
5157
|
+
completedAt: (0, import_mysql_core28.datetime)("completedAt", {
|
|
4690
5158
|
mode: "string",
|
|
4691
5159
|
fsp: 3
|
|
4692
5160
|
})
|
|
4693
5161
|
}, (table) => {
|
|
4694
5162
|
return {
|
|
4695
|
-
purchaseUserTransferId: (0,
|
|
5163
|
+
purchaseUserTransferId: (0, import_mysql_core28.primaryKey)({
|
|
4696
5164
|
columns: [
|
|
4697
5165
|
table.id
|
|
4698
5166
|
],
|
|
@@ -4700,282 +5168,14 @@ var getPurchaseUserTransferSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4700
5168
|
})
|
|
4701
5169
|
};
|
|
4702
5170
|
});
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
};
|
|
4706
|
-
}, "getPurchaseUserTransferSchema");
|
|
4707
|
-
|
|
4708
|
-
// src/lib/mysql/schemas/communication/communication-channel.ts
|
|
4709
|
-
var import_mysql_core22 = require("drizzle-orm/mysql-core");
|
|
4710
|
-
var getCommunicationChannelSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4711
|
-
const communicationChannel = mysqlTable("communicationChannel", {
|
|
4712
|
-
id: (0, import_mysql_core22.varchar)("id", {
|
|
4713
|
-
length: 255
|
|
4714
|
-
}).notNull().primaryKey(),
|
|
4715
|
-
name: (0, import_mysql_core22.varchar)("name", {
|
|
4716
|
-
length: 255
|
|
4717
|
-
}).notNull(),
|
|
4718
|
-
description: (0, import_mysql_core22.text)("description"),
|
|
4719
|
-
active: (0, import_mysql_core22.boolean)("active").notNull().default(true),
|
|
4720
|
-
createdAt: (0, import_mysql_core22.timestamp)("createdAt", {
|
|
4721
|
-
mode: "date",
|
|
4722
|
-
fsp: 3
|
|
4723
|
-
}).defaultNow(),
|
|
4724
|
-
updatedAt: (0, import_mysql_core22.timestamp)("updatedAt", {
|
|
4725
|
-
mode: "date",
|
|
4726
|
-
fsp: 3
|
|
4727
|
-
}).defaultNow(),
|
|
4728
|
-
deletedAt: (0, import_mysql_core22.timestamp)("deletedAt", {
|
|
4729
|
-
mode: "date",
|
|
4730
|
-
fsp: 3
|
|
4731
|
-
})
|
|
4732
|
-
}, (cc) => ({
|
|
4733
|
-
nameIdx: (0, import_mysql_core22.index)("name_idx").on(cc.name)
|
|
4734
|
-
}));
|
|
4735
|
-
return {
|
|
4736
|
-
communicationChannel
|
|
4737
|
-
};
|
|
4738
|
-
}, "getCommunicationChannelSchema");
|
|
4739
|
-
|
|
4740
|
-
// src/lib/mysql/schemas/communication/communication-preference-types.ts
|
|
4741
|
-
var import_mysql_core23 = require("drizzle-orm/mysql-core");
|
|
4742
|
-
var getCommunicationPreferenceTypesSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4743
|
-
const communicationPreferenceTypes = mysqlTable("communicationPreferenceType", {
|
|
4744
|
-
id: (0, import_mysql_core23.varchar)("id", {
|
|
4745
|
-
length: 255
|
|
4746
|
-
}).notNull().primaryKey(),
|
|
4747
|
-
name: (0, import_mysql_core23.varchar)("name", {
|
|
4748
|
-
length: 255
|
|
4749
|
-
}).notNull(),
|
|
4750
|
-
description: (0, import_mysql_core23.text)("description"),
|
|
4751
|
-
active: (0, import_mysql_core23.boolean)("active").notNull().default(true),
|
|
4752
|
-
createdAt: (0, import_mysql_core23.timestamp)("createdAt", {
|
|
4753
|
-
mode: "date",
|
|
4754
|
-
fsp: 3
|
|
4755
|
-
}).defaultNow(),
|
|
4756
|
-
updatedAt: (0, import_mysql_core23.timestamp)("updatedAt", {
|
|
4757
|
-
mode: "date",
|
|
4758
|
-
fsp: 3
|
|
4759
|
-
}),
|
|
4760
|
-
deletedAt: (0, import_mysql_core23.timestamp)("deletedAt", {
|
|
4761
|
-
mode: "date",
|
|
4762
|
-
fsp: 3
|
|
4763
|
-
})
|
|
4764
|
-
});
|
|
4765
|
-
return {
|
|
4766
|
-
communicationPreferenceTypes
|
|
4767
|
-
};
|
|
4768
|
-
}, "getCommunicationPreferenceTypesSchema");
|
|
4769
|
-
|
|
4770
|
-
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
4771
|
-
var import_mysql_core24 = require("drizzle-orm/mysql-core");
|
|
4772
|
-
var getCommunicationPreferencesSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4773
|
-
const communicationPreferences = mysqlTable("communicationPreference", {
|
|
4774
|
-
id: (0, import_mysql_core24.varchar)("id", {
|
|
4775
|
-
length: 255
|
|
4776
|
-
}).notNull().primaryKey(),
|
|
4777
|
-
userId: (0, import_mysql_core24.varchar)("userId", {
|
|
4778
|
-
length: 255
|
|
4779
|
-
}).notNull(),
|
|
4780
|
-
channelId: (0, import_mysql_core24.varchar)("channelId", {
|
|
4781
|
-
length: 255
|
|
4782
|
-
}).notNull(),
|
|
4783
|
-
preferenceLevel: (0, import_mysql_core24.mysqlEnum)("preferenceLevel", [
|
|
4784
|
-
"low",
|
|
4785
|
-
"medium",
|
|
4786
|
-
"high"
|
|
4787
|
-
]).notNull().default("medium"),
|
|
4788
|
-
preferenceTypeId: (0, import_mysql_core24.varchar)("preferenceTypeId", {
|
|
4789
|
-
length: 255
|
|
4790
|
-
}).notNull(),
|
|
4791
|
-
active: (0, import_mysql_core24.boolean)("active").notNull().default(true),
|
|
4792
|
-
createdAt: (0, import_mysql_core24.timestamp)("createdAt", {
|
|
4793
|
-
mode: "date",
|
|
4794
|
-
fsp: 3
|
|
4795
|
-
}).defaultNow(),
|
|
4796
|
-
optInAt: (0, import_mysql_core24.timestamp)("optInAt", {
|
|
4797
|
-
mode: "date",
|
|
4798
|
-
fsp: 3
|
|
4799
|
-
}),
|
|
4800
|
-
optOutAt: (0, import_mysql_core24.timestamp)("optOutAt", {
|
|
4801
|
-
mode: "date",
|
|
4802
|
-
fsp: 3
|
|
4803
|
-
}),
|
|
4804
|
-
updatedAt: (0, import_mysql_core24.timestamp)("updatedAt", {
|
|
4805
|
-
mode: "date",
|
|
4806
|
-
fsp: 3
|
|
4807
|
-
}).defaultNow(),
|
|
4808
|
-
deletedAt: (0, import_mysql_core24.timestamp)("deletedAt", {
|
|
4809
|
-
mode: "date",
|
|
4810
|
-
fsp: 3
|
|
4811
|
-
})
|
|
4812
|
-
}, (cp) => ({
|
|
4813
|
-
userIdIdx: (0, import_mysql_core24.index)("userId_idx").on(cp.userId),
|
|
4814
|
-
preferenceTypeIdx: (0, import_mysql_core24.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
4815
|
-
channelIdIdx: (0, import_mysql_core24.index)("channelId_idx").on(cp.channelId)
|
|
4816
|
-
}));
|
|
4817
|
-
return {
|
|
4818
|
-
communicationPreferences
|
|
4819
|
-
};
|
|
4820
|
-
}, "getCommunicationPreferencesSchema");
|
|
4821
|
-
|
|
4822
|
-
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
4823
|
-
var import_mysql_core25 = require("drizzle-orm/mysql-core");
|
|
4824
|
-
var getContentContributionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4825
|
-
const contentContributions = mysqlTable("contentContribution", {
|
|
4826
|
-
id: (0, import_mysql_core25.varchar)("id", {
|
|
4827
|
-
length: 255
|
|
4828
|
-
}).notNull().primaryKey(),
|
|
4829
|
-
userId: (0, import_mysql_core25.varchar)("userId", {
|
|
4830
|
-
length: 255
|
|
4831
|
-
}).notNull(),
|
|
4832
|
-
contentId: (0, import_mysql_core25.varchar)("contentId", {
|
|
4833
|
-
length: 255
|
|
4834
|
-
}).notNull(),
|
|
4835
|
-
contributionTypeId: (0, import_mysql_core25.varchar)("contributionTypeId", {
|
|
4836
|
-
length: 255
|
|
4837
|
-
}).notNull(),
|
|
4838
|
-
active: (0, import_mysql_core25.boolean)("active").notNull().default(true),
|
|
4839
|
-
createdAt: (0, import_mysql_core25.timestamp)("createdAt", {
|
|
4840
|
-
mode: "date",
|
|
4841
|
-
fsp: 3
|
|
4842
|
-
}).defaultNow(),
|
|
4843
|
-
updatedAt: (0, import_mysql_core25.timestamp)("updatedAt", {
|
|
4844
|
-
mode: "date",
|
|
4845
|
-
fsp: 3
|
|
4846
|
-
}).defaultNow(),
|
|
4847
|
-
deletedAt: (0, import_mysql_core25.timestamp)("deletedAt", {
|
|
4848
|
-
mode: "date",
|
|
4849
|
-
fsp: 3
|
|
4850
|
-
})
|
|
4851
|
-
}, (cc) => ({
|
|
4852
|
-
userIdIdx: (0, import_mysql_core25.index)("userId_idx").on(cc.userId),
|
|
4853
|
-
contentIdIdx: (0, import_mysql_core25.index)("contentId_idx").on(cc.contentId),
|
|
4854
|
-
contributionTypeIdIdx: (0, import_mysql_core25.index)("contributionTypeId_idx").on(cc.contributionTypeId)
|
|
4855
|
-
}));
|
|
4856
|
-
return {
|
|
4857
|
-
contentContributions
|
|
4858
|
-
};
|
|
4859
|
-
}, "getContentContributionsSchema");
|
|
4860
|
-
|
|
4861
|
-
// src/lib/mysql/schemas/content/content-resource.ts
|
|
4862
|
-
var import_drizzle_orm12 = require("drizzle-orm");
|
|
4863
|
-
var import_mysql_core26 = require("drizzle-orm/mysql-core");
|
|
4864
|
-
var getContentResourceSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4865
|
-
const contentResource = mysqlTable("contentResource", {
|
|
4866
|
-
id: (0, import_mysql_core26.varchar)("id", {
|
|
4867
|
-
length: 255
|
|
4868
|
-
}).notNull().primaryKey(),
|
|
4869
|
-
type: (0, import_mysql_core26.varchar)("type", {
|
|
4870
|
-
length: 255
|
|
4871
|
-
}).notNull(),
|
|
4872
|
-
createdById: (0, import_mysql_core26.varchar)("createdById", {
|
|
4873
|
-
length: 255
|
|
4874
|
-
}).notNull(),
|
|
4875
|
-
fields: (0, import_mysql_core26.json)("fields").$type().default({}),
|
|
4876
|
-
createdAt: (0, import_mysql_core26.timestamp)("createdAt", {
|
|
4877
|
-
mode: "date",
|
|
4878
|
-
fsp: 3
|
|
4879
|
-
}).default(import_drizzle_orm12.sql`CURRENT_TIMESTAMP(3)`),
|
|
4880
|
-
updatedAt: (0, import_mysql_core26.timestamp)("updatedAt", {
|
|
4881
|
-
mode: "date",
|
|
4882
|
-
fsp: 3
|
|
4883
|
-
}).default(import_drizzle_orm12.sql`CURRENT_TIMESTAMP(3)`),
|
|
4884
|
-
deletedAt: (0, import_mysql_core26.timestamp)("deletedAt", {
|
|
4885
|
-
mode: "date",
|
|
4886
|
-
fsp: 3
|
|
4887
|
-
})
|
|
4888
|
-
}, (cm) => ({
|
|
4889
|
-
typeIdx: (0, import_mysql_core26.index)("type_idx").on(cm.type),
|
|
4890
|
-
createdByIdx: (0, import_mysql_core26.index)("createdById_idx").on(cm.createdById),
|
|
4891
|
-
createdAtIdx: (0, import_mysql_core26.index)("createdAt_idx").on(cm.createdAt)
|
|
4892
|
-
}));
|
|
4893
|
-
return {
|
|
4894
|
-
contentResource
|
|
4895
|
-
};
|
|
4896
|
-
}, "getContentResourceSchema");
|
|
4897
|
-
|
|
4898
|
-
// src/lib/mysql/schemas/content/content-resource-resource.ts
|
|
4899
|
-
var import_drizzle_orm13 = require("drizzle-orm");
|
|
4900
|
-
var import_mysql_core27 = require("drizzle-orm/mysql-core");
|
|
4901
|
-
var getContentResourceResourceSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4902
|
-
const contentResourceResource = mysqlTable("contentResourceResource", {
|
|
4903
|
-
resourceOfId: (0, import_mysql_core27.varchar)("resourceOfId", {
|
|
4904
|
-
length: 255
|
|
4905
|
-
}).notNull(),
|
|
4906
|
-
resourceId: (0, import_mysql_core27.varchar)("resourceId", {
|
|
4907
|
-
length: 255
|
|
4908
|
-
}).notNull(),
|
|
4909
|
-
position: (0, import_mysql_core27.double)("position").notNull().default(0),
|
|
4910
|
-
metadata: (0, import_mysql_core27.json)("fields").$type().default({}),
|
|
4911
|
-
createdAt: (0, import_mysql_core27.timestamp)("createdAt", {
|
|
4912
|
-
mode: "date",
|
|
4913
|
-
fsp: 3
|
|
4914
|
-
}).default(import_drizzle_orm13.sql`CURRENT_TIMESTAMP(3)`),
|
|
4915
|
-
updatedAt: (0, import_mysql_core27.timestamp)("updatedAt", {
|
|
4916
|
-
mode: "date",
|
|
4917
|
-
fsp: 3
|
|
4918
|
-
}).default(import_drizzle_orm13.sql`CURRENT_TIMESTAMP(3)`),
|
|
4919
|
-
deletedAt: (0, import_mysql_core27.timestamp)("deletedAt", {
|
|
4920
|
-
mode: "date",
|
|
4921
|
-
fsp: 3
|
|
4922
|
-
})
|
|
4923
|
-
}, (crr) => ({
|
|
4924
|
-
pk: (0, import_mysql_core27.primaryKey)({
|
|
4925
|
-
columns: [
|
|
4926
|
-
crr.resourceOfId,
|
|
4927
|
-
crr.resourceId
|
|
4928
|
-
]
|
|
4929
|
-
}),
|
|
4930
|
-
contentResourceIdIdx: (0, import_mysql_core27.index)("contentResourceId_idx").on(crr.resourceOfId),
|
|
4931
|
-
resourceIdIdx: (0, import_mysql_core27.index)("resourceId_idx").on(crr.resourceId)
|
|
4932
|
-
}));
|
|
4933
|
-
return {
|
|
4934
|
-
contentResourceResource
|
|
4935
|
-
};
|
|
4936
|
-
}, "getContentResourceResourceSchema");
|
|
4937
|
-
|
|
4938
|
-
// src/lib/mysql/schemas/content/contribution-types.ts
|
|
4939
|
-
var import_mysql_core28 = require("drizzle-orm/mysql-core");
|
|
4940
|
-
var getContributionTypesSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
4941
|
-
const contributionTypes = mysqlTable("contributionType", {
|
|
4942
|
-
id: (0, import_mysql_core28.varchar)("id", {
|
|
4943
|
-
length: 255
|
|
4944
|
-
}).notNull().primaryKey(),
|
|
4945
|
-
slug: (0, import_mysql_core28.varchar)("slug", {
|
|
4946
|
-
length: 255
|
|
4947
|
-
}).notNull().unique(),
|
|
4948
|
-
name: (0, import_mysql_core28.varchar)("name", {
|
|
4949
|
-
length: 255
|
|
4950
|
-
}).notNull(),
|
|
4951
|
-
description: (0, import_mysql_core28.text)("description"),
|
|
4952
|
-
active: (0, import_mysql_core28.boolean)("active").notNull().default(true),
|
|
4953
|
-
createdAt: (0, import_mysql_core28.timestamp)("createdAt", {
|
|
4954
|
-
mode: "date",
|
|
4955
|
-
fsp: 3
|
|
4956
|
-
}).defaultNow(),
|
|
4957
|
-
updatedAt: (0, import_mysql_core28.timestamp)("updatedAt", {
|
|
4958
|
-
mode: "date",
|
|
4959
|
-
fsp: 3
|
|
4960
|
-
}).defaultNow(),
|
|
4961
|
-
deletedAt: (0, import_mysql_core28.timestamp)("deletedAt", {
|
|
4962
|
-
mode: "date",
|
|
4963
|
-
fsp: 3
|
|
4964
|
-
})
|
|
4965
|
-
}, (ct) => ({
|
|
4966
|
-
nameIdx: (0, import_mysql_core28.index)("name_idx").on(ct.name),
|
|
4967
|
-
slugIdx: (0, import_mysql_core28.index)("slug_idx").on(ct.slug)
|
|
4968
|
-
}));
|
|
4969
|
-
return {
|
|
4970
|
-
contributionTypes
|
|
4971
|
-
};
|
|
4972
|
-
}, "getContributionTypesSchema");
|
|
5171
|
+
}
|
|
5172
|
+
__name(getPurchaseUserTransferSchema, "getPurchaseUserTransferSchema");
|
|
4973
5173
|
|
|
4974
5174
|
// src/lib/mysql/schemas/content/resource-progress.ts
|
|
4975
|
-
var
|
|
5175
|
+
var import_drizzle_orm24 = require("drizzle-orm");
|
|
4976
5176
|
var import_mysql_core29 = require("drizzle-orm/mysql-core");
|
|
4977
|
-
|
|
4978
|
-
|
|
5177
|
+
function getResourceProgressSchema(mysqlTable) {
|
|
5178
|
+
return mysqlTable("resourceProgresses", {
|
|
4979
5179
|
userId: (0, import_mysql_core29.varchar)("userId", {
|
|
4980
5180
|
length: 191
|
|
4981
5181
|
}).notNull(),
|
|
@@ -4994,7 +5194,7 @@ var getResourceProgressSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
4994
5194
|
createdAt: (0, import_mysql_core29.datetime)("createdAt", {
|
|
4995
5195
|
mode: "string",
|
|
4996
5196
|
fsp: 3
|
|
4997
|
-
}).default(
|
|
5197
|
+
}).default(import_drizzle_orm24.sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
4998
5198
|
}, (crp) => {
|
|
4999
5199
|
return {
|
|
5000
5200
|
userIdLessonIdIdx: (0, import_mysql_core29.index)("crp_userId_contentResourceId_idx").on(crp.userId, crp.contentResourceId),
|
|
@@ -5008,34 +5208,60 @@ var getResourceProgressSchema = /* @__PURE__ */ __name((mysqlTable) => {
|
|
|
5008
5208
|
userIdIdx: (0, import_mysql_core29.index)("resourceId_idx").on(crp.userId)
|
|
5009
5209
|
};
|
|
5010
5210
|
});
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
};
|
|
5014
|
-
}, "getResourceProgressSchema");
|
|
5211
|
+
}
|
|
5212
|
+
__name(getResourceProgressSchema, "getResourceProgressSchema");
|
|
5015
5213
|
|
|
5016
5214
|
// src/lib/mysql/index.ts
|
|
5017
|
-
function
|
|
5215
|
+
function getCourseBuilderSchema(mysqlTable) {
|
|
5018
5216
|
return {
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
coupon: getCouponSchema(
|
|
5217
|
+
accounts: getAccountsSchema(mysqlTable),
|
|
5218
|
+
accountsRelations: getAccountsRelationsSchema(mysqlTable),
|
|
5219
|
+
permissions: getPermissionsSchema(mysqlTable),
|
|
5220
|
+
permissionsRelations: getPermissionsRelationsSchema(mysqlTable),
|
|
5221
|
+
rolePermissions: getRolePermissionsSchema(mysqlTable),
|
|
5222
|
+
rolePermissionsRelations: getRolePermissionsRelationsSchema(mysqlTable),
|
|
5223
|
+
roles: getRolesSchema(mysqlTable),
|
|
5224
|
+
rolesRelations: getRolesRelationsSchema(mysqlTable),
|
|
5225
|
+
sessions: getSessionsSchema(mysqlTable),
|
|
5226
|
+
sessionsRelations: getSessionRelationsSchema(mysqlTable),
|
|
5227
|
+
userPermissions: getUserPermissionsSchema(mysqlTable),
|
|
5228
|
+
userPermissionsRelations: getUserPermissionsRelationsSchema(mysqlTable),
|
|
5229
|
+
userRoles: getUserRolesSchema(mysqlTable),
|
|
5230
|
+
userRolesRelations: getUserRolesRelationsSchema(mysqlTable),
|
|
5231
|
+
users: getUsersSchema(mysqlTable),
|
|
5232
|
+
usersRelations: getUsersRelationsSchema(mysqlTable),
|
|
5233
|
+
verificationTokens: getVerificationTokensSchema(mysqlTable),
|
|
5234
|
+
coupon: getCouponSchema(mysqlTable),
|
|
5235
|
+
merchantAccount: getMerchantAccountSchema(mysqlTable),
|
|
5236
|
+
merchantCharge: getMerchantChargeSchema(mysqlTable),
|
|
5237
|
+
merchantCoupon: getMerchantCouponSchema(mysqlTable),
|
|
5238
|
+
merchantCustomer: getMerchantCustomerSchema(mysqlTable),
|
|
5239
|
+
merchantPrice: getMerchantPriceSchema(mysqlTable),
|
|
5240
|
+
merchantProduct: getMerchantProductSchema(mysqlTable),
|
|
5241
|
+
merchantSession: getMerchantSessionSchema(mysqlTable),
|
|
5242
|
+
price: getPriceSchema(mysqlTable),
|
|
5243
|
+
product: getProductSchema(mysqlTable),
|
|
5244
|
+
purchase: getPurchaseSchema(mysqlTable),
|
|
5245
|
+
purchaseUserTransfer: getPurchaseUserTransferSchema(mysqlTable),
|
|
5246
|
+
communicationChannel: getCommunicationChannelSchema(mysqlTable),
|
|
5247
|
+
communicationPreferenceTypes: getCommunicationPreferenceTypesSchema(mysqlTable),
|
|
5248
|
+
communicationPreferences: getCommunicationPreferencesSchema(mysqlTable),
|
|
5249
|
+
communicationPreferencesRelations: getCommunicationPreferencesRelationsSchema(mysqlTable),
|
|
5250
|
+
contentContributions: getContentContributionsSchema(mysqlTable),
|
|
5251
|
+
contentContributionRelations: getContentContributionRelationsSchema(mysqlTable),
|
|
5252
|
+
contentResource: getContentResourceSchema(mysqlTable),
|
|
5253
|
+
contentResourceRelations: getContentResourceRelationsSchema(mysqlTable),
|
|
5254
|
+
contentResourceResource: getContentResourceResourceSchema(mysqlTable),
|
|
5255
|
+
contentResourceResourceRelations: getContentResourceResourceRelationsSchema(mysqlTable),
|
|
5256
|
+
contributionTypes: getContributionTypesSchema(mysqlTable),
|
|
5257
|
+
contributionTypesRelations: getContributionTypesRelationsSchema(mysqlTable),
|
|
5258
|
+
resourceProgress: getResourceProgressSchema(mysqlTable)
|
|
5037
5259
|
};
|
|
5038
5260
|
}
|
|
5261
|
+
__name(getCourseBuilderSchema, "getCourseBuilderSchema");
|
|
5262
|
+
function createTables(mySqlTable) {
|
|
5263
|
+
return getCourseBuilderSchema(mySqlTable);
|
|
5264
|
+
}
|
|
5039
5265
|
__name(createTables, "createTables");
|
|
5040
5266
|
function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
|
|
5041
5267
|
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchase, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, price, product } = createTables(tableFn);
|
|
@@ -5044,20 +5270,20 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
|
|
|
5044
5270
|
if (!options.id) {
|
|
5045
5271
|
throw new Error("No content resource id.");
|
|
5046
5272
|
}
|
|
5047
|
-
const currentResource = await client.select().from(contentResource).where((0,
|
|
5273
|
+
const currentResource = await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, options.id)).then((res) => res[0]);
|
|
5048
5274
|
await client.update(contentResource).set({
|
|
5049
5275
|
fields: {
|
|
5050
5276
|
...currentResource.fields,
|
|
5051
5277
|
...options.fields
|
|
5052
5278
|
}
|
|
5053
|
-
}).where((0,
|
|
5054
|
-
return await client.select().from(contentResource).where((0,
|
|
5279
|
+
}).where((0, import_drizzle_orm25.eq)(contentResource.id, options.id));
|
|
5280
|
+
return await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, options.id)).then((res) => res[0]);
|
|
5055
5281
|
},
|
|
5056
5282
|
async getVideoResource(id) {
|
|
5057
5283
|
if (!id) {
|
|
5058
5284
|
throw new Error("videoResourceId is required");
|
|
5059
5285
|
}
|
|
5060
|
-
const query =
|
|
5286
|
+
const query = import_drizzle_orm25.sql`
|
|
5061
5287
|
SELECT
|
|
5062
5288
|
id as _id,
|
|
5063
5289
|
CAST(updatedAt AS DATETIME) as _updatedAt,
|
|
@@ -5088,10 +5314,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
|
|
|
5088
5314
|
...data,
|
|
5089
5315
|
id
|
|
5090
5316
|
});
|
|
5091
|
-
return await client.select().from(contentResource).where((0,
|
|
5317
|
+
return await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, id)).then((res) => res[0]);
|
|
5092
5318
|
},
|
|
5093
5319
|
async getContentResource(data) {
|
|
5094
|
-
return await client.select().from(contentResource).where((0,
|
|
5320
|
+
return await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, data)).then((res) => res[0]) ?? null;
|
|
5095
5321
|
},
|
|
5096
5322
|
async createUser(data) {
|
|
5097
5323
|
const id = crypto.randomUUID();
|
|
@@ -5099,57 +5325,57 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
|
|
|
5099
5325
|
...data,
|
|
5100
5326
|
id
|
|
5101
5327
|
});
|
|
5102
|
-
return await client.select().from(users).where((0,
|
|
5328
|
+
return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, id)).then((res) => res[0]);
|
|
5103
5329
|
},
|
|
5104
5330
|
async getUser(data) {
|
|
5105
|
-
return await client.select().from(users).where((0,
|
|
5331
|
+
return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, data)).then((res) => res[0]) ?? null;
|
|
5106
5332
|
},
|
|
5107
5333
|
async getUserByEmail(data) {
|
|
5108
|
-
return await client.select().from(users).where((0,
|
|
5334
|
+
return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.email, data)).then((res) => res[0]) ?? null;
|
|
5109
5335
|
},
|
|
5110
5336
|
async createSession(data) {
|
|
5111
5337
|
await client.insert(sessions).values(data);
|
|
5112
|
-
return await client.select().from(sessions).where((0,
|
|
5338
|
+
return await client.select().from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
|
|
5113
5339
|
},
|
|
5114
5340
|
async getSessionAndUser(data) {
|
|
5115
5341
|
return await client.select({
|
|
5116
5342
|
session: sessions,
|
|
5117
5343
|
user: users
|
|
5118
|
-
}).from(sessions).where((0,
|
|
5344
|
+
}).from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data)).innerJoin(users, (0, import_drizzle_orm25.eq)(users.id, sessions.userId)).then((res) => res[0]) ?? null;
|
|
5119
5345
|
},
|
|
5120
5346
|
async updateUser(data) {
|
|
5121
5347
|
if (!data.id) {
|
|
5122
5348
|
throw new Error("No user id.");
|
|
5123
5349
|
}
|
|
5124
|
-
await client.update(users).set(data).where((0,
|
|
5125
|
-
return await client.select().from(users).where((0,
|
|
5350
|
+
await client.update(users).set(data).where((0, import_drizzle_orm25.eq)(users.id, data.id));
|
|
5351
|
+
return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, data.id)).then((res) => res[0]);
|
|
5126
5352
|
},
|
|
5127
5353
|
async updateSession(data) {
|
|
5128
|
-
await client.update(sessions).set(data).where((0,
|
|
5129
|
-
return await client.select().from(sessions).where((0,
|
|
5354
|
+
await client.update(sessions).set(data).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data.sessionToken));
|
|
5355
|
+
return await client.select().from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
|
|
5130
5356
|
},
|
|
5131
5357
|
async linkAccount(rawAccount) {
|
|
5132
5358
|
await client.insert(accounts).values(rawAccount);
|
|
5133
5359
|
},
|
|
5134
5360
|
async getUserByAccount(account) {
|
|
5135
|
-
const dbAccount = await client.select().from(accounts).where((0,
|
|
5361
|
+
const dbAccount = await client.select().from(accounts).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm25.eq)(accounts.provider, account.provider))).leftJoin(users, (0, import_drizzle_orm25.eq)(accounts.userId, users.id)).then((res) => res[0]) ?? null;
|
|
5136
5362
|
if (!dbAccount) {
|
|
5137
5363
|
return null;
|
|
5138
5364
|
}
|
|
5139
5365
|
return dbAccount.user;
|
|
5140
5366
|
},
|
|
5141
5367
|
async deleteSession(sessionToken) {
|
|
5142
|
-
const session = await client.select().from(sessions).where((0,
|
|
5143
|
-
await client.delete(sessions).where((0,
|
|
5368
|
+
const session = await client.select().from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, sessionToken)).then((res) => res[0]) ?? null;
|
|
5369
|
+
await client.delete(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, sessionToken));
|
|
5144
5370
|
return session;
|
|
5145
5371
|
},
|
|
5146
5372
|
async createVerificationToken(token) {
|
|
5147
5373
|
await client.insert(verificationTokens).values(token);
|
|
5148
|
-
return await client.select().from(verificationTokens).where((0,
|
|
5374
|
+
return await client.select().from(verificationTokens).where((0, import_drizzle_orm25.eq)(verificationTokens.identifier, token.identifier)).then((res) => res[0]);
|
|
5149
5375
|
},
|
|
5150
5376
|
async useVerificationToken(token) {
|
|
5151
5377
|
try {
|
|
5152
|
-
const deletedToken = await client.select().from(verificationTokens).where((0,
|
|
5378
|
+
const deletedToken = await client.select().from(verificationTokens).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm25.eq)(verificationTokens.token, token.token))).then((res) => res[0]) ?? null;
|
|
5153
5379
|
if (deletedToken?.createdAt) {
|
|
5154
5380
|
const TIMEOUT_IN_SECONDS = 90;
|
|
5155
5381
|
const expireMultipleClicks = (0, import_date_fns.addSeconds)(deletedToken.createdAt, TIMEOUT_IN_SECONDS);
|
|
@@ -5158,7 +5384,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
|
|
|
5158
5384
|
const { id: _, ...verificationToken } = token;
|
|
5159
5385
|
return deletedToken;
|
|
5160
5386
|
} else {
|
|
5161
|
-
await client.delete(verificationTokens).where((0,
|
|
5387
|
+
await client.delete(verificationTokens).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm25.eq)(verificationTokens.token, token.token)));
|
|
5162
5388
|
return deletedToken;
|
|
5163
5389
|
}
|
|
5164
5390
|
}
|
|
@@ -5168,12 +5394,12 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
|
|
|
5168
5394
|
}
|
|
5169
5395
|
},
|
|
5170
5396
|
async deleteUser(id) {
|
|
5171
|
-
const user = await client.select().from(users).where((0,
|
|
5172
|
-
await client.delete(users).where((0,
|
|
5397
|
+
const user = await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, id)).then((res) => res[0] ?? null);
|
|
5398
|
+
await client.delete(users).where((0, import_drizzle_orm25.eq)(users.id, id));
|
|
5173
5399
|
return user;
|
|
5174
5400
|
},
|
|
5175
5401
|
async unlinkAccount(account) {
|
|
5176
|
-
await client.delete(accounts).where((0,
|
|
5402
|
+
await client.delete(accounts).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm25.eq)(accounts.provider, account.provider)));
|
|
5177
5403
|
return void 0;
|
|
5178
5404
|
}
|
|
5179
5405
|
};
|
|
@@ -5182,35 +5408,7 @@ __name(mySqlDrizzleAdapter, "mySqlDrizzleAdapter");
|
|
|
5182
5408
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5183
5409
|
0 && (module.exports = {
|
|
5184
5410
|
createTables,
|
|
5185
|
-
|
|
5186
|
-
getCommunicationChannelSchema,
|
|
5187
|
-
getCommunicationPreferenceTypesSchema,
|
|
5188
|
-
getCommunicationPreferencesSchema,
|
|
5189
|
-
getContentContributionsSchema,
|
|
5190
|
-
getContentResourceResourceSchema,
|
|
5191
|
-
getContentResourceSchema,
|
|
5192
|
-
getContributionTypesSchema,
|
|
5193
|
-
getCouponSchema,
|
|
5194
|
-
getMerchantAccountSchema,
|
|
5195
|
-
getMerchantChargeSchema,
|
|
5196
|
-
getMerchantCouponSchema,
|
|
5197
|
-
getMerchantCustomerSchema,
|
|
5198
|
-
getMerchantPriceSchema,
|
|
5199
|
-
getMerchantProductSchema,
|
|
5200
|
-
getMerchantSessionSchema,
|
|
5201
|
-
getPermissionsSchema,
|
|
5202
|
-
getPriceSchema,
|
|
5203
|
-
getProductSchema,
|
|
5204
|
-
getPurchaseSchema,
|
|
5205
|
-
getPurchaseUserTransferSchema,
|
|
5206
|
-
getResourceProgressSchema,
|
|
5207
|
-
getRolePermissionsSchema,
|
|
5208
|
-
getRolesSchema,
|
|
5209
|
-
getSessionsSchema,
|
|
5210
|
-
getUserPermissionsSchema,
|
|
5211
|
-
getUserRolesSchema,
|
|
5212
|
-
getUsersSchema,
|
|
5213
|
-
getVerificationTokensSchema,
|
|
5411
|
+
getCourseBuilderSchema,
|
|
5214
5412
|
mySqlDrizzleAdapter
|
|
5215
5413
|
});
|
|
5216
5414
|
//# sourceMappingURL=index.cjs.map
|