@coursebuilder/adapter-drizzle 2.0.1-canary.cd34f124e → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ULJCXOOM.js → chunk-25RKHMRM.js} +521 -4993
- package/dist/{chunk-WPDVDHLH.js → chunk-2AW5KYAK.js} +2 -2
- package/dist/{chunk-QDWLBCD3.js → chunk-3AF6MZQ7.js} +2 -2
- package/dist/{chunk-RDAVEULA.js → chunk-3EF5ZXLG.js} +2 -2
- package/dist/{chunk-4SMVVOU5.js → chunk-4SWTV7Z3.js} +2 -2
- package/dist/{chunk-6VDGZ4KA.js → chunk-7FBSP3VD.js} +2 -2
- package/dist/chunk-AP5HBIV4.js +112 -0
- package/dist/chunk-CFSRMUNC.js +78 -0
- package/dist/{chunk-Q5NZ5UFZ.js → chunk-DUFH5L2F.js} +2 -2
- package/dist/{chunk-DHII2GRW.js → chunk-EZEQQJNH.js} +2 -2
- package/dist/chunk-F56AI52P.js +49 -0
- package/dist/chunk-FJGNLVE4.js +101 -0
- package/dist/chunk-HAQZSRJL.js +4696 -0
- package/dist/chunk-I2U5PTWN.js +79 -0
- package/dist/chunk-IBQGXFEX.js +8729 -0
- package/dist/chunk-KIQLUFJX.js +101 -0
- package/dist/{chunk-3XHKEHGF.js → chunk-M3WM5Q7W.js} +2 -2
- package/dist/{chunk-52A4W4YI.js → chunk-MYG6PCE3.js} +2 -2
- package/dist/chunk-PJORQUQP.js +58 -0
- package/dist/{chunk-DB473RZJ.js → chunk-PNPTKVJ4.js} +4 -4
- package/dist/chunk-W6RPAAKG.js +2144 -0
- package/dist/chunk-WKJTU24D.js +88 -0
- package/dist/chunk-WWBSNLRC.js +63 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +18 -17
- package/dist/lib/mysql/cms-resource-actions.cjs +4715 -0
- package/dist/lib/mysql/cms-resource-actions.cjs.map +1 -0
- package/dist/lib/mysql/cms-resource-actions.d.cts +140 -0
- package/dist/lib/mysql/cms-resource-actions.d.ts +140 -0
- package/dist/lib/mysql/cms-resource-actions.js +8 -0
- package/dist/lib/mysql/cms-resource-actions.js.map +1 -0
- package/dist/lib/mysql/index.cjs +398 -186
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +5 -0
- package/dist/lib/mysql/index.d.ts +5 -0
- package/dist/lib/mysql/index.js +21 -17
- package/dist/lib/mysql/schemas/auth/accounts.js +5 -5
- package/dist/lib/mysql/schemas/auth/device-access-token.js +6 -6
- package/dist/lib/mysql/schemas/auth/device-verification.js +6 -6
- package/dist/lib/mysql/schemas/auth/personal-access-token.js +6 -6
- package/dist/lib/mysql/schemas/auth/profiles.js +5 -5
- package/dist/lib/mysql/schemas/auth/role-permissions.js +6 -6
- package/dist/lib/mysql/schemas/auth/roles.js +5 -5
- package/dist/lib/mysql/schemas/auth/sessions.js +6 -6
- package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -5
- package/dist/lib/mysql/schemas/auth/user-prefs.js +5 -5
- package/dist/lib/mysql/schemas/auth/user-roles.js +5 -5
- package/dist/lib/mysql/schemas/auth/users.js +5 -5
- package/dist/lib/mysql/schemas/commerce/coupon.js +5 -5
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +5 -5
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +5 -5
- package/dist/lib/mysql/schemas/commerce/price.js +5 -5
- package/dist/lib/mysql/schemas/commerce/product.js +5 -5
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +6 -6
- package/dist/lib/mysql/schemas/commerce/purchase.js +5 -5
- package/dist/lib/mysql/schemas/commerce/subscription.js +5 -5
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +6 -6
- package/dist/lib/mysql/schemas/communication/comment.js +5 -5
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -5
- package/dist/lib/mysql/schemas/communication/question-response.js +6 -6
- package/dist/lib/mysql/schemas/content/content-contributions.js +5 -5
- package/dist/lib/mysql/schemas/content/content-resource-product.js +5 -5
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -5
- package/dist/lib/mysql/schemas/content/content-resource-tag.js +5 -5
- package/dist/lib/mysql/schemas/content/content-resource-version.js +5 -5
- package/dist/lib/mysql/schemas/content/content-resource.js +5 -5
- package/dist/lib/mysql/schemas/content/tag-tag.js +5 -5
- package/dist/lib/mysql/schemas/content/tag.js +5 -5
- package/dist/lib/mysql/schemas/entitlements/entitlement.js +6 -6
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js +5 -5
- package/dist/lib/mysql/schemas/org/organization-memberships.js +5 -5
- package/dist/lib/mysql/schemas/org/organizations.js +5 -5
- package/dist/lib/utils.d.cts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/package.json +3 -3
- package/src/lib/mysql/cms-resource-actions.ts +490 -0
- package/src/lib/mysql/index.ts +2 -0
|
@@ -0,0 +1,2144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getContributionTypesSchema
|
|
3
|
+
} from "./chunk-6SJORFGN.js";
|
|
4
|
+
import {
|
|
5
|
+
getCommunicationPreferenceTypesSchema
|
|
6
|
+
} from "./chunk-QKFITIXC.js";
|
|
7
|
+
import {
|
|
8
|
+
getPermissionsSchema
|
|
9
|
+
} from "./chunk-UWUDJCJM.js";
|
|
10
|
+
import {
|
|
11
|
+
getCommunicationChannelSchema
|
|
12
|
+
} from "./chunk-65H5Y4PD.js";
|
|
13
|
+
import {
|
|
14
|
+
getMerchantCouponSchema
|
|
15
|
+
} from "./chunk-NON5CXDH.js";
|
|
16
|
+
import {
|
|
17
|
+
getMerchantCustomerSchema
|
|
18
|
+
} from "./chunk-SIZFEXIS.js";
|
|
19
|
+
import {
|
|
20
|
+
getMerchantPriceSchema
|
|
21
|
+
} from "./chunk-PMCOC5PM.js";
|
|
22
|
+
import {
|
|
23
|
+
getMerchantProductSchema
|
|
24
|
+
} from "./chunk-2I7NIOKI.js";
|
|
25
|
+
import {
|
|
26
|
+
getMerchantSessionSchema
|
|
27
|
+
} from "./chunk-5NNBQJUP.js";
|
|
28
|
+
import {
|
|
29
|
+
getMerchantAccountSchema
|
|
30
|
+
} from "./chunk-DNBW5D64.js";
|
|
31
|
+
import {
|
|
32
|
+
__name
|
|
33
|
+
} from "./chunk-2X5XVNDN.js";
|
|
34
|
+
|
|
35
|
+
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
36
|
+
import { relations as relations27 } from "drizzle-orm";
|
|
37
|
+
import { boolean as boolean7, index as index27, primaryKey as primaryKey17, timestamp as timestamp26, varchar as varchar27 } from "drizzle-orm/mysql-core";
|
|
38
|
+
|
|
39
|
+
// src/lib/mysql/schemas/auth/roles.ts
|
|
40
|
+
import { relations } from "drizzle-orm";
|
|
41
|
+
import { boolean, index, text, timestamp, uniqueIndex, varchar } from "drizzle-orm/mysql-core";
|
|
42
|
+
function getRolesSchema(mysqlTable) {
|
|
43
|
+
return mysqlTable("Role", {
|
|
44
|
+
id: varchar("id", {
|
|
45
|
+
length: 255
|
|
46
|
+
}).notNull().primaryKey(),
|
|
47
|
+
organizationId: varchar("organizationId", {
|
|
48
|
+
length: 191
|
|
49
|
+
}),
|
|
50
|
+
name: varchar("name", {
|
|
51
|
+
length: 255
|
|
52
|
+
}).notNull(),
|
|
53
|
+
description: text("description"),
|
|
54
|
+
active: boolean("active").notNull().default(true),
|
|
55
|
+
createdAt: timestamp("createdAt", {
|
|
56
|
+
mode: "date",
|
|
57
|
+
fsp: 3
|
|
58
|
+
}).defaultNow(),
|
|
59
|
+
updatedAt: timestamp("updatedAt", {
|
|
60
|
+
mode: "date",
|
|
61
|
+
fsp: 3
|
|
62
|
+
}).defaultNow(),
|
|
63
|
+
deletedAt: timestamp("deletedAt", {
|
|
64
|
+
mode: "date",
|
|
65
|
+
fsp: 3
|
|
66
|
+
})
|
|
67
|
+
}, (role) => ({
|
|
68
|
+
nameIdx: index("name_idx").on(role.name),
|
|
69
|
+
organizationIdIdx: index("organizationId_idx").on(role.organizationId),
|
|
70
|
+
uniqueNamePerOrg: uniqueIndex("unique_name_per_org").on(role.organizationId, role.name)
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
__name(getRolesSchema, "getRolesSchema");
|
|
74
|
+
function getRolesRelationsSchema(mysqlTable) {
|
|
75
|
+
const roles = getRolesSchema(mysqlTable);
|
|
76
|
+
const userRoles = getUserRolesSchema(mysqlTable);
|
|
77
|
+
return relations(roles, ({ many }) => ({
|
|
78
|
+
userRoles: many(userRoles, {
|
|
79
|
+
relationName: "role"
|
|
80
|
+
})
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
__name(getRolesRelationsSchema, "getRolesRelationsSchema");
|
|
84
|
+
|
|
85
|
+
// src/lib/mysql/schemas/auth/users.ts
|
|
86
|
+
import { relations as relations26, sql as sql20 } from "drizzle-orm";
|
|
87
|
+
import { index as index26, json as json17, timestamp as timestamp25, varchar as varchar26 } from "drizzle-orm/mysql-core";
|
|
88
|
+
|
|
89
|
+
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
90
|
+
import { relations as relations19, sql as sql16 } from "drizzle-orm";
|
|
91
|
+
import { decimal as decimal3, index as index19, json as json13, primaryKey as primaryKey12, timestamp as timestamp19, unique as unique4, varchar as varchar19 } from "drizzle-orm/mysql-core";
|
|
92
|
+
|
|
93
|
+
// src/lib/mysql/schemas/org/organization-memberships.ts
|
|
94
|
+
import { relations as relations17, sql as sql14 } from "drizzle-orm";
|
|
95
|
+
import { index as index17, json as json11, timestamp as timestamp17, varchar as varchar17 } from "drizzle-orm/mysql-core";
|
|
96
|
+
|
|
97
|
+
// src/lib/mysql/schemas/org/organization-membership-roles.ts
|
|
98
|
+
import { relations as relations16 } from "drizzle-orm";
|
|
99
|
+
import { boolean as boolean3, index as index16, primaryKey as primaryKey10, timestamp as timestamp16, varchar as varchar16 } from "drizzle-orm/mysql-core";
|
|
100
|
+
|
|
101
|
+
// src/lib/mysql/schemas/org/organizations.ts
|
|
102
|
+
import { relations as relations15, sql as sql13 } from "drizzle-orm";
|
|
103
|
+
import { index as index15, json as json10, timestamp as timestamp15, varchar as varchar15 } from "drizzle-orm/mysql-core";
|
|
104
|
+
|
|
105
|
+
// src/lib/mysql/schemas/commerce/subscription.ts
|
|
106
|
+
import { relations as relations14, sql as sql12 } from "drizzle-orm";
|
|
107
|
+
import { index as index14, json as json9, primaryKey as primaryKey9, timestamp as timestamp14, varchar as varchar14 } from "drizzle-orm/mysql-core";
|
|
108
|
+
|
|
109
|
+
// src/lib/mysql/schemas/commerce/merchant-subscription.ts
|
|
110
|
+
import { relations as relations3, sql as sql2 } from "drizzle-orm";
|
|
111
|
+
import { index as index3, int as int2, primaryKey as primaryKey2, timestamp as timestamp3, varchar as varchar3 } from "drizzle-orm/mysql-core";
|
|
112
|
+
|
|
113
|
+
// src/lib/mysql/schemas/commerce/merchant-charge.ts
|
|
114
|
+
import { relations as relations2, sql } from "drizzle-orm";
|
|
115
|
+
import { index as index2, int, primaryKey, timestamp as timestamp2, unique, varchar as varchar2 } from "drizzle-orm/mysql-core";
|
|
116
|
+
function getMerchantChargeSchema(mysqlTable) {
|
|
117
|
+
return mysqlTable("MerchantCharge", {
|
|
118
|
+
id: varchar2("id", {
|
|
119
|
+
length: 191
|
|
120
|
+
}).notNull(),
|
|
121
|
+
organizationId: varchar2("organizationId", {
|
|
122
|
+
length: 191
|
|
123
|
+
}),
|
|
124
|
+
status: int("status").default(0).notNull(),
|
|
125
|
+
identifier: varchar2("identifier", {
|
|
126
|
+
length: 191
|
|
127
|
+
}).notNull(),
|
|
128
|
+
userId: varchar2("userId", {
|
|
129
|
+
length: 191
|
|
130
|
+
}).notNull(),
|
|
131
|
+
merchantAccountId: varchar2("merchantAccountId", {
|
|
132
|
+
length: 191
|
|
133
|
+
}).notNull(),
|
|
134
|
+
merchantProductId: varchar2("merchantProductId", {
|
|
135
|
+
length: 191
|
|
136
|
+
}).notNull(),
|
|
137
|
+
merchantSubscriptionId: varchar2("merchantSubscriptionId", {
|
|
138
|
+
length: 191
|
|
139
|
+
}),
|
|
140
|
+
createdAt: timestamp2("createdAt", {
|
|
141
|
+
mode: "date",
|
|
142
|
+
fsp: 3
|
|
143
|
+
}).default(sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
144
|
+
merchantCustomerId: varchar2("merchantCustomerId", {
|
|
145
|
+
length: 191
|
|
146
|
+
}).notNull()
|
|
147
|
+
}, (table) => {
|
|
148
|
+
return {
|
|
149
|
+
merchantChargeId: primaryKey({
|
|
150
|
+
columns: [
|
|
151
|
+
table.id
|
|
152
|
+
],
|
|
153
|
+
name: "MerchantCharge_id"
|
|
154
|
+
}),
|
|
155
|
+
merchantChargeIdentifierKey: unique("MerchantCharge_identifier_key").on(table.identifier),
|
|
156
|
+
merchantSubscriptionIdIdx: index2("merchantSubscriptionId_idx").on(table.merchantSubscriptionId),
|
|
157
|
+
organizationIdIdx: index2("organizationId_idx").on(table.organizationId)
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
__name(getMerchantChargeSchema, "getMerchantChargeSchema");
|
|
162
|
+
function getMerchantChargeRelationsSchema(mysqlTable) {
|
|
163
|
+
const merchantCharge = getMerchantChargeSchema(mysqlTable);
|
|
164
|
+
const merchantAccount = getMerchantAccountSchema(mysqlTable);
|
|
165
|
+
const merchantProduct = getMerchantProductSchema(mysqlTable);
|
|
166
|
+
const merchantCustomer = getMerchantCustomerSchema(mysqlTable);
|
|
167
|
+
const merchantSubscription = getMerchantSubscriptionSchema(mysqlTable);
|
|
168
|
+
return relations2(merchantCharge, ({ one }) => ({
|
|
169
|
+
merchantAccount: one(merchantAccount, {
|
|
170
|
+
fields: [
|
|
171
|
+
merchantCharge.merchantAccountId
|
|
172
|
+
],
|
|
173
|
+
references: [
|
|
174
|
+
merchantAccount.id
|
|
175
|
+
],
|
|
176
|
+
relationName: "merchantAccount"
|
|
177
|
+
}),
|
|
178
|
+
merchantProduct: one(merchantProduct, {
|
|
179
|
+
fields: [
|
|
180
|
+
merchantCharge.merchantProductId
|
|
181
|
+
],
|
|
182
|
+
references: [
|
|
183
|
+
merchantProduct.id
|
|
184
|
+
],
|
|
185
|
+
relationName: "merchantProduct"
|
|
186
|
+
}),
|
|
187
|
+
merchantCustomer: one(merchantCustomer, {
|
|
188
|
+
fields: [
|
|
189
|
+
merchantCharge.merchantCustomerId
|
|
190
|
+
],
|
|
191
|
+
references: [
|
|
192
|
+
merchantCustomer.id
|
|
193
|
+
],
|
|
194
|
+
relationName: "merchantCustomer"
|
|
195
|
+
}),
|
|
196
|
+
merchantSubscription: one(merchantSubscription, {
|
|
197
|
+
fields: [
|
|
198
|
+
merchantCharge.merchantSubscriptionId
|
|
199
|
+
],
|
|
200
|
+
references: [
|
|
201
|
+
merchantSubscription.id
|
|
202
|
+
],
|
|
203
|
+
relationName: "merchantSubscription"
|
|
204
|
+
})
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
__name(getMerchantChargeRelationsSchema, "getMerchantChargeRelationsSchema");
|
|
208
|
+
|
|
209
|
+
// src/lib/mysql/schemas/commerce/merchant-subscription.ts
|
|
210
|
+
function getMerchantSubscriptionSchema(mysqlTable) {
|
|
211
|
+
return mysqlTable("MerchantSubscription", {
|
|
212
|
+
id: varchar3("id", {
|
|
213
|
+
length: 191
|
|
214
|
+
}).notNull(),
|
|
215
|
+
organizationId: varchar3("organizationId", {
|
|
216
|
+
length: 191
|
|
217
|
+
}),
|
|
218
|
+
merchantAccountId: varchar3("merchantAccountId", {
|
|
219
|
+
length: 191
|
|
220
|
+
}).notNull(),
|
|
221
|
+
status: int2("status").default(0).notNull(),
|
|
222
|
+
createdAt: timestamp3("createdAt", {
|
|
223
|
+
mode: "date",
|
|
224
|
+
fsp: 3
|
|
225
|
+
}).default(sql2`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
226
|
+
label: varchar3("label", {
|
|
227
|
+
length: 191
|
|
228
|
+
}),
|
|
229
|
+
identifier: varchar3("identifier", {
|
|
230
|
+
length: 191
|
|
231
|
+
}),
|
|
232
|
+
merchantCustomerId: varchar3("merchantCustomerId", {
|
|
233
|
+
length: 191
|
|
234
|
+
}).notNull(),
|
|
235
|
+
merchantProductId: varchar3("merchantProductId", {
|
|
236
|
+
length: 191
|
|
237
|
+
}).notNull()
|
|
238
|
+
}, (table) => {
|
|
239
|
+
return {
|
|
240
|
+
merchantSubscriptionId: primaryKey2({
|
|
241
|
+
columns: [
|
|
242
|
+
table.id
|
|
243
|
+
],
|
|
244
|
+
name: "MerchantSubscription_id"
|
|
245
|
+
}),
|
|
246
|
+
organizationIdIdx: index3("organizationId_idx").on(table.organizationId)
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
__name(getMerchantSubscriptionSchema, "getMerchantSubscriptionSchema");
|
|
251
|
+
function getMerchantSubscriptionRelationsSchema(mysqlTable) {
|
|
252
|
+
const merchantSubscription = getMerchantSubscriptionSchema(mysqlTable);
|
|
253
|
+
const merchantCharge = getMerchantChargeSchema(mysqlTable);
|
|
254
|
+
const subscription = getSubscriptionSchema(mysqlTable);
|
|
255
|
+
return relations3(merchantSubscription, ({ many, one }) => ({
|
|
256
|
+
merchantCharges: many(merchantCharge, {
|
|
257
|
+
relationName: "merchantSubscription"
|
|
258
|
+
}),
|
|
259
|
+
subscription: one(subscription, {
|
|
260
|
+
fields: [
|
|
261
|
+
merchantSubscription.id
|
|
262
|
+
],
|
|
263
|
+
references: [
|
|
264
|
+
subscription.merchantSubscriptionId
|
|
265
|
+
],
|
|
266
|
+
relationName: "subscription"
|
|
267
|
+
})
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
__name(getMerchantSubscriptionRelationsSchema, "getMerchantSubscriptionRelationsSchema");
|
|
271
|
+
|
|
272
|
+
// src/lib/mysql/schemas/commerce/product.ts
|
|
273
|
+
import { relations as relations13, sql as sql11 } from "drizzle-orm";
|
|
274
|
+
import { index as index13, int as int5, json as json8, primaryKey as primaryKey8, timestamp as timestamp13, varchar as varchar13 } from "drizzle-orm/mysql-core";
|
|
275
|
+
|
|
276
|
+
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
277
|
+
import { relations as relations11, sql as sql9 } from "drizzle-orm";
|
|
278
|
+
import { double as double4, index as index11, json as json6, primaryKey as primaryKey6, timestamp as timestamp11, varchar as varchar11 } from "drizzle-orm/mysql-core";
|
|
279
|
+
|
|
280
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
281
|
+
import { relations as relations10, sql as sql8 } from "drizzle-orm";
|
|
282
|
+
import { index as index10, json as json5, timestamp as timestamp10, varchar as varchar10 } from "drizzle-orm/mysql-core";
|
|
283
|
+
|
|
284
|
+
// src/lib/mysql/schemas/content/content-contributions.ts
|
|
285
|
+
import { relations as relations4 } from "drizzle-orm";
|
|
286
|
+
import { boolean as boolean2, index as index4, timestamp as timestamp4, varchar as varchar4 } from "drizzle-orm/mysql-core";
|
|
287
|
+
function getContentContributionsSchema(mysqlTable) {
|
|
288
|
+
return mysqlTable("ContentContribution", {
|
|
289
|
+
id: varchar4("id", {
|
|
290
|
+
length: 255
|
|
291
|
+
}).notNull().primaryKey(),
|
|
292
|
+
userId: varchar4("userId", {
|
|
293
|
+
length: 255
|
|
294
|
+
}).notNull(),
|
|
295
|
+
organizationId: varchar4("organizationId", {
|
|
296
|
+
length: 191
|
|
297
|
+
}),
|
|
298
|
+
organizationMembershipId: varchar4("organizationMembershipId", {
|
|
299
|
+
length: 255
|
|
300
|
+
}),
|
|
301
|
+
contentId: varchar4("contentId", {
|
|
302
|
+
length: 255
|
|
303
|
+
}).notNull(),
|
|
304
|
+
contributionTypeId: varchar4("contributionTypeId", {
|
|
305
|
+
length: 255
|
|
306
|
+
}).notNull(),
|
|
307
|
+
active: boolean2("active").notNull().default(true),
|
|
308
|
+
createdAt: timestamp4("createdAt", {
|
|
309
|
+
mode: "date",
|
|
310
|
+
fsp: 3
|
|
311
|
+
}).defaultNow(),
|
|
312
|
+
updatedAt: timestamp4("updatedAt", {
|
|
313
|
+
mode: "date",
|
|
314
|
+
fsp: 3
|
|
315
|
+
}).defaultNow(),
|
|
316
|
+
deletedAt: timestamp4("deletedAt", {
|
|
317
|
+
mode: "date",
|
|
318
|
+
fsp: 3
|
|
319
|
+
})
|
|
320
|
+
}, (cc) => ({
|
|
321
|
+
userIdIdx: index4("userId_idx").on(cc.userId),
|
|
322
|
+
contentIdIdx: index4("contentId_idx").on(cc.contentId),
|
|
323
|
+
contributionTypeIdIdx: index4("contributionTypeId_idx").on(cc.contributionTypeId),
|
|
324
|
+
organizationMembershipIdIdx: index4("organizationMembershipId_idx").on(cc.organizationMembershipId)
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
__name(getContentContributionsSchema, "getContentContributionsSchema");
|
|
328
|
+
function getContentContributionRelationsSchema(mysqlTable, overrides = {}) {
|
|
329
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
330
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
331
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
332
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
333
|
+
const contributionTypes = getContributionTypesSchema(mysqlTable);
|
|
334
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
335
|
+
return relations4(contentContributions, ({ one }) => ({
|
|
336
|
+
user: one(users, {
|
|
337
|
+
fields: [
|
|
338
|
+
contentContributions.userId
|
|
339
|
+
],
|
|
340
|
+
references: [
|
|
341
|
+
users.id
|
|
342
|
+
],
|
|
343
|
+
relationName: "user"
|
|
344
|
+
}),
|
|
345
|
+
content: one(contentResource, {
|
|
346
|
+
fields: [
|
|
347
|
+
contentContributions.contentId
|
|
348
|
+
],
|
|
349
|
+
references: [
|
|
350
|
+
contentResource.id
|
|
351
|
+
],
|
|
352
|
+
relationName: "contributions"
|
|
353
|
+
}),
|
|
354
|
+
contributionType: one(contributionTypes, {
|
|
355
|
+
fields: [
|
|
356
|
+
contentContributions.contributionTypeId
|
|
357
|
+
],
|
|
358
|
+
references: [
|
|
359
|
+
contributionTypes.id
|
|
360
|
+
],
|
|
361
|
+
relationName: "contributionType"
|
|
362
|
+
}),
|
|
363
|
+
organizationMembership: one(organizationMemberships, {
|
|
364
|
+
fields: [
|
|
365
|
+
contentContributions.organizationMembershipId
|
|
366
|
+
],
|
|
367
|
+
references: [
|
|
368
|
+
organizationMemberships.id
|
|
369
|
+
],
|
|
370
|
+
relationName: "organizationMembership"
|
|
371
|
+
})
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
__name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
|
|
375
|
+
|
|
376
|
+
// src/lib/mysql/schemas/content/content-resource-resource.ts
|
|
377
|
+
import { relations as relations5, sql as sql3 } from "drizzle-orm";
|
|
378
|
+
import { double, index as index5, json, primaryKey as primaryKey3, timestamp as timestamp5, varchar as varchar5 } from "drizzle-orm/mysql-core";
|
|
379
|
+
function getContentResourceResourceSchema(mysqlTable) {
|
|
380
|
+
return mysqlTable("ContentResourceResource", {
|
|
381
|
+
resourceOfId: varchar5("resourceOfId", {
|
|
382
|
+
length: 255
|
|
383
|
+
}).notNull(),
|
|
384
|
+
resourceId: varchar5("resourceId", {
|
|
385
|
+
length: 255
|
|
386
|
+
}).notNull(),
|
|
387
|
+
position: double("position").notNull().default(0),
|
|
388
|
+
metadata: json("metadata").$type().default({}),
|
|
389
|
+
organizationId: varchar5("organizationId", {
|
|
390
|
+
length: 191
|
|
391
|
+
}),
|
|
392
|
+
createdAt: timestamp5("createdAt", {
|
|
393
|
+
mode: "date",
|
|
394
|
+
fsp: 3
|
|
395
|
+
}).default(sql3`CURRENT_TIMESTAMP(3)`),
|
|
396
|
+
updatedAt: timestamp5("updatedAt", {
|
|
397
|
+
mode: "date",
|
|
398
|
+
fsp: 3
|
|
399
|
+
}).default(sql3`CURRENT_TIMESTAMP(3)`),
|
|
400
|
+
deletedAt: timestamp5("deletedAt", {
|
|
401
|
+
mode: "date",
|
|
402
|
+
fsp: 3
|
|
403
|
+
})
|
|
404
|
+
}, (crr) => ({
|
|
405
|
+
pk: primaryKey3({
|
|
406
|
+
columns: [
|
|
407
|
+
crr.resourceOfId,
|
|
408
|
+
crr.resourceId
|
|
409
|
+
]
|
|
410
|
+
}),
|
|
411
|
+
contentResourceIdIdx: index5("contentResourceId_idx").on(crr.resourceOfId),
|
|
412
|
+
resourceIdIdx: index5("resourceId_idx").on(crr.resourceId),
|
|
413
|
+
organizationIdIdx: index5("organizationId_idx").on(crr.organizationId)
|
|
414
|
+
}));
|
|
415
|
+
}
|
|
416
|
+
__name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
|
|
417
|
+
function getContentResourceResourceRelationsSchema(mysqlTable) {
|
|
418
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
419
|
+
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
420
|
+
return relations5(contentResourceResource, ({ one }) => ({
|
|
421
|
+
resourceOf: one(contentResource, {
|
|
422
|
+
fields: [
|
|
423
|
+
contentResourceResource.resourceOfId
|
|
424
|
+
],
|
|
425
|
+
references: [
|
|
426
|
+
contentResource.id
|
|
427
|
+
],
|
|
428
|
+
relationName: "resourceOf"
|
|
429
|
+
}),
|
|
430
|
+
resource: one(contentResource, {
|
|
431
|
+
fields: [
|
|
432
|
+
contentResourceResource.resourceId
|
|
433
|
+
],
|
|
434
|
+
references: [
|
|
435
|
+
contentResource.id
|
|
436
|
+
],
|
|
437
|
+
relationName: "resource"
|
|
438
|
+
})
|
|
439
|
+
}));
|
|
440
|
+
}
|
|
441
|
+
__name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
|
|
442
|
+
|
|
443
|
+
// src/lib/mysql/schemas/content/content-resource-tag.ts
|
|
444
|
+
import { relations as relations8, sql as sql6 } from "drizzle-orm";
|
|
445
|
+
import { double as double3, index as index8, primaryKey as primaryKey5, timestamp as timestamp8, varchar as varchar8 } from "drizzle-orm/mysql-core";
|
|
446
|
+
|
|
447
|
+
// src/lib/mysql/schemas/content/tag.ts
|
|
448
|
+
import { relations as relations7, sql as sql5 } from "drizzle-orm";
|
|
449
|
+
import { index as index7, json as json3, timestamp as timestamp7, varchar as varchar7 } from "drizzle-orm/mysql-core";
|
|
450
|
+
|
|
451
|
+
// src/lib/mysql/schemas/content/tag-tag.ts
|
|
452
|
+
import { relations as relations6, sql as sql4 } from "drizzle-orm";
|
|
453
|
+
import { double as double2, index as index6, json as json2, primaryKey as primaryKey4, timestamp as timestamp6, varchar as varchar6 } from "drizzle-orm/mysql-core";
|
|
454
|
+
function getTagTagSchema(mysqlTable) {
|
|
455
|
+
return mysqlTable("TagTag", {
|
|
456
|
+
parentTagId: varchar6("parentTagId", {
|
|
457
|
+
length: 255
|
|
458
|
+
}).notNull(),
|
|
459
|
+
childTagId: varchar6("childTagId", {
|
|
460
|
+
length: 255
|
|
461
|
+
}).notNull(),
|
|
462
|
+
position: double2("position").notNull().default(0),
|
|
463
|
+
metadata: json2("metadata").$type().default({}),
|
|
464
|
+
organizationId: varchar6("organizationId", {
|
|
465
|
+
length: 191
|
|
466
|
+
}),
|
|
467
|
+
createdAt: timestamp6("createdAt", {
|
|
468
|
+
mode: "date",
|
|
469
|
+
fsp: 3
|
|
470
|
+
}).default(sql4`CURRENT_TIMESTAMP(3)`),
|
|
471
|
+
updatedAt: timestamp6("updatedAt", {
|
|
472
|
+
mode: "date",
|
|
473
|
+
fsp: 3
|
|
474
|
+
}).default(sql4`CURRENT_TIMESTAMP(3)`),
|
|
475
|
+
deletedAt: timestamp6("deletedAt", {
|
|
476
|
+
mode: "date",
|
|
477
|
+
fsp: 3
|
|
478
|
+
})
|
|
479
|
+
}, (tt) => ({
|
|
480
|
+
pk: primaryKey4({
|
|
481
|
+
columns: [
|
|
482
|
+
tt.parentTagId,
|
|
483
|
+
tt.childTagId
|
|
484
|
+
]
|
|
485
|
+
}),
|
|
486
|
+
parentTagIdIdx: index6("parentTagId_idx").on(tt.parentTagId),
|
|
487
|
+
childTagIdIdx: index6("childTagId_idx").on(tt.childTagId),
|
|
488
|
+
positionIdx: index6("position_idx").on(tt.position),
|
|
489
|
+
organizationIdIdx: index6("organizationId_idx").on(tt.organizationId)
|
|
490
|
+
}));
|
|
491
|
+
}
|
|
492
|
+
__name(getTagTagSchema, "getTagTagSchema");
|
|
493
|
+
function getTagTagRelationsSchema(mysqlTable) {
|
|
494
|
+
const tag = getTagSchema(mysqlTable);
|
|
495
|
+
const tagTag = getTagTagSchema(mysqlTable);
|
|
496
|
+
return relations6(tagTag, ({ one }) => ({
|
|
497
|
+
parentTag: one(tag, {
|
|
498
|
+
fields: [
|
|
499
|
+
tagTag.parentTagId
|
|
500
|
+
],
|
|
501
|
+
references: [
|
|
502
|
+
tag.id
|
|
503
|
+
],
|
|
504
|
+
relationName: "parentTag"
|
|
505
|
+
}),
|
|
506
|
+
childTag: one(tag, {
|
|
507
|
+
fields: [
|
|
508
|
+
tagTag.childTagId
|
|
509
|
+
],
|
|
510
|
+
references: [
|
|
511
|
+
tag.id
|
|
512
|
+
],
|
|
513
|
+
relationName: "childTag"
|
|
514
|
+
})
|
|
515
|
+
}));
|
|
516
|
+
}
|
|
517
|
+
__name(getTagTagRelationsSchema, "getTagTagRelationsSchema");
|
|
518
|
+
|
|
519
|
+
// src/lib/mysql/schemas/content/tag.ts
|
|
520
|
+
function getTagSchema(mysqlTable) {
|
|
521
|
+
return mysqlTable("Tag", {
|
|
522
|
+
id: varchar7("id", {
|
|
523
|
+
length: 255
|
|
524
|
+
}).notNull().primaryKey(),
|
|
525
|
+
organizationId: varchar7("organizationId", {
|
|
526
|
+
length: 191
|
|
527
|
+
}),
|
|
528
|
+
type: varchar7("type", {
|
|
529
|
+
length: 255
|
|
530
|
+
}).notNull(),
|
|
531
|
+
fields: json3("fields").$type().default({}),
|
|
532
|
+
createdAt: timestamp7("createdAt", {
|
|
533
|
+
mode: "date",
|
|
534
|
+
fsp: 3
|
|
535
|
+
}).default(sql5`CURRENT_TIMESTAMP(3)`),
|
|
536
|
+
updatedAt: timestamp7("updatedAt", {
|
|
537
|
+
mode: "date",
|
|
538
|
+
fsp: 3
|
|
539
|
+
}).default(sql5`CURRENT_TIMESTAMP(3)`),
|
|
540
|
+
deletedAt: timestamp7("deletedAt", {
|
|
541
|
+
mode: "date",
|
|
542
|
+
fsp: 3
|
|
543
|
+
})
|
|
544
|
+
}, (t) => ({
|
|
545
|
+
typeIdx: index7("type_idx").on(t.type),
|
|
546
|
+
organizationIdIdx: index7("organizationId_idx").on(t.organizationId)
|
|
547
|
+
}));
|
|
548
|
+
}
|
|
549
|
+
__name(getTagSchema, "getTagSchema");
|
|
550
|
+
function getTagRelationsSchema(mysqlTable) {
|
|
551
|
+
const tag = getTagSchema(mysqlTable);
|
|
552
|
+
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
553
|
+
const tagTag = getTagTagSchema(mysqlTable);
|
|
554
|
+
return relations7(tag, ({ many }) => ({
|
|
555
|
+
resources: many(contentResourceTag, {
|
|
556
|
+
relationName: "contentResource"
|
|
557
|
+
}),
|
|
558
|
+
parentTags: many(tagTag, {
|
|
559
|
+
relationName: "childTag"
|
|
560
|
+
}),
|
|
561
|
+
childTags: many(tagTag, {
|
|
562
|
+
relationName: "parentTag"
|
|
563
|
+
})
|
|
564
|
+
}));
|
|
565
|
+
}
|
|
566
|
+
__name(getTagRelationsSchema, "getTagRelationsSchema");
|
|
567
|
+
|
|
568
|
+
// src/lib/mysql/schemas/content/content-resource-tag.ts
|
|
569
|
+
function getContentResourceTagSchema(mysqlTable) {
|
|
570
|
+
return mysqlTable("ContentResourceTag", {
|
|
571
|
+
contentResourceId: varchar8("contentResourceId", {
|
|
572
|
+
length: 255
|
|
573
|
+
}).notNull(),
|
|
574
|
+
organizationId: varchar8("organizationId", {
|
|
575
|
+
length: 191
|
|
576
|
+
}),
|
|
577
|
+
tagId: varchar8("tagId", {
|
|
578
|
+
length: 255
|
|
579
|
+
}).notNull(),
|
|
580
|
+
position: double3("position").notNull().default(0),
|
|
581
|
+
createdAt: timestamp8("createdAt", {
|
|
582
|
+
mode: "date",
|
|
583
|
+
fsp: 3
|
|
584
|
+
}).default(sql6`CURRENT_TIMESTAMP(3)`),
|
|
585
|
+
updatedAt: timestamp8("updatedAt", {
|
|
586
|
+
mode: "date",
|
|
587
|
+
fsp: 3
|
|
588
|
+
}).default(sql6`CURRENT_TIMESTAMP(3)`)
|
|
589
|
+
}, (crt) => ({
|
|
590
|
+
pk: primaryKey5({
|
|
591
|
+
columns: [
|
|
592
|
+
crt.contentResourceId,
|
|
593
|
+
crt.tagId
|
|
594
|
+
]
|
|
595
|
+
}),
|
|
596
|
+
contentResourceIdIdx: index8("contentResourceId_idx").on(crt.contentResourceId),
|
|
597
|
+
tagIdIdx: index8("tagId_idx").on(crt.tagId),
|
|
598
|
+
positionIdx: index8("position_idx").on(crt.position),
|
|
599
|
+
organizationIdIdx: index8("organizationId_idx").on(crt.organizationId)
|
|
600
|
+
}));
|
|
601
|
+
}
|
|
602
|
+
__name(getContentResourceTagSchema, "getContentResourceTagSchema");
|
|
603
|
+
function getContentResourceTagRelationsSchema(mysqlTable) {
|
|
604
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
605
|
+
const tag = getTagSchema(mysqlTable);
|
|
606
|
+
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
607
|
+
return relations8(contentResourceTag, ({ one }) => ({
|
|
608
|
+
contentResource: one(contentResource, {
|
|
609
|
+
fields: [
|
|
610
|
+
contentResourceTag.contentResourceId
|
|
611
|
+
],
|
|
612
|
+
references: [
|
|
613
|
+
contentResource.id
|
|
614
|
+
],
|
|
615
|
+
relationName: "contentResource"
|
|
616
|
+
}),
|
|
617
|
+
tag: one(tag, {
|
|
618
|
+
fields: [
|
|
619
|
+
contentResourceTag.tagId
|
|
620
|
+
],
|
|
621
|
+
references: [
|
|
622
|
+
tag.id
|
|
623
|
+
],
|
|
624
|
+
relationName: "tag"
|
|
625
|
+
})
|
|
626
|
+
}));
|
|
627
|
+
}
|
|
628
|
+
__name(getContentResourceTagRelationsSchema, "getContentResourceTagRelationsSchema");
|
|
629
|
+
|
|
630
|
+
// src/lib/mysql/schemas/content/content-resource-version.ts
|
|
631
|
+
import { relations as relations9, sql as sql7 } from "drizzle-orm";
|
|
632
|
+
import { index as index9, int as int3, json as json4, timestamp as timestamp9, unique as unique2, varchar as varchar9 } from "drizzle-orm/mysql-core";
|
|
633
|
+
function getContentResourceVersionSchema(mysqlTable) {
|
|
634
|
+
return mysqlTable("ContentResourceVersion", {
|
|
635
|
+
id: varchar9("id", {
|
|
636
|
+
length: 255
|
|
637
|
+
}).notNull().primaryKey(),
|
|
638
|
+
organizationId: varchar9("organizationId", {
|
|
639
|
+
length: 191
|
|
640
|
+
}),
|
|
641
|
+
resourceId: varchar9("resourceId", {
|
|
642
|
+
length: 255
|
|
643
|
+
}).notNull(),
|
|
644
|
+
parentVersionId: varchar9("parentVersionId", {
|
|
645
|
+
length: 255
|
|
646
|
+
}),
|
|
647
|
+
versionNumber: int3("versionNumber").notNull(),
|
|
648
|
+
fields: json4("fields").$type().default({}),
|
|
649
|
+
createdAt: timestamp9("createdAt", {
|
|
650
|
+
mode: "date",
|
|
651
|
+
fsp: 3
|
|
652
|
+
}).default(sql7`CURRENT_TIMESTAMP(3)`),
|
|
653
|
+
createdById: varchar9("createdById", {
|
|
654
|
+
length: 255
|
|
655
|
+
}).notNull()
|
|
656
|
+
}, (crv) => ({
|
|
657
|
+
resourceIdIdx: index9("resourceId_idx").on(crv.resourceId),
|
|
658
|
+
parentVersionIdIdx: index9("parentVersionId_idx").on(crv.parentVersionId),
|
|
659
|
+
resourceIdVersionNumberIdx: index9("resourceId_versionNumber_idx").on(crv.resourceId, crv.versionNumber),
|
|
660
|
+
uniqueResourceVersion: unique2("uq_resource_version_number").on(crv.resourceId, crv.versionNumber),
|
|
661
|
+
organizationIdIdx: index9("organizationId_idx").on(crv.organizationId)
|
|
662
|
+
}));
|
|
663
|
+
}
|
|
664
|
+
__name(getContentResourceVersionSchema, "getContentResourceVersionSchema");
|
|
665
|
+
function getContentResourceVersionRelationsSchema(mysqlTable, overrides = {}) {
|
|
666
|
+
const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
|
|
667
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
668
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
669
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
670
|
+
return relations9(contentResourceVersion, ({ one }) => ({
|
|
671
|
+
resource: one(contentResource, {
|
|
672
|
+
fields: [
|
|
673
|
+
contentResourceVersion.resourceId
|
|
674
|
+
],
|
|
675
|
+
references: [
|
|
676
|
+
contentResource.id
|
|
677
|
+
],
|
|
678
|
+
relationName: "versions"
|
|
679
|
+
}),
|
|
680
|
+
parentVersion: one(contentResourceVersion, {
|
|
681
|
+
fields: [
|
|
682
|
+
contentResourceVersion.parentVersionId
|
|
683
|
+
],
|
|
684
|
+
references: [
|
|
685
|
+
contentResourceVersion.id
|
|
686
|
+
],
|
|
687
|
+
relationName: "childVersions"
|
|
688
|
+
}),
|
|
689
|
+
createdBy: one(users, {
|
|
690
|
+
fields: [
|
|
691
|
+
contentResourceVersion.createdById
|
|
692
|
+
],
|
|
693
|
+
references: [
|
|
694
|
+
users.id
|
|
695
|
+
],
|
|
696
|
+
relationName: "createdVersions"
|
|
697
|
+
})
|
|
698
|
+
}));
|
|
699
|
+
}
|
|
700
|
+
__name(getContentResourceVersionRelationsSchema, "getContentResourceVersionRelationsSchema");
|
|
701
|
+
|
|
702
|
+
// src/lib/mysql/schemas/content/content-resource.ts
|
|
703
|
+
function getContentResourceSchema(mysqlTable) {
|
|
704
|
+
return mysqlTable("ContentResource", {
|
|
705
|
+
id: varchar10("id", {
|
|
706
|
+
length: 255
|
|
707
|
+
}).notNull().primaryKey(),
|
|
708
|
+
organizationId: varchar10("organizationId", {
|
|
709
|
+
length: 191
|
|
710
|
+
}),
|
|
711
|
+
createdByOrganizationMembershipId: varchar10("createdByOrganizationMembershipId", {
|
|
712
|
+
length: 191
|
|
713
|
+
}),
|
|
714
|
+
type: varchar10("type", {
|
|
715
|
+
length: 255
|
|
716
|
+
}).notNull(),
|
|
717
|
+
createdById: varchar10("createdById", {
|
|
718
|
+
length: 255
|
|
719
|
+
}).notNull(),
|
|
720
|
+
fields: json5("fields").$type().default({}),
|
|
721
|
+
// Generated column for indexing JSON slug field
|
|
722
|
+
slug: varchar10("slug", {
|
|
723
|
+
length: 255
|
|
724
|
+
}).generatedAlwaysAs(sql8`(fields->>'$.slug')`, {
|
|
725
|
+
mode: "stored"
|
|
726
|
+
}),
|
|
727
|
+
currentVersionId: varchar10("currentVersionId", {
|
|
728
|
+
length: 255
|
|
729
|
+
}),
|
|
730
|
+
createdAt: timestamp10("createdAt", {
|
|
731
|
+
mode: "date",
|
|
732
|
+
fsp: 3
|
|
733
|
+
}).default(sql8`CURRENT_TIMESTAMP(3)`),
|
|
734
|
+
updatedAt: timestamp10("updatedAt", {
|
|
735
|
+
mode: "date",
|
|
736
|
+
fsp: 3
|
|
737
|
+
}).default(sql8`CURRENT_TIMESTAMP(3)`),
|
|
738
|
+
deletedAt: timestamp10("deletedAt", {
|
|
739
|
+
mode: "date",
|
|
740
|
+
fsp: 3
|
|
741
|
+
})
|
|
742
|
+
}, (cm) => ({
|
|
743
|
+
typeIdx: index10("type_idx").on(cm.type),
|
|
744
|
+
createdByIdx: index10("createdById_idx").on(cm.createdById),
|
|
745
|
+
createdAtIdx: index10("createdAt_idx").on(cm.createdAt),
|
|
746
|
+
currentVersionIdIdx: index10("currentVersionId_idx").on(cm.currentVersionId),
|
|
747
|
+
createdByOrganizationMembershipIdIdx: index10("createdByOrganizationMembershipId_idx").on(cm.createdByOrganizationMembershipId),
|
|
748
|
+
slugIdx: index10("slug_idx").on(cm.slug)
|
|
749
|
+
}));
|
|
750
|
+
}
|
|
751
|
+
__name(getContentResourceSchema, "getContentResourceSchema");
|
|
752
|
+
function getContentResourceRelationsSchema(mysqlTable, overrides = {}) {
|
|
753
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
754
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
755
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
756
|
+
const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
|
|
757
|
+
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
758
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
759
|
+
const contentResourceTag = getContentResourceTagSchema(mysqlTable);
|
|
760
|
+
const contentResourceVersion = getContentResourceVersionSchema(mysqlTable);
|
|
761
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
762
|
+
const tag = getTagSchema(mysqlTable);
|
|
763
|
+
return relations10(contentResource, ({ one, many }) => ({
|
|
764
|
+
createdBy: one(users, {
|
|
765
|
+
fields: [
|
|
766
|
+
contentResource.createdById
|
|
767
|
+
],
|
|
768
|
+
references: [
|
|
769
|
+
users.id
|
|
770
|
+
],
|
|
771
|
+
relationName: "creator"
|
|
772
|
+
}),
|
|
773
|
+
createdByOrganizationMembership: one(organizationMemberships, {
|
|
774
|
+
fields: [
|
|
775
|
+
contentResource.createdByOrganizationMembershipId
|
|
776
|
+
],
|
|
777
|
+
references: [
|
|
778
|
+
organizationMemberships.id
|
|
779
|
+
],
|
|
780
|
+
relationName: "createdByOrganizationMembership"
|
|
781
|
+
}),
|
|
782
|
+
tags: many(contentResourceTag, {
|
|
783
|
+
relationName: "contentResource"
|
|
784
|
+
}),
|
|
785
|
+
resources: many(contentResourceResource, {
|
|
786
|
+
relationName: "resourceOf"
|
|
787
|
+
}),
|
|
788
|
+
resourceOf: many(contentResourceResource, {
|
|
789
|
+
relationName: "resource"
|
|
790
|
+
}),
|
|
791
|
+
resourceProducts: many(contentResourceProduct, {
|
|
792
|
+
relationName: "resource"
|
|
793
|
+
}),
|
|
794
|
+
contributions: many(contentContributions, {
|
|
795
|
+
relationName: "contributions"
|
|
796
|
+
}),
|
|
797
|
+
currentVersion: one(contentResourceVersion, {
|
|
798
|
+
fields: [
|
|
799
|
+
contentResource.currentVersionId
|
|
800
|
+
],
|
|
801
|
+
references: [
|
|
802
|
+
contentResourceVersion.id
|
|
803
|
+
],
|
|
804
|
+
relationName: "currentVersionResource"
|
|
805
|
+
}),
|
|
806
|
+
versions: many(contentResourceVersion, {
|
|
807
|
+
relationName: "resource"
|
|
808
|
+
})
|
|
809
|
+
}));
|
|
810
|
+
}
|
|
811
|
+
__name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
|
|
812
|
+
|
|
813
|
+
// src/lib/mysql/schemas/content/content-resource-product.ts
|
|
814
|
+
function getContentResourceProductSchema(mysqlTable) {
|
|
815
|
+
return mysqlTable("ContentResourceProduct", {
|
|
816
|
+
productId: varchar11("productId", {
|
|
817
|
+
length: 255
|
|
818
|
+
}).notNull(),
|
|
819
|
+
resourceId: varchar11("resourceId", {
|
|
820
|
+
length: 255
|
|
821
|
+
}).notNull(),
|
|
822
|
+
organizationId: varchar11("organizationId", {
|
|
823
|
+
length: 191
|
|
824
|
+
}),
|
|
825
|
+
position: double4("position").notNull().default(0),
|
|
826
|
+
metadata: json6("metadata").$type().default({}),
|
|
827
|
+
createdAt: timestamp11("createdAt", {
|
|
828
|
+
mode: "date",
|
|
829
|
+
fsp: 3
|
|
830
|
+
}).default(sql9`CURRENT_TIMESTAMP(3)`),
|
|
831
|
+
updatedAt: timestamp11("updatedAt", {
|
|
832
|
+
mode: "date",
|
|
833
|
+
fsp: 3
|
|
834
|
+
}).default(sql9`CURRENT_TIMESTAMP(3)`),
|
|
835
|
+
deletedAt: timestamp11("deletedAt", {
|
|
836
|
+
mode: "date",
|
|
837
|
+
fsp: 3
|
|
838
|
+
})
|
|
839
|
+
}, (crr) => ({
|
|
840
|
+
pk: primaryKey6({
|
|
841
|
+
columns: [
|
|
842
|
+
crr.productId,
|
|
843
|
+
crr.resourceId
|
|
844
|
+
]
|
|
845
|
+
}),
|
|
846
|
+
contentResourceIdIdx: index11("contentResourceId_idx").on(crr.productId),
|
|
847
|
+
resourceIdIdx: index11("resourceId_idx").on(crr.resourceId),
|
|
848
|
+
organizationIdIdx: index11("organizationId_idx").on(crr.organizationId)
|
|
849
|
+
}));
|
|
850
|
+
}
|
|
851
|
+
__name(getContentResourceProductSchema, "getContentResourceProductSchema");
|
|
852
|
+
function getContentResourceProductRelationsSchema(mysqlTable) {
|
|
853
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
854
|
+
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
855
|
+
const product = getProductSchema(mysqlTable);
|
|
856
|
+
return relations11(contentResourceProduct, ({ one }) => ({
|
|
857
|
+
product: one(product, {
|
|
858
|
+
fields: [
|
|
859
|
+
contentResourceProduct.productId
|
|
860
|
+
],
|
|
861
|
+
references: [
|
|
862
|
+
product.id
|
|
863
|
+
],
|
|
864
|
+
relationName: "product"
|
|
865
|
+
}),
|
|
866
|
+
resource: one(contentResource, {
|
|
867
|
+
fields: [
|
|
868
|
+
contentResourceProduct.resourceId
|
|
869
|
+
],
|
|
870
|
+
references: [
|
|
871
|
+
contentResource.id
|
|
872
|
+
],
|
|
873
|
+
relationName: "resource"
|
|
874
|
+
})
|
|
875
|
+
}));
|
|
876
|
+
}
|
|
877
|
+
__name(getContentResourceProductRelationsSchema, "getContentResourceProductRelationsSchema");
|
|
878
|
+
|
|
879
|
+
// src/lib/mysql/schemas/commerce/price.ts
|
|
880
|
+
import { relations as relations12, sql as sql10 } from "drizzle-orm";
|
|
881
|
+
import { decimal, index as index12, int as int4, json as json7, primaryKey as primaryKey7, timestamp as timestamp12, varchar as varchar12 } from "drizzle-orm/mysql-core";
|
|
882
|
+
function getPriceSchema(mysqlTable) {
|
|
883
|
+
return mysqlTable("Price", {
|
|
884
|
+
id: varchar12("id", {
|
|
885
|
+
length: 191
|
|
886
|
+
}).notNull(),
|
|
887
|
+
productId: varchar12("productId", {
|
|
888
|
+
length: 191
|
|
889
|
+
}),
|
|
890
|
+
organizationId: varchar12("organizationId", {
|
|
891
|
+
length: 191
|
|
892
|
+
}),
|
|
893
|
+
nickname: varchar12("nickname", {
|
|
894
|
+
length: 191
|
|
895
|
+
}),
|
|
896
|
+
status: int4("status").default(0).notNull(),
|
|
897
|
+
unitAmount: decimal("unitAmount", {
|
|
898
|
+
precision: 10,
|
|
899
|
+
scale: 2
|
|
900
|
+
}).notNull(),
|
|
901
|
+
createdAt: timestamp12("createdAt", {
|
|
902
|
+
mode: "date",
|
|
903
|
+
fsp: 3
|
|
904
|
+
}).default(sql10`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
905
|
+
fields: json7("fields").$type().default({})
|
|
906
|
+
}, (table) => {
|
|
907
|
+
return {
|
|
908
|
+
priceId: primaryKey7({
|
|
909
|
+
columns: [
|
|
910
|
+
table.id
|
|
911
|
+
],
|
|
912
|
+
name: "Price_id"
|
|
913
|
+
}),
|
|
914
|
+
organizationIdIdx: index12("organizationId_idx").on(table.organizationId)
|
|
915
|
+
};
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
__name(getPriceSchema, "getPriceSchema");
|
|
919
|
+
function getProductRelationsSchema(mysqlTable) {
|
|
920
|
+
const product = getProductSchema(mysqlTable);
|
|
921
|
+
const price = getPriceSchema(mysqlTable);
|
|
922
|
+
const merchantPrice = getMerchantPriceSchema(mysqlTable);
|
|
923
|
+
return relations12(price, ({ one, many }) => ({
|
|
924
|
+
product: one(product, {
|
|
925
|
+
fields: [
|
|
926
|
+
price.productId
|
|
927
|
+
],
|
|
928
|
+
references: [
|
|
929
|
+
product.id
|
|
930
|
+
],
|
|
931
|
+
relationName: "user"
|
|
932
|
+
}),
|
|
933
|
+
merchantPrice: one(merchantPrice, {
|
|
934
|
+
fields: [
|
|
935
|
+
price.id
|
|
936
|
+
],
|
|
937
|
+
references: [
|
|
938
|
+
merchantPrice.priceId
|
|
939
|
+
],
|
|
940
|
+
relationName: "merchantPrice"
|
|
941
|
+
})
|
|
942
|
+
}));
|
|
943
|
+
}
|
|
944
|
+
__name(getProductRelationsSchema, "getProductRelationsSchema");
|
|
945
|
+
|
|
946
|
+
// src/lib/mysql/schemas/commerce/product.ts
|
|
947
|
+
function getProductSchema(mysqlTable) {
|
|
948
|
+
return mysqlTable("Product", {
|
|
949
|
+
id: varchar13("id", {
|
|
950
|
+
length: 191
|
|
951
|
+
}).notNull(),
|
|
952
|
+
organizationId: varchar13("organizationId", {
|
|
953
|
+
length: 191
|
|
954
|
+
}),
|
|
955
|
+
name: varchar13("name", {
|
|
956
|
+
length: 191
|
|
957
|
+
}).notNull(),
|
|
958
|
+
key: varchar13("key", {
|
|
959
|
+
length: 191
|
|
960
|
+
}),
|
|
961
|
+
type: varchar13("type", {
|
|
962
|
+
length: 191
|
|
963
|
+
}),
|
|
964
|
+
fields: json8("fields").$type().default({}),
|
|
965
|
+
createdAt: timestamp13("createdAt", {
|
|
966
|
+
mode: "date",
|
|
967
|
+
fsp: 3
|
|
968
|
+
}).default(sql11`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
969
|
+
status: int5("status").default(0).notNull(),
|
|
970
|
+
quantityAvailable: int5("quantityAvailable").default(-1).notNull()
|
|
971
|
+
}, (table) => {
|
|
972
|
+
return {
|
|
973
|
+
productId: primaryKey8({
|
|
974
|
+
columns: [
|
|
975
|
+
table.id
|
|
976
|
+
],
|
|
977
|
+
name: "Product_id"
|
|
978
|
+
}),
|
|
979
|
+
organizationIdIdx: index13("organizationId_idx").on(table.organizationId)
|
|
980
|
+
};
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
__name(getProductSchema, "getProductSchema");
|
|
984
|
+
function getProductRelationsSchema2(mysqlTable) {
|
|
985
|
+
const product = getProductSchema(mysqlTable);
|
|
986
|
+
const price = getPriceSchema(mysqlTable);
|
|
987
|
+
const merchantProduct = getMerchantProductSchema(mysqlTable);
|
|
988
|
+
const contentResourceProduct = getContentResourceProductSchema(mysqlTable);
|
|
989
|
+
return relations13(product, ({ one, many }) => ({
|
|
990
|
+
price: one(price, {
|
|
991
|
+
fields: [
|
|
992
|
+
product.id
|
|
993
|
+
],
|
|
994
|
+
references: [
|
|
995
|
+
price.productId
|
|
996
|
+
],
|
|
997
|
+
relationName: "price"
|
|
998
|
+
}),
|
|
999
|
+
resources: many(contentResourceProduct, {
|
|
1000
|
+
relationName: "product"
|
|
1001
|
+
}),
|
|
1002
|
+
merchantProduct: one(merchantProduct, {
|
|
1003
|
+
fields: [
|
|
1004
|
+
product.id
|
|
1005
|
+
],
|
|
1006
|
+
references: [
|
|
1007
|
+
merchantProduct.productId
|
|
1008
|
+
],
|
|
1009
|
+
relationName: "merchantProduct"
|
|
1010
|
+
})
|
|
1011
|
+
}));
|
|
1012
|
+
}
|
|
1013
|
+
__name(getProductRelationsSchema2, "getProductRelationsSchema");
|
|
1014
|
+
|
|
1015
|
+
// src/lib/mysql/schemas/commerce/subscription.ts
|
|
1016
|
+
function getSubscriptionSchema(mysqlTable) {
|
|
1017
|
+
return mysqlTable("Subscription", {
|
|
1018
|
+
id: varchar14("id", {
|
|
1019
|
+
length: 191
|
|
1020
|
+
}).notNull(),
|
|
1021
|
+
organizationId: varchar14("organizationId", {
|
|
1022
|
+
length: 191
|
|
1023
|
+
}),
|
|
1024
|
+
productId: varchar14("productId", {
|
|
1025
|
+
length: 191
|
|
1026
|
+
}).notNull(),
|
|
1027
|
+
createdAt: timestamp14("createdAt", {
|
|
1028
|
+
mode: "date",
|
|
1029
|
+
fsp: 3
|
|
1030
|
+
}).default(sql12`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
1031
|
+
merchantSubscriptionId: varchar14("merchantSubscriptionId", {
|
|
1032
|
+
length: 191
|
|
1033
|
+
}).notNull(),
|
|
1034
|
+
status: varchar14("status", {
|
|
1035
|
+
length: 191
|
|
1036
|
+
}).default("active").notNull(),
|
|
1037
|
+
fields: json9("fields").$type().default({})
|
|
1038
|
+
}, (table) => {
|
|
1039
|
+
return {
|
|
1040
|
+
subscriptionId: primaryKey9({
|
|
1041
|
+
columns: [
|
|
1042
|
+
table.id
|
|
1043
|
+
],
|
|
1044
|
+
name: "Subscription_id"
|
|
1045
|
+
}),
|
|
1046
|
+
organizationIdIdx: index14("organizationId_idx").on(table.organizationId)
|
|
1047
|
+
};
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
__name(getSubscriptionSchema, "getSubscriptionSchema");
|
|
1051
|
+
function getSubscriptionRelationsSchema(mysqlTable) {
|
|
1052
|
+
const subscriptions = getSubscriptionSchema(mysqlTable);
|
|
1053
|
+
const products = getProductSchema(mysqlTable);
|
|
1054
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
1055
|
+
const merchantSubscriptions = getMerchantSubscriptionSchema(mysqlTable);
|
|
1056
|
+
return relations14(subscriptions, ({ many, one }) => ({
|
|
1057
|
+
organization: one(organizations, {
|
|
1058
|
+
fields: [
|
|
1059
|
+
subscriptions.organizationId
|
|
1060
|
+
],
|
|
1061
|
+
references: [
|
|
1062
|
+
organizations.id
|
|
1063
|
+
],
|
|
1064
|
+
relationName: "organization"
|
|
1065
|
+
}),
|
|
1066
|
+
product: one(products, {
|
|
1067
|
+
fields: [
|
|
1068
|
+
subscriptions.productId
|
|
1069
|
+
],
|
|
1070
|
+
references: [
|
|
1071
|
+
products.id
|
|
1072
|
+
],
|
|
1073
|
+
relationName: "product"
|
|
1074
|
+
}),
|
|
1075
|
+
merchantSubscription: one(merchantSubscriptions, {
|
|
1076
|
+
fields: [
|
|
1077
|
+
subscriptions.merchantSubscriptionId
|
|
1078
|
+
],
|
|
1079
|
+
references: [
|
|
1080
|
+
merchantSubscriptions.id
|
|
1081
|
+
],
|
|
1082
|
+
relationName: "merchantSubscription"
|
|
1083
|
+
})
|
|
1084
|
+
}));
|
|
1085
|
+
}
|
|
1086
|
+
__name(getSubscriptionRelationsSchema, "getSubscriptionRelationsSchema");
|
|
1087
|
+
|
|
1088
|
+
// src/lib/mysql/schemas/org/organizations.ts
|
|
1089
|
+
function getOrganizationsSchema(mysqlTable) {
|
|
1090
|
+
return mysqlTable("Organization", {
|
|
1091
|
+
id: varchar15("id", {
|
|
1092
|
+
length: 255
|
|
1093
|
+
}).notNull().primaryKey(),
|
|
1094
|
+
name: varchar15("name", {
|
|
1095
|
+
length: 255
|
|
1096
|
+
}),
|
|
1097
|
+
fields: json10("fields").$type().default({}),
|
|
1098
|
+
image: varchar15("image", {
|
|
1099
|
+
length: 255
|
|
1100
|
+
}),
|
|
1101
|
+
createdAt: timestamp15("createdAt", {
|
|
1102
|
+
mode: "date",
|
|
1103
|
+
fsp: 3
|
|
1104
|
+
}).default(sql13`CURRENT_TIMESTAMP(3)`)
|
|
1105
|
+
}, (organization) => ({
|
|
1106
|
+
createdAtIdx: index15("created_at_idx").on(organization.createdAt)
|
|
1107
|
+
}));
|
|
1108
|
+
}
|
|
1109
|
+
__name(getOrganizationsSchema, "getOrganizationsSchema");
|
|
1110
|
+
function getOrganizationsRelationsSchema(mysqlTable) {
|
|
1111
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
1112
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
1113
|
+
const subscriptions = getSubscriptionSchema(mysqlTable);
|
|
1114
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1115
|
+
return relations15(organizations, ({ many }) => ({
|
|
1116
|
+
purchases: many(purchases, {
|
|
1117
|
+
relationName: "organization"
|
|
1118
|
+
}),
|
|
1119
|
+
subscriptions: many(subscriptions, {
|
|
1120
|
+
relationName: "organization"
|
|
1121
|
+
}),
|
|
1122
|
+
members: many(organizationMemberships, {
|
|
1123
|
+
relationName: "organization"
|
|
1124
|
+
})
|
|
1125
|
+
}));
|
|
1126
|
+
}
|
|
1127
|
+
__name(getOrganizationsRelationsSchema, "getOrganizationsRelationsSchema");
|
|
1128
|
+
|
|
1129
|
+
// src/lib/mysql/schemas/org/organization-membership-roles.ts
|
|
1130
|
+
function getOrganizationMembershipRolesSchema(mysqlTable) {
|
|
1131
|
+
return mysqlTable("OrganizationMembershipRole", {
|
|
1132
|
+
organizationMembershipId: varchar16("organizationMembershipId", {
|
|
1133
|
+
length: 255
|
|
1134
|
+
}).notNull(),
|
|
1135
|
+
roleId: varchar16("roleId", {
|
|
1136
|
+
length: 255
|
|
1137
|
+
}).notNull(),
|
|
1138
|
+
active: boolean3("active").notNull().default(true),
|
|
1139
|
+
organizationId: varchar16("organizationId", {
|
|
1140
|
+
length: 191
|
|
1141
|
+
}),
|
|
1142
|
+
createdAt: timestamp16("createdAt", {
|
|
1143
|
+
mode: "date",
|
|
1144
|
+
fsp: 3
|
|
1145
|
+
}).defaultNow(),
|
|
1146
|
+
updatedAt: timestamp16("updatedAt", {
|
|
1147
|
+
mode: "date",
|
|
1148
|
+
fsp: 3
|
|
1149
|
+
}).defaultNow(),
|
|
1150
|
+
deletedAt: timestamp16("deletedAt", {
|
|
1151
|
+
mode: "date",
|
|
1152
|
+
fsp: 3
|
|
1153
|
+
})
|
|
1154
|
+
}, (ur) => ({
|
|
1155
|
+
pk: primaryKey10({
|
|
1156
|
+
columns: [
|
|
1157
|
+
ur.organizationMembershipId,
|
|
1158
|
+
ur.roleId
|
|
1159
|
+
],
|
|
1160
|
+
name: "pk"
|
|
1161
|
+
}),
|
|
1162
|
+
orgMemberIdIdx: index16("orgMemberId_idx").on(ur.organizationMembershipId),
|
|
1163
|
+
roleIdIdx: index16("roleId_idx").on(ur.roleId),
|
|
1164
|
+
organizationIdIdx: index16("organizationId_idx").on(ur.organizationId)
|
|
1165
|
+
}));
|
|
1166
|
+
}
|
|
1167
|
+
__name(getOrganizationMembershipRolesSchema, "getOrganizationMembershipRolesSchema");
|
|
1168
|
+
function getOrganizationMembershipRolesRelationsSchema(mysqlTable) {
|
|
1169
|
+
const organizationMembershipRoles = getOrganizationMembershipRolesSchema(mysqlTable);
|
|
1170
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1171
|
+
const roles = getRolesSchema(mysqlTable);
|
|
1172
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
1173
|
+
return relations16(organizationMembershipRoles, ({ one }) => ({
|
|
1174
|
+
organizationMembership: one(organizationMemberships, {
|
|
1175
|
+
fields: [
|
|
1176
|
+
organizationMembershipRoles.organizationMembershipId
|
|
1177
|
+
],
|
|
1178
|
+
references: [
|
|
1179
|
+
organizationMemberships.id
|
|
1180
|
+
],
|
|
1181
|
+
relationName: "organizationMembership"
|
|
1182
|
+
}),
|
|
1183
|
+
role: one(roles, {
|
|
1184
|
+
fields: [
|
|
1185
|
+
organizationMembershipRoles.roleId
|
|
1186
|
+
],
|
|
1187
|
+
references: [
|
|
1188
|
+
roles.id
|
|
1189
|
+
],
|
|
1190
|
+
relationName: "role"
|
|
1191
|
+
}),
|
|
1192
|
+
organization: one(organizations, {
|
|
1193
|
+
fields: [
|
|
1194
|
+
organizationMembershipRoles.organizationId
|
|
1195
|
+
],
|
|
1196
|
+
references: [
|
|
1197
|
+
organizations.id
|
|
1198
|
+
],
|
|
1199
|
+
relationName: "organization"
|
|
1200
|
+
})
|
|
1201
|
+
}));
|
|
1202
|
+
}
|
|
1203
|
+
__name(getOrganizationMembershipRolesRelationsSchema, "getOrganizationMembershipRolesRelationsSchema");
|
|
1204
|
+
|
|
1205
|
+
// src/lib/mysql/schemas/org/organization-memberships.ts
|
|
1206
|
+
function getOrganizationMembershipsSchema(mysqlTable) {
|
|
1207
|
+
return mysqlTable("OrganizationMembership", {
|
|
1208
|
+
id: varchar17("id", {
|
|
1209
|
+
length: 255
|
|
1210
|
+
}).notNull().primaryKey(),
|
|
1211
|
+
organizationId: varchar17("organizationId", {
|
|
1212
|
+
length: 191
|
|
1213
|
+
}),
|
|
1214
|
+
role: varchar17("role", {
|
|
1215
|
+
length: 191
|
|
1216
|
+
}).notNull().default("user"),
|
|
1217
|
+
invitedById: varchar17("invitedById", {
|
|
1218
|
+
length: 255
|
|
1219
|
+
}).notNull(),
|
|
1220
|
+
userId: varchar17("userId", {
|
|
1221
|
+
length: 255
|
|
1222
|
+
}).notNull(),
|
|
1223
|
+
fields: json11("fields").$type().default({}),
|
|
1224
|
+
createdAt: timestamp17("createdAt", {
|
|
1225
|
+
mode: "date",
|
|
1226
|
+
fsp: 3
|
|
1227
|
+
}).default(sql14`CURRENT_TIMESTAMP(3)`)
|
|
1228
|
+
}, (organizationMembership) => ({
|
|
1229
|
+
roleIdx: index17("role_idx").on(organizationMembership.role),
|
|
1230
|
+
createdAtIdx: index17("created_at_idx").on(organizationMembership.createdAt),
|
|
1231
|
+
organizationIdIdx: index17("organizationId_idx").on(organizationMembership.organizationId)
|
|
1232
|
+
}));
|
|
1233
|
+
}
|
|
1234
|
+
__name(getOrganizationMembershipsSchema, "getOrganizationMembershipsSchema");
|
|
1235
|
+
function getOrganizationMembershipsRelationsSchema(mysqlTable, overrides = {}) {
|
|
1236
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1237
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1238
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1239
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
1240
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
1241
|
+
const organizationMembershipRoles = getOrganizationMembershipRolesSchema(mysqlTable);
|
|
1242
|
+
return relations17(organizationMemberships, ({ one, many }) => ({
|
|
1243
|
+
user: one(users, {
|
|
1244
|
+
fields: [
|
|
1245
|
+
organizationMemberships.userId
|
|
1246
|
+
],
|
|
1247
|
+
references: [
|
|
1248
|
+
users.id
|
|
1249
|
+
],
|
|
1250
|
+
relationName: "user"
|
|
1251
|
+
}),
|
|
1252
|
+
invitedBy: one(users, {
|
|
1253
|
+
fields: [
|
|
1254
|
+
organizationMemberships.invitedById
|
|
1255
|
+
],
|
|
1256
|
+
references: [
|
|
1257
|
+
users.id
|
|
1258
|
+
],
|
|
1259
|
+
relationName: "invitedBy"
|
|
1260
|
+
}),
|
|
1261
|
+
purchases: many(purchases),
|
|
1262
|
+
organization: one(organizations, {
|
|
1263
|
+
fields: [
|
|
1264
|
+
organizationMemberships.organizationId
|
|
1265
|
+
],
|
|
1266
|
+
references: [
|
|
1267
|
+
organizations.id
|
|
1268
|
+
],
|
|
1269
|
+
relationName: "organization"
|
|
1270
|
+
}),
|
|
1271
|
+
organizationMembershipRoles: many(organizationMembershipRoles, {
|
|
1272
|
+
relationName: "organizationMembership"
|
|
1273
|
+
})
|
|
1274
|
+
}));
|
|
1275
|
+
}
|
|
1276
|
+
__name(getOrganizationMembershipsRelationsSchema, "getOrganizationMembershipsRelationsSchema");
|
|
1277
|
+
|
|
1278
|
+
// src/lib/mysql/schemas/commerce/coupon.ts
|
|
1279
|
+
import { relations as relations18, sql as sql15 } from "drizzle-orm";
|
|
1280
|
+
import { boolean as boolean4, decimal as decimal2, index as index18, int as int6, json as json12, primaryKey as primaryKey11, timestamp as timestamp18, unique as unique3, varchar as varchar18 } from "drizzle-orm/mysql-core";
|
|
1281
|
+
function getCouponSchema(mysqlTable) {
|
|
1282
|
+
return mysqlTable("Coupon", {
|
|
1283
|
+
id: varchar18("id", {
|
|
1284
|
+
length: 191
|
|
1285
|
+
}).notNull(),
|
|
1286
|
+
organizationId: varchar18("organizationId", {
|
|
1287
|
+
length: 191
|
|
1288
|
+
}),
|
|
1289
|
+
code: varchar18("code", {
|
|
1290
|
+
length: 191
|
|
1291
|
+
}),
|
|
1292
|
+
createdAt: timestamp18("createdAt", {
|
|
1293
|
+
mode: "date",
|
|
1294
|
+
fsp: 3
|
|
1295
|
+
}).default(sql15`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
1296
|
+
expires: timestamp18("expires", {
|
|
1297
|
+
mode: "date",
|
|
1298
|
+
fsp: 3
|
|
1299
|
+
}),
|
|
1300
|
+
fields: json12("fields").$type().default({}),
|
|
1301
|
+
maxUses: int6("maxUses").default(-1).notNull(),
|
|
1302
|
+
default: boolean4("default").default(false).notNull(),
|
|
1303
|
+
merchantCouponId: varchar18("merchantCouponId", {
|
|
1304
|
+
length: 191
|
|
1305
|
+
}),
|
|
1306
|
+
status: int6("status").default(0).notNull(),
|
|
1307
|
+
usedCount: int6("usedCount").default(0).notNull(),
|
|
1308
|
+
percentageDiscount: decimal2("percentageDiscount", {
|
|
1309
|
+
precision: 3,
|
|
1310
|
+
scale: 2
|
|
1311
|
+
}),
|
|
1312
|
+
amountDiscount: int6("amountDiscount"),
|
|
1313
|
+
restrictedToProductId: varchar18("restrictedToProductId", {
|
|
1314
|
+
length: 191
|
|
1315
|
+
})
|
|
1316
|
+
}, (table) => {
|
|
1317
|
+
return {
|
|
1318
|
+
couponIdCodeIndex: index18("Coupon_id_code_index").on(table.id, table.code),
|
|
1319
|
+
couponId: primaryKey11({
|
|
1320
|
+
columns: [
|
|
1321
|
+
table.id
|
|
1322
|
+
],
|
|
1323
|
+
name: "Coupon_id"
|
|
1324
|
+
}),
|
|
1325
|
+
couponCodeKey: unique3("Coupon_code_key").on(table.code),
|
|
1326
|
+
organizationIdIdx: index18("organizationId_idx").on(table.organizationId)
|
|
1327
|
+
};
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
__name(getCouponSchema, "getCouponSchema");
|
|
1331
|
+
function getCouponRelationsSchema(mysqlTable) {
|
|
1332
|
+
const purchase = getPurchaseSchema(mysqlTable);
|
|
1333
|
+
const coupon = getCouponSchema(mysqlTable);
|
|
1334
|
+
const merchantCoupon = getMerchantCouponSchema(mysqlTable);
|
|
1335
|
+
return relations18(coupon, ({ many, one }) => ({
|
|
1336
|
+
redeemedBulkCouponPurchases: many(purchase, {
|
|
1337
|
+
relationName: "redeemedBulkCoupon"
|
|
1338
|
+
}),
|
|
1339
|
+
merchantCoupon: one(merchantCoupon, {
|
|
1340
|
+
fields: [
|
|
1341
|
+
coupon.merchantCouponId
|
|
1342
|
+
],
|
|
1343
|
+
references: [
|
|
1344
|
+
merchantCoupon.id
|
|
1345
|
+
],
|
|
1346
|
+
relationName: "merchantCoupon"
|
|
1347
|
+
}),
|
|
1348
|
+
product: one(getProductSchema(mysqlTable), {
|
|
1349
|
+
fields: [
|
|
1350
|
+
coupon.restrictedToProductId
|
|
1351
|
+
],
|
|
1352
|
+
references: [
|
|
1353
|
+
getProductSchema(mysqlTable).id
|
|
1354
|
+
],
|
|
1355
|
+
relationName: "product"
|
|
1356
|
+
}),
|
|
1357
|
+
bulkPurchases: many(purchase, {
|
|
1358
|
+
relationName: "bulkCoupon"
|
|
1359
|
+
})
|
|
1360
|
+
}));
|
|
1361
|
+
}
|
|
1362
|
+
__name(getCouponRelationsSchema, "getCouponRelationsSchema");
|
|
1363
|
+
|
|
1364
|
+
// src/lib/mysql/schemas/commerce/purchase.ts
|
|
1365
|
+
function getPurchaseSchema(mysqlTable) {
|
|
1366
|
+
return mysqlTable("Purchase", {
|
|
1367
|
+
id: varchar19("id", {
|
|
1368
|
+
length: 191
|
|
1369
|
+
}).notNull(),
|
|
1370
|
+
userId: varchar19("userId", {
|
|
1371
|
+
length: 191
|
|
1372
|
+
}),
|
|
1373
|
+
purchasedByorganizationMembershipId: varchar19("organizationMembershipId", {
|
|
1374
|
+
length: 191
|
|
1375
|
+
}),
|
|
1376
|
+
organizationId: varchar19("organizationId", {
|
|
1377
|
+
length: 191
|
|
1378
|
+
}),
|
|
1379
|
+
createdAt: timestamp19("createdAt", {
|
|
1380
|
+
mode: "date",
|
|
1381
|
+
fsp: 3
|
|
1382
|
+
}).default(sql16`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
1383
|
+
totalAmount: decimal3("totalAmount", {
|
|
1384
|
+
precision: 65,
|
|
1385
|
+
scale: 30
|
|
1386
|
+
}).notNull(),
|
|
1387
|
+
ipAddress: varchar19("ip_address", {
|
|
1388
|
+
length: 191
|
|
1389
|
+
}),
|
|
1390
|
+
city: varchar19("city", {
|
|
1391
|
+
length: 191
|
|
1392
|
+
}),
|
|
1393
|
+
state: varchar19("state", {
|
|
1394
|
+
length: 191
|
|
1395
|
+
}),
|
|
1396
|
+
country: varchar19("country", {
|
|
1397
|
+
length: 191
|
|
1398
|
+
}),
|
|
1399
|
+
couponId: varchar19("couponId", {
|
|
1400
|
+
length: 191
|
|
1401
|
+
}),
|
|
1402
|
+
productId: varchar19("productId", {
|
|
1403
|
+
length: 191
|
|
1404
|
+
}).notNull(),
|
|
1405
|
+
merchantChargeId: varchar19("merchantChargeId", {
|
|
1406
|
+
length: 191
|
|
1407
|
+
}),
|
|
1408
|
+
upgradedFromId: varchar19("upgradedFromId", {
|
|
1409
|
+
length: 191
|
|
1410
|
+
}),
|
|
1411
|
+
status: varchar19("status", {
|
|
1412
|
+
length: 191
|
|
1413
|
+
}).default("Valid").notNull(),
|
|
1414
|
+
bulkCouponId: varchar19("bulkCouponId", {
|
|
1415
|
+
length: 191
|
|
1416
|
+
}),
|
|
1417
|
+
merchantSessionId: varchar19("merchantSessionId", {
|
|
1418
|
+
length: 191
|
|
1419
|
+
}),
|
|
1420
|
+
redeemedBulkCouponId: varchar19("redeemedBulkCouponId", {
|
|
1421
|
+
length: 191
|
|
1422
|
+
}),
|
|
1423
|
+
fields: json13("fields").$type().default({})
|
|
1424
|
+
}, (table) => {
|
|
1425
|
+
return {
|
|
1426
|
+
purchaseId: primaryKey12({
|
|
1427
|
+
columns: [
|
|
1428
|
+
table.id
|
|
1429
|
+
],
|
|
1430
|
+
name: "Purchase_id"
|
|
1431
|
+
}),
|
|
1432
|
+
merchantChargeIdIdx: index19("idx_Purchase_on_merchantChargeId").on(table.merchantChargeId),
|
|
1433
|
+
purchaseUpgradedFromIdKey: unique4("Purchase_upgradedFromId_key").on(table.upgradedFromId),
|
|
1434
|
+
organizationIdIdx: index19("organizationId_idx").on(table.organizationId),
|
|
1435
|
+
organizationMembershipIdIdx: index19("organizationMembershipId_idx").on(table.purchasedByorganizationMembershipId),
|
|
1436
|
+
userStatusProductIdx: index19("idx_Purchase_on_userId_status_productId").on(table.userId, table.status, table.productId)
|
|
1437
|
+
};
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
__name(getPurchaseSchema, "getPurchaseSchema");
|
|
1441
|
+
function getPurchaseRelationsSchema(mysqlTable, overrides = {}) {
|
|
1442
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
1443
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1444
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1445
|
+
const products = getProductSchema(mysqlTable);
|
|
1446
|
+
const merchantCharges = getMerchantChargeSchema(mysqlTable);
|
|
1447
|
+
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
1448
|
+
const coupons = getCouponSchema(mysqlTable);
|
|
1449
|
+
const organizations = getOrganizationsSchema(mysqlTable);
|
|
1450
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1451
|
+
return relations19(purchases, ({ many, one }) => ({
|
|
1452
|
+
redeemedBulkCoupon: one(coupons, {
|
|
1453
|
+
fields: [
|
|
1454
|
+
purchases.redeemedBulkCouponId
|
|
1455
|
+
],
|
|
1456
|
+
references: [
|
|
1457
|
+
coupons.id
|
|
1458
|
+
],
|
|
1459
|
+
relationName: "redeemedBulkCoupon"
|
|
1460
|
+
}),
|
|
1461
|
+
user: one(users, {
|
|
1462
|
+
fields: [
|
|
1463
|
+
purchases.userId
|
|
1464
|
+
],
|
|
1465
|
+
references: [
|
|
1466
|
+
users.id
|
|
1467
|
+
],
|
|
1468
|
+
relationName: "user"
|
|
1469
|
+
}),
|
|
1470
|
+
organization: one(organizations, {
|
|
1471
|
+
fields: [
|
|
1472
|
+
purchases.organizationId
|
|
1473
|
+
],
|
|
1474
|
+
references: [
|
|
1475
|
+
organizations.id
|
|
1476
|
+
],
|
|
1477
|
+
relationName: "organization"
|
|
1478
|
+
}),
|
|
1479
|
+
purchasedBy: one(organizationMemberships, {
|
|
1480
|
+
fields: [
|
|
1481
|
+
purchases.purchasedByorganizationMembershipId
|
|
1482
|
+
],
|
|
1483
|
+
references: [
|
|
1484
|
+
organizationMemberships.id
|
|
1485
|
+
],
|
|
1486
|
+
relationName: "organizationMembership"
|
|
1487
|
+
}),
|
|
1488
|
+
product: one(products, {
|
|
1489
|
+
fields: [
|
|
1490
|
+
purchases.productId
|
|
1491
|
+
],
|
|
1492
|
+
references: [
|
|
1493
|
+
products.id
|
|
1494
|
+
],
|
|
1495
|
+
relationName: "product"
|
|
1496
|
+
}),
|
|
1497
|
+
bulkCoupon: one(coupons, {
|
|
1498
|
+
fields: [
|
|
1499
|
+
purchases.bulkCouponId
|
|
1500
|
+
],
|
|
1501
|
+
references: [
|
|
1502
|
+
coupons.id
|
|
1503
|
+
],
|
|
1504
|
+
relationName: "bulkCoupon"
|
|
1505
|
+
}),
|
|
1506
|
+
merchantCharge: one(merchantCharges, {
|
|
1507
|
+
fields: [
|
|
1508
|
+
purchases.merchantChargeId
|
|
1509
|
+
],
|
|
1510
|
+
references: [
|
|
1511
|
+
merchantCharges.id
|
|
1512
|
+
],
|
|
1513
|
+
relationName: "merchantCharge"
|
|
1514
|
+
}),
|
|
1515
|
+
merchantSession: one(merchantSessions, {
|
|
1516
|
+
fields: [
|
|
1517
|
+
purchases.merchantSessionId
|
|
1518
|
+
],
|
|
1519
|
+
references: [
|
|
1520
|
+
merchantSessions.id
|
|
1521
|
+
],
|
|
1522
|
+
relationName: "merchantSession"
|
|
1523
|
+
})
|
|
1524
|
+
}));
|
|
1525
|
+
}
|
|
1526
|
+
__name(getPurchaseRelationsSchema, "getPurchaseRelationsSchema");
|
|
1527
|
+
|
|
1528
|
+
// src/lib/mysql/schemas/communication/comment.ts
|
|
1529
|
+
import { relations as relations20, sql as sql17 } from "drizzle-orm";
|
|
1530
|
+
import { index as index20, json as json14, primaryKey as primaryKey13, text as text2, timestamp as timestamp20, varchar as varchar20 } from "drizzle-orm/mysql-core";
|
|
1531
|
+
function getCommentsSchema(mysqlTable) {
|
|
1532
|
+
return mysqlTable("Comment", {
|
|
1533
|
+
id: varchar20("id", {
|
|
1534
|
+
length: 191
|
|
1535
|
+
}).notNull(),
|
|
1536
|
+
userId: varchar20("userId", {
|
|
1537
|
+
length: 255
|
|
1538
|
+
}).notNull(),
|
|
1539
|
+
organizationMembershipId: varchar20("organizationMembershipId", {
|
|
1540
|
+
length: 255
|
|
1541
|
+
}),
|
|
1542
|
+
context: json14("context").$type().default({}),
|
|
1543
|
+
text: text2("text").notNull(),
|
|
1544
|
+
createdAt: timestamp20("createdAt", {
|
|
1545
|
+
mode: "date",
|
|
1546
|
+
fsp: 3
|
|
1547
|
+
}).default(sql17`CURRENT_TIMESTAMP(3)`),
|
|
1548
|
+
updatedAt: timestamp20("updatedAt", {
|
|
1549
|
+
mode: "date",
|
|
1550
|
+
fsp: 3
|
|
1551
|
+
}).default(sql17`CURRENT_TIMESTAMP(3)`),
|
|
1552
|
+
deletedAt: timestamp20("deletedAt", {
|
|
1553
|
+
mode: "date",
|
|
1554
|
+
fsp: 3
|
|
1555
|
+
})
|
|
1556
|
+
}, (crr) => ({
|
|
1557
|
+
pk: primaryKey13({
|
|
1558
|
+
columns: [
|
|
1559
|
+
crr.id
|
|
1560
|
+
]
|
|
1561
|
+
}),
|
|
1562
|
+
crrUserIdIdKey: index20("crr_userIdId_idx").on(crr.userId),
|
|
1563
|
+
organizationMembershipIdIdx: index20("organizationMembershipId_idx").on(crr.organizationMembershipId)
|
|
1564
|
+
}));
|
|
1565
|
+
}
|
|
1566
|
+
__name(getCommentsSchema, "getCommentsSchema");
|
|
1567
|
+
function getCommentRelationsSchema(mysqlTable, overrides = {}) {
|
|
1568
|
+
const comment = getCommentsSchema(mysqlTable);
|
|
1569
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1570
|
+
const user = resolveUsersSchema(mysqlTable);
|
|
1571
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1572
|
+
return relations20(comment, ({ one }) => ({
|
|
1573
|
+
user: one(user, {
|
|
1574
|
+
fields: [
|
|
1575
|
+
comment.userId
|
|
1576
|
+
],
|
|
1577
|
+
references: [
|
|
1578
|
+
user.id
|
|
1579
|
+
],
|
|
1580
|
+
relationName: "user"
|
|
1581
|
+
}),
|
|
1582
|
+
organizationMembership: one(organizationMemberships, {
|
|
1583
|
+
fields: [
|
|
1584
|
+
comment.organizationMembershipId
|
|
1585
|
+
],
|
|
1586
|
+
references: [
|
|
1587
|
+
organizationMemberships.id
|
|
1588
|
+
],
|
|
1589
|
+
relationName: "organizationMembership"
|
|
1590
|
+
})
|
|
1591
|
+
}));
|
|
1592
|
+
}
|
|
1593
|
+
__name(getCommentRelationsSchema, "getCommentRelationsSchema");
|
|
1594
|
+
|
|
1595
|
+
// src/lib/mysql/schemas/communication/communication-preferences.ts
|
|
1596
|
+
import { relations as relations21 } from "drizzle-orm";
|
|
1597
|
+
import { boolean as boolean5, index as index21, mysqlEnum, timestamp as timestamp21, varchar as varchar21 } from "drizzle-orm/mysql-core";
|
|
1598
|
+
function getCommunicationPreferencesSchema(mysqlTable) {
|
|
1599
|
+
return mysqlTable("CommunicationPreference", {
|
|
1600
|
+
id: varchar21("id", {
|
|
1601
|
+
length: 255
|
|
1602
|
+
}).notNull().primaryKey(),
|
|
1603
|
+
organizationId: varchar21("organizationId", {
|
|
1604
|
+
length: 191
|
|
1605
|
+
}),
|
|
1606
|
+
userId: varchar21("userId", {
|
|
1607
|
+
length: 255
|
|
1608
|
+
}).notNull(),
|
|
1609
|
+
organizationMembershipId: varchar21("organizationMembershipId", {
|
|
1610
|
+
length: 255
|
|
1611
|
+
}),
|
|
1612
|
+
channelId: varchar21("channelId", {
|
|
1613
|
+
length: 255
|
|
1614
|
+
}).notNull(),
|
|
1615
|
+
preferenceLevel: mysqlEnum("preferenceLevel", [
|
|
1616
|
+
"low",
|
|
1617
|
+
"medium",
|
|
1618
|
+
"high"
|
|
1619
|
+
]).notNull().default("medium"),
|
|
1620
|
+
preferenceTypeId: varchar21("preferenceTypeId", {
|
|
1621
|
+
length: 255
|
|
1622
|
+
}).notNull(),
|
|
1623
|
+
active: boolean5("active").notNull().default(true),
|
|
1624
|
+
createdAt: timestamp21("createdAt", {
|
|
1625
|
+
mode: "date",
|
|
1626
|
+
fsp: 3
|
|
1627
|
+
}).defaultNow(),
|
|
1628
|
+
optInAt: timestamp21("optInAt", {
|
|
1629
|
+
mode: "date",
|
|
1630
|
+
fsp: 3
|
|
1631
|
+
}),
|
|
1632
|
+
optOutAt: timestamp21("optOutAt", {
|
|
1633
|
+
mode: "date",
|
|
1634
|
+
fsp: 3
|
|
1635
|
+
}),
|
|
1636
|
+
updatedAt: timestamp21("updatedAt", {
|
|
1637
|
+
mode: "date",
|
|
1638
|
+
fsp: 3
|
|
1639
|
+
}).defaultNow(),
|
|
1640
|
+
deletedAt: timestamp21("deletedAt", {
|
|
1641
|
+
mode: "date",
|
|
1642
|
+
fsp: 3
|
|
1643
|
+
})
|
|
1644
|
+
}, (cp) => ({
|
|
1645
|
+
userIdIdx: index21("userId_idx").on(cp.userId),
|
|
1646
|
+
preferenceTypeIdx: index21("preferenceTypeId_idx").on(cp.preferenceTypeId),
|
|
1647
|
+
channelIdIdx: index21("channelId_idx").on(cp.channelId),
|
|
1648
|
+
organizationMembershipIdIdx: index21("organizationMembershipId_idx").on(cp.organizationMembershipId)
|
|
1649
|
+
}));
|
|
1650
|
+
}
|
|
1651
|
+
__name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
|
|
1652
|
+
function getCommunicationPreferencesRelationsSchema(mysqlTable, overrides = {}) {
|
|
1653
|
+
const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
|
|
1654
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1655
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1656
|
+
const communicationChannel = getCommunicationChannelSchema(mysqlTable);
|
|
1657
|
+
const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
|
|
1658
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1659
|
+
return relations21(communicationPreferences, ({ one }) => ({
|
|
1660
|
+
user: one(users, {
|
|
1661
|
+
fields: [
|
|
1662
|
+
communicationPreferences.userId
|
|
1663
|
+
],
|
|
1664
|
+
references: [
|
|
1665
|
+
users.id
|
|
1666
|
+
],
|
|
1667
|
+
relationName: "user"
|
|
1668
|
+
}),
|
|
1669
|
+
organizationMembership: one(organizationMemberships, {
|
|
1670
|
+
fields: [
|
|
1671
|
+
communicationPreferences.organizationMembershipId
|
|
1672
|
+
],
|
|
1673
|
+
references: [
|
|
1674
|
+
organizationMemberships.id
|
|
1675
|
+
],
|
|
1676
|
+
relationName: "organizationMembership"
|
|
1677
|
+
}),
|
|
1678
|
+
channel: one(communicationChannel, {
|
|
1679
|
+
fields: [
|
|
1680
|
+
communicationPreferences.channelId
|
|
1681
|
+
],
|
|
1682
|
+
references: [
|
|
1683
|
+
communicationChannel.id
|
|
1684
|
+
],
|
|
1685
|
+
relationName: "channel"
|
|
1686
|
+
}),
|
|
1687
|
+
preferenceType: one(communicationPreferenceTypes, {
|
|
1688
|
+
fields: [
|
|
1689
|
+
communicationPreferences.preferenceTypeId
|
|
1690
|
+
],
|
|
1691
|
+
references: [
|
|
1692
|
+
communicationPreferenceTypes.id
|
|
1693
|
+
],
|
|
1694
|
+
relationName: "preferenceType"
|
|
1695
|
+
})
|
|
1696
|
+
}));
|
|
1697
|
+
}
|
|
1698
|
+
__name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
|
|
1699
|
+
|
|
1700
|
+
// src/lib/mysql/schemas/auth/accounts.ts
|
|
1701
|
+
import { relations as relations22 } from "drizzle-orm";
|
|
1702
|
+
import { index as index22, int as int7, primaryKey as primaryKey14, text as text3, varchar as varchar22 } from "drizzle-orm/mysql-core";
|
|
1703
|
+
function getAccountsSchema(mysqlTable) {
|
|
1704
|
+
return mysqlTable("Account", {
|
|
1705
|
+
userId: varchar22("userId", {
|
|
1706
|
+
length: 255
|
|
1707
|
+
}).notNull(),
|
|
1708
|
+
type: varchar22("type", {
|
|
1709
|
+
length: 255
|
|
1710
|
+
}).$type().notNull(),
|
|
1711
|
+
provider: varchar22("provider", {
|
|
1712
|
+
length: 255
|
|
1713
|
+
}).notNull(),
|
|
1714
|
+
providerAccountId: varchar22("providerAccountId", {
|
|
1715
|
+
length: 255
|
|
1716
|
+
}).notNull(),
|
|
1717
|
+
refresh_token: text3("refresh_token"),
|
|
1718
|
+
access_token: text3("access_token"),
|
|
1719
|
+
oauth_token: text3("oauth_token"),
|
|
1720
|
+
oauth_token_secret: text3("oauth_token_secret"),
|
|
1721
|
+
expires_at: int7("expires_at"),
|
|
1722
|
+
token_type: varchar22("token_type", {
|
|
1723
|
+
length: 255
|
|
1724
|
+
}),
|
|
1725
|
+
scope: varchar22("scope", {
|
|
1726
|
+
length: 255
|
|
1727
|
+
}),
|
|
1728
|
+
id_token: text3("id_token"),
|
|
1729
|
+
session_state: varchar22("session_state", {
|
|
1730
|
+
length: 255
|
|
1731
|
+
}),
|
|
1732
|
+
refresh_token_expires_in: int7("refresh_token_expires_in")
|
|
1733
|
+
}, (account) => ({
|
|
1734
|
+
pk: primaryKey14({
|
|
1735
|
+
columns: [
|
|
1736
|
+
account.provider,
|
|
1737
|
+
account.providerAccountId
|
|
1738
|
+
]
|
|
1739
|
+
}),
|
|
1740
|
+
userIdIdx: index22("userId_idx").on(account.userId)
|
|
1741
|
+
}));
|
|
1742
|
+
}
|
|
1743
|
+
__name(getAccountsSchema, "getAccountsSchema");
|
|
1744
|
+
function getAccountsRelationsSchema(mysqlTable, overrides = {}) {
|
|
1745
|
+
const accounts = getAccountsSchema(mysqlTable);
|
|
1746
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1747
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1748
|
+
return relations22(accounts, ({ one }) => ({
|
|
1749
|
+
user: one(users, {
|
|
1750
|
+
fields: [
|
|
1751
|
+
accounts.userId
|
|
1752
|
+
],
|
|
1753
|
+
references: [
|
|
1754
|
+
users.id
|
|
1755
|
+
],
|
|
1756
|
+
relationName: "user"
|
|
1757
|
+
})
|
|
1758
|
+
}));
|
|
1759
|
+
}
|
|
1760
|
+
__name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
|
|
1761
|
+
|
|
1762
|
+
// src/lib/mysql/schemas/auth/profiles.ts
|
|
1763
|
+
import { relations as relations23, sql as sql18 } from "drizzle-orm";
|
|
1764
|
+
import { index as index23, json as json15, timestamp as timestamp22, uniqueIndex as uniqueIndex2, varchar as varchar23 } from "drizzle-orm/mysql-core";
|
|
1765
|
+
function getProfilesSchema(mysqlTable) {
|
|
1766
|
+
return mysqlTable("Profile", {
|
|
1767
|
+
id: varchar23("id", {
|
|
1768
|
+
length: 255
|
|
1769
|
+
}).notNull().primaryKey(),
|
|
1770
|
+
userId: varchar23("userId", {
|
|
1771
|
+
length: 255
|
|
1772
|
+
}).notNull(),
|
|
1773
|
+
type: varchar23("type", {
|
|
1774
|
+
length: 255
|
|
1775
|
+
}).notNull(),
|
|
1776
|
+
fields: json15("fields").$type().default({}),
|
|
1777
|
+
createdAt: timestamp22("createdAt", {
|
|
1778
|
+
mode: "date",
|
|
1779
|
+
fsp: 3
|
|
1780
|
+
}).default(sql18`CURRENT_TIMESTAMP(3)`),
|
|
1781
|
+
updatedAt: timestamp22("updatedAt", {
|
|
1782
|
+
mode: "date",
|
|
1783
|
+
fsp: 3
|
|
1784
|
+
}).default(sql18`CURRENT_TIMESTAMP(3)`)
|
|
1785
|
+
}, (profile) => ({
|
|
1786
|
+
userIdIdx: index23("userId_idx").on(profile.userId),
|
|
1787
|
+
uniqueUserType: uniqueIndex2("unique_user_type_idx").on(profile.userId, profile.type)
|
|
1788
|
+
}));
|
|
1789
|
+
}
|
|
1790
|
+
__name(getProfilesSchema, "getProfilesSchema");
|
|
1791
|
+
function getProfilesRelationsSchema(mysqlTable, overrides = {}) {
|
|
1792
|
+
const profiles = getProfilesSchema(mysqlTable);
|
|
1793
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1794
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1795
|
+
return relations23(profiles, ({ one }) => ({
|
|
1796
|
+
user: one(users, {
|
|
1797
|
+
fields: [
|
|
1798
|
+
profiles.userId
|
|
1799
|
+
],
|
|
1800
|
+
references: [
|
|
1801
|
+
users.id
|
|
1802
|
+
],
|
|
1803
|
+
relationName: "profiles"
|
|
1804
|
+
})
|
|
1805
|
+
}));
|
|
1806
|
+
}
|
|
1807
|
+
__name(getProfilesRelationsSchema, "getProfilesRelationsSchema");
|
|
1808
|
+
|
|
1809
|
+
// src/lib/mysql/schemas/auth/user-permissions.ts
|
|
1810
|
+
import { relations as relations24 } from "drizzle-orm";
|
|
1811
|
+
import { boolean as boolean6, index as index24, primaryKey as primaryKey15, timestamp as timestamp23, varchar as varchar24 } from "drizzle-orm/mysql-core";
|
|
1812
|
+
function getUserPermissionsSchema(mysqlTable) {
|
|
1813
|
+
return mysqlTable("UserPermission", {
|
|
1814
|
+
userId: varchar24("userId", {
|
|
1815
|
+
length: 255
|
|
1816
|
+
}).notNull(),
|
|
1817
|
+
organizationId: varchar24("organizationId", {
|
|
1818
|
+
length: 191
|
|
1819
|
+
}),
|
|
1820
|
+
permissionId: varchar24("permissionId", {
|
|
1821
|
+
length: 255
|
|
1822
|
+
}).notNull(),
|
|
1823
|
+
active: boolean6("active").notNull().default(true),
|
|
1824
|
+
createdAt: timestamp23("createdAt", {
|
|
1825
|
+
mode: "date",
|
|
1826
|
+
fsp: 3
|
|
1827
|
+
}).defaultNow(),
|
|
1828
|
+
updatedAt: timestamp23("updatedAt", {
|
|
1829
|
+
mode: "date",
|
|
1830
|
+
fsp: 3
|
|
1831
|
+
}).defaultNow(),
|
|
1832
|
+
deletedAt: timestamp23("deletedAt", {
|
|
1833
|
+
mode: "date",
|
|
1834
|
+
fsp: 3
|
|
1835
|
+
})
|
|
1836
|
+
}, (up) => ({
|
|
1837
|
+
pk: primaryKey15({
|
|
1838
|
+
columns: [
|
|
1839
|
+
up.userId,
|
|
1840
|
+
up.permissionId
|
|
1841
|
+
]
|
|
1842
|
+
}),
|
|
1843
|
+
userIdIdx: index24("userId_idx").on(up.userId),
|
|
1844
|
+
permissionIdIdx: index24("permissionId_idx").on(up.permissionId),
|
|
1845
|
+
organizationIdIdx: index24("organizationId_idx").on(up.organizationId)
|
|
1846
|
+
}));
|
|
1847
|
+
}
|
|
1848
|
+
__name(getUserPermissionsSchema, "getUserPermissionsSchema");
|
|
1849
|
+
function getUserPermissionsRelationsSchema(mysqlTable, overrides = {}) {
|
|
1850
|
+
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
1851
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1852
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1853
|
+
const permissions = getPermissionsSchema(mysqlTable);
|
|
1854
|
+
return relations24(userPermissions, ({ one }) => ({
|
|
1855
|
+
user: one(users, {
|
|
1856
|
+
fields: [
|
|
1857
|
+
userPermissions.userId
|
|
1858
|
+
],
|
|
1859
|
+
references: [
|
|
1860
|
+
users.id
|
|
1861
|
+
],
|
|
1862
|
+
relationName: "user"
|
|
1863
|
+
}),
|
|
1864
|
+
permission: one(permissions, {
|
|
1865
|
+
fields: [
|
|
1866
|
+
userPermissions.permissionId
|
|
1867
|
+
],
|
|
1868
|
+
references: [
|
|
1869
|
+
permissions.id
|
|
1870
|
+
],
|
|
1871
|
+
relationName: "permission"
|
|
1872
|
+
})
|
|
1873
|
+
}));
|
|
1874
|
+
}
|
|
1875
|
+
__name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
|
|
1876
|
+
|
|
1877
|
+
// src/lib/mysql/schemas/auth/user-prefs.ts
|
|
1878
|
+
import { relations as relations25, sql as sql19 } from "drizzle-orm";
|
|
1879
|
+
import { index as index25, json as json16, primaryKey as primaryKey16, timestamp as timestamp24, varchar as varchar25 } from "drizzle-orm/mysql-core";
|
|
1880
|
+
function getUserPrefsSchema(mysqlTable) {
|
|
1881
|
+
return mysqlTable("UserPrefs", {
|
|
1882
|
+
id: varchar25("id", {
|
|
1883
|
+
length: 191
|
|
1884
|
+
}).notNull(),
|
|
1885
|
+
organizationId: varchar25("organizationId", {
|
|
1886
|
+
length: 191
|
|
1887
|
+
}),
|
|
1888
|
+
type: varchar25("type", {
|
|
1889
|
+
length: 191
|
|
1890
|
+
}).default("Global").notNull(),
|
|
1891
|
+
userId: varchar25("userId", {
|
|
1892
|
+
length: 255
|
|
1893
|
+
}).notNull(),
|
|
1894
|
+
fields: json16("fields").$type().default({}),
|
|
1895
|
+
createdAt: timestamp24("createdAt", {
|
|
1896
|
+
mode: "date",
|
|
1897
|
+
fsp: 3
|
|
1898
|
+
}).default(sql19`CURRENT_TIMESTAMP(3)`),
|
|
1899
|
+
updatedAt: timestamp24("updatedAt", {
|
|
1900
|
+
mode: "date",
|
|
1901
|
+
fsp: 3
|
|
1902
|
+
}).default(sql19`CURRENT_TIMESTAMP(3)`),
|
|
1903
|
+
deletedAt: timestamp24("deletedAt", {
|
|
1904
|
+
mode: "date",
|
|
1905
|
+
fsp: 3
|
|
1906
|
+
})
|
|
1907
|
+
}, (crr) => ({
|
|
1908
|
+
pk: primaryKey16({
|
|
1909
|
+
columns: [
|
|
1910
|
+
crr.id
|
|
1911
|
+
]
|
|
1912
|
+
}),
|
|
1913
|
+
crrUserIdIdKey: index25("crr_userIdId_idx").on(crr.userId),
|
|
1914
|
+
organizationIdIdx: index25("organizationId_idx").on(crr.organizationId)
|
|
1915
|
+
}));
|
|
1916
|
+
}
|
|
1917
|
+
__name(getUserPrefsSchema, "getUserPrefsSchema");
|
|
1918
|
+
function getUserPrefsRelationsSchema(mysqlTable, overrides = {}) {
|
|
1919
|
+
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
1920
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1921
|
+
const user = resolveUsersSchema(mysqlTable);
|
|
1922
|
+
return relations25(userPrefs, ({ one }) => ({
|
|
1923
|
+
user: one(user, {
|
|
1924
|
+
fields: [
|
|
1925
|
+
userPrefs.userId
|
|
1926
|
+
],
|
|
1927
|
+
references: [
|
|
1928
|
+
user.id
|
|
1929
|
+
],
|
|
1930
|
+
relationName: "user"
|
|
1931
|
+
})
|
|
1932
|
+
}));
|
|
1933
|
+
}
|
|
1934
|
+
__name(getUserPrefsRelationsSchema, "getUserPrefsRelationsSchema");
|
|
1935
|
+
|
|
1936
|
+
// src/lib/mysql/schemas/auth/users.ts
|
|
1937
|
+
function getUsersSchema(mysqlTable) {
|
|
1938
|
+
return mysqlTable("User", {
|
|
1939
|
+
id: varchar26("id", {
|
|
1940
|
+
length: 255
|
|
1941
|
+
}).notNull().primaryKey(),
|
|
1942
|
+
name: varchar26("name", {
|
|
1943
|
+
length: 255
|
|
1944
|
+
}),
|
|
1945
|
+
role: varchar26("role", {
|
|
1946
|
+
length: 191
|
|
1947
|
+
}).notNull().default("user"),
|
|
1948
|
+
email: varchar26("email", {
|
|
1949
|
+
length: 255
|
|
1950
|
+
}).notNull().unique(),
|
|
1951
|
+
fields: json17("fields").$type().default({}),
|
|
1952
|
+
emailVerified: timestamp25("emailVerified", {
|
|
1953
|
+
mode: "date",
|
|
1954
|
+
fsp: 3
|
|
1955
|
+
}),
|
|
1956
|
+
image: varchar26("image", {
|
|
1957
|
+
length: 255
|
|
1958
|
+
}),
|
|
1959
|
+
createdAt: timestamp25("createdAt", {
|
|
1960
|
+
mode: "date",
|
|
1961
|
+
fsp: 3
|
|
1962
|
+
}).default(sql20`CURRENT_TIMESTAMP(3)`)
|
|
1963
|
+
}, (user) => ({
|
|
1964
|
+
emailIdx: index26("email_idx").on(user.email),
|
|
1965
|
+
roleIdx: index26("role_idx").on(user.role),
|
|
1966
|
+
createdAtIdx: index26("created_at_idx").on(user.createdAt)
|
|
1967
|
+
}));
|
|
1968
|
+
}
|
|
1969
|
+
__name(getUsersSchema, "getUsersSchema");
|
|
1970
|
+
function getUsersRelationsSchema(mysqlTable, overrides = {}) {
|
|
1971
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
1972
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
1973
|
+
const profiles = getProfilesSchema(mysqlTable);
|
|
1974
|
+
const accounts = getAccountsSchema(mysqlTable);
|
|
1975
|
+
const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
|
|
1976
|
+
const userRoles = getUserRolesSchema(mysqlTable);
|
|
1977
|
+
const userPermissions = getUserPermissionsSchema(mysqlTable);
|
|
1978
|
+
const contentContributions = getContentContributionsSchema(mysqlTable);
|
|
1979
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
1980
|
+
const purchases = getPurchaseSchema(mysqlTable);
|
|
1981
|
+
const comments = getCommentsSchema(mysqlTable);
|
|
1982
|
+
const userPrefs = getUserPrefsSchema(mysqlTable);
|
|
1983
|
+
const organizationMemberships = getOrganizationMembershipsSchema(mysqlTable);
|
|
1984
|
+
return relations26(users, ({ many, one }) => ({
|
|
1985
|
+
profiles: many(profiles, {
|
|
1986
|
+
relationName: "profiles"
|
|
1987
|
+
}),
|
|
1988
|
+
accounts: many(accounts, {
|
|
1989
|
+
relationName: "user"
|
|
1990
|
+
}),
|
|
1991
|
+
purchases: many(purchases, {
|
|
1992
|
+
relationName: "user"
|
|
1993
|
+
}),
|
|
1994
|
+
communicationPreferences: many(communicationPreferences, {
|
|
1995
|
+
relationName: "user"
|
|
1996
|
+
}),
|
|
1997
|
+
roles: many(userRoles, {
|
|
1998
|
+
relationName: "user"
|
|
1999
|
+
}),
|
|
2000
|
+
userPermissions: many(userPermissions, {
|
|
2001
|
+
relationName: "user"
|
|
2002
|
+
}),
|
|
2003
|
+
contributions: many(contentContributions, {
|
|
2004
|
+
relationName: "user"
|
|
2005
|
+
}),
|
|
2006
|
+
createdContent: many(contentResource, {
|
|
2007
|
+
relationName: "user"
|
|
2008
|
+
}),
|
|
2009
|
+
comments: many(comments, {
|
|
2010
|
+
relationName: "user"
|
|
2011
|
+
}),
|
|
2012
|
+
prefs: many(userPrefs, {
|
|
2013
|
+
relationName: "user"
|
|
2014
|
+
}),
|
|
2015
|
+
organizationMemberships: many(organizationMemberships, {
|
|
2016
|
+
relationName: "user"
|
|
2017
|
+
})
|
|
2018
|
+
}));
|
|
2019
|
+
}
|
|
2020
|
+
__name(getUsersRelationsSchema, "getUsersRelationsSchema");
|
|
2021
|
+
|
|
2022
|
+
// src/lib/mysql/schemas/auth/user-roles.ts
|
|
2023
|
+
function getUserRolesSchema(mysqlTable) {
|
|
2024
|
+
return mysqlTable("UserRole", {
|
|
2025
|
+
userId: varchar27("userId", {
|
|
2026
|
+
length: 255
|
|
2027
|
+
}).notNull(),
|
|
2028
|
+
roleId: varchar27("roleId", {
|
|
2029
|
+
length: 255
|
|
2030
|
+
}).notNull(),
|
|
2031
|
+
active: boolean7("active").notNull().default(true),
|
|
2032
|
+
organizationId: varchar27("organizationId", {
|
|
2033
|
+
length: 191
|
|
2034
|
+
}),
|
|
2035
|
+
createdAt: timestamp26("createdAt", {
|
|
2036
|
+
mode: "date",
|
|
2037
|
+
fsp: 3
|
|
2038
|
+
}).defaultNow(),
|
|
2039
|
+
updatedAt: timestamp26("updatedAt", {
|
|
2040
|
+
mode: "date",
|
|
2041
|
+
fsp: 3
|
|
2042
|
+
}).defaultNow(),
|
|
2043
|
+
deletedAt: timestamp26("deletedAt", {
|
|
2044
|
+
mode: "date",
|
|
2045
|
+
fsp: 3
|
|
2046
|
+
})
|
|
2047
|
+
}, (ur) => ({
|
|
2048
|
+
pk: primaryKey17({
|
|
2049
|
+
columns: [
|
|
2050
|
+
ur.userId,
|
|
2051
|
+
ur.roleId
|
|
2052
|
+
]
|
|
2053
|
+
}),
|
|
2054
|
+
userIdIdx: index27("userId_idx").on(ur.userId),
|
|
2055
|
+
roleIdIdx: index27("roleId_idx").on(ur.roleId),
|
|
2056
|
+
organizationIdIdx: index27("organizationId_idx").on(ur.organizationId)
|
|
2057
|
+
}));
|
|
2058
|
+
}
|
|
2059
|
+
__name(getUserRolesSchema, "getUserRolesSchema");
|
|
2060
|
+
function getUserRolesRelationsSchema(mysqlTable, overrides = {}) {
|
|
2061
|
+
const userRoles = getUserRolesSchema(mysqlTable);
|
|
2062
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
2063
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
2064
|
+
const roles = getRolesSchema(mysqlTable);
|
|
2065
|
+
return relations27(userRoles, ({ one }) => ({
|
|
2066
|
+
user: one(users, {
|
|
2067
|
+
fields: [
|
|
2068
|
+
userRoles.userId
|
|
2069
|
+
],
|
|
2070
|
+
references: [
|
|
2071
|
+
users.id
|
|
2072
|
+
],
|
|
2073
|
+
relationName: "user"
|
|
2074
|
+
}),
|
|
2075
|
+
role: one(roles, {
|
|
2076
|
+
fields: [
|
|
2077
|
+
userRoles.roleId
|
|
2078
|
+
],
|
|
2079
|
+
references: [
|
|
2080
|
+
roles.id
|
|
2081
|
+
],
|
|
2082
|
+
relationName: "role"
|
|
2083
|
+
})
|
|
2084
|
+
}));
|
|
2085
|
+
}
|
|
2086
|
+
__name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
|
|
2087
|
+
|
|
2088
|
+
export {
|
|
2089
|
+
getUserRolesSchema,
|
|
2090
|
+
getUserRolesRelationsSchema,
|
|
2091
|
+
getRolesSchema,
|
|
2092
|
+
getRolesRelationsSchema,
|
|
2093
|
+
getMerchantChargeSchema,
|
|
2094
|
+
getMerchantChargeRelationsSchema,
|
|
2095
|
+
getMerchantSubscriptionSchema,
|
|
2096
|
+
getMerchantSubscriptionRelationsSchema,
|
|
2097
|
+
getContentContributionsSchema,
|
|
2098
|
+
getContentContributionRelationsSchema,
|
|
2099
|
+
getContentResourceResourceSchema,
|
|
2100
|
+
getContentResourceResourceRelationsSchema,
|
|
2101
|
+
getTagTagSchema,
|
|
2102
|
+
getTagTagRelationsSchema,
|
|
2103
|
+
getTagSchema,
|
|
2104
|
+
getTagRelationsSchema,
|
|
2105
|
+
getContentResourceTagSchema,
|
|
2106
|
+
getContentResourceTagRelationsSchema,
|
|
2107
|
+
getContentResourceVersionSchema,
|
|
2108
|
+
getContentResourceVersionRelationsSchema,
|
|
2109
|
+
getContentResourceSchema,
|
|
2110
|
+
getContentResourceRelationsSchema,
|
|
2111
|
+
getContentResourceProductSchema,
|
|
2112
|
+
getContentResourceProductRelationsSchema,
|
|
2113
|
+
getPriceSchema,
|
|
2114
|
+
getProductRelationsSchema,
|
|
2115
|
+
getProductSchema,
|
|
2116
|
+
getProductRelationsSchema2,
|
|
2117
|
+
getSubscriptionSchema,
|
|
2118
|
+
getSubscriptionRelationsSchema,
|
|
2119
|
+
getOrganizationsSchema,
|
|
2120
|
+
getOrganizationsRelationsSchema,
|
|
2121
|
+
getOrganizationMembershipRolesSchema,
|
|
2122
|
+
getOrganizationMembershipRolesRelationsSchema,
|
|
2123
|
+
getOrganizationMembershipsSchema,
|
|
2124
|
+
getOrganizationMembershipsRelationsSchema,
|
|
2125
|
+
getCouponSchema,
|
|
2126
|
+
getCouponRelationsSchema,
|
|
2127
|
+
getPurchaseSchema,
|
|
2128
|
+
getPurchaseRelationsSchema,
|
|
2129
|
+
getCommentsSchema,
|
|
2130
|
+
getCommentRelationsSchema,
|
|
2131
|
+
getCommunicationPreferencesSchema,
|
|
2132
|
+
getCommunicationPreferencesRelationsSchema,
|
|
2133
|
+
getProfilesSchema,
|
|
2134
|
+
getProfilesRelationsSchema,
|
|
2135
|
+
getUserPermissionsSchema,
|
|
2136
|
+
getUserPermissionsRelationsSchema,
|
|
2137
|
+
getUserPrefsSchema,
|
|
2138
|
+
getUserPrefsRelationsSchema,
|
|
2139
|
+
getUsersSchema,
|
|
2140
|
+
getUsersRelationsSchema,
|
|
2141
|
+
getAccountsSchema,
|
|
2142
|
+
getAccountsRelationsSchema
|
|
2143
|
+
};
|
|
2144
|
+
//# sourceMappingURL=chunk-W6RPAAKG.js.map
|