@codecks/fetch 0.1.0 → 0.1.2

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.
@@ -0,0 +1,3037 @@
1
+ //#region src/models/_desc.ts
2
+ const makeModel = (opts) => {
3
+ return opts;
4
+ };
5
+ const relation = (relName, options) => {
6
+ return {
7
+ relName,
8
+ options
9
+ };
10
+ };
11
+
12
+ //#endregion
13
+ //#region src/models/_root.ts
14
+ const _rootDesc = makeModel({
15
+ name: "_root",
16
+ fields: {},
17
+ relations: {
18
+ releases: relation("release", { type: "hasMany" }),
19
+ accountOnboardingSteps: relation("accountOnboardingStep", { type: "hasMany" }),
20
+ apps: relation("app", { type: "hasMany" }),
21
+ account: relation("account", { type: "hasOne" }),
22
+ loggedInUser: relation("user", { type: "hasOne" }),
23
+ cardsStatusHistory: relation("cardsStatusHistory", { type: "hasMany" }),
24
+ cardsEffortHistory: relation("cardsEffortHistory", { type: "hasMany" }),
25
+ cardsFinishedHistory: relation("cardsFinishedHistory", { type: "hasMany" }),
26
+ cardsTimeToFinished: relation("cardsTimeToFinished", { type: "hasMany" })
27
+ },
28
+ keys: []
29
+ });
30
+
31
+ //#endregion
32
+ //#region src/models/_fields.ts
33
+ const id = () => {
34
+ return { type: "id" };
35
+ };
36
+ const string = (opts) => {
37
+ return { type: "string" };
38
+ };
39
+ const int = (opts) => {
40
+ return { type: "int" };
41
+ };
42
+ const bigint = (opts) => {
43
+ return { type: "bigint" };
44
+ };
45
+ const bool = (opts) => {
46
+ return { type: "bool" };
47
+ };
48
+ const date = (opts) => {
49
+ return { type: "date" };
50
+ };
51
+ const day = (opts) => {
52
+ return { type: "day" };
53
+ };
54
+ const object = (opts) => {
55
+ return { type: "obj" };
56
+ };
57
+ const array = (opts) => {
58
+ return { type: "array" };
59
+ };
60
+ const belongsTo = (opts) => {
61
+ return { type: () => {
62
+ return { type: "belongsTo" };
63
+ } };
64
+ };
65
+
66
+ //#endregion
67
+ //#region src/models/AccountOnboardingStep.ts
68
+ const accountOnboardingStepDesc = makeModel({
69
+ name: "accountOnboardingStep",
70
+ fields: {
71
+ key: id(),
72
+ title: string({}),
73
+ description: string({}),
74
+ chapter: string({}),
75
+ sortValue: string({}),
76
+ variants: array({}),
77
+ xp: int({}),
78
+ milestone: string({})
79
+ },
80
+ relations: {},
81
+ keys: ["key"]
82
+ });
83
+
84
+ //#endregion
85
+ //#region src/models/File.ts
86
+ const fileDesc = makeModel({
87
+ name: "file",
88
+ fields: {
89
+ id: id(),
90
+ name: string({}),
91
+ url: string({}),
92
+ size: string({}),
93
+ isDeleted: string({}),
94
+ meta: object({}),
95
+ createdAt: date({}),
96
+ deletedAt: date({}),
97
+ selfHosted: string({}),
98
+ accountId: belongsTo({}).type(),
99
+ uploaderId: belongsTo({}).type(),
100
+ deletedById: belongsTo({}).type()
101
+ },
102
+ relations: {
103
+ account: relation("account", {
104
+ type: "belongsTo",
105
+ fk: "accountId"
106
+ }),
107
+ uploader: relation("user", {
108
+ type: "belongsTo",
109
+ fk: "uploaderId"
110
+ }),
111
+ deletedBy: relation("user", {
112
+ type: "belongsTo",
113
+ fk: "deletedById"
114
+ })
115
+ },
116
+ keys: ["id"]
117
+ });
118
+
119
+ //#endregion
120
+ //#region src/models/Release.ts
121
+ const releaseDesc = makeModel({
122
+ name: "release",
123
+ fields: {
124
+ id: id(),
125
+ version: string({}),
126
+ isLive: string({}),
127
+ content: string({}),
128
+ title: string({}),
129
+ createdAt: date({})
130
+ },
131
+ relations: {},
132
+ keys: ["id"]
133
+ });
134
+
135
+ //#endregion
136
+ //#region src/models/User.ts
137
+ const userDesc = makeModel({
138
+ name: "user",
139
+ fields: {
140
+ id: id(),
141
+ name: string({}),
142
+ fullName: string({ optional: true }),
143
+ timezone: string({ optional: true }),
144
+ createdAt: date({}),
145
+ hasPassword: bool({}),
146
+ showCardIdInTimer: bool({}),
147
+ disableMovingImages: bool({}),
148
+ autoMeFilterCardLimit: int({ optional: true }),
149
+ isIntegration: bool({}),
150
+ statusColorPalette: string({}),
151
+ wantsNewsletter: bool({ optional: true }),
152
+ wantsDailyDigestMail: bool({ optional: true }),
153
+ wantsConvoDigestMail: bool({ optional: true }),
154
+ disableAnimations: bool({}),
155
+ enableClickToEditCards: bool({}),
156
+ cdxRole: string({}),
157
+ profileImageId: belongsTo({ optional: true }).type(),
158
+ lastSeenReleaseId: belongsTo({}).type()
159
+ },
160
+ relations: {
161
+ profileImage: relation("file", {
162
+ type: "belongsTo",
163
+ fk: "profileImageId"
164
+ }),
165
+ lastSeenRelease: relation("release", {
166
+ type: "belongsTo",
167
+ fk: "lastSeenReleaseId"
168
+ }),
169
+ projectOrders: relation("projectOrder", { type: "hasMany" }),
170
+ projectSelections: relation("projectSelection", { type: "hasMany" }),
171
+ queueSelections: relation("queueSelection", { type: "hasMany" }),
172
+ accountRoles: relation("accountRole", { type: "hasMany" }),
173
+ cardDiffNotifications: relation("cardDiffNotification", { type: "hasMany" }),
174
+ resolvableNotifications: relation("resolvableNotification", { type: "hasMany" }),
175
+ publicProjectMembership: relation("publicProjectMembership", { type: "hasMany" }),
176
+ lastSeenCardUpvotes: relation("lastSeenCardUpvote", { type: "hasMany" }),
177
+ dueCards: relation("dueCard", { type: "hasMany" }),
178
+ assigneeDeckAssignments: relation("assigneeDeckAssignment", { type: "hasMany" }),
179
+ autoFinishedTimeTrackingSegments: relation("autoFinishedTimeTrackingSegment", { type: "hasMany" }),
180
+ savedSearches: relation("savedSearch", { type: "hasMany" }),
181
+ activities: relation("activity", { type: "hasMany" }),
182
+ emails: relation("userEmail", { type: "hasMany" }),
183
+ tags: relation("userTag", { type: "hasMany" }),
184
+ unverifiedEmails: relation("userEmail", { type: "hasMany" }),
185
+ primaryEmail: relation("userEmail", { type: "hasOne" }),
186
+ pinnedMilestoneNext: relation("pinnedMilestone", { type: "hasOne" }),
187
+ projectAccess: relation("projectUser", { type: "hasMany" }),
188
+ explicitProjectAccess: relation("projectUser", { type: "hasMany" }),
189
+ withProjectAccess: relation("userProjectAccess", { type: "hasMany" }),
190
+ projectSettings: relation("projectUserSetting", { type: "hasMany" }),
191
+ accountSettings: relation("accountUserSetting", { type: "hasMany" }),
192
+ dismissedHints: relation("userDismissedHint", { type: "hasMany" }),
193
+ slackIntegrations: relation("integration", { type: "hasMany" }),
194
+ activeTimeTracker: relation("activeTimeTracker", { type: "hasOne" }),
195
+ participations: relation("resolvableParticipant", { type: "hasMany" }),
196
+ upvotes: relation("cardUpvote", { type: "hasMany" }),
197
+ userOnboarding: relation("userOnboarding", { type: "hasOne" })
198
+ },
199
+ keys: ["id"]
200
+ });
201
+
202
+ //#endregion
203
+ //#region src/models/Account.ts
204
+ const accountDesc = makeModel({
205
+ name: "account",
206
+ fields: {
207
+ id: id(),
208
+ subdomain: string({}),
209
+ name: string({}),
210
+ billingName: string({ optional: true }),
211
+ billingLine1: string({ optional: true }),
212
+ billingLine2: string({ optional: true }),
213
+ billingZip: string({ optional: true }),
214
+ billingCity: string({ optional: true }),
215
+ billingCountryCode: string({ optional: true }),
216
+ billingEmail: string({ optional: true }),
217
+ netGiftAmount: int({}),
218
+ persona: string({ optional: true }),
219
+ createdAt: date({}),
220
+ disabledAt: date({ optional: true }),
221
+ totalMediaByteUsage: bigint({}),
222
+ isDisabled: string({}),
223
+ milestonesEnabled: string({}),
224
+ sprintsEnabled: string({}),
225
+ priorityLabels: object({}),
226
+ effortScale: object({}),
227
+ statusChangeDurations: object({}),
228
+ activeFeatureFlags: object({}),
229
+ timeTrackingMode: string({}),
230
+ maxTimeTrackingSegmentMsDuration: int({}),
231
+ timeTrackingSwimLaneInfo: bool({}),
232
+ workdays: string({}),
233
+ workflowMode: string({}),
234
+ isLearning: bool({}),
235
+ isNonProfit: bool({}),
236
+ dependenciesEnabled: bool({}),
237
+ maxHandSlotCount: int({}),
238
+ seats: int({}),
239
+ activeProjectCount: int({}),
240
+ billingType: string({}),
241
+ allowInheritHeroCover: bool({}),
242
+ attachmentCoverMode: string({}),
243
+ staffPermission: string({}),
244
+ offeringTrial: bool({}),
245
+ coupon: object({ optional: true }),
246
+ hideCompletedCardCountForDecks: bool({}),
247
+ visionBoardEnabled: bool({}),
248
+ fallbackEffort: int({}),
249
+ timelineScaleType: string({}),
250
+ startWeekday: string({}),
251
+ disabledById: belongsTo({ optional: true }).type()
252
+ },
253
+ relations: {
254
+ disabledBy: relation("user", {
255
+ type: "belongsTo",
256
+ fk: "disabledById"
257
+ }),
258
+ cards: relation("card", { type: "hasMany" }),
259
+ invoices: relation("invoice", { type: "hasMany" }),
260
+ cardPresets: relation("cardPreset", { type: "hasMany" }),
261
+ attachments: relation("attachment", { type: "hasMany" }),
262
+ discordGuilds: relation("discordGuild", { type: "hasMany" }),
263
+ timeTrackingSegments: relation("timeTrackingSegment", { type: "hasMany" }),
264
+ workflowItems: relation("workflowItem", { type: "hasMany" }),
265
+ deckAssignments: relation("deckAssignment", { type: "hasMany" }),
266
+ assigneeAssignments: relation("assigneeAssignment", { type: "hasMany" }),
267
+ assigneeDeckAssignments: relation("assigneeDeckAssignment", { type: "hasMany" }),
268
+ wizards: relation("wizard", { type: "hasMany" }),
269
+ milestones: relation("milestone", { type: "hasMany" }),
270
+ sprints: relation("sprint", { type: "hasMany" }),
271
+ sprintConfigs: relation("sprintConfig", { type: "hasMany" }),
272
+ handCards: relation("handCard", { type: "hasMany" }),
273
+ resolvables: relation("resolvable", { type: "hasMany" }),
274
+ cardUpvotes: relation("cardUpvote", { type: "hasMany" }),
275
+ resolvableParticipants: relation("resolvableParticipant", { type: "hasMany" }),
276
+ userReportSettings: relation("userReportSetting", { type: "hasMany" }),
277
+ cardOrders: relation("cardOrder", { type: "hasMany" }),
278
+ accountUserAchievements: relation("accountUserAchievement", { type: "hasMany" }),
279
+ userInviteCodes: relation("userInviteCode", { type: "hasMany" }),
280
+ visionBoards: relation("visionBoard", { type: "hasMany" }),
281
+ deckSubscriptions: relation("deckSubscription", { type: "hasMany" }),
282
+ appInstallations: relation("appInstallation", { type: "hasMany" }),
283
+ files: relation("file", { type: "hasMany" }),
284
+ decks: relation("deck", { type: "hasMany" }),
285
+ queueEntries: relation("queueEntry", { type: "hasMany" }),
286
+ visionBoardQueries: relation("visionBoardQuery", { type: "hasMany" }),
287
+ anyDecks: relation("deck", { type: "hasMany" }),
288
+ projects: relation("project", { type: "hasMany" }),
289
+ archivedProjects: relation("project", { type: "hasMany" }),
290
+ anyProjects: relation("project", { type: "hasMany" }),
291
+ roles: relation("accountRole", { type: "hasMany" }),
292
+ invitations: relation("userInvitation", { type: "hasMany" }),
293
+ githubIntegration: relation("integration", { type: "hasOne" }),
294
+ slackIntegration: relation("integration", { type: "hasOne" }),
295
+ affiliateCodes: relation("affiliateCode", { type: "hasMany" }),
296
+ activities: relation("activity", { type: "hasMany" }),
297
+ stripeAccountSync: relation("stripeAccountSync", { type: "hasOne" }),
298
+ accountOnboarding: relation("accountOnboarding", { type: "hasOne" })
299
+ },
300
+ keys: ["id"]
301
+ });
302
+
303
+ //#endregion
304
+ //#region src/models/AccountOnboarding.ts
305
+ const accountOnboardingDesc = makeModel({
306
+ name: "accountOnboarding",
307
+ fields: {
308
+ variants: array({}),
309
+ steps: object({}),
310
+ accountId: belongsTo({}).type()
311
+ },
312
+ relations: { account: relation("account", {
313
+ type: "belongsTo",
314
+ fk: "accountId"
315
+ }) },
316
+ keys: ["accountId"]
317
+ });
318
+
319
+ //#endregion
320
+ //#region src/models/AccountRole.ts
321
+ const accountRoleDesc = makeModel({
322
+ name: "accountRole",
323
+ fields: {
324
+ role: string({}),
325
+ createdAt: date({}),
326
+ lastChangedAt: date({}),
327
+ roleAsPrio: int({}),
328
+ userId: belongsTo({}).type(),
329
+ accountId: belongsTo({}).type()
330
+ },
331
+ relations: {
332
+ user: relation("user", {
333
+ type: "belongsTo",
334
+ fk: "userId"
335
+ }),
336
+ account: relation("account", {
337
+ type: "belongsTo",
338
+ fk: "accountId"
339
+ })
340
+ },
341
+ keys: ["accountId", "userId"]
342
+ });
343
+
344
+ //#endregion
345
+ //#region src/models/AccountUserAchievement.ts
346
+ const accountUserAchievementDesc = makeModel({
347
+ name: "accountUserAchievement",
348
+ fields: {
349
+ value: object({}),
350
+ context: object({}),
351
+ accountId: belongsTo({}).type(),
352
+ userId: belongsTo({}).type()
353
+ },
354
+ relations: {
355
+ account: relation("account", {
356
+ type: "belongsTo",
357
+ fk: "accountId"
358
+ }),
359
+ user: relation("user", {
360
+ type: "belongsTo",
361
+ fk: "userId"
362
+ })
363
+ },
364
+ keys: [
365
+ "accountId",
366
+ "userId",
367
+ "key"
368
+ ]
369
+ });
370
+
371
+ //#endregion
372
+ //#region src/models/Project.ts
373
+ const projectDesc = makeModel({
374
+ name: "project",
375
+ fields: {
376
+ id: id(),
377
+ name: string({}),
378
+ visibility: string({}),
379
+ defaultUserAccess: string({}),
380
+ createdAt: date({}),
381
+ accountSeq: int({}),
382
+ allowUpvotes: string({}),
383
+ isPublic: string({}),
384
+ commentsArePublic: string({}),
385
+ publicRegistryAgreement: string({ optional: true }),
386
+ publicLayoutVersion: string({}),
387
+ publicIsExplicit: string({}),
388
+ markerColor: string({ optional: true }),
389
+ effortIcon: string({ optional: true }),
390
+ spaces: string({}),
391
+ publicPath: string({ optional: true }),
392
+ publicMessage: string({ optional: true }),
393
+ publicHeading: string({ optional: true }),
394
+ publicBackgroundColor: string({ optional: true }),
395
+ accountId: belongsTo({}).type(),
396
+ coverFileId: belongsTo({ optional: true }).type(),
397
+ publicBannerFileId: belongsTo({ optional: true }).type(),
398
+ publicTileFileId: belongsTo({ optional: true }).type(),
399
+ publicBackgroundImageId: belongsTo({ optional: true }).type()
400
+ },
401
+ relations: {
402
+ account: relation("account", {
403
+ type: "belongsTo",
404
+ fk: "accountId"
405
+ }),
406
+ coverFile: relation("file", {
407
+ type: "belongsTo",
408
+ fk: "coverFileId"
409
+ }),
410
+ publicBannerFile: relation("file", {
411
+ type: "belongsTo",
412
+ fk: "publicBannerFileId"
413
+ }),
414
+ publicTileFile: relation("file", {
415
+ type: "belongsTo",
416
+ fk: "publicTileFileId"
417
+ }),
418
+ publicBackgroundImage: relation("file", {
419
+ type: "belongsTo",
420
+ fk: "publicBackgroundImageId"
421
+ }),
422
+ decks: relation("deck", { type: "hasMany" }),
423
+ milestoneProjects: relation("milestoneProject", { type: "hasMany" }),
424
+ sprintProjects: relation("sprintProject", { type: "hasMany" }),
425
+ publicProjectVisits: relation("publicProjectVisit", { type: "hasMany" }),
426
+ dailyPublicProjectMembership: relation("dailyPublicProjectMembership", { type: "hasMany" }),
427
+ publicProjectMemberships: relation("publicProjectMembership", { type: "hasMany" }),
428
+ cardUpvotes: relation("cardUpvote", { type: "hasMany" }),
429
+ tags: relation("projectTag", { type: "hasMany" }),
430
+ activities: relation("activity", { type: "hasMany" }),
431
+ explicitProjectUsers: relation("projectUser", { type: "hasMany" }),
432
+ access: relation("userProjectAccess", { type: "hasMany" }),
433
+ publicProjectInfo: relation("publicProjectInfo", { type: "hasOne" })
434
+ },
435
+ keys: ["id"]
436
+ });
437
+
438
+ //#endregion
439
+ //#region src/models/Milestone.ts
440
+ const milestoneDesc = makeModel({
441
+ name: "milestone",
442
+ fields: {
443
+ id: id(),
444
+ name: string({}),
445
+ color: string({}),
446
+ date: day({}),
447
+ startDate: day({ optional: true }),
448
+ createdAt: date({}),
449
+ accountSeq: int({}),
450
+ description: string({ optional: true }),
451
+ isGlobal: string({}),
452
+ handSyncEnabled: string({}),
453
+ manualOrderLabels: string({}),
454
+ stats: object({}),
455
+ userCapacities: object({}),
456
+ isDeleted: bool({}),
457
+ preferredOrder: string({ optional: true }),
458
+ accountId: belongsTo({}).type(),
459
+ creatorId: belongsTo({}).type(),
460
+ coverFileId: belongsTo({ optional: true }).type()
461
+ },
462
+ relations: {
463
+ account: relation("account", {
464
+ type: "belongsTo",
465
+ fk: "accountId"
466
+ }),
467
+ creator: relation("user", {
468
+ type: "belongsTo",
469
+ fk: "creatorId"
470
+ }),
471
+ coverFile: relation("file", {
472
+ type: "belongsTo",
473
+ fk: "coverFileId"
474
+ }),
475
+ milestoneProjects: relation("milestoneProject", { type: "hasMany" }),
476
+ cards: relation("card", { type: "hasMany" }),
477
+ activities: relation("activity", { type: "hasMany" }),
478
+ progress: relation("milestoneProgress", { type: "hasMany" })
479
+ },
480
+ keys: ["id"]
481
+ });
482
+
483
+ //#endregion
484
+ //#region src/models/ProjectTag.ts
485
+ const projectTagDesc = makeModel({
486
+ name: "projectTag",
487
+ fields: {
488
+ id: id(),
489
+ tag: string({}),
490
+ color: string({ optional: true }),
491
+ emoji: string({ optional: true }),
492
+ description: string({ optional: true }),
493
+ createdAt: date({}),
494
+ projectId: belongsTo({}).type()
495
+ },
496
+ relations: { project: relation("project", {
497
+ type: "belongsTo",
498
+ fk: "projectId"
499
+ }) },
500
+ keys: ["id"]
501
+ });
502
+
503
+ //#endregion
504
+ //#region src/models/Deck.ts
505
+ const deckDesc = makeModel({
506
+ name: "deck",
507
+ fields: {
508
+ id: id(),
509
+ content: string({}),
510
+ description: string({}),
511
+ title: string({}),
512
+ sortValue: string({}),
513
+ preferredOrder: string({ optional: true }),
514
+ coverColor: string({ optional: true }),
515
+ isDeleted: string({}),
516
+ accountSeq: int({}),
517
+ spaceId: int({ optional: true }),
518
+ defaultCard: object({}),
519
+ isOnboardingDeck: bool({}),
520
+ handSyncEnabled: string({}),
521
+ stickyDefaultProjectTag: string({}),
522
+ manualOrderLabels: string({}),
523
+ workflowItemOrderLabels: string({}),
524
+ createdAt: date({}),
525
+ stats: object({}),
526
+ hasGuardians: string({}),
527
+ allowedCardTypes: string({}),
528
+ projectId: belongsTo({}).type(),
529
+ accountId: belongsTo({}).type(),
530
+ milestoneId: belongsTo({ optional: true }).type(),
531
+ creatorId: belongsTo({}).type(),
532
+ coverFileId: belongsTo({ optional: true }).type(),
533
+ descriptionCoverFileId: belongsTo({ optional: true }).type(),
534
+ defaultProjectTagId: belongsTo({ optional: true }).type()
535
+ },
536
+ relations: {
537
+ project: relation("project", {
538
+ type: "belongsTo",
539
+ fk: "projectId"
540
+ }),
541
+ account: relation("account", {
542
+ type: "belongsTo",
543
+ fk: "accountId"
544
+ }),
545
+ milestone: relation("milestone", {
546
+ type: "belongsTo",
547
+ fk: "milestoneId"
548
+ }),
549
+ creator: relation("user", {
550
+ type: "belongsTo",
551
+ fk: "creatorId"
552
+ }),
553
+ coverFile: relation("file", {
554
+ type: "belongsTo",
555
+ fk: "coverFileId"
556
+ }),
557
+ descriptionCoverFile: relation("file", {
558
+ type: "belongsTo",
559
+ fk: "descriptionCoverFileId"
560
+ }),
561
+ defaultProjectTag: relation("projectTag", {
562
+ type: "belongsTo",
563
+ fk: "defaultProjectTagId"
564
+ }),
565
+ cards: relation("card", { type: "hasMany" }),
566
+ workflowItems: relation("workflowItem", { type: "hasMany" }),
567
+ cardOrderInDecks: relation("cardOrderInDeck", { type: "hasMany" }),
568
+ activities: relation("activity", { type: "hasMany" }),
569
+ guardians: relation("deckGuardian", { type: "hasMany" })
570
+ },
571
+ keys: ["id"]
572
+ });
573
+
574
+ //#endregion
575
+ //#region src/models/AccountUserSetting.ts
576
+ const accountUserSettingDesc = makeModel({
577
+ name: "accountUserSetting",
578
+ fields: {
579
+ wantsWeeklyDigestMail: bool({}),
580
+ timelineScaleTypeOverwrite: string({}),
581
+ startWeekdayOverwrite: string({}),
582
+ accountId: belongsTo({}).type(),
583
+ userId: belongsTo({}).type(),
584
+ inboxDeckId: belongsTo({}).type()
585
+ },
586
+ relations: {
587
+ account: relation("account", {
588
+ type: "belongsTo",
589
+ fk: "accountId"
590
+ }),
591
+ user: relation("user", {
592
+ type: "belongsTo",
593
+ fk: "userId"
594
+ }),
595
+ inboxDeck: relation("deck", {
596
+ type: "belongsTo",
597
+ fk: "inboxDeckId"
598
+ })
599
+ },
600
+ keys: ["accountId", "userId"]
601
+ });
602
+
603
+ //#endregion
604
+ //#region src/models/SprintConfig.ts
605
+ const sprintConfigDesc = makeModel({
606
+ name: "sprintConfig",
607
+ fields: {
608
+ id: id(),
609
+ name: string({}),
610
+ color: string({}),
611
+ stopOn: day({ optional: true }),
612
+ isGlobal: string({}),
613
+ upcomingSprints: int({}),
614
+ sprintDurationWeeks: int({}),
615
+ sprintStartWeekday: int({}),
616
+ endHour: int({}),
617
+ endHourTimezone: string({}),
618
+ createdAt: date({}),
619
+ preferredOrder: string({ optional: true }),
620
+ moveOnFinish: string({}),
621
+ autoBeastModeDurationHours: int({ optional: true }),
622
+ autoAssignStartedCard: bool({}),
623
+ autoAssignNewCard: bool({}),
624
+ beastGracePeriodHours: int({}),
625
+ accountId: belongsTo({}).type(),
626
+ creatorId: belongsTo({}).type()
627
+ },
628
+ relations: {
629
+ account: relation("account", {
630
+ type: "belongsTo",
631
+ fk: "accountId"
632
+ }),
633
+ creator: relation("user", {
634
+ type: "belongsTo",
635
+ fk: "creatorId"
636
+ }),
637
+ sprintProjects: relation("sprintProject", { type: "hasMany" }),
638
+ sprints: relation("sprint", { type: "hasMany" }),
639
+ progress: relation("sprintConfigProgress", { type: "hasMany" })
640
+ },
641
+ keys: ["id"]
642
+ });
643
+
644
+ //#endregion
645
+ //#region src/models/Sprint.ts
646
+ const sprintDesc = makeModel({
647
+ name: "sprint",
648
+ fields: {
649
+ id: id(),
650
+ description: string({}),
651
+ name: string({ optional: true }),
652
+ accountSeq: int({}),
653
+ index: int({}),
654
+ startDate: day({}),
655
+ endDate: day({}),
656
+ stats: object({}),
657
+ manualOrderLabels: string({}),
658
+ userCapacities: object({}),
659
+ handSyncEnabled: string({}),
660
+ createdAt: date({}),
661
+ isDeleted: bool({}),
662
+ completedAt: date({ optional: true }),
663
+ lockedAt: date({ optional: true }),
664
+ accountId: belongsTo({}).type(),
665
+ sprintConfigId: belongsTo({}).type(),
666
+ creatorId: belongsTo({}).type(),
667
+ coverFileId: belongsTo({ optional: true }).type(),
668
+ autoMilestoneId: belongsTo({ optional: true }).type()
669
+ },
670
+ relations: {
671
+ account: relation("account", {
672
+ type: "belongsTo",
673
+ fk: "accountId"
674
+ }),
675
+ sprintConfig: relation("sprintConfig", {
676
+ type: "belongsTo",
677
+ fk: "sprintConfigId"
678
+ }),
679
+ creator: relation("user", {
680
+ type: "belongsTo",
681
+ fk: "creatorId"
682
+ }),
683
+ coverFile: relation("file", {
684
+ type: "belongsTo",
685
+ fk: "coverFileId"
686
+ }),
687
+ autoMilestone: relation("milestone", {
688
+ type: "belongsTo",
689
+ fk: "autoMilestoneId"
690
+ }),
691
+ cards: relation("card", { type: "hasMany" }),
692
+ progress: relation("sprintProgress", { type: "hasMany" }),
693
+ activities: relation("activity", { type: "hasMany" })
694
+ },
695
+ keys: ["id"]
696
+ });
697
+
698
+ //#endregion
699
+ //#region src/models/WorkflowItem.ts
700
+ const workflowItemDesc = makeModel({
701
+ name: "workflowItem",
702
+ fields: {
703
+ itemId: id(),
704
+ version: string({}),
705
+ sortOrder: string({}),
706
+ sortValue: string({}),
707
+ priority: string({ optional: true }),
708
+ content: string({}),
709
+ createdAt: date({}),
710
+ lastUpdatedAt: date({}),
711
+ tags: array({}),
712
+ masterTags: array({}),
713
+ mentionedUsers: array({}),
714
+ title: string({}),
715
+ effort: int({ optional: true }),
716
+ label: string({ optional: true }),
717
+ checkboxStats: object({}),
718
+ accountSeq: int({}),
719
+ checkboxInfo: array({}),
720
+ visibility: string({}),
721
+ accountId: belongsTo({}).type(),
722
+ deckId: belongsTo({}).type(),
723
+ targetDeckId: belongsTo({ optional: true }).type(),
724
+ assigneeId: belongsTo({ optional: true }).type(),
725
+ creatorId: belongsTo({}).type()
726
+ },
727
+ relations: {
728
+ account: relation("account", {
729
+ type: "belongsTo",
730
+ fk: "accountId"
731
+ }),
732
+ deck: relation("deck", {
733
+ type: "belongsTo",
734
+ fk: "deckId"
735
+ }),
736
+ targetDeck: relation("deck", {
737
+ type: "belongsTo",
738
+ fk: "targetDeckId"
739
+ }),
740
+ assignee: relation("user", {
741
+ type: "belongsTo",
742
+ fk: "assigneeId"
743
+ }),
744
+ creator: relation("user", {
745
+ type: "belongsTo",
746
+ fk: "creatorId"
747
+ }),
748
+ diffs: relation("workflowItemHistory", { type: "hasMany" }),
749
+ inDeps: relation("workflowItem", { type: "hasMany" }),
750
+ outDeps: relation("workflowItem", { type: "hasMany" })
751
+ },
752
+ keys: ["itemId"]
753
+ });
754
+
755
+ //#endregion
756
+ //#region src/models/DiscordGuild.ts
757
+ const discordGuildDesc = makeModel({
758
+ name: "discordGuild",
759
+ fields: {
760
+ id: id(),
761
+ discordGuildId: string({}),
762
+ guildName: string({}),
763
+ guildIconId: string({}),
764
+ scope: string({}),
765
+ karmaRoleThresholds: object({}),
766
+ removeCommandEnabled: string({}),
767
+ removeCommandEmoji: string({}),
768
+ removeCommandRoleId: string({}),
769
+ createdAt: date({}),
770
+ accountId: belongsTo({}).type()
771
+ },
772
+ relations: {
773
+ account: relation("account", {
774
+ type: "belongsTo",
775
+ fk: "accountId"
776
+ }),
777
+ slashCommands: relation("discordSlashCommand", { type: "hasMany" }),
778
+ projectNotifications: relation("discordProjectNotification", { type: "hasMany" }),
779
+ dailyDiscordGuildVoteMemberships: relation("dailyDiscordGuildVoteMembership", { type: "hasMany" }),
780
+ members: relation("discordMember", { type: "hasMany" })
781
+ },
782
+ keys: ["id"]
783
+ });
784
+
785
+ //#endregion
786
+ //#region src/models/VisionBoard.ts
787
+ const visionBoardDesc = makeModel({
788
+ name: "visionBoard",
789
+ fields: {
790
+ id: id(),
791
+ accountSeq: int({}),
792
+ createdAt: date({}),
793
+ isDeleted: bool({}),
794
+ cardId: belongsTo({}).type(),
795
+ accountId: belongsTo({}).type(),
796
+ creatorId: belongsTo({}).type()
797
+ },
798
+ relations: {
799
+ card: relation("card", {
800
+ type: "belongsTo",
801
+ fk: "cardId"
802
+ }),
803
+ account: relation("account", {
804
+ type: "belongsTo",
805
+ fk: "accountId"
806
+ }),
807
+ creator: relation("user", {
808
+ type: "belongsTo",
809
+ fk: "creatorId"
810
+ })
811
+ },
812
+ keys: ["id"]
813
+ });
814
+
815
+ //#endregion
816
+ //#region src/models/Card.ts
817
+ const cardDesc = makeModel({
818
+ name: "card",
819
+ fields: {
820
+ cardId: id(),
821
+ version: int({}),
822
+ accountSeq: int({}),
823
+ content: string({}),
824
+ status: string({}),
825
+ derivedStatus: string({}),
826
+ createdAt: date({}),
827
+ lastUpdatedAt: date({}),
828
+ tags: array({}),
829
+ masterTags: array({}),
830
+ mentionedUsers: array({}),
831
+ title: string({}),
832
+ priority: string({ optional: true }),
833
+ effort: int({ optional: true }),
834
+ checkboxStats: object({}),
835
+ checkboxInfo: array({}),
836
+ visibility: string({}),
837
+ legacyProjectSeq: int({ optional: true }),
838
+ meta: object({}),
839
+ embeds: object({}),
840
+ isPublic: bool({}),
841
+ hasBlockingDeps: bool({}),
842
+ dueDate: day({ optional: true }),
843
+ isDoc: bool({ optional: true }),
844
+ childCardInfo: string({}),
845
+ accountId: belongsTo({}).type(),
846
+ deckId: belongsTo({ optional: true }).type(),
847
+ assigneeId: belongsTo({ optional: true }).type(),
848
+ creatorId: belongsTo({ optional: true }).type(),
849
+ milestoneId: belongsTo({ optional: true }).type(),
850
+ sprintId: belongsTo({ optional: true }).type(),
851
+ legacyProjectId: belongsTo({ optional: true }).type(),
852
+ coverFileId: belongsTo({ optional: true }).type(),
853
+ parentCardId: belongsTo({ optional: true }).type(),
854
+ sourceWorkflowItemId: belongsTo({ optional: true }).type(),
855
+ discordGuildId: belongsTo({}).type(),
856
+ visionBoardId: belongsTo({ optional: true }).type()
857
+ },
858
+ relations: {
859
+ account: relation("account", {
860
+ type: "belongsTo",
861
+ fk: "accountId"
862
+ }),
863
+ deck: relation("deck", {
864
+ type: "belongsTo",
865
+ fk: "deckId"
866
+ }),
867
+ assignee: relation("user", {
868
+ type: "belongsTo",
869
+ fk: "assigneeId"
870
+ }),
871
+ creator: relation("user", {
872
+ type: "belongsTo",
873
+ fk: "creatorId"
874
+ }),
875
+ milestone: relation("milestone", {
876
+ type: "belongsTo",
877
+ fk: "milestoneId"
878
+ }),
879
+ sprint: relation("sprint", {
880
+ type: "belongsTo",
881
+ fk: "sprintId"
882
+ }),
883
+ legacyProject: relation("project", {
884
+ type: "belongsTo",
885
+ fk: "legacyProjectId"
886
+ }),
887
+ coverFile: relation("file", {
888
+ type: "belongsTo",
889
+ fk: "coverFileId"
890
+ }),
891
+ parentCard: relation("card", {
892
+ type: "belongsTo",
893
+ fk: "parentCardId"
894
+ }),
895
+ sourceWorkflowItem: relation("workflowItem", {
896
+ type: "belongsTo",
897
+ fk: "sourceWorkflowItemId"
898
+ }),
899
+ discordGuild: relation("discordGuild", {
900
+ type: "belongsTo",
901
+ fk: "discordGuildId"
902
+ }),
903
+ visionBoard: relation("visionBoard", {
904
+ type: "belongsTo",
905
+ fk: "visionBoardId"
906
+ }),
907
+ resolvables: relation("resolvable", { type: "hasMany" }),
908
+ handCards: relation("handCard", { type: "hasMany" }),
909
+ timeTrackingSegments: relation("timeTrackingSegment", { type: "hasMany" }),
910
+ cardSubscriptions: relation("cardSubscription", { type: "hasMany" }),
911
+ cardOrders: relation("cardOrder", { type: "hasMany" }),
912
+ resolvableEntries: relation("resolvableEntry", { type: "hasMany" }),
913
+ queueEntries: relation("queueEntry", { type: "hasMany" }),
914
+ attachments: relation("attachment", { type: "hasMany" }),
915
+ diffs: relation("cardHistory", { type: "hasMany" }),
916
+ totalTimeTrackingSums: relation("timeTrackingSum", { type: "hasOne" }),
917
+ userTimeTrackingSums: relation("timeTrackingSum", { type: "hasMany" }),
918
+ childCards: relation("card", { type: "hasMany" }),
919
+ inDeps: relation("card", { type: "hasMany" }),
920
+ outDeps: relation("card", { type: "hasMany" }),
921
+ cardReferences: relation("card", { type: "hasMany" }),
922
+ upvotes: relation("cardUpvote", { type: "hasMany" })
923
+ },
924
+ keys: ["cardId"]
925
+ });
926
+
927
+ //#endregion
928
+ //#region src/models/ActiveTimeTracker.ts
929
+ const activeTimeTrackerDesc = makeModel({
930
+ name: "activeTimeTracker",
931
+ fields: {
932
+ id: id(),
933
+ createdAt: date({}),
934
+ cardId: belongsTo({}).type(),
935
+ userId: belongsTo({}).type(),
936
+ accountId: belongsTo({}).type()
937
+ },
938
+ relations: {
939
+ card: relation("card", {
940
+ type: "belongsTo",
941
+ fk: "cardId"
942
+ }),
943
+ user: relation("user", {
944
+ type: "belongsTo",
945
+ fk: "userId"
946
+ }),
947
+ account: relation("account", {
948
+ type: "belongsTo",
949
+ fk: "accountId"
950
+ })
951
+ },
952
+ keys: ["id"]
953
+ });
954
+
955
+ //#endregion
956
+ //#region src/models/Activity.ts
957
+ const activityDesc = makeModel({
958
+ name: "activity",
959
+ fields: {
960
+ id: id(),
961
+ type: string({}),
962
+ data: object({}),
963
+ isRemovedFromDeckEntry: bool({}),
964
+ isRemovedFromMilestoneEntry: bool({}),
965
+ isRemovedFromSprintEntry: bool({}),
966
+ createdAt: date({}),
967
+ cardId: belongsTo({}).type(),
968
+ deckId: belongsTo({}).type(),
969
+ projectId: belongsTo({}).type(),
970
+ milestoneId: belongsTo({}).type(),
971
+ sprintId: belongsTo({}).type(),
972
+ changerId: belongsTo({}).type()
973
+ },
974
+ relations: {
975
+ card: relation("card", {
976
+ type: "belongsTo",
977
+ fk: "cardId"
978
+ }),
979
+ deck: relation("deck", {
980
+ type: "belongsTo",
981
+ fk: "deckId"
982
+ }),
983
+ project: relation("project", {
984
+ type: "belongsTo",
985
+ fk: "projectId"
986
+ }),
987
+ milestone: relation("milestone", {
988
+ type: "belongsTo",
989
+ fk: "milestoneId"
990
+ }),
991
+ sprint: relation("sprint", {
992
+ type: "belongsTo",
993
+ fk: "sprintId"
994
+ }),
995
+ changer: relation("user", {
996
+ type: "belongsTo",
997
+ fk: "changerId"
998
+ })
999
+ },
1000
+ keys: ["id"]
1001
+ });
1002
+
1003
+ //#endregion
1004
+ //#region src/models/AffiliateCode.ts
1005
+ const affiliateCodeDesc = makeModel({
1006
+ name: "affiliateCode",
1007
+ fields: {
1008
+ id: id(),
1009
+ code: string({}),
1010
+ vanityUrl: string({}),
1011
+ message: string({}),
1012
+ label: string({}),
1013
+ isDisabled: string({}),
1014
+ isDeleted: string({}),
1015
+ validUntil: string({}),
1016
+ remainingRedemptions: string({}),
1017
+ reward: object({}),
1018
+ createdAt: date({}),
1019
+ accountId: belongsTo({}).type(),
1020
+ creatorId: belongsTo({}).type()
1021
+ },
1022
+ relations: {
1023
+ account: relation("account", {
1024
+ type: "belongsTo",
1025
+ fk: "accountId"
1026
+ }),
1027
+ creator: relation("user", {
1028
+ type: "belongsTo",
1029
+ fk: "creatorId"
1030
+ }),
1031
+ stats: relation("affiliateCodeStat", { type: "hasMany" })
1032
+ },
1033
+ keys: ["id"]
1034
+ });
1035
+
1036
+ //#endregion
1037
+ //#region src/models/AffiliateCodeStat.ts
1038
+ const affiliateCodeStatDesc = makeModel({
1039
+ name: "affiliateCodeStat",
1040
+ fields: {
1041
+ month: int({}),
1042
+ year: int({}),
1043
+ visits: int({}),
1044
+ newVisitors: int({}),
1045
+ signups: int({}),
1046
+ revenue: int({}),
1047
+ affiliateCodeId: belongsTo({}).type()
1048
+ },
1049
+ relations: { affiliateCode: relation("affiliateCode", {
1050
+ type: "belongsTo",
1051
+ fk: "affiliateCodeId"
1052
+ }) },
1053
+ keys: ["affiliateCodeId", "month"]
1054
+ });
1055
+
1056
+ //#endregion
1057
+ //#region src/models/App.ts
1058
+ const appDesc = makeModel({
1059
+ name: "app",
1060
+ fields: {
1061
+ id: id(),
1062
+ name: string({}),
1063
+ createdAt: date({}),
1064
+ payload: object({})
1065
+ },
1066
+ relations: {},
1067
+ keys: ["id"]
1068
+ });
1069
+
1070
+ //#endregion
1071
+ //#region src/models/AppInstallation.ts
1072
+ const appInstallationDesc = makeModel({
1073
+ name: "appInstallation",
1074
+ fields: {
1075
+ id: id(),
1076
+ createdAt: date({}),
1077
+ accountId: belongsTo({}).type(),
1078
+ appId: belongsTo({}).type(),
1079
+ installerId: belongsTo({}).type()
1080
+ },
1081
+ relations: {
1082
+ account: relation("account", {
1083
+ type: "belongsTo",
1084
+ fk: "accountId"
1085
+ }),
1086
+ app: relation("app", {
1087
+ type: "belongsTo",
1088
+ fk: "appId"
1089
+ }),
1090
+ installer: relation("user", {
1091
+ type: "belongsTo",
1092
+ fk: "installerId"
1093
+ })
1094
+ },
1095
+ keys: ["id"]
1096
+ });
1097
+
1098
+ //#endregion
1099
+ //#region src/models/AssigneeAssignment.ts
1100
+ const assigneeAssignmentDesc = makeModel({
1101
+ name: "assigneeAssignment",
1102
+ fields: {
1103
+ lastAssignedAt: date({}),
1104
+ accountId: belongsTo({}).type(),
1105
+ assigneeId: belongsTo({}).type(),
1106
+ assignedById: belongsTo({}).type()
1107
+ },
1108
+ relations: {
1109
+ account: relation("account", {
1110
+ type: "belongsTo",
1111
+ fk: "accountId"
1112
+ }),
1113
+ assignee: relation("user", {
1114
+ type: "belongsTo",
1115
+ fk: "assigneeId"
1116
+ }),
1117
+ assignedBy: relation("user", {
1118
+ type: "belongsTo",
1119
+ fk: "assignedById"
1120
+ })
1121
+ },
1122
+ keys: ["assigneeId", "assignedById"]
1123
+ });
1124
+
1125
+ //#endregion
1126
+ //#region src/models/AssigneeDeckAssignment.ts
1127
+ const assigneeDeckAssignmentDesc = makeModel({
1128
+ name: "assigneeDeckAssignment",
1129
+ fields: {
1130
+ lastAssignedAt: date({}),
1131
+ accountId: belongsTo({}).type(),
1132
+ deckId: belongsTo({}).type(),
1133
+ assigneeId: belongsTo({}).type(),
1134
+ assignedById: belongsTo({}).type()
1135
+ },
1136
+ relations: {
1137
+ account: relation("account", {
1138
+ type: "belongsTo",
1139
+ fk: "accountId"
1140
+ }),
1141
+ deck: relation("deck", {
1142
+ type: "belongsTo",
1143
+ fk: "deckId"
1144
+ }),
1145
+ assignee: relation("user", {
1146
+ type: "belongsTo",
1147
+ fk: "assigneeId"
1148
+ }),
1149
+ assignedBy: relation("user", {
1150
+ type: "belongsTo",
1151
+ fk: "assignedById"
1152
+ })
1153
+ },
1154
+ keys: [
1155
+ "assigneeId",
1156
+ "assignedById",
1157
+ "deckId"
1158
+ ]
1159
+ });
1160
+
1161
+ //#endregion
1162
+ //#region src/models/Attachment.ts
1163
+ const attachmentDesc = makeModel({
1164
+ name: "attachment",
1165
+ fields: {
1166
+ id: id(),
1167
+ content: string({}),
1168
+ title: string({}),
1169
+ createdAt: date({}),
1170
+ fileId: belongsTo({}).type(),
1171
+ cardId: belongsTo({}).type(),
1172
+ accountId: belongsTo({}).type(),
1173
+ creatorId: belongsTo({}).type()
1174
+ },
1175
+ relations: {
1176
+ file: relation("file", {
1177
+ type: "belongsTo",
1178
+ fk: "fileId"
1179
+ }),
1180
+ card: relation("card", {
1181
+ type: "belongsTo",
1182
+ fk: "cardId"
1183
+ }),
1184
+ account: relation("account", {
1185
+ type: "belongsTo",
1186
+ fk: "accountId"
1187
+ }),
1188
+ creator: relation("user", {
1189
+ type: "belongsTo",
1190
+ fk: "creatorId"
1191
+ })
1192
+ },
1193
+ keys: ["id"]
1194
+ });
1195
+
1196
+ //#endregion
1197
+ //#region src/models/TimeTrackingSegment.ts
1198
+ const timeTrackingSegmentDesc = makeModel({
1199
+ name: "timeTrackingSegment",
1200
+ fields: {
1201
+ id: id(),
1202
+ createdAt: date({}),
1203
+ finishedAt: date({ optional: true }),
1204
+ startedAt: date({}),
1205
+ modifyDurationMsBy: int({}),
1206
+ addedManually: string({}),
1207
+ autoFinishedState: string({}),
1208
+ cardId: belongsTo({}).type(),
1209
+ userId: belongsTo({}).type(),
1210
+ accountId: belongsTo({}).type()
1211
+ },
1212
+ relations: {
1213
+ card: relation("card", {
1214
+ type: "belongsTo",
1215
+ fk: "cardId"
1216
+ }),
1217
+ user: relation("user", {
1218
+ type: "belongsTo",
1219
+ fk: "userId"
1220
+ }),
1221
+ account: relation("account", {
1222
+ type: "belongsTo",
1223
+ fk: "accountId"
1224
+ })
1225
+ },
1226
+ keys: ["id"]
1227
+ });
1228
+
1229
+ //#endregion
1230
+ //#region src/models/AutoFinishedTimeTrackingSegment.ts
1231
+ const autoFinishedTimeTrackingSegmentDesc = makeModel({
1232
+ name: "autoFinishedTimeTrackingSegment",
1233
+ fields: {
1234
+ createdAt: date({}),
1235
+ userId: belongsTo({}).type(),
1236
+ accountId: belongsTo({}).type(),
1237
+ cardId: belongsTo({}).type(),
1238
+ timeTrackingSegmentId: belongsTo({}).type()
1239
+ },
1240
+ relations: {
1241
+ user: relation("user", {
1242
+ type: "belongsTo",
1243
+ fk: "userId"
1244
+ }),
1245
+ account: relation("account", {
1246
+ type: "belongsTo",
1247
+ fk: "accountId"
1248
+ }),
1249
+ card: relation("card", {
1250
+ type: "belongsTo",
1251
+ fk: "cardId"
1252
+ }),
1253
+ timeTrackingSegment: relation("timeTrackingSegment", {
1254
+ type: "belongsTo",
1255
+ fk: "timeTrackingSegmentId"
1256
+ })
1257
+ },
1258
+ keys: ["userId", "accountId"]
1259
+ });
1260
+
1261
+ //#endregion
1262
+ //#region src/models/CardDiffNotification.ts
1263
+ const cardDiffNotificationDesc = makeModel({
1264
+ name: "cardDiffNotification",
1265
+ fields: {
1266
+ changes: object({}),
1267
+ asOwner: bool({}),
1268
+ changers: array({}),
1269
+ lastUpdatedAt: date({}),
1270
+ createdAt: date({}),
1271
+ userId: belongsTo({}).type(),
1272
+ cardId: belongsTo({}).type(),
1273
+ accountId: belongsTo({}).type()
1274
+ },
1275
+ relations: {
1276
+ user: relation("user", {
1277
+ type: "belongsTo",
1278
+ fk: "userId"
1279
+ }),
1280
+ card: relation("card", {
1281
+ type: "belongsTo",
1282
+ fk: "cardId"
1283
+ }),
1284
+ account: relation("account", {
1285
+ type: "belongsTo",
1286
+ fk: "accountId"
1287
+ })
1288
+ },
1289
+ keys: ["userId", "cardId"]
1290
+ });
1291
+
1292
+ //#endregion
1293
+ //#region src/models/CardHistory.ts
1294
+ const cardHistoryDesc = makeModel({
1295
+ name: "cardHistory",
1296
+ fields: {
1297
+ diff: object({}),
1298
+ versionCreatedAt: date({}),
1299
+ version: int({}),
1300
+ accountId: belongsTo({}).type(),
1301
+ cardId: belongsTo({}).type(),
1302
+ changerId: belongsTo({}).type()
1303
+ },
1304
+ relations: {
1305
+ account: relation("account", {
1306
+ type: "belongsTo",
1307
+ fk: "accountId"
1308
+ }),
1309
+ card: relation("card", {
1310
+ type: "belongsTo",
1311
+ fk: "cardId"
1312
+ }),
1313
+ changer: relation("user", {
1314
+ type: "belongsTo",
1315
+ fk: "changerId"
1316
+ })
1317
+ },
1318
+ keys: ["cardId", "version"]
1319
+ });
1320
+
1321
+ //#endregion
1322
+ //#region src/models/CardOrderInDeck.ts
1323
+ const cardOrderInDeckDesc = makeModel({
1324
+ name: "cardOrderInDeck",
1325
+ fields: {
1326
+ sortIndex: string({}),
1327
+ cardId: belongsTo({}).type(),
1328
+ deckId: belongsTo({}).type(),
1329
+ changerId: belongsTo({}).type()
1330
+ },
1331
+ relations: {
1332
+ card: relation("card", {
1333
+ type: "belongsTo",
1334
+ fk: "cardId"
1335
+ }),
1336
+ deck: relation("deck", {
1337
+ type: "belongsTo",
1338
+ fk: "deckId"
1339
+ }),
1340
+ changer: relation("user", {
1341
+ type: "belongsTo",
1342
+ fk: "changerId"
1343
+ })
1344
+ },
1345
+ keys: ["cardId", "deckId"]
1346
+ });
1347
+
1348
+ //#endregion
1349
+ //#region src/models/CardOrder.ts
1350
+ const cardOrderDesc = makeModel({
1351
+ name: "cardOrder",
1352
+ fields: {
1353
+ sortValue: string({}),
1354
+ label: string({}),
1355
+ cardId: belongsTo({}).type(),
1356
+ accountId: belongsTo({}).type()
1357
+ },
1358
+ relations: {
1359
+ card: relation("card", {
1360
+ type: "belongsTo",
1361
+ fk: "cardId"
1362
+ }),
1363
+ account: relation("account", {
1364
+ type: "belongsTo",
1365
+ fk: "accountId"
1366
+ })
1367
+ },
1368
+ keys: ["context", "cardId"]
1369
+ });
1370
+
1371
+ //#endregion
1372
+ //#region src/models/CardPreset.ts
1373
+ const cardPresetDesc = makeModel({
1374
+ name: "cardPreset",
1375
+ fields: {
1376
+ id: id(),
1377
+ name: string({}),
1378
+ data: object({}),
1379
+ createdAt: date({}),
1380
+ accountId: belongsTo({}).type(),
1381
+ creatorId: belongsTo({}).type()
1382
+ },
1383
+ relations: {
1384
+ account: relation("account", {
1385
+ type: "belongsTo",
1386
+ fk: "accountId"
1387
+ }),
1388
+ creator: relation("user", {
1389
+ type: "belongsTo",
1390
+ fk: "creatorId"
1391
+ })
1392
+ },
1393
+ keys: ["id"]
1394
+ });
1395
+
1396
+ //#endregion
1397
+ //#region src/models/CardSubscription.ts
1398
+ const cardSubscriptionDesc = makeModel({
1399
+ name: "cardSubscription",
1400
+ fields: {
1401
+ id: id(),
1402
+ createdAt: date({}),
1403
+ userId: belongsTo({}).type(),
1404
+ cardId: belongsTo({}).type(),
1405
+ accountId: belongsTo({}).type()
1406
+ },
1407
+ relations: {
1408
+ user: relation("user", {
1409
+ type: "belongsTo",
1410
+ fk: "userId"
1411
+ }),
1412
+ card: relation("card", {
1413
+ type: "belongsTo",
1414
+ fk: "cardId"
1415
+ }),
1416
+ account: relation("account", {
1417
+ type: "belongsTo",
1418
+ fk: "accountId"
1419
+ })
1420
+ },
1421
+ keys: ["id"]
1422
+ });
1423
+
1424
+ //#endregion
1425
+ //#region src/models/CardUpvote.ts
1426
+ const cardUpvoteDesc = makeModel({
1427
+ name: "cardUpvote",
1428
+ fields: {
1429
+ id: id(),
1430
+ type: string({}),
1431
+ createdAt: date({}),
1432
+ discordUserInfo: object({}),
1433
+ userId: belongsTo({}).type(),
1434
+ accountId: belongsTo({}).type(),
1435
+ cardId: belongsTo({}).type()
1436
+ },
1437
+ relations: {
1438
+ user: relation("user", {
1439
+ type: "belongsTo",
1440
+ fk: "userId"
1441
+ }),
1442
+ account: relation("account", {
1443
+ type: "belongsTo",
1444
+ fk: "accountId"
1445
+ }),
1446
+ card: relation("card", {
1447
+ type: "belongsTo",
1448
+ fk: "cardId"
1449
+ })
1450
+ },
1451
+ keys: ["id"]
1452
+ });
1453
+
1454
+ //#endregion
1455
+ //#region src/models/CardsEffortHistory.ts
1456
+ const cardsEffortHistoryDesc = makeModel({
1457
+ name: "cardsEffortHistory",
1458
+ fields: {
1459
+ effortSum: bigint({}),
1460
+ cardCount: bigint({}),
1461
+ date: day({})
1462
+ },
1463
+ relations: {},
1464
+ keys: [
1465
+ "date",
1466
+ "effortSum",
1467
+ "cardCount"
1468
+ ]
1469
+ });
1470
+
1471
+ //#endregion
1472
+ //#region src/models/CardsFinishedHistory.ts
1473
+ const cardsFinishedHistoryDesc = makeModel({
1474
+ name: "cardsFinishedHistory",
1475
+ fields: {
1476
+ effortSum: bigint({}),
1477
+ cardCount: bigint({}),
1478
+ date: day({}),
1479
+ assigneeId: belongsTo({}).type()
1480
+ },
1481
+ relations: { assignee: relation("user", {
1482
+ type: "belongsTo",
1483
+ fk: "assigneeId"
1484
+ }) },
1485
+ keys: [
1486
+ "date",
1487
+ "effortSum",
1488
+ "cardCount",
1489
+ "assigneeId"
1490
+ ]
1491
+ });
1492
+
1493
+ //#endregion
1494
+ //#region src/models/CardsStatusHistory.ts
1495
+ const cardsStatusHistoryDesc = makeModel({
1496
+ name: "cardsStatusHistory",
1497
+ fields: {
1498
+ status: string({}),
1499
+ count: int({}),
1500
+ date: day({})
1501
+ },
1502
+ relations: {},
1503
+ keys: [
1504
+ "date",
1505
+ "status",
1506
+ "count"
1507
+ ]
1508
+ });
1509
+
1510
+ //#endregion
1511
+ //#region src/models/CardsTimeToFinished.ts
1512
+ const cardsTimeToFinishedDesc = makeModel({
1513
+ name: "cardsTimeToFinished",
1514
+ fields: {
1515
+ effort: int({}),
1516
+ startedAt: date({}),
1517
+ doneAt: date({}),
1518
+ cardId: belongsTo({}).type(),
1519
+ assigneeId: belongsTo({}).type()
1520
+ },
1521
+ relations: {
1522
+ card: relation("card", {
1523
+ type: "belongsTo",
1524
+ fk: "cardId"
1525
+ }),
1526
+ assignee: relation("user", {
1527
+ type: "belongsTo",
1528
+ fk: "assigneeId"
1529
+ })
1530
+ },
1531
+ keys: [
1532
+ "cardId",
1533
+ "startedAt",
1534
+ "doneAt",
1535
+ "effort",
1536
+ "assigneeId"
1537
+ ]
1538
+ });
1539
+
1540
+ //#endregion
1541
+ //#region src/models/DailyDiscordGuildVoteMembership.ts
1542
+ const dailyDiscordGuildVoteMembershipDesc = makeModel({
1543
+ name: "dailyDiscordGuildVoteMembership",
1544
+ fields: {
1545
+ t: date({}),
1546
+ membershipCount: int({}),
1547
+ discordGuildId: belongsTo({}).type()
1548
+ },
1549
+ relations: { discordGuild: relation("discordGuild", {
1550
+ type: "belongsTo",
1551
+ fk: "discordGuildId"
1552
+ }) },
1553
+ keys: ["t", "guildId"]
1554
+ });
1555
+
1556
+ //#endregion
1557
+ //#region src/models/DailyPublicProjectMembership.ts
1558
+ const dailyPublicProjectMembershipDesc = makeModel({
1559
+ name: "dailyPublicProjectMembership",
1560
+ fields: {
1561
+ t: date({}),
1562
+ membershipCount: int({}),
1563
+ projectId: belongsTo({}).type()
1564
+ },
1565
+ relations: { project: relation("project", {
1566
+ type: "belongsTo",
1567
+ fk: "projectId"
1568
+ }) },
1569
+ keys: ["t", "projectId"]
1570
+ });
1571
+
1572
+ //#endregion
1573
+ //#region src/models/PublicProjectVisit.ts
1574
+ const publicProjectVisitDesc = makeModel({
1575
+ name: "publicProjectVisit",
1576
+ fields: {
1577
+ t: date({}),
1578
+ topReferrers: object({}),
1579
+ visitCounts: int({}),
1580
+ projectId: belongsTo({}).type()
1581
+ },
1582
+ relations: { project: relation("project", {
1583
+ type: "belongsTo",
1584
+ fk: "projectId"
1585
+ }) },
1586
+ keys: ["t", "projectId"]
1587
+ });
1588
+
1589
+ //#endregion
1590
+ //#region src/models/DeckAssignment.ts
1591
+ const deckAssignmentDesc = makeModel({
1592
+ name: "deckAssignment",
1593
+ fields: {
1594
+ lastAssignedAt: date({}),
1595
+ deckId: belongsTo({}).type(),
1596
+ userId: belongsTo({}).type(),
1597
+ accountId: belongsTo({}).type()
1598
+ },
1599
+ relations: {
1600
+ deck: relation("deck", {
1601
+ type: "belongsTo",
1602
+ fk: "deckId"
1603
+ }),
1604
+ user: relation("user", {
1605
+ type: "belongsTo",
1606
+ fk: "userId"
1607
+ }),
1608
+ account: relation("account", {
1609
+ type: "belongsTo",
1610
+ fk: "accountId"
1611
+ })
1612
+ },
1613
+ keys: ["userId", "deckId"]
1614
+ });
1615
+
1616
+ //#endregion
1617
+ //#region src/models/DeckGuardian.ts
1618
+ const deckGuardianDesc = makeModel({
1619
+ name: "deckGuardian",
1620
+ fields: {
1621
+ userId: belongsTo({}).type(),
1622
+ accountId: belongsTo({}).type(),
1623
+ deckId: belongsTo({}).type()
1624
+ },
1625
+ relations: {
1626
+ user: relation("user", {
1627
+ type: "belongsTo",
1628
+ fk: "userId"
1629
+ }),
1630
+ account: relation("account", {
1631
+ type: "belongsTo",
1632
+ fk: "accountId"
1633
+ }),
1634
+ deck: relation("deck", {
1635
+ type: "belongsTo",
1636
+ fk: "deckId"
1637
+ })
1638
+ },
1639
+ keys: ["deckId", "userId"]
1640
+ });
1641
+
1642
+ //#endregion
1643
+ //#region src/models/DeckSubscription.ts
1644
+ const deckSubscriptionDesc = makeModel({
1645
+ name: "deckSubscription",
1646
+ fields: {
1647
+ id: id(),
1648
+ userId: belongsTo({}).type(),
1649
+ deckId: belongsTo({}).type(),
1650
+ accountId: belongsTo({}).type()
1651
+ },
1652
+ relations: {
1653
+ user: relation("user", {
1654
+ type: "belongsTo",
1655
+ fk: "userId"
1656
+ }),
1657
+ deck: relation("deck", {
1658
+ type: "belongsTo",
1659
+ fk: "deckId"
1660
+ }),
1661
+ account: relation("account", {
1662
+ type: "belongsTo",
1663
+ fk: "accountId"
1664
+ })
1665
+ },
1666
+ keys: ["id"]
1667
+ });
1668
+
1669
+ //#endregion
1670
+ //#region src/models/DiscordMember.ts
1671
+ const discordMemberDesc = makeModel({
1672
+ name: "discordMember",
1673
+ fields: {
1674
+ id: id(),
1675
+ discordUserId: string({}),
1676
+ name: string({}),
1677
+ nick: string({}),
1678
+ avatar: string({}),
1679
+ discriminator: string({}),
1680
+ createdAt: date({}),
1681
+ deckyScore: int({}),
1682
+ discordGuildId: belongsTo({}).type()
1683
+ },
1684
+ relations: { discordGuild: relation("discordGuild", {
1685
+ type: "belongsTo",
1686
+ fk: "discordGuildId"
1687
+ }) },
1688
+ keys: ["id"]
1689
+ });
1690
+
1691
+ //#endregion
1692
+ //#region src/models/DiscordProjectNotification.ts
1693
+ const discordProjectNotificationDesc = makeModel({
1694
+ name: "discordProjectNotification",
1695
+ fields: {
1696
+ id: id(),
1697
+ discordChannelId: string({}),
1698
+ disabledTypes: object({}),
1699
+ createdAt: date({}),
1700
+ projectId: belongsTo({}).type(),
1701
+ discordGuildId: belongsTo({}).type()
1702
+ },
1703
+ relations: {
1704
+ project: relation("project", {
1705
+ type: "belongsTo",
1706
+ fk: "projectId"
1707
+ }),
1708
+ discordGuild: relation("discordGuild", {
1709
+ type: "belongsTo",
1710
+ fk: "discordGuildId"
1711
+ })
1712
+ },
1713
+ keys: ["id"]
1714
+ });
1715
+
1716
+ //#endregion
1717
+ //#region src/models/DiscordSlashCommand.ts
1718
+ const discordSlashCommandDesc = makeModel({
1719
+ name: "discordSlashCommand",
1720
+ fields: {
1721
+ id: id(),
1722
+ channelId: string({}),
1723
+ statusTargetChannelId: string({}),
1724
+ reaction: string({}),
1725
+ name: string({}),
1726
+ description: string({}),
1727
+ autoAddRoleToThread: string({}),
1728
+ leaderboard: object({}),
1729
+ reactionThreshold: int({}),
1730
+ karmaForCompletion: int({}),
1731
+ maxFileSizeInBytes: int({}),
1732
+ statusMessages: object({}),
1733
+ permissions: object({}),
1734
+ deckId: belongsTo({}).type(),
1735
+ discordGuildId: belongsTo({}).type()
1736
+ },
1737
+ relations: {
1738
+ deck: relation("deck", {
1739
+ type: "belongsTo",
1740
+ fk: "deckId"
1741
+ }),
1742
+ discordGuild: relation("discordGuild", {
1743
+ type: "belongsTo",
1744
+ fk: "discordGuildId"
1745
+ })
1746
+ },
1747
+ keys: ["id"]
1748
+ });
1749
+
1750
+ //#endregion
1751
+ //#region src/models/DueCard.ts
1752
+ const dueCardDesc = makeModel({
1753
+ name: "dueCard",
1754
+ fields: {
1755
+ createdAt: date({}),
1756
+ userId: belongsTo({}).type(),
1757
+ accountId: belongsTo({}).type(),
1758
+ cardId: belongsTo({}).type()
1759
+ },
1760
+ relations: {
1761
+ user: relation("user", {
1762
+ type: "belongsTo",
1763
+ fk: "userId"
1764
+ }),
1765
+ account: relation("account", {
1766
+ type: "belongsTo",
1767
+ fk: "accountId"
1768
+ }),
1769
+ card: relation("card", {
1770
+ type: "belongsTo",
1771
+ fk: "cardId"
1772
+ })
1773
+ },
1774
+ keys: ["userId", "cardId"]
1775
+ });
1776
+
1777
+ //#endregion
1778
+ //#region src/models/HandCard.ts
1779
+ const handCardDesc = makeModel({
1780
+ name: "handCard",
1781
+ fields: {
1782
+ sortIndex: int({}),
1783
+ userId: belongsTo({}).type(),
1784
+ accountId: belongsTo({}).type(),
1785
+ cardId: belongsTo({}).type()
1786
+ },
1787
+ relations: {
1788
+ user: relation("user", {
1789
+ type: "belongsTo",
1790
+ fk: "userId"
1791
+ }),
1792
+ account: relation("account", {
1793
+ type: "belongsTo",
1794
+ fk: "accountId"
1795
+ }),
1796
+ card: relation("card", {
1797
+ type: "belongsTo",
1798
+ fk: "cardId"
1799
+ })
1800
+ },
1801
+ keys: [
1802
+ "cardId",
1803
+ "userId",
1804
+ "accountId"
1805
+ ]
1806
+ });
1807
+
1808
+ //#endregion
1809
+ //#region src/models/Integration.ts
1810
+ const integrationDesc = makeModel({
1811
+ name: "integration",
1812
+ fields: {
1813
+ id: id(),
1814
+ type: string({}),
1815
+ disabled: string({}),
1816
+ userData: object({}),
1817
+ createdAt: date({}),
1818
+ version: int({}),
1819
+ accountId: belongsTo({}).type(),
1820
+ userId: belongsTo({}).type(),
1821
+ creatorId: belongsTo({}).type()
1822
+ },
1823
+ relations: {
1824
+ account: relation("account", {
1825
+ type: "belongsTo",
1826
+ fk: "accountId"
1827
+ }),
1828
+ user: relation("user", {
1829
+ type: "belongsTo",
1830
+ fk: "userId"
1831
+ }),
1832
+ creator: relation("user", {
1833
+ type: "belongsTo",
1834
+ fk: "creatorId"
1835
+ })
1836
+ },
1837
+ keys: ["id"]
1838
+ });
1839
+
1840
+ //#endregion
1841
+ //#region src/models/Invoice.ts
1842
+ const invoiceDesc = makeModel({
1843
+ name: "invoice",
1844
+ fields: {
1845
+ id: id(),
1846
+ invoiceNumber: string({}),
1847
+ url: string({}),
1848
+ createdAt: date({}),
1849
+ total: int({}),
1850
+ subtotal: int({}),
1851
+ charged: int({}),
1852
+ chargeData: object({}),
1853
+ accountId: belongsTo({}).type()
1854
+ },
1855
+ relations: { account: relation("account", {
1856
+ type: "belongsTo",
1857
+ fk: "accountId"
1858
+ }) },
1859
+ keys: ["id"]
1860
+ });
1861
+
1862
+ //#endregion
1863
+ //#region src/models/LastSeenCardUpvote.ts
1864
+ const lastSeenCardUpvoteDesc = makeModel({
1865
+ name: "lastSeenCardUpvote",
1866
+ fields: {
1867
+ lastSeenAt: date({}),
1868
+ createdAt: date({}),
1869
+ userId: belongsTo({}).type(),
1870
+ accountId: belongsTo({}).type()
1871
+ },
1872
+ relations: {
1873
+ user: relation("user", {
1874
+ type: "belongsTo",
1875
+ fk: "userId"
1876
+ }),
1877
+ account: relation("account", {
1878
+ type: "belongsTo",
1879
+ fk: "accountId"
1880
+ })
1881
+ },
1882
+ keys: ["userId", "accountId"]
1883
+ });
1884
+
1885
+ //#endregion
1886
+ //#region src/models/MilestoneProgress.ts
1887
+ const milestoneProgressDesc = makeModel({
1888
+ name: "milestoneProgress",
1889
+ fields: {
1890
+ progress: object({}),
1891
+ milestoneId: belongsTo({}).type()
1892
+ },
1893
+ relations: { milestone: relation("milestone", {
1894
+ type: "belongsTo",
1895
+ fk: "milestoneId"
1896
+ }) },
1897
+ keys: ["milestoneId", "date"]
1898
+ });
1899
+
1900
+ //#endregion
1901
+ //#region src/models/MilestoneProject.ts
1902
+ const milestoneProjectDesc = makeModel({
1903
+ name: "milestoneProject",
1904
+ fields: {
1905
+ milestoneId: belongsTo({}).type(),
1906
+ projectId: belongsTo({}).type(),
1907
+ accountId: belongsTo({}).type()
1908
+ },
1909
+ relations: {
1910
+ milestone: relation("milestone", {
1911
+ type: "belongsTo",
1912
+ fk: "milestoneId"
1913
+ }),
1914
+ project: relation("project", {
1915
+ type: "belongsTo",
1916
+ fk: "projectId"
1917
+ }),
1918
+ account: relation("account", {
1919
+ type: "belongsTo",
1920
+ fk: "accountId"
1921
+ })
1922
+ },
1923
+ keys: ["milestoneId", "projectId"]
1924
+ });
1925
+
1926
+ //#endregion
1927
+ //#region src/models/PinnedMilestone.ts
1928
+ const pinnedMilestoneDesc = makeModel({
1929
+ name: "pinnedMilestone",
1930
+ fields: {
1931
+ id: id(),
1932
+ autoAssignStartedCard: bool({}),
1933
+ autoAssignNewCard: bool({}),
1934
+ userId: belongsTo({}).type(),
1935
+ accountId: belongsTo({}).type(),
1936
+ sprintId: belongsTo({}).type(),
1937
+ milestoneId: belongsTo({}).type()
1938
+ },
1939
+ relations: {
1940
+ user: relation("user", {
1941
+ type: "belongsTo",
1942
+ fk: "userId"
1943
+ }),
1944
+ account: relation("account", {
1945
+ type: "belongsTo",
1946
+ fk: "accountId"
1947
+ }),
1948
+ sprint: relation("sprint", {
1949
+ type: "belongsTo",
1950
+ fk: "sprintId"
1951
+ }),
1952
+ milestone: relation("milestone", {
1953
+ type: "belongsTo",
1954
+ fk: "milestoneId"
1955
+ })
1956
+ },
1957
+ keys: ["id"]
1958
+ });
1959
+
1960
+ //#endregion
1961
+ //#region src/models/ProjectOrder.ts
1962
+ const projectOrderDesc = makeModel({
1963
+ name: "projectOrder",
1964
+ fields: {
1965
+ sortIndex: int({}),
1966
+ userId: belongsTo({}).type(),
1967
+ accountId: belongsTo({}).type(),
1968
+ projectId: belongsTo({}).type()
1969
+ },
1970
+ relations: {
1971
+ user: relation("user", {
1972
+ type: "belongsTo",
1973
+ fk: "userId"
1974
+ }),
1975
+ account: relation("account", {
1976
+ type: "belongsTo",
1977
+ fk: "accountId"
1978
+ }),
1979
+ project: relation("project", {
1980
+ type: "belongsTo",
1981
+ fk: "projectId"
1982
+ })
1983
+ },
1984
+ keys: [
1985
+ "projectId",
1986
+ "userId",
1987
+ "accountId"
1988
+ ]
1989
+ });
1990
+
1991
+ //#endregion
1992
+ //#region src/models/ProjectSelection.ts
1993
+ const projectSelectionDesc = makeModel({
1994
+ name: "projectSelection",
1995
+ fields: {
1996
+ id: id(),
1997
+ userId: belongsTo({}).type(),
1998
+ accountId: belongsTo({}).type(),
1999
+ projectId: belongsTo({}).type()
2000
+ },
2001
+ relations: {
2002
+ user: relation("user", {
2003
+ type: "belongsTo",
2004
+ fk: "userId"
2005
+ }),
2006
+ account: relation("account", {
2007
+ type: "belongsTo",
2008
+ fk: "accountId"
2009
+ }),
2010
+ project: relation("project", {
2011
+ type: "belongsTo",
2012
+ fk: "projectId"
2013
+ })
2014
+ },
2015
+ keys: ["id"]
2016
+ });
2017
+
2018
+ //#endregion
2019
+ //#region src/models/ProjectUserSetting.ts
2020
+ const projectUserSettingDesc = makeModel({
2021
+ name: "projectUserSetting",
2022
+ fields: {
2023
+ projectId: belongsTo({}).type(),
2024
+ userId: belongsTo({}).type()
2025
+ },
2026
+ relations: {
2027
+ project: relation("project", {
2028
+ type: "belongsTo",
2029
+ fk: "projectId"
2030
+ }),
2031
+ user: relation("user", {
2032
+ type: "belongsTo",
2033
+ fk: "userId"
2034
+ })
2035
+ },
2036
+ keys: ["projectId", "userId"]
2037
+ });
2038
+
2039
+ //#endregion
2040
+ //#region src/models/ProjectUser.ts
2041
+ const projectUserDesc = makeModel({
2042
+ name: "projectUser",
2043
+ fields: {
2044
+ projectRole: string({}),
2045
+ userId: belongsTo({}).type(),
2046
+ projectId: belongsTo({}).type(),
2047
+ accountId: belongsTo({}).type()
2048
+ },
2049
+ relations: {
2050
+ user: relation("user", {
2051
+ type: "belongsTo",
2052
+ fk: "userId"
2053
+ }),
2054
+ project: relation("project", {
2055
+ type: "belongsTo",
2056
+ fk: "projectId"
2057
+ }),
2058
+ account: relation("account", {
2059
+ type: "belongsTo",
2060
+ fk: "accountId"
2061
+ })
2062
+ },
2063
+ keys: ["projectId", "userId"]
2064
+ });
2065
+
2066
+ //#endregion
2067
+ //#region src/models/PublicProjectInfo.ts
2068
+ const publicProjectInfoDesc = makeModel({
2069
+ name: "publicProjectInfo",
2070
+ fields: {
2071
+ lastActivityAt: string({}),
2072
+ activities7d: string({}),
2073
+ cardCount: string({}),
2074
+ visits7d: string({}),
2075
+ cardDoneStreak: string({}),
2076
+ projectId: belongsTo({}).type(),
2077
+ accountId: belongsTo({}).type()
2078
+ },
2079
+ relations: {
2080
+ project: relation("project", {
2081
+ type: "belongsTo",
2082
+ fk: "projectId"
2083
+ }),
2084
+ account: relation("account", {
2085
+ type: "belongsTo",
2086
+ fk: "accountId"
2087
+ })
2088
+ },
2089
+ keys: ["projectId"]
2090
+ });
2091
+
2092
+ //#endregion
2093
+ //#region src/models/PublicProjectMembership.ts
2094
+ const publicProjectMembershipDesc = makeModel({
2095
+ name: "publicProjectMembership",
2096
+ fields: {
2097
+ digestFrequencyInDays: int({}),
2098
+ createdAt: date({}),
2099
+ userId: belongsTo({}).type(),
2100
+ projectId: belongsTo({}).type()
2101
+ },
2102
+ relations: {
2103
+ user: relation("user", {
2104
+ type: "belongsTo",
2105
+ fk: "userId"
2106
+ }),
2107
+ project: relation("project", {
2108
+ type: "belongsTo",
2109
+ fk: "projectId"
2110
+ })
2111
+ },
2112
+ keys: ["userId", "projectId"]
2113
+ });
2114
+
2115
+ //#endregion
2116
+ //#region src/models/QueueEntry.ts
2117
+ const queueEntryDesc = makeModel({
2118
+ name: "queueEntry",
2119
+ fields: {
2120
+ id: id(),
2121
+ sortIndex: int({}),
2122
+ cardDoneAt: date({}),
2123
+ createdAt: date({}),
2124
+ accountId: belongsTo({}).type(),
2125
+ userId: belongsTo({}).type(),
2126
+ cardId: belongsTo({}).type()
2127
+ },
2128
+ relations: {
2129
+ account: relation("account", {
2130
+ type: "belongsTo",
2131
+ fk: "accountId"
2132
+ }),
2133
+ user: relation("user", {
2134
+ type: "belongsTo",
2135
+ fk: "userId"
2136
+ }),
2137
+ card: relation("card", {
2138
+ type: "belongsTo",
2139
+ fk: "cardId"
2140
+ })
2141
+ },
2142
+ keys: ["id"]
2143
+ });
2144
+
2145
+ //#endregion
2146
+ //#region src/models/QueueSelection.ts
2147
+ const queueSelectionDesc = makeModel({
2148
+ name: "queueSelection",
2149
+ fields: {
2150
+ id: id(),
2151
+ sortIndex: int({}),
2152
+ userId: belongsTo({}).type(),
2153
+ accountId: belongsTo({}).type(),
2154
+ queueUserId: belongsTo({}).type()
2155
+ },
2156
+ relations: {
2157
+ user: relation("user", {
2158
+ type: "belongsTo",
2159
+ fk: "userId"
2160
+ }),
2161
+ account: relation("account", {
2162
+ type: "belongsTo",
2163
+ fk: "accountId"
2164
+ }),
2165
+ queueUser: relation("user", {
2166
+ type: "belongsTo",
2167
+ fk: "queueUserId"
2168
+ })
2169
+ },
2170
+ keys: ["id"]
2171
+ });
2172
+
2173
+ //#endregion
2174
+ //#region src/models/Resolvable.ts
2175
+ const resolvableDesc = makeModel({
2176
+ name: "resolvable",
2177
+ fields: {
2178
+ id: id(),
2179
+ context: string({}),
2180
+ contextAsPrio: int({}),
2181
+ isClosed: bool({}),
2182
+ closedAt: date({ optional: true }),
2183
+ createdAt: date({}),
2184
+ isPublic: bool({}),
2185
+ cardId: belongsTo({}).type(),
2186
+ accountId: belongsTo({}).type(),
2187
+ creatorId: belongsTo({}).type(),
2188
+ closedById: belongsTo({ optional: true }).type()
2189
+ },
2190
+ relations: {
2191
+ card: relation("card", {
2192
+ type: "belongsTo",
2193
+ fk: "cardId"
2194
+ }),
2195
+ account: relation("account", {
2196
+ type: "belongsTo",
2197
+ fk: "accountId"
2198
+ }),
2199
+ creator: relation("user", {
2200
+ type: "belongsTo",
2201
+ fk: "creatorId"
2202
+ }),
2203
+ closedBy: relation("user", {
2204
+ type: "belongsTo",
2205
+ fk: "closedById"
2206
+ }),
2207
+ participants: relation("resolvableParticipant", { type: "hasMany" }),
2208
+ participantHistories: relation("resolvableParticipantHistory", { type: "hasMany" }),
2209
+ entries: relation("resolvableEntry", { type: "hasMany" })
2210
+ },
2211
+ keys: ["id"]
2212
+ });
2213
+
2214
+ //#endregion
2215
+ //#region src/models/ResolvableEntry.ts
2216
+ const resolvableEntryDesc = makeModel({
2217
+ name: "resolvableEntry",
2218
+ fields: {
2219
+ entryId: id(),
2220
+ content: string({}),
2221
+ lastChangedAt: date({}),
2222
+ createdAt: date({}),
2223
+ version: int({}),
2224
+ meta: object({}),
2225
+ resolvableId: belongsTo({}).type(),
2226
+ cardId: belongsTo({}).type(),
2227
+ authorId: belongsTo({}).type()
2228
+ },
2229
+ relations: {
2230
+ resolvable: relation("resolvable", {
2231
+ type: "belongsTo",
2232
+ fk: "resolvableId"
2233
+ }),
2234
+ card: relation("card", {
2235
+ type: "belongsTo",
2236
+ fk: "cardId"
2237
+ }),
2238
+ author: relation("user", {
2239
+ type: "belongsTo",
2240
+ fk: "authorId"
2241
+ }),
2242
+ reactions: relation("resolvableEntryReaction", { type: "hasMany" }),
2243
+ histories: relation("resolvableEntryHistory", { type: "hasMany" })
2244
+ },
2245
+ keys: ["entryId"]
2246
+ });
2247
+
2248
+ //#endregion
2249
+ //#region src/models/ResolvableEntryHistory.ts
2250
+ const resolvableEntryHistoryDesc = makeModel({
2251
+ name: "resolvableEntryHistory",
2252
+ fields: {
2253
+ content: string({}),
2254
+ lastChangedAt: date({}),
2255
+ version: int({}),
2256
+ resolvableId: belongsTo({}).type(),
2257
+ authorId: belongsTo({}).type(),
2258
+ entryId: belongsTo({}).type()
2259
+ },
2260
+ relations: {
2261
+ resolvable: relation("resolvable", {
2262
+ type: "belongsTo",
2263
+ fk: "resolvableId"
2264
+ }),
2265
+ author: relation("user", {
2266
+ type: "belongsTo",
2267
+ fk: "authorId"
2268
+ }),
2269
+ entry: relation("resolvableEntry", {
2270
+ type: "belongsTo",
2271
+ fk: "entryId"
2272
+ })
2273
+ },
2274
+ keys: ["entryId", "version"]
2275
+ });
2276
+
2277
+ //#endregion
2278
+ //#region src/models/ResolvableEntryReaction.ts
2279
+ const resolvableEntryReactionDesc = makeModel({
2280
+ name: "resolvableEntryReaction",
2281
+ fields: {
2282
+ id: id(),
2283
+ value: object({}),
2284
+ createdAt: date({}),
2285
+ isPublic: bool({}),
2286
+ resolvableEntryId: belongsTo({}).type(),
2287
+ accountId: belongsTo({}).type(),
2288
+ userId: belongsTo({}).type(),
2289
+ resolvableId: belongsTo({}).type()
2290
+ },
2291
+ relations: {
2292
+ resolvableEntry: relation("resolvableEntry", {
2293
+ type: "belongsTo",
2294
+ fk: "resolvableEntryId"
2295
+ }),
2296
+ account: relation("account", {
2297
+ type: "belongsTo",
2298
+ fk: "accountId"
2299
+ }),
2300
+ user: relation("user", {
2301
+ type: "belongsTo",
2302
+ fk: "userId"
2303
+ }),
2304
+ resolvable: relation("resolvable", {
2305
+ type: "belongsTo",
2306
+ fk: "resolvableId"
2307
+ })
2308
+ },
2309
+ keys: ["id"]
2310
+ });
2311
+
2312
+ //#endregion
2313
+ //#region src/models/ResolvableNotification.ts
2314
+ const resolvableNotificationDesc = makeModel({
2315
+ name: "resolvableNotification",
2316
+ fields: {
2317
+ isParticipating: bool({}),
2318
+ isSnoozing: bool({}),
2319
+ unseenEntryCount: int({}),
2320
+ unseenAuthors: array({}),
2321
+ isLastParticipant: bool({}),
2322
+ lastUpdatedAt: date({}),
2323
+ snoozeUntil: date({ optional: true }),
2324
+ remindMeOn: date({ optional: true }),
2325
+ createdAt: date({}),
2326
+ userId: belongsTo({}).type(),
2327
+ resolvableId: belongsTo({}).type(),
2328
+ accountId: belongsTo({}).type(),
2329
+ latestEntryId: belongsTo({}).type(),
2330
+ latestSeenEntryId: belongsTo({}).type()
2331
+ },
2332
+ relations: {
2333
+ user: relation("user", {
2334
+ type: "belongsTo",
2335
+ fk: "userId"
2336
+ }),
2337
+ resolvable: relation("resolvable", {
2338
+ type: "belongsTo",
2339
+ fk: "resolvableId"
2340
+ }),
2341
+ account: relation("account", {
2342
+ type: "belongsTo",
2343
+ fk: "accountId"
2344
+ }),
2345
+ latestEntry: relation("resolvableEntry", {
2346
+ type: "belongsTo",
2347
+ fk: "latestEntryId"
2348
+ }),
2349
+ latestSeenEntry: relation("resolvableEntry", {
2350
+ type: "belongsTo",
2351
+ fk: "latestSeenEntryId"
2352
+ })
2353
+ },
2354
+ keys: ["userId", "resolvableId"]
2355
+ });
2356
+
2357
+ //#endregion
2358
+ //#region src/models/ResolvableParticipantHistory.ts
2359
+ const resolvableParticipantHistoryDesc = makeModel({
2360
+ name: "resolvableParticipantHistory",
2361
+ fields: {
2362
+ firstJoinedAt: string({}),
2363
+ done: string({}),
2364
+ status: string({}),
2365
+ lastChangedAt: date({}),
2366
+ version: int({}),
2367
+ reaction: string({}),
2368
+ resolvableId: belongsTo({}).type(),
2369
+ userId: belongsTo({}).type(),
2370
+ addedById: belongsTo({}).type()
2371
+ },
2372
+ relations: {
2373
+ resolvable: relation("resolvable", {
2374
+ type: "belongsTo",
2375
+ fk: "resolvableId"
2376
+ }),
2377
+ user: relation("user", {
2378
+ type: "belongsTo",
2379
+ fk: "userId"
2380
+ }),
2381
+ addedBy: relation("user", {
2382
+ type: "belongsTo",
2383
+ fk: "addedById"
2384
+ })
2385
+ },
2386
+ keys: [
2387
+ "participantId",
2388
+ "resolvableId",
2389
+ "version"
2390
+ ]
2391
+ });
2392
+
2393
+ //#endregion
2394
+ //#region src/models/ResolvableParticipant.ts
2395
+ const resolvableParticipantDesc = makeModel({
2396
+ name: "resolvableParticipant",
2397
+ fields: {
2398
+ firstJoinedAt: date({}),
2399
+ lastChangedAt: date({}),
2400
+ done: bool({}),
2401
+ status: string({}),
2402
+ discordUserId: string({}),
2403
+ resolvableIsClosed: bool({}),
2404
+ resolvableId: belongsTo({}).type(),
2405
+ accountId: belongsTo({}).type(),
2406
+ userId: belongsTo({}).type(),
2407
+ addedById: belongsTo({}).type()
2408
+ },
2409
+ relations: {
2410
+ resolvable: relation("resolvable", {
2411
+ type: "belongsTo",
2412
+ fk: "resolvableId"
2413
+ }),
2414
+ account: relation("account", {
2415
+ type: "belongsTo",
2416
+ fk: "accountId"
2417
+ }),
2418
+ user: relation("user", {
2419
+ type: "belongsTo",
2420
+ fk: "userId"
2421
+ }),
2422
+ addedBy: relation("user", {
2423
+ type: "belongsTo",
2424
+ fk: "addedById"
2425
+ })
2426
+ },
2427
+ keys: ["participantId", "resolvableId"]
2428
+ });
2429
+
2430
+ //#endregion
2431
+ //#region src/models/SavedSearch.ts
2432
+ const savedSearchDesc = makeModel({
2433
+ name: "savedSearch",
2434
+ fields: {
2435
+ id: id(),
2436
+ tokens: array({}),
2437
+ forceOr: bool({}),
2438
+ accountId: belongsTo({}).type(),
2439
+ ownerId: belongsTo({}).type()
2440
+ },
2441
+ relations: {
2442
+ account: relation("account", {
2443
+ type: "belongsTo",
2444
+ fk: "accountId"
2445
+ }),
2446
+ owner: relation("user", {
2447
+ type: "belongsTo",
2448
+ fk: "ownerId"
2449
+ })
2450
+ },
2451
+ keys: ["id"]
2452
+ });
2453
+
2454
+ //#endregion
2455
+ //#region src/models/SprintConfigProgress.ts
2456
+ const sprintConfigProgressDesc = makeModel({
2457
+ name: "sprintConfigProgress",
2458
+ fields: {
2459
+ progress: object({}),
2460
+ sprintConfigId: belongsTo({}).type()
2461
+ },
2462
+ relations: { sprintConfig: relation("sprintConfig", {
2463
+ type: "belongsTo",
2464
+ fk: "sprintConfigId"
2465
+ }) },
2466
+ keys: ["sprintConfigId", "date"]
2467
+ });
2468
+
2469
+ //#endregion
2470
+ //#region src/models/SprintProgress.ts
2471
+ const sprintProgressDesc = makeModel({
2472
+ name: "sprintProgress",
2473
+ fields: {
2474
+ progress: object({}),
2475
+ sprintId: belongsTo({}).type()
2476
+ },
2477
+ relations: { sprint: relation("sprint", {
2478
+ type: "belongsTo",
2479
+ fk: "sprintId"
2480
+ }) },
2481
+ keys: ["sprintId", "date"]
2482
+ });
2483
+
2484
+ //#endregion
2485
+ //#region src/models/SprintProject.ts
2486
+ const sprintProjectDesc = makeModel({
2487
+ name: "sprintProject",
2488
+ fields: {
2489
+ sprintConfigId: belongsTo({}).type(),
2490
+ projectId: belongsTo({}).type(),
2491
+ accountId: belongsTo({}).type()
2492
+ },
2493
+ relations: {
2494
+ sprintConfig: relation("sprintConfig", {
2495
+ type: "belongsTo",
2496
+ fk: "sprintConfigId"
2497
+ }),
2498
+ project: relation("project", {
2499
+ type: "belongsTo",
2500
+ fk: "projectId"
2501
+ }),
2502
+ account: relation("account", {
2503
+ type: "belongsTo",
2504
+ fk: "accountId"
2505
+ })
2506
+ },
2507
+ keys: ["sprintConfigId", "projectId"]
2508
+ });
2509
+
2510
+ //#endregion
2511
+ //#region src/models/StripeAccountSync.ts
2512
+ const stripeAccountSyncDesc = makeModel({
2513
+ name: "stripeAccountSync",
2514
+ fields: {
2515
+ status: string({}),
2516
+ euVatIdData: object({}),
2517
+ vatCountryCode: string({}),
2518
+ vatTaxPercentage: int({}),
2519
+ centsPerSeat: int({}),
2520
+ billingCycleStart: date({}),
2521
+ billingCycleEnd: date({}),
2522
+ grossActualBalance: int({}),
2523
+ grossBonusBalance: int({}),
2524
+ netGiftBalance: int({}),
2525
+ paymentMethod: object({}),
2526
+ hasBeenCancelledAt: date({}),
2527
+ planType: string({}),
2528
+ planName: string({}),
2529
+ pendingPlanType: string({}),
2530
+ repeatingCoupon: object({}),
2531
+ accountId: belongsTo({}).type()
2532
+ },
2533
+ relations: { account: relation("account", {
2534
+ type: "belongsTo",
2535
+ fk: "accountId"
2536
+ }) },
2537
+ keys: ["accountId"]
2538
+ });
2539
+
2540
+ //#endregion
2541
+ //#region src/models/TimeTrackingSum.ts
2542
+ const timeTrackingSumDesc = makeModel({
2543
+ name: "timeTrackingSum",
2544
+ fields: {
2545
+ sumMs: int({}),
2546
+ runningStartedAt: date({}),
2547
+ runningModifyDurationMsBy: int({}),
2548
+ cardId: belongsTo({}).type(),
2549
+ userId: belongsTo({}).type()
2550
+ },
2551
+ relations: {
2552
+ card: relation("card", {
2553
+ type: "belongsTo",
2554
+ fk: "cardId"
2555
+ }),
2556
+ user: relation("user", {
2557
+ type: "belongsTo",
2558
+ fk: "userId"
2559
+ })
2560
+ },
2561
+ keys: ["cardId", "userId"]
2562
+ });
2563
+
2564
+ //#endregion
2565
+ //#region src/models/UserDismissedHint.ts
2566
+ const userDismissedHintDesc = makeModel({
2567
+ name: "userDismissedHint",
2568
+ fields: {
2569
+ hintKey: string({}),
2570
+ createdAt: date({}),
2571
+ returnAt: date({}),
2572
+ userId: belongsTo({}).type()
2573
+ },
2574
+ relations: { user: relation("user", {
2575
+ type: "belongsTo",
2576
+ fk: "userId"
2577
+ }) },
2578
+ keys: ["userId", "hintKey"]
2579
+ });
2580
+
2581
+ //#endregion
2582
+ //#region src/models/UserEmail.ts
2583
+ const userEmailDesc = makeModel({
2584
+ name: "userEmail",
2585
+ fields: {
2586
+ id: id(),
2587
+ email: string({}),
2588
+ createdAt: date({}),
2589
+ isPrimary: bool({}),
2590
+ isVerified: bool({}),
2591
+ userId: belongsTo({}).type()
2592
+ },
2593
+ relations: { user: relation("user", {
2594
+ type: "belongsTo",
2595
+ fk: "userId"
2596
+ }) },
2597
+ keys: ["id"]
2598
+ });
2599
+
2600
+ //#endregion
2601
+ //#region src/models/UserInvitation.ts
2602
+ const userInvitationDesc = makeModel({
2603
+ name: "userInvitation",
2604
+ fields: {
2605
+ id: id(),
2606
+ email: string({}),
2607
+ role: string({}),
2608
+ accessToProjectIds: array({}),
2609
+ createdAt: date({}),
2610
+ accountId: belongsTo({}).type(),
2611
+ inviterId: belongsTo({}).type()
2612
+ },
2613
+ relations: {
2614
+ account: relation("account", {
2615
+ type: "belongsTo",
2616
+ fk: "accountId"
2617
+ }),
2618
+ inviter: relation("user", {
2619
+ type: "belongsTo",
2620
+ fk: "inviterId"
2621
+ })
2622
+ },
2623
+ keys: ["id"]
2624
+ });
2625
+
2626
+ //#endregion
2627
+ //#region src/models/UserInviteCode.ts
2628
+ const userInviteCodeDesc = makeModel({
2629
+ name: "userInviteCode",
2630
+ fields: {
2631
+ id: id(),
2632
+ token: string({}),
2633
+ role: string({}),
2634
+ useCount: string({}),
2635
+ isActive: string({}),
2636
+ accessToProjectIds: array({}),
2637
+ validUntil: date({}),
2638
+ createdAt: date({}),
2639
+ accountId: belongsTo({}).type(),
2640
+ creatorId: belongsTo({}).type()
2641
+ },
2642
+ relations: {
2643
+ account: relation("account", {
2644
+ type: "belongsTo",
2645
+ fk: "accountId"
2646
+ }),
2647
+ creator: relation("user", {
2648
+ type: "belongsTo",
2649
+ fk: "creatorId"
2650
+ })
2651
+ },
2652
+ keys: ["id"]
2653
+ });
2654
+
2655
+ //#endregion
2656
+ //#region src/models/UserOnboarding.ts
2657
+ const userOnboardingDesc = makeModel({
2658
+ name: "userOnboarding",
2659
+ fields: {
2660
+ steps: object({}),
2661
+ userId: belongsTo({}).type()
2662
+ },
2663
+ relations: { user: relation("user", {
2664
+ type: "belongsTo",
2665
+ fk: "userId"
2666
+ }) },
2667
+ keys: ["userId"]
2668
+ });
2669
+
2670
+ //#endregion
2671
+ //#region src/models/UserProjectAccess.ts
2672
+ const userProjectAccessDesc = makeModel({
2673
+ name: "userProjectAccess",
2674
+ fields: {
2675
+ role: string({}),
2676
+ projectRole: string({}),
2677
+ userId: belongsTo({}).type(),
2678
+ projectId: belongsTo({}).type()
2679
+ },
2680
+ relations: {
2681
+ user: relation("user", {
2682
+ type: "belongsTo",
2683
+ fk: "userId"
2684
+ }),
2685
+ project: relation("project", {
2686
+ type: "belongsTo",
2687
+ fk: "projectId"
2688
+ })
2689
+ },
2690
+ keys: ["projectId", "userId"]
2691
+ });
2692
+
2693
+ //#endregion
2694
+ //#region src/models/UserTag.ts
2695
+ const userTagDesc = makeModel({
2696
+ name: "userTag",
2697
+ fields: {
2698
+ id: id(),
2699
+ tag: string({}),
2700
+ createdAt: date({}),
2701
+ userId: belongsTo({}).type(),
2702
+ accountId: belongsTo({}).type()
2703
+ },
2704
+ relations: {
2705
+ user: relation("user", {
2706
+ type: "belongsTo",
2707
+ fk: "userId"
2708
+ }),
2709
+ account: relation("account", {
2710
+ type: "belongsTo",
2711
+ fk: "accountId"
2712
+ })
2713
+ },
2714
+ keys: ["id"]
2715
+ });
2716
+
2717
+ //#endregion
2718
+ //#region src/models/UserReportSetting.ts
2719
+ const userReportSettingDesc = makeModel({
2720
+ name: "userReportSetting",
2721
+ fields: {
2722
+ id: id(),
2723
+ name: string({}),
2724
+ fileSizeBytesLimit: bigint({}),
2725
+ createdAt: date({}),
2726
+ deckMapping: object({}),
2727
+ prioMapping: object({}),
2728
+ accountId: belongsTo({}).type()
2729
+ },
2730
+ relations: {
2731
+ account: relation("account", {
2732
+ type: "belongsTo",
2733
+ fk: "accountId"
2734
+ }),
2735
+ reportTokens: relation("userReportToken", { type: "hasMany" })
2736
+ },
2737
+ keys: ["id"]
2738
+ });
2739
+
2740
+ //#endregion
2741
+ //#region src/models/UserReportEmail.ts
2742
+ const userReportEmailDesc = makeModel({
2743
+ name: "userReportEmail",
2744
+ fields: {
2745
+ id: id(),
2746
+ email: string({}),
2747
+ createdAt: date({}),
2748
+ enabled: string({}),
2749
+ userReportSettingId: belongsTo({}).type(),
2750
+ accountId: belongsTo({}).type()
2751
+ },
2752
+ relations: {
2753
+ userReportSetting: relation("userReportSetting", {
2754
+ type: "belongsTo",
2755
+ fk: "userReportSettingId"
2756
+ }),
2757
+ account: relation("account", {
2758
+ type: "belongsTo",
2759
+ fk: "accountId"
2760
+ })
2761
+ },
2762
+ keys: ["id"]
2763
+ });
2764
+
2765
+ //#endregion
2766
+ //#region src/models/UserReportToken.ts
2767
+ const userReportTokenDesc = makeModel({
2768
+ name: "userReportToken",
2769
+ fields: {
2770
+ token: id(),
2771
+ label: string({}),
2772
+ reportCount: int({}),
2773
+ createdAt: date({}),
2774
+ enabled: string({}),
2775
+ userReportSettingId: belongsTo({}).type()
2776
+ },
2777
+ relations: { userReportSetting: relation("userReportSetting", {
2778
+ type: "belongsTo",
2779
+ fk: "userReportSettingId"
2780
+ }) },
2781
+ keys: ["token"]
2782
+ });
2783
+
2784
+ //#endregion
2785
+ //#region src/models/VisionBoardQuery.ts
2786
+ const visionBoardQueryDesc = makeModel({
2787
+ name: "visionBoardQuery",
2788
+ fields: {
2789
+ id: id(),
2790
+ query: object({}),
2791
+ lastUsedAt: date({}),
2792
+ isStale: bool({}),
2793
+ type: string({}),
2794
+ payload: object({}),
2795
+ createdAt: date({}),
2796
+ cardId: belongsTo({}).type(),
2797
+ accountId: belongsTo({}).type()
2798
+ },
2799
+ relations: {
2800
+ card: relation("card", {
2801
+ type: "belongsTo",
2802
+ fk: "cardId"
2803
+ }),
2804
+ account: relation("account", {
2805
+ type: "belongsTo",
2806
+ fk: "accountId"
2807
+ })
2808
+ },
2809
+ keys: ["id"]
2810
+ });
2811
+
2812
+ //#endregion
2813
+ //#region src/models/Wizard.ts
2814
+ const wizardDesc = makeModel({
2815
+ name: "wizard",
2816
+ fields: {
2817
+ id: id(),
2818
+ name: string({}),
2819
+ currentStep: string({}),
2820
+ data: object({}),
2821
+ createdAt: date({}),
2822
+ finishedAt: date({}),
2823
+ accountId: belongsTo({}).type()
2824
+ },
2825
+ relations: { account: relation("account", {
2826
+ type: "belongsTo",
2827
+ fk: "accountId"
2828
+ }) },
2829
+ keys: ["id"]
2830
+ });
2831
+
2832
+ //#endregion
2833
+ //#region src/models/WorkflowItemHistory.ts
2834
+ const workflowItemHistoryDesc = makeModel({
2835
+ name: "workflowItemHistory",
2836
+ fields: {
2837
+ diff: object({}),
2838
+ versionCreatedAt: date({}),
2839
+ version: int({}),
2840
+ accountId: belongsTo({}).type(),
2841
+ changerId: belongsTo({}).type()
2842
+ },
2843
+ relations: {
2844
+ account: relation("account", {
2845
+ type: "belongsTo",
2846
+ fk: "accountId"
2847
+ }),
2848
+ changer: relation("user", {
2849
+ type: "belongsTo",
2850
+ fk: "changerId"
2851
+ })
2852
+ },
2853
+ keys: ["itemId", "version"]
2854
+ });
2855
+
2856
+ //#endregion
2857
+ //#region src/models/index.ts
2858
+ const modelMap = {
2859
+ _root: _rootDesc,
2860
+ accountOnboardingStep: accountOnboardingStepDesc,
2861
+ accountOnboarding: accountOnboardingDesc,
2862
+ accountRole: accountRoleDesc,
2863
+ accountUserAchievement: accountUserAchievementDesc,
2864
+ accountUserSetting: accountUserSettingDesc,
2865
+ account: accountDesc,
2866
+ activeTimeTracker: activeTimeTrackerDesc,
2867
+ activity: activityDesc,
2868
+ affiliateCodeStat: affiliateCodeStatDesc,
2869
+ affiliateCode: affiliateCodeDesc,
2870
+ appInstallation: appInstallationDesc,
2871
+ app: appDesc,
2872
+ assigneeAssignment: assigneeAssignmentDesc,
2873
+ assigneeDeckAssignment: assigneeDeckAssignmentDesc,
2874
+ attachment: attachmentDesc,
2875
+ autoFinishedTimeTrackingSegment: autoFinishedTimeTrackingSegmentDesc,
2876
+ cardDiffNotification: cardDiffNotificationDesc,
2877
+ cardHistory: cardHistoryDesc,
2878
+ cardOrderInDeck: cardOrderInDeckDesc,
2879
+ cardOrder: cardOrderDesc,
2880
+ cardPreset: cardPresetDesc,
2881
+ cardSubscription: cardSubscriptionDesc,
2882
+ cardUpvote: cardUpvoteDesc,
2883
+ card: cardDesc,
2884
+ cardsEffortHistory: cardsEffortHistoryDesc,
2885
+ cardsFinishedHistory: cardsFinishedHistoryDesc,
2886
+ cardsStatusHistory: cardsStatusHistoryDesc,
2887
+ cardsTimeToFinished: cardsTimeToFinishedDesc,
2888
+ dailyDiscordGuildVoteMembership: dailyDiscordGuildVoteMembershipDesc,
2889
+ dailyPublicProjectMembership: dailyPublicProjectMembershipDesc,
2890
+ publicProjectVisit: publicProjectVisitDesc,
2891
+ deckAssignment: deckAssignmentDesc,
2892
+ deckGuardian: deckGuardianDesc,
2893
+ deckSubscription: deckSubscriptionDesc,
2894
+ deck: deckDesc,
2895
+ discordGuild: discordGuildDesc,
2896
+ discordMember: discordMemberDesc,
2897
+ discordProjectNotification: discordProjectNotificationDesc,
2898
+ discordSlashCommand: discordSlashCommandDesc,
2899
+ dueCard: dueCardDesc,
2900
+ file: fileDesc,
2901
+ handCard: handCardDesc,
2902
+ integration: integrationDesc,
2903
+ invoice: invoiceDesc,
2904
+ lastSeenCardUpvote: lastSeenCardUpvoteDesc,
2905
+ milestoneProgress: milestoneProgressDesc,
2906
+ milestoneProject: milestoneProjectDesc,
2907
+ milestone: milestoneDesc,
2908
+ pinnedMilestone: pinnedMilestoneDesc,
2909
+ projectOrder: projectOrderDesc,
2910
+ projectSelection: projectSelectionDesc,
2911
+ projectTag: projectTagDesc,
2912
+ projectUserSetting: projectUserSettingDesc,
2913
+ projectUser: projectUserDesc,
2914
+ project: projectDesc,
2915
+ publicProjectInfo: publicProjectInfoDesc,
2916
+ publicProjectMembership: publicProjectMembershipDesc,
2917
+ queueEntry: queueEntryDesc,
2918
+ queueSelection: queueSelectionDesc,
2919
+ release: releaseDesc,
2920
+ resolvableEntryHistory: resolvableEntryHistoryDesc,
2921
+ resolvableEntryReaction: resolvableEntryReactionDesc,
2922
+ resolvableEntry: resolvableEntryDesc,
2923
+ resolvableNotification: resolvableNotificationDesc,
2924
+ resolvableParticipantHistory: resolvableParticipantHistoryDesc,
2925
+ resolvableParticipant: resolvableParticipantDesc,
2926
+ resolvable: resolvableDesc,
2927
+ savedSearch: savedSearchDesc,
2928
+ sprintConfigProgress: sprintConfigProgressDesc,
2929
+ sprintConfig: sprintConfigDesc,
2930
+ sprintProgress: sprintProgressDesc,
2931
+ sprintProject: sprintProjectDesc,
2932
+ sprint: sprintDesc,
2933
+ stripeAccountSync: stripeAccountSyncDesc,
2934
+ timeTrackingSegment: timeTrackingSegmentDesc,
2935
+ timeTrackingSum: timeTrackingSumDesc,
2936
+ userDismissedHint: userDismissedHintDesc,
2937
+ userEmail: userEmailDesc,
2938
+ userInvitation: userInvitationDesc,
2939
+ userInviteCode: userInviteCodeDesc,
2940
+ userOnboarding: userOnboardingDesc,
2941
+ userProjectAccess: userProjectAccessDesc,
2942
+ userTag: userTagDesc,
2943
+ user: userDesc,
2944
+ userReportEmail: userReportEmailDesc,
2945
+ userReportSetting: userReportSettingDesc,
2946
+ userReportToken: userReportTokenDesc,
2947
+ visionBoardQuery: visionBoardQueryDesc,
2948
+ visionBoard: visionBoardDesc,
2949
+ wizard: wizardDesc,
2950
+ workflowItemHistory: workflowItemHistoryDesc,
2951
+ workflowItem: workflowItemDesc
2952
+ };
2953
+
2954
+ //#endregion
2955
+ //#region src/query-helpers.ts
2956
+ const normalizeQuery = (q) => {
2957
+ return JSON.stringify(q);
2958
+ };
2959
+ const queryToKey = normalizeQuery;
2960
+ const getRelKey = (r, k) => {
2961
+ const getSuffix = () => {
2962
+ if (r.type === "exists") return `exists:`;
2963
+ if (r.type === "count") return `count:`;
2964
+ return "";
2965
+ };
2966
+ const suffix = getSuffix();
2967
+ const isPlainKey = () => {
2968
+ if (r.type === "first") return false;
2969
+ if (r.filter && Object.keys(r.filter).length > 0) return false;
2970
+ if (r.type === "query" || r.type === void 0) {
2971
+ if (r.limit || r.orderBy || r.offset) return false;
2972
+ }
2973
+ return true;
2974
+ };
2975
+ if (isPlainKey()) return `${suffix}${k}`;
2976
+ const q = { ...r.filter };
2977
+ if (r.type === "first") {
2978
+ q.$first = true;
2979
+ q.$order = r.orderBy;
2980
+ }
2981
+ if (r.type === "query" || r.type === void 0) {
2982
+ if (r.limit) q.$limit = r.limit;
2983
+ if (r.offset) q.$offset = r.offset;
2984
+ if (r.orderBy) q.$order = r.orderBy;
2985
+ }
2986
+ return `${suffix}${k}(${normalizeQuery(q)})`;
2987
+ };
2988
+ const processRelations = (rels) => {
2989
+ const result = {};
2990
+ for (const [key, relq] of Object.entries(rels)) {
2991
+ const asArray = Array.isArray(relq) ? relq : [relq];
2992
+ for (const rel of asArray) {
2993
+ if (!rel) continue;
2994
+ result[getRelKey(rel, key)] = makeRelQuerySerializable(rel);
2995
+ }
2996
+ }
2997
+ return result;
2998
+ };
2999
+ const makeModelQuerySerializable = (q) => {
3000
+ if (!q.relations) return q;
3001
+ return {
3002
+ ...q,
3003
+ relations: processRelations(q.relations)
3004
+ };
3005
+ };
3006
+ const makeRelQuerySerializable = (r) => {
3007
+ if (r.type === "exists" || r.type === "count") return { asField: true };
3008
+ return {
3009
+ asField: false,
3010
+ fields: r.fields,
3011
+ relations: r.relations ? processRelations(r.relations) : void 0
3012
+ };
3013
+ };
3014
+ const serializeModel = (q) => {
3015
+ const list = q.fields ? [...q.fields] : [];
3016
+ if (!q.relations) return list;
3017
+ const relObj = {};
3018
+ Object.entries(q.relations).forEach(([k, r]) => {
3019
+ if (r.asField) list.push(k);
3020
+ else relObj[k] = serializeModel(r);
3021
+ });
3022
+ if (Object.keys(relObj).length) list.push(relObj);
3023
+ return list;
3024
+ };
3025
+ const serializeInstanceQuery = (q, instances) => {
3026
+ return Object.fromEntries(instances.map((instance) => {
3027
+ const name = instance["~model"];
3028
+ const getKey = () => {
3029
+ if (name === "_root") return "_root";
3030
+ return `${name}(${instance["~key"]})`;
3031
+ };
3032
+ return [getKey(), serializeModel(q)];
3033
+ }));
3034
+ };
3035
+
3036
+ //#endregion
3037
+ export { _rootDesc, getRelKey, makeModelQuerySerializable, makeRelQuerySerializable, modelMap, queryToKey, serializeInstanceQuery, serializeModel };