@earbug/db-models 0.0.62 → 0.0.63

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.
Files changed (128) hide show
  1. package/.dockerignore +10 -0
  2. package/.github/workflows/publish.yaml +303 -0
  3. package/.nvmrc +1 -0
  4. package/Dockerfile.generate +19 -0
  5. package/model_options.json +3 -0
  6. package/models/AccessControlPreference.ts +53 -0
  7. package/models/AffinityRelationshipType.ts +96 -0
  8. package/models/AffinityTier.ts +131 -0
  9. package/models/AppUser.ts +577 -0
  10. package/models/AppUserDevice.ts +101 -0
  11. package/models/AppUserDeviceClassicBackup20260906.ts +66 -0
  12. package/models/AppUserFollowRelation.ts +128 -0
  13. package/models/AppUserPlatformRelation.ts +150 -0
  14. package/models/CanonAlbum.ts +229 -0
  15. package/models/CanonAlbumExternalReferenceRelation.ts +92 -0
  16. package/models/CanonAlbumGenreRelation.ts +86 -0
  17. package/models/CanonAlbumLabelRelation.ts +86 -0
  18. package/models/CanonAlbumTrackRelation.ts +92 -0
  19. package/models/CanonArtist.ts +356 -0
  20. package/models/CanonArtistAlbumRelation.ts +92 -0
  21. package/models/CanonArtistExternalReferenceRelation.ts +92 -0
  22. package/models/CanonArtistGenreRelation.ts +86 -0
  23. package/models/CanonArtistMemberRelation.ts +86 -0
  24. package/models/CanonArtistTrackRelation.ts +92 -0
  25. package/models/CanonGenre.ts +273 -0
  26. package/models/CanonGenreExternalReferenceRelation.ts +92 -0
  27. package/models/CanonLabel.ts +129 -0
  28. package/models/CanonLabelExternalReferenceRelation.ts +92 -0
  29. package/models/CanonMember.ts +130 -0
  30. package/models/CanonMemberExternalReferenceRelation.ts +99 -0
  31. package/models/CanonToPlatformAlbumRelation.ts +92 -0
  32. package/models/CanonToPlatformArtistRelation.ts +92 -0
  33. package/models/CanonToPlatformGenreRelation.ts +86 -0
  34. package/models/CanonToPlatformTrackRelation.ts +92 -0
  35. package/models/CanonTrack.ts +232 -0
  36. package/models/ConfigParam.ts +62 -0
  37. package/models/ExternalReference.ts +201 -0
  38. package/models/FeedConfig.ts +65 -0
  39. package/models/FeedContentType.ts +124 -0
  40. package/models/GuestUser.ts +137 -0
  41. package/models/JukeboxAccessType.ts +60 -0
  42. package/models/JukeboxCanonGenreRelation.ts +108 -0
  43. package/models/JukeboxInvite.ts +125 -0
  44. package/models/JukeboxQueueEntry.ts +247 -0
  45. package/models/JukeboxQueueMode.ts +60 -0
  46. package/models/JukeboxSession.ts +334 -0
  47. package/models/JukeboxSessionArtistAffinity.ts +136 -0
  48. package/models/JukeboxSessionGenreAffinity.ts +136 -0
  49. package/models/JukeboxStatus.ts +58 -0
  50. package/models/JukeboxTerminationCondition.ts +60 -0
  51. package/models/JukeboxType.ts +60 -0
  52. package/models/JukeboxUser.ts +182 -0
  53. package/models/JukeboxUserType.ts +58 -0
  54. package/models/KnexMigrations.ts +60 -0
  55. package/models/KnexMigrationsLock.ts +48 -0
  56. package/models/MerchItem.ts +198 -0
  57. package/models/MerchOrchestration.ts +130 -0
  58. package/models/MerchPlatform.ts +95 -0
  59. package/models/MerchType.ts +89 -0
  60. package/models/MetricsDaily.ts +79 -0
  61. package/models/MetricsEvent.ts +124 -0
  62. package/models/NewsArticle.ts +177 -0
  63. package/models/NewsPlatform.ts +76 -0
  64. package/models/NewsSite.ts +75 -0
  65. package/models/Notification.ts +214 -0
  66. package/models/NotificationType.ts +66 -0
  67. package/models/PauseStatusType.ts +58 -0
  68. package/models/Platform.ts +189 -0
  69. package/models/PlatformAlbum.ts +398 -0
  70. package/models/PlatformAlbumGenreRelation.ts +86 -0
  71. package/models/PlatformAlbumTrackRelation.ts +92 -0
  72. package/models/PlatformArtist.ts +358 -0
  73. package/models/PlatformArtistAlbumRelation.ts +92 -0
  74. package/models/PlatformArtistGenreRelation.ts +86 -0
  75. package/models/PlatformArtistTrackRelation.ts +92 -0
  76. package/models/PlatformGenre.ts +194 -0
  77. package/models/PlatformTrack.ts +339 -0
  78. package/models/PlatformTrackGenreRelation.ts +86 -0
  79. package/models/PlatformUserAlbum.ts +152 -0
  80. package/models/PlatformUserAlbumTrack.ts +138 -0
  81. package/models/PlatformUserPlaylist.ts +260 -0
  82. package/models/PlatformUserPlaylistArtistAffinity.ts +136 -0
  83. package/models/PlatformUserPlaylistGenreAffinity.ts +136 -0
  84. package/models/PlatformUserPlaylistTrack.ts +162 -0
  85. package/models/PlaybackStatus.ts +47 -0
  86. package/models/PlaybackStatusType.ts +58 -0
  87. package/models/RadioShow.ts +209 -0
  88. package/models/RadioShowGenres.ts +107 -0
  89. package/models/RadioShowMedia.ts +181 -0
  90. package/models/RadioShowPlacement.ts +115 -0
  91. package/models/RadioShowPublishRequests.ts +86 -0
  92. package/models/State.ts +86 -0
  93. package/models/TrackDeletionReason.ts +58 -0
  94. package/models/UnmatchedAlbum.ts +66 -0
  95. package/models/UnmatchedArtist.ts +81 -0
  96. package/models/UserAbuseReports.ts +232 -0
  97. package/models/UserAffinity.ts +117 -0
  98. package/models/UserArtistAffinity.ts +136 -0
  99. package/models/UserBookmarks.ts +235 -0
  100. package/models/UserComments.ts +271 -0
  101. package/models/UserContacts.ts +155 -0
  102. package/models/UserEngagementFactor.ts +109 -0
  103. package/models/UserGenreAffinity.ts +136 -0
  104. package/models/UserLikes.ts +235 -0
  105. package/models/UserMessages.ts +189 -0
  106. package/models/Versus.ts +438 -0
  107. package/models/VersusAccessType.ts +66 -0
  108. package/models/VersusCoCreator.ts +111 -0
  109. package/models/VersusCreatorScope.ts +66 -0
  110. package/models/VersusEndMode.ts +66 -0
  111. package/models/VersusEndTimerDuration.ts +81 -0
  112. package/models/VersusEndVoteThreshold.ts +67 -0
  113. package/models/VersusEntityKind.ts +79 -0
  114. package/models/VersusOption.ts +258 -0
  115. package/models/VersusPublishIssue.ts +146 -0
  116. package/models/VersusQuestion.ts +123 -0
  117. package/models/VersusQuestionVariableType.ts +66 -0
  118. package/models/VersusVote.ts +99 -0
  119. package/models/VersusVotingListType.ts +66 -0
  120. package/models/VersusVotingMode.ts +66 -0
  121. package/models/index.ts +3 -0
  122. package/models/init-models.ts +1259 -0
  123. package/models/initDb.ts +72 -0
  124. package/models/rdsCaBundle.ts +5 -0
  125. package/package.json +2 -5
  126. package/scripts/generate-and-upload.mjs +123 -0
  127. package/scripts/update-rds-ca-bundle.mjs +44 -0
  128. package/tsconfig.json +52 -0
@@ -0,0 +1,81 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { Platform, PlatformId } from './Platform';
4
+
5
+ export interface UnmatchedArtistAttributes {
6
+ id: string;
7
+ platformId: number;
8
+ externalArtistId: number;
9
+ createDate: Date;
10
+ updateDate: Date;
11
+ }
12
+
13
+ export type UnmatchedArtistPk = "id";
14
+ export type UnmatchedArtistId = UnmatchedArtist[UnmatchedArtistPk];
15
+ export type UnmatchedArtistOptionalAttributes = "id" | "createDate" | "updateDate";
16
+ export type UnmatchedArtistCreationAttributes = Optional<UnmatchedArtistAttributes, UnmatchedArtistOptionalAttributes>;
17
+
18
+ export class UnmatchedArtist extends Model<UnmatchedArtistAttributes, UnmatchedArtistCreationAttributes> implements UnmatchedArtistAttributes {
19
+ id!: string;
20
+ platformId!: number;
21
+ externalArtistId!: number;
22
+ createDate!: Date;
23
+ updateDate!: Date;
24
+
25
+ // UnmatchedArtist belongsTo Platform via platformId
26
+ platform!: Platform;
27
+ getPlatform!: Sequelize.BelongsToGetAssociationMixin<Platform>;
28
+ setPlatform!: Sequelize.BelongsToSetAssociationMixin<Platform, PlatformId>;
29
+ createPlatform!: Sequelize.BelongsToCreateAssociationMixin<Platform>;
30
+
31
+ static initModel(sequelize: Sequelize.Sequelize): typeof UnmatchedArtist {
32
+ return UnmatchedArtist.init({
33
+ id: {
34
+ type: DataTypes.UUID,
35
+ allowNull: false,
36
+ defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
37
+ primaryKey: true
38
+ },
39
+ platformId: {
40
+ type: DataTypes.SMALLINT,
41
+ allowNull: false,
42
+ references: {
43
+ model: 'platform',
44
+ key: 'id'
45
+ },
46
+ field: 'platform_id'
47
+ },
48
+ externalArtistId: {
49
+ type: DataTypes.INTEGER,
50
+ allowNull: false,
51
+ field: 'external_artist_id'
52
+ },
53
+ createDate: {
54
+ type: DataTypes.DATE,
55
+ allowNull: false,
56
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
57
+ field: 'create_date'
58
+ },
59
+ updateDate: {
60
+ type: DataTypes.DATE,
61
+ allowNull: false,
62
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
63
+ field: 'update_date'
64
+ }
65
+ }, {
66
+ sequelize,
67
+ tableName: 'unmatched_artist',
68
+ schema: 'eb',
69
+ timestamps: false,
70
+ indexes: [
71
+ {
72
+ name: "unmatched_artist_pkey",
73
+ unique: true,
74
+ fields: [
75
+ { name: "id" },
76
+ ]
77
+ },
78
+ ]
79
+ });
80
+ }
81
+ }
@@ -0,0 +1,232 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { AppUser, AppUserId } from './AppUser';
4
+ import type { JukeboxSession, JukeboxSessionId } from './JukeboxSession';
5
+ import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUserPlaylist';
6
+ import type { RadioShow, RadioShowId } from './RadioShow';
7
+ import type { RadioShowMedia, RadioShowMediaId } from './RadioShowMedia';
8
+ import type { UserComments, UserCommentsId } from './UserComments';
9
+ import type { UserMessages, UserMessagesId } from './UserMessages';
10
+
11
+ export interface UserAbuseReportsAttributes {
12
+ id: string;
13
+ reporterUserId: string;
14
+ reportDate: Date;
15
+ updateDate: Date;
16
+ jukeboxId?: string;
17
+ jukeboxChatMessageId?: string;
18
+ radioShowId?: string;
19
+ radioShowMediaId?: string;
20
+ playlistId?: string;
21
+ versusThemeTextId?: string;
22
+ commentId?: string;
23
+ directMessageId?: string;
24
+ }
25
+
26
+ export type UserAbuseReportsPk = "id";
27
+ export type UserAbuseReportsId = UserAbuseReports[UserAbuseReportsPk];
28
+ export type UserAbuseReportsOptionalAttributes = "id" | "reportDate" | "updateDate" | "jukeboxId" | "jukeboxChatMessageId" | "radioShowId" | "radioShowMediaId" | "playlistId" | "versusThemeTextId" | "commentId" | "directMessageId";
29
+ export type UserAbuseReportsCreationAttributes = Optional<UserAbuseReportsAttributes, UserAbuseReportsOptionalAttributes>;
30
+
31
+ export class UserAbuseReports extends Model<UserAbuseReportsAttributes, UserAbuseReportsCreationAttributes> implements UserAbuseReportsAttributes {
32
+ id!: string;
33
+ reporterUserId!: string;
34
+ reportDate!: Date;
35
+ updateDate!: Date;
36
+ jukeboxId?: string;
37
+ jukeboxChatMessageId?: string;
38
+ radioShowId?: string;
39
+ radioShowMediaId?: string;
40
+ playlistId?: string;
41
+ versusThemeTextId?: string;
42
+ commentId?: string;
43
+ directMessageId?: string;
44
+
45
+ // UserAbuseReports belongsTo AppUser via reporterUserId
46
+ reporterUser!: AppUser;
47
+ getReporterUser!: Sequelize.BelongsToGetAssociationMixin<AppUser>;
48
+ setReporterUser!: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
49
+ createReporterUser!: Sequelize.BelongsToCreateAssociationMixin<AppUser>;
50
+ // UserAbuseReports belongsTo JukeboxSession via jukeboxId
51
+ jukebox!: JukeboxSession;
52
+ getJukebox!: Sequelize.BelongsToGetAssociationMixin<JukeboxSession>;
53
+ setJukebox!: Sequelize.BelongsToSetAssociationMixin<JukeboxSession, JukeboxSessionId>;
54
+ createJukebox!: Sequelize.BelongsToCreateAssociationMixin<JukeboxSession>;
55
+ // UserAbuseReports belongsTo PlatformUserPlaylist via playlistId
56
+ playlist!: PlatformUserPlaylist;
57
+ getPlaylist!: Sequelize.BelongsToGetAssociationMixin<PlatformUserPlaylist>;
58
+ setPlaylist!: Sequelize.BelongsToSetAssociationMixin<PlatformUserPlaylist, PlatformUserPlaylistId>;
59
+ createPlaylist!: Sequelize.BelongsToCreateAssociationMixin<PlatformUserPlaylist>;
60
+ // UserAbuseReports belongsTo RadioShow via radioShowId
61
+ radioShow!: RadioShow;
62
+ getRadioShow!: Sequelize.BelongsToGetAssociationMixin<RadioShow>;
63
+ setRadioShow!: Sequelize.BelongsToSetAssociationMixin<RadioShow, RadioShowId>;
64
+ createRadioShow!: Sequelize.BelongsToCreateAssociationMixin<RadioShow>;
65
+ // UserAbuseReports belongsTo RadioShowMedia via radioShowMediaId
66
+ radioShowMedium!: RadioShowMedia;
67
+ getRadioShowMedium!: Sequelize.BelongsToGetAssociationMixin<RadioShowMedia>;
68
+ setRadioShowMedium!: Sequelize.BelongsToSetAssociationMixin<RadioShowMedia, RadioShowMediaId>;
69
+ createRadioShowMedium!: Sequelize.BelongsToCreateAssociationMixin<RadioShowMedia>;
70
+ // UserAbuseReports belongsTo UserComments via commentId
71
+ comment!: UserComments;
72
+ getComment!: Sequelize.BelongsToGetAssociationMixin<UserComments>;
73
+ setComment!: Sequelize.BelongsToSetAssociationMixin<UserComments, UserCommentsId>;
74
+ createComment!: Sequelize.BelongsToCreateAssociationMixin<UserComments>;
75
+ // UserAbuseReports belongsTo UserMessages via directMessageId
76
+ directMessage!: UserMessages;
77
+ getDirectMessage!: Sequelize.BelongsToGetAssociationMixin<UserMessages>;
78
+ setDirectMessage!: Sequelize.BelongsToSetAssociationMixin<UserMessages, UserMessagesId>;
79
+ createDirectMessage!: Sequelize.BelongsToCreateAssociationMixin<UserMessages>;
80
+
81
+ static initModel(sequelize: Sequelize.Sequelize): typeof UserAbuseReports {
82
+ return UserAbuseReports.init({
83
+ id: {
84
+ type: DataTypes.UUID,
85
+ allowNull: false,
86
+ defaultValue: DataTypes.UUIDV4,
87
+ primaryKey: true
88
+ },
89
+ reporterUserId: {
90
+ type: DataTypes.UUID,
91
+ allowNull: false,
92
+ references: {
93
+ model: 'app_user',
94
+ key: 'id'
95
+ },
96
+ field: 'reporter_user_id'
97
+ },
98
+ reportDate: {
99
+ type: DataTypes.DATE,
100
+ allowNull: false,
101
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
102
+ field: 'report_date'
103
+ },
104
+ updateDate: {
105
+ type: DataTypes.DATE,
106
+ allowNull: false,
107
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
108
+ field: 'update_date'
109
+ },
110
+ jukeboxId: {
111
+ type: DataTypes.UUID,
112
+ allowNull: true,
113
+ references: {
114
+ model: 'jukebox_session',
115
+ key: 'id'
116
+ },
117
+ field: 'jukebox_id'
118
+ },
119
+ jukeboxChatMessageId: {
120
+ type: DataTypes.STRING(50),
121
+ allowNull: true,
122
+ field: 'jukebox_chat_message_id'
123
+ },
124
+ radioShowId: {
125
+ type: DataTypes.UUID,
126
+ allowNull: true,
127
+ references: {
128
+ model: 'radio_show',
129
+ key: 'id'
130
+ },
131
+ field: 'radio_show_id'
132
+ },
133
+ radioShowMediaId: {
134
+ type: DataTypes.UUID,
135
+ allowNull: true,
136
+ references: {
137
+ model: 'radio_show_media',
138
+ key: 'id'
139
+ },
140
+ field: 'radio_show_media_id'
141
+ },
142
+ playlistId: {
143
+ type: DataTypes.UUID,
144
+ allowNull: true,
145
+ references: {
146
+ model: 'platform_user_playlist',
147
+ key: 'id'
148
+ },
149
+ field: 'playlist_id'
150
+ },
151
+ versusThemeTextId: {
152
+ type: DataTypes.UUID,
153
+ allowNull: true,
154
+ field: 'versus_theme_text_id'
155
+ },
156
+ commentId: {
157
+ type: DataTypes.UUID,
158
+ allowNull: true,
159
+ references: {
160
+ model: 'user_comments',
161
+ key: 'id'
162
+ },
163
+ field: 'comment_id'
164
+ },
165
+ directMessageId: {
166
+ type: DataTypes.UUID,
167
+ allowNull: true,
168
+ references: {
169
+ model: 'user_messages',
170
+ key: 'id'
171
+ },
172
+ field: 'direct_message_id'
173
+ }
174
+ }, {
175
+ sequelize,
176
+ tableName: 'user_abuse_reports',
177
+ schema: 'eb',
178
+ timestamps: false,
179
+ indexes: [
180
+ {
181
+ name: "idx_user_abuse_reports_comment",
182
+ fields: [
183
+ { name: "comment_id" },
184
+ ]
185
+ },
186
+ {
187
+ name: "idx_user_abuse_reports_direct_message",
188
+ fields: [
189
+ { name: "direct_message_id" },
190
+ ]
191
+ },
192
+ {
193
+ name: "idx_user_abuse_reports_jukebox",
194
+ fields: [
195
+ { name: "jukebox_id" },
196
+ ]
197
+ },
198
+ {
199
+ name: "idx_user_abuse_reports_playlist",
200
+ fields: [
201
+ { name: "playlist_id" },
202
+ ]
203
+ },
204
+ {
205
+ name: "idx_user_abuse_reports_radio_show",
206
+ fields: [
207
+ { name: "radio_show_id" },
208
+ ]
209
+ },
210
+ {
211
+ name: "idx_user_abuse_reports_radio_show_media",
212
+ fields: [
213
+ { name: "radio_show_media_id" },
214
+ ]
215
+ },
216
+ {
217
+ name: "idx_user_abuse_reports_reporter",
218
+ fields: [
219
+ { name: "reporter_user_id" },
220
+ ]
221
+ },
222
+ {
223
+ name: "user_abuse_reports_pkey",
224
+ unique: true,
225
+ fields: [
226
+ { name: "id" },
227
+ ]
228
+ },
229
+ ]
230
+ });
231
+ }
232
+ }
@@ -0,0 +1,117 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { AffinityRelationshipType, AffinityRelationshipTypeId } from './AffinityRelationshipType';
4
+ import type { AppUser, AppUserId } from './AppUser';
5
+
6
+ export interface UserAffinityAttributes {
7
+ id: string;
8
+ userId: string;
9
+ affinityRelationshipTypeId: string;
10
+ relatedId: string;
11
+ createDate?: Date;
12
+ updateDate?: Date;
13
+ }
14
+
15
+ export type UserAffinityPk = "id";
16
+ export type UserAffinityId = UserAffinity[UserAffinityPk];
17
+ export type UserAffinityOptionalAttributes = "id" | "createDate" | "updateDate";
18
+ export type UserAffinityCreationAttributes = Optional<UserAffinityAttributes, UserAffinityOptionalAttributes>;
19
+
20
+ export class UserAffinity extends Model<UserAffinityAttributes, UserAffinityCreationAttributes> implements UserAffinityAttributes {
21
+ id!: string;
22
+ userId!: string;
23
+ affinityRelationshipTypeId!: string;
24
+ relatedId!: string;
25
+ createDate?: Date;
26
+ updateDate?: Date;
27
+
28
+ // UserAffinity belongsTo AffinityRelationshipType via affinityRelationshipTypeId
29
+ affinityRelationshipType!: AffinityRelationshipType;
30
+ getAffinityRelationshipType!: Sequelize.BelongsToGetAssociationMixin<AffinityRelationshipType>;
31
+ setAffinityRelationshipType!: Sequelize.BelongsToSetAssociationMixin<AffinityRelationshipType, AffinityRelationshipTypeId>;
32
+ createAffinityRelationshipType!: Sequelize.BelongsToCreateAssociationMixin<AffinityRelationshipType>;
33
+ // UserAffinity belongsTo AppUser via userId
34
+ user!: AppUser;
35
+ getUser!: Sequelize.BelongsToGetAssociationMixin<AppUser>;
36
+ setUser!: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
37
+ createUser!: Sequelize.BelongsToCreateAssociationMixin<AppUser>;
38
+
39
+ static initModel(sequelize: Sequelize.Sequelize): typeof UserAffinity {
40
+ return UserAffinity.init({
41
+ id: {
42
+ type: DataTypes.UUID,
43
+ allowNull: false,
44
+ defaultValue: DataTypes.UUIDV4,
45
+ primaryKey: true
46
+ },
47
+ userId: {
48
+ type: DataTypes.UUID,
49
+ allowNull: false,
50
+ references: {
51
+ model: 'app_user',
52
+ key: 'id'
53
+ },
54
+ unique: "user_affinity_user_id_affinity_relationship_type_id_related_id_",
55
+ field: 'user_id'
56
+ },
57
+ affinityRelationshipTypeId: {
58
+ type: DataTypes.UUID,
59
+ allowNull: false,
60
+ references: {
61
+ model: 'affinity_relationship_type',
62
+ key: 'id'
63
+ },
64
+ unique: "user_affinity_user_id_affinity_relationship_type_id_related_id_",
65
+ field: 'affinity_relationship_type_id'
66
+ },
67
+ relatedId: {
68
+ type: DataTypes.UUID,
69
+ allowNull: false,
70
+ unique: "user_affinity_user_id_affinity_relationship_type_id_related_id_",
71
+ field: 'related_id'
72
+ },
73
+ createDate: {
74
+ type: DataTypes.DATE,
75
+ allowNull: true,
76
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
77
+ field: 'create_date'
78
+ },
79
+ updateDate: {
80
+ type: DataTypes.DATE,
81
+ allowNull: true,
82
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
83
+ field: 'update_date'
84
+ }
85
+ }, {
86
+ sequelize,
87
+ tableName: 'user_affinity',
88
+ schema: 'eb',
89
+ timestamps: false,
90
+ indexes: [
91
+ {
92
+ name: "user_affinity_pkey",
93
+ unique: true,
94
+ fields: [
95
+ { name: "id" },
96
+ ]
97
+ },
98
+ {
99
+ name: "user_affinity_user_id_affinity_relationship_type_id_index",
100
+ fields: [
101
+ { name: "user_id" },
102
+ { name: "affinity_relationship_type_id" },
103
+ ]
104
+ },
105
+ {
106
+ name: "user_affinity_user_id_affinity_relationship_type_id_related_id_",
107
+ unique: true,
108
+ fields: [
109
+ { name: "user_id" },
110
+ { name: "affinity_relationship_type_id" },
111
+ { name: "related_id" },
112
+ ]
113
+ },
114
+ ]
115
+ });
116
+ }
117
+ }
@@ -0,0 +1,136 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { AffinityTier, AffinityTierId } from './AffinityTier';
4
+ import type { AppUser, AppUserId } from './AppUser';
5
+ import type { CanonArtist, CanonArtistId } from './CanonArtist';
6
+
7
+ export interface UserArtistAffinityAttributes {
8
+ id: string;
9
+ userId: string;
10
+ canonArtistId: string;
11
+ affinityTierId: number;
12
+ rank: number;
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ }
16
+
17
+ export type UserArtistAffinityPk = "id";
18
+ export type UserArtistAffinityId = UserArtistAffinity[UserArtistAffinityPk];
19
+ export type UserArtistAffinityOptionalAttributes = "id" | "createdAt" | "updatedAt";
20
+ export type UserArtistAffinityCreationAttributes = Optional<UserArtistAffinityAttributes, UserArtistAffinityOptionalAttributes>;
21
+
22
+ export class UserArtistAffinity extends Model<UserArtistAffinityAttributes, UserArtistAffinityCreationAttributes> implements UserArtistAffinityAttributes {
23
+ id!: string;
24
+ userId!: string;
25
+ canonArtistId!: string;
26
+ affinityTierId!: number;
27
+ rank!: number;
28
+ createdAt!: Date;
29
+ updatedAt!: Date;
30
+
31
+ // UserArtistAffinity belongsTo AffinityTier via affinityTierId
32
+ affinityTier!: AffinityTier;
33
+ getAffinityTier!: Sequelize.BelongsToGetAssociationMixin<AffinityTier>;
34
+ setAffinityTier!: Sequelize.BelongsToSetAssociationMixin<AffinityTier, AffinityTierId>;
35
+ createAffinityTier!: Sequelize.BelongsToCreateAssociationMixin<AffinityTier>;
36
+ // UserArtistAffinity belongsTo AppUser via userId
37
+ user!: AppUser;
38
+ getUser!: Sequelize.BelongsToGetAssociationMixin<AppUser>;
39
+ setUser!: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
40
+ createUser!: Sequelize.BelongsToCreateAssociationMixin<AppUser>;
41
+ // UserArtistAffinity belongsTo CanonArtist via canonArtistId
42
+ canonArtist!: CanonArtist;
43
+ getCanonArtist!: Sequelize.BelongsToGetAssociationMixin<CanonArtist>;
44
+ setCanonArtist!: Sequelize.BelongsToSetAssociationMixin<CanonArtist, CanonArtistId>;
45
+ createCanonArtist!: Sequelize.BelongsToCreateAssociationMixin<CanonArtist>;
46
+
47
+ static initModel(sequelize: Sequelize.Sequelize): typeof UserArtistAffinity {
48
+ return UserArtistAffinity.init({
49
+ id: {
50
+ type: DataTypes.UUID,
51
+ allowNull: false,
52
+ defaultValue: DataTypes.UUIDV4,
53
+ primaryKey: true
54
+ },
55
+ userId: {
56
+ type: DataTypes.UUID,
57
+ allowNull: false,
58
+ references: {
59
+ model: 'app_user',
60
+ key: 'id'
61
+ },
62
+ unique: "user_artist_affinity_user_id_canon_artist_id_unique",
63
+ field: 'user_id'
64
+ },
65
+ canonArtistId: {
66
+ type: DataTypes.UUID,
67
+ allowNull: false,
68
+ references: {
69
+ model: 'canon_artist',
70
+ key: 'id'
71
+ },
72
+ unique: "user_artist_affinity_user_id_canon_artist_id_unique",
73
+ field: 'canon_artist_id'
74
+ },
75
+ affinityTierId: {
76
+ type: DataTypes.SMALLINT,
77
+ allowNull: false,
78
+ references: {
79
+ model: 'affinity_tier',
80
+ key: 'id'
81
+ },
82
+ field: 'affinity_tier_id'
83
+ },
84
+ rank: {
85
+ type: DataTypes.INTEGER,
86
+ allowNull: false
87
+ },
88
+ createdAt: {
89
+ type: DataTypes.DATE,
90
+ allowNull: false,
91
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
92
+ field: 'created_at'
93
+ },
94
+ updatedAt: {
95
+ type: DataTypes.DATE,
96
+ allowNull: false,
97
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
98
+ field: 'updated_at'
99
+ }
100
+ }, {
101
+ sequelize,
102
+ tableName: 'user_artist_affinity',
103
+ schema: 'eb',
104
+ timestamps: false,
105
+ indexes: [
106
+ {
107
+ name: "idx_user_artist_affinity_artist",
108
+ fields: [
109
+ { name: "canon_artist_id" },
110
+ ]
111
+ },
112
+ {
113
+ name: "idx_user_artist_affinity_session",
114
+ fields: [
115
+ { name: "user_id" },
116
+ ]
117
+ },
118
+ {
119
+ name: "user_artist_affinity_pkey",
120
+ unique: true,
121
+ fields: [
122
+ { name: "id" },
123
+ ]
124
+ },
125
+ {
126
+ name: "user_artist_affinity_user_id_canon_artist_id_unique",
127
+ unique: true,
128
+ fields: [
129
+ { name: "user_id" },
130
+ { name: "canon_artist_id" },
131
+ ]
132
+ },
133
+ ]
134
+ });
135
+ }
136
+ }