@earbug/db-models 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/models/AppUser.ts CHANGED
@@ -6,8 +6,10 @@ import type { AppUserPlatformRelation, AppUserPlatformRelationCreationAttributes
6
6
  import type { JukeboxInvite, JukeboxInviteId } from './JukeboxInvite';
7
7
  import type { JukeboxQueueEntry, JukeboxQueueEntryId } from './JukeboxQueueEntry';
8
8
  import type { JukeboxUser, JukeboxUserId } from './JukeboxUser';
9
+ import type { Notification, NotificationId } from './Notification';
9
10
  import type { PlatformUserAlbum, PlatformUserAlbumId } from './PlatformUserAlbum';
10
11
  import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUserPlaylist';
12
+ import type { RadioShow, RadioShowId } from './RadioShow';
11
13
  import type { State, StateId } from './State';
12
14
  import type { UserContacts, UserContactsId } from './UserContacts';
13
15
 
@@ -132,6 +134,30 @@ export class AppUser extends Model<AppUserAttributes, AppUserCreationAttributes>
132
134
  hasJukeboxUser!: Sequelize.HasManyHasAssociationMixin<JukeboxUser, JukeboxUserId>;
133
135
  hasJukeboxUsers!: Sequelize.HasManyHasAssociationsMixin<JukeboxUser, JukeboxUserId>;
134
136
  countJukeboxUsers!: Sequelize.HasManyCountAssociationsMixin;
137
+ // AppUser hasMany Notification via sourceUserId
138
+ notifications!: Notification[];
139
+ getNotifications!: Sequelize.HasManyGetAssociationsMixin<Notification>;
140
+ setNotifications!: Sequelize.HasManySetAssociationsMixin<Notification, NotificationId>;
141
+ addNotification!: Sequelize.HasManyAddAssociationMixin<Notification, NotificationId>;
142
+ addNotifications!: Sequelize.HasManyAddAssociationsMixin<Notification, NotificationId>;
143
+ createNotification!: Sequelize.HasManyCreateAssociationMixin<Notification>;
144
+ removeNotification!: Sequelize.HasManyRemoveAssociationMixin<Notification, NotificationId>;
145
+ removeNotifications!: Sequelize.HasManyRemoveAssociationsMixin<Notification, NotificationId>;
146
+ hasNotification!: Sequelize.HasManyHasAssociationMixin<Notification, NotificationId>;
147
+ hasNotifications!: Sequelize.HasManyHasAssociationsMixin<Notification, NotificationId>;
148
+ countNotifications!: Sequelize.HasManyCountAssociationsMixin;
149
+ // AppUser hasMany Notification via targetUserId
150
+ targetUserNotifications!: Notification[];
151
+ getTargetUserNotifications!: Sequelize.HasManyGetAssociationsMixin<Notification>;
152
+ setTargetUserNotifications!: Sequelize.HasManySetAssociationsMixin<Notification, NotificationId>;
153
+ addTargetUserNotification!: Sequelize.HasManyAddAssociationMixin<Notification, NotificationId>;
154
+ addTargetUserNotifications!: Sequelize.HasManyAddAssociationsMixin<Notification, NotificationId>;
155
+ createTargetUserNotification!: Sequelize.HasManyCreateAssociationMixin<Notification>;
156
+ removeTargetUserNotification!: Sequelize.HasManyRemoveAssociationMixin<Notification, NotificationId>;
157
+ removeTargetUserNotifications!: Sequelize.HasManyRemoveAssociationsMixin<Notification, NotificationId>;
158
+ hasTargetUserNotification!: Sequelize.HasManyHasAssociationMixin<Notification, NotificationId>;
159
+ hasTargetUserNotifications!: Sequelize.HasManyHasAssociationsMixin<Notification, NotificationId>;
160
+ countTargetUserNotifications!: Sequelize.HasManyCountAssociationsMixin;
135
161
  // AppUser hasMany PlatformUserAlbum via appUserId
136
162
  platformUserAlbums!: PlatformUserAlbum[];
137
163
  getPlatformUserAlbums!: Sequelize.HasManyGetAssociationsMixin<PlatformUserAlbum>;
@@ -156,6 +182,18 @@ export class AppUser extends Model<AppUserAttributes, AppUserCreationAttributes>
156
182
  hasPlatformUserPlaylist!: Sequelize.HasManyHasAssociationMixin<PlatformUserPlaylist, PlatformUserPlaylistId>;
157
183
  hasPlatformUserPlaylists!: Sequelize.HasManyHasAssociationsMixin<PlatformUserPlaylist, PlatformUserPlaylistId>;
158
184
  countPlatformUserPlaylists!: Sequelize.HasManyCountAssociationsMixin;
185
+ // AppUser hasMany RadioShow via creatorUserId
186
+ radioShows!: RadioShow[];
187
+ getRadioShows!: Sequelize.HasManyGetAssociationsMixin<RadioShow>;
188
+ setRadioShows!: Sequelize.HasManySetAssociationsMixin<RadioShow, RadioShowId>;
189
+ addRadioShow!: Sequelize.HasManyAddAssociationMixin<RadioShow, RadioShowId>;
190
+ addRadioShows!: Sequelize.HasManyAddAssociationsMixin<RadioShow, RadioShowId>;
191
+ createRadioShow!: Sequelize.HasManyCreateAssociationMixin<RadioShow>;
192
+ removeRadioShow!: Sequelize.HasManyRemoveAssociationMixin<RadioShow, RadioShowId>;
193
+ removeRadioShows!: Sequelize.HasManyRemoveAssociationsMixin<RadioShow, RadioShowId>;
194
+ hasRadioShow!: Sequelize.HasManyHasAssociationMixin<RadioShow, RadioShowId>;
195
+ hasRadioShows!: Sequelize.HasManyHasAssociationsMixin<RadioShow, RadioShowId>;
196
+ countRadioShows!: Sequelize.HasManyCountAssociationsMixin;
159
197
  // AppUser hasMany UserContacts via appUserId
160
198
  userContacts!: UserContacts[];
161
199
  getUserContacts!: Sequelize.HasManyGetAssociationsMixin<UserContacts>;
@@ -9,6 +9,7 @@ import type { JukeboxCanonGenreRelation, JukeboxCanonGenreRelationId } from './J
9
9
  import type { PlatformAlbum, PlatformAlbumId } from './PlatformAlbum';
10
10
  import type { PlatformArtist, PlatformArtistId } from './PlatformArtist';
11
11
  import type { PlatformGenre, PlatformGenreId } from './PlatformGenre';
12
+ import type { RadioShowGenres, RadioShowGenresId } from './RadioShowGenres';
12
13
 
13
14
  export interface CanonGenreAttributes {
14
15
  name: string;
@@ -142,6 +143,18 @@ export class CanonGenre extends Model<CanonGenreAttributes, CanonGenreCreationAt
142
143
  hasPlatformGenreIdPlatformGenre!: Sequelize.BelongsToManyHasAssociationMixin<PlatformGenre, PlatformGenreId>;
143
144
  hasPlatformGenreIdPlatformGenres!: Sequelize.BelongsToManyHasAssociationsMixin<PlatformGenre, PlatformGenreId>;
144
145
  countPlatformGenreIdPlatformGenres!: Sequelize.BelongsToManyCountAssociationsMixin;
146
+ // CanonGenre hasMany RadioShowGenres via canonGenreId
147
+ radioShowGenres!: RadioShowGenres[];
148
+ getRadioShowGenres!: Sequelize.HasManyGetAssociationsMixin<RadioShowGenres>;
149
+ setRadioShowGenres!: Sequelize.HasManySetAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
150
+ addRadioShowGenre!: Sequelize.HasManyAddAssociationMixin<RadioShowGenres, RadioShowGenresId>;
151
+ addRadioShowGenres!: Sequelize.HasManyAddAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
152
+ createRadioShowGenre!: Sequelize.HasManyCreateAssociationMixin<RadioShowGenres>;
153
+ removeRadioShowGenre!: Sequelize.HasManyRemoveAssociationMixin<RadioShowGenres, RadioShowGenresId>;
154
+ removeRadioShowGenres!: Sequelize.HasManyRemoveAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
155
+ hasRadioShowGenre!: Sequelize.HasManyHasAssociationMixin<RadioShowGenres, RadioShowGenresId>;
156
+ hasRadioShowGenres!: Sequelize.HasManyHasAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
157
+ countRadioShowGenres!: Sequelize.HasManyCountAssociationsMixin;
145
158
 
146
159
  static initModel(sequelize: Sequelize.Sequelize): typeof CanonGenre {
147
160
  return CanonGenre.init({
@@ -7,6 +7,7 @@ import type { CanonArtistTrackRelation, CanonArtistTrackRelationId } from './Can
7
7
  import type { CanonToPlatformTrackRelation, CanonToPlatformTrackRelationId } from './CanonToPlatformTrackRelation';
8
8
  import type { JukeboxQueueEntry, JukeboxQueueEntryId } from './JukeboxQueueEntry';
9
9
  import type { PlatformTrack, PlatformTrackId } from './PlatformTrack';
10
+ import type { RadioShowPlacement, RadioShowPlacementId } from './RadioShowPlacement';
10
11
 
11
12
  export interface CanonTrackAttributes {
12
13
  name: string;
@@ -120,6 +121,18 @@ export class CanonTrack extends Model<CanonTrackAttributes, CanonTrackCreationAt
120
121
  hasPlatformTrackIdPlatformTrack!: Sequelize.BelongsToManyHasAssociationMixin<PlatformTrack, PlatformTrackId>;
121
122
  hasPlatformTrackIdPlatformTracks!: Sequelize.BelongsToManyHasAssociationsMixin<PlatformTrack, PlatformTrackId>;
122
123
  countPlatformTrackIdPlatformTracks!: Sequelize.BelongsToManyCountAssociationsMixin;
124
+ // CanonTrack hasMany RadioShowPlacement via canonTrackId
125
+ radioShowPlacements!: RadioShowPlacement[];
126
+ getRadioShowPlacements!: Sequelize.HasManyGetAssociationsMixin<RadioShowPlacement>;
127
+ setRadioShowPlacements!: Sequelize.HasManySetAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
128
+ addRadioShowPlacement!: Sequelize.HasManyAddAssociationMixin<RadioShowPlacement, RadioShowPlacementId>;
129
+ addRadioShowPlacements!: Sequelize.HasManyAddAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
130
+ createRadioShowPlacement!: Sequelize.HasManyCreateAssociationMixin<RadioShowPlacement>;
131
+ removeRadioShowPlacement!: Sequelize.HasManyRemoveAssociationMixin<RadioShowPlacement, RadioShowPlacementId>;
132
+ removeRadioShowPlacements!: Sequelize.HasManyRemoveAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
133
+ hasRadioShowPlacement!: Sequelize.HasManyHasAssociationMixin<RadioShowPlacement, RadioShowPlacementId>;
134
+ hasRadioShowPlacements!: Sequelize.HasManyHasAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
135
+ countRadioShowPlacements!: Sequelize.HasManyCountAssociationsMixin;
123
136
 
124
137
  static initModel(sequelize: Sequelize.Sequelize): typeof CanonTrack {
125
138
  return CanonTrack.init({
@@ -9,6 +9,7 @@ import type { JukeboxStatus, JukeboxStatusId } from './JukeboxStatus';
9
9
  import type { JukeboxTerminationCondition, JukeboxTerminationConditionId } from './JukeboxTerminationCondition';
10
10
  import type { JukeboxType, JukeboxTypeId } from './JukeboxType';
11
11
  import type { JukeboxUser, JukeboxUserId } from './JukeboxUser';
12
+ import type { Notification, NotificationId } from './Notification';
12
13
 
13
14
  export interface JukeboxSessionAttributes {
14
15
  typeId: number;
@@ -102,6 +103,18 @@ export class JukeboxSession extends Model<JukeboxSessionAttributes, JukeboxSessi
102
103
  hasJukeboxUser!: Sequelize.HasManyHasAssociationMixin<JukeboxUser, JukeboxUserId>;
103
104
  hasJukeboxUsers!: Sequelize.HasManyHasAssociationsMixin<JukeboxUser, JukeboxUserId>;
104
105
  countJukeboxUsers!: Sequelize.HasManyCountAssociationsMixin;
106
+ // JukeboxSession hasMany Notification via jukeboxSessionId
107
+ notifications!: Notification[];
108
+ getNotifications!: Sequelize.HasManyGetAssociationsMixin<Notification>;
109
+ setNotifications!: Sequelize.HasManySetAssociationsMixin<Notification, NotificationId>;
110
+ addNotification!: Sequelize.HasManyAddAssociationMixin<Notification, NotificationId>;
111
+ addNotifications!: Sequelize.HasManyAddAssociationsMixin<Notification, NotificationId>;
112
+ createNotification!: Sequelize.HasManyCreateAssociationMixin<Notification>;
113
+ removeNotification!: Sequelize.HasManyRemoveAssociationMixin<Notification, NotificationId>;
114
+ removeNotifications!: Sequelize.HasManyRemoveAssociationsMixin<Notification, NotificationId>;
115
+ hasNotification!: Sequelize.HasManyHasAssociationMixin<Notification, NotificationId>;
116
+ hasNotifications!: Sequelize.HasManyHasAssociationsMixin<Notification, NotificationId>;
117
+ countNotifications!: Sequelize.HasManyCountAssociationsMixin;
105
118
  // JukeboxSession belongsTo JukeboxStatus via jukeboxStatusId
106
119
  jukeboxStatus!: JukeboxStatus;
107
120
  getJukeboxStatus!: Sequelize.BelongsToGetAssociationMixin<JukeboxStatus>;
@@ -0,0 +1,202 @@
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 { NotificationType, NotificationTypeId } from './NotificationType';
6
+
7
+ export interface NotificationAttributes {
8
+ targetUserId: string;
9
+ notificationTypeId: number;
10
+ metadata?: object;
11
+ readAt?: Date;
12
+ dismissedAt?: Date;
13
+ sourceUserId?: string;
14
+ jukeboxSessionId?: string;
15
+ expiresAt?: Date;
16
+ pushSentAt?: Date;
17
+ pushError?: string;
18
+ id: string;
19
+ isRead: boolean;
20
+ isDismissed: boolean;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ pushSent: boolean;
24
+ }
25
+
26
+ export type NotificationPk = "id";
27
+ export type NotificationId = Notification[NotificationPk];
28
+ export type NotificationOptionalAttributes = "metadata" | "readAt" | "dismissedAt" | "sourceUserId" | "jukeboxSessionId" | "expiresAt" | "pushSentAt" | "pushError" | "id" | "createdAt" | "updatedAt";
29
+ export type NotificationCreationAttributes = Optional<NotificationAttributes, NotificationOptionalAttributes>;
30
+
31
+ export class Notification extends Model<NotificationAttributes, NotificationCreationAttributes> implements NotificationAttributes {
32
+ targetUserId!: string;
33
+ notificationTypeId!: number;
34
+ metadata?: object;
35
+ readAt?: Date;
36
+ dismissedAt?: Date;
37
+ sourceUserId?: string;
38
+ jukeboxSessionId?: string;
39
+ expiresAt?: Date;
40
+ pushSentAt?: Date;
41
+ pushError?: string;
42
+ id!: string;
43
+ isRead!: boolean;
44
+ isDismissed!: boolean;
45
+ createdAt!: Date;
46
+ updatedAt!: Date;
47
+ pushSent!: boolean;
48
+
49
+ // Notification belongsTo AppUser via sourceUserId
50
+ sourceUser!: AppUser;
51
+ getSourceUser!: Sequelize.BelongsToGetAssociationMixin<AppUser>;
52
+ setSourceUser!: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
53
+ createSourceUser!: Sequelize.BelongsToCreateAssociationMixin<AppUser>;
54
+ // Notification belongsTo AppUser via targetUserId
55
+ targetUser!: AppUser;
56
+ getTargetUser!: Sequelize.BelongsToGetAssociationMixin<AppUser>;
57
+ setTargetUser!: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
58
+ createTargetUser!: Sequelize.BelongsToCreateAssociationMixin<AppUser>;
59
+ // Notification belongsTo JukeboxSession via jukeboxSessionId
60
+ jukeboxSession!: JukeboxSession;
61
+ getJukeboxSession!: Sequelize.BelongsToGetAssociationMixin<JukeboxSession>;
62
+ setJukeboxSession!: Sequelize.BelongsToSetAssociationMixin<JukeboxSession, JukeboxSessionId>;
63
+ createJukeboxSession!: Sequelize.BelongsToCreateAssociationMixin<JukeboxSession>;
64
+ // Notification belongsTo NotificationType via notificationTypeId
65
+ notificationType!: NotificationType;
66
+ getNotificationType!: Sequelize.BelongsToGetAssociationMixin<NotificationType>;
67
+ setNotificationType!: Sequelize.BelongsToSetAssociationMixin<NotificationType, NotificationTypeId>;
68
+ createNotificationType!: Sequelize.BelongsToCreateAssociationMixin<NotificationType>;
69
+
70
+ static initModel(sequelize: Sequelize.Sequelize): typeof Notification {
71
+ return Notification.init({
72
+ targetUserId: {
73
+ type: DataTypes.UUID,
74
+ allowNull: false,
75
+ references: {
76
+ model: 'app_user',
77
+ key: 'id'
78
+ },
79
+ field: 'target_user_id'
80
+ },
81
+ notificationTypeId: {
82
+ type: DataTypes.SMALLINT,
83
+ allowNull: false,
84
+ references: {
85
+ model: 'notification_type',
86
+ key: 'id'
87
+ },
88
+ field: 'notification_type_id'
89
+ },
90
+ metadata: {
91
+ type: DataTypes.JSONB,
92
+ allowNull: true
93
+ },
94
+ readAt: {
95
+ type: DataTypes.DATE,
96
+ allowNull: true,
97
+ field: 'read_at'
98
+ },
99
+ dismissedAt: {
100
+ type: DataTypes.DATE,
101
+ allowNull: true,
102
+ field: 'dismissed_at'
103
+ },
104
+ sourceUserId: {
105
+ type: DataTypes.UUID,
106
+ allowNull: true,
107
+ references: {
108
+ model: 'app_user',
109
+ key: 'id'
110
+ },
111
+ field: 'source_user_id'
112
+ },
113
+ jukeboxSessionId: {
114
+ type: DataTypes.UUID,
115
+ allowNull: true,
116
+ references: {
117
+ model: 'jukebox_session',
118
+ key: 'id'
119
+ },
120
+ field: 'jukebox_session_id'
121
+ },
122
+ expiresAt: {
123
+ type: DataTypes.DATE,
124
+ allowNull: true,
125
+ field: 'expires_at'
126
+ },
127
+ pushSentAt: {
128
+ type: DataTypes.DATE,
129
+ allowNull: true,
130
+ field: 'push_sent_at'
131
+ },
132
+ pushError: {
133
+ type: DataTypes.TEXT,
134
+ allowNull: true,
135
+ field: 'push_error'
136
+ },
137
+ id: {
138
+ type: DataTypes.UUID,
139
+ allowNull: false,
140
+ defaultValue: DataTypes.UUIDV4,
141
+ primaryKey: true
142
+ },
143
+ isRead: {
144
+ type: DataTypes.BOOLEAN,
145
+ allowNull: false,
146
+ defaultValue: false,
147
+ field: 'is_read'
148
+ },
149
+ isDismissed: {
150
+ type: DataTypes.BOOLEAN,
151
+ allowNull: false,
152
+ defaultValue: false,
153
+ field: 'is_dismissed'
154
+ },
155
+ createdAt: {
156
+ type: DataTypes.DATE,
157
+ allowNull: false,
158
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
159
+ field: 'created_at'
160
+ },
161
+ updatedAt: {
162
+ type: DataTypes.DATE,
163
+ allowNull: false,
164
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
165
+ field: 'updated_at'
166
+ },
167
+ pushSent: {
168
+ type: DataTypes.BOOLEAN,
169
+ allowNull: false,
170
+ defaultValue: false,
171
+ field: 'push_sent'
172
+ }
173
+ }, {
174
+ sequelize,
175
+ tableName: 'notification',
176
+ schema: 'eb',
177
+ timestamps: false,
178
+ indexes: [
179
+ {
180
+ name: "idx_notification_expires_at",
181
+ fields: [
182
+ { name: "expires_at" },
183
+ ]
184
+ },
185
+ {
186
+ name: "idx_notification_target_user_created_at",
187
+ fields: [
188
+ { name: "target_user_id" },
189
+ { name: "created_at", order: "DESC" },
190
+ ]
191
+ },
192
+ {
193
+ name: "notification_pkey",
194
+ unique: true,
195
+ fields: [
196
+ { name: "id" },
197
+ ]
198
+ },
199
+ ]
200
+ });
201
+ }
202
+ }
@@ -0,0 +1,66 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { Notification, NotificationId } from './Notification';
4
+
5
+ export interface NotificationTypeAttributes {
6
+ id: number;
7
+ name: string;
8
+ }
9
+
10
+ export type NotificationTypePk = "id";
11
+ export type NotificationTypeId = NotificationType[NotificationTypePk];
12
+ export type NotificationTypeCreationAttributes = NotificationTypeAttributes;
13
+
14
+ export class NotificationType extends Model<NotificationTypeAttributes, NotificationTypeCreationAttributes> implements NotificationTypeAttributes {
15
+ id!: number;
16
+ name!: string;
17
+
18
+ // NotificationType hasMany Notification via notificationTypeId
19
+ notifications!: Notification[];
20
+ getNotifications!: Sequelize.HasManyGetAssociationsMixin<Notification>;
21
+ setNotifications!: Sequelize.HasManySetAssociationsMixin<Notification, NotificationId>;
22
+ addNotification!: Sequelize.HasManyAddAssociationMixin<Notification, NotificationId>;
23
+ addNotifications!: Sequelize.HasManyAddAssociationsMixin<Notification, NotificationId>;
24
+ createNotification!: Sequelize.HasManyCreateAssociationMixin<Notification>;
25
+ removeNotification!: Sequelize.HasManyRemoveAssociationMixin<Notification, NotificationId>;
26
+ removeNotifications!: Sequelize.HasManyRemoveAssociationsMixin<Notification, NotificationId>;
27
+ hasNotification!: Sequelize.HasManyHasAssociationMixin<Notification, NotificationId>;
28
+ hasNotifications!: Sequelize.HasManyHasAssociationsMixin<Notification, NotificationId>;
29
+ countNotifications!: Sequelize.HasManyCountAssociationsMixin;
30
+
31
+ static initModel(sequelize: Sequelize.Sequelize): typeof NotificationType {
32
+ return NotificationType.init({
33
+ id: {
34
+ type: DataTypes.SMALLINT,
35
+ allowNull: false,
36
+ primaryKey: true
37
+ },
38
+ name: {
39
+ type: DataTypes.TEXT,
40
+ allowNull: false,
41
+ unique: "notification_type_name_unique"
42
+ }
43
+ }, {
44
+ sequelize,
45
+ tableName: 'notification_type',
46
+ schema: 'eb',
47
+ timestamps: false,
48
+ indexes: [
49
+ {
50
+ name: "notification_type_name_unique",
51
+ unique: true,
52
+ fields: [
53
+ { name: "name" },
54
+ ]
55
+ },
56
+ {
57
+ name: "notification_type_pkey",
58
+ unique: true,
59
+ fields: [
60
+ { name: "id" },
61
+ ]
62
+ },
63
+ ]
64
+ });
65
+ }
66
+ }
@@ -0,0 +1,151 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { AppUser, AppUserId } from './AppUser';
4
+ import type { RadioShowGenres, RadioShowGenresId } from './RadioShowGenres';
5
+ import type { RadioShowMedia, RadioShowMediaId } from './RadioShowMedia';
6
+ import type { RadioShowPlacement, RadioShowPlacementId } from './RadioShowPlacement';
7
+ import type { RadioShowPublishRequests, RadioShowPublishRequestsId } from './RadioShowPublishRequests';
8
+
9
+ export interface RadioShowAttributes {
10
+ creatorUserId: string;
11
+ scheduledRelease?: Date;
12
+ title: string;
13
+ description?: string;
14
+ deleted?: boolean;
15
+ id: string;
16
+ createDate: Date;
17
+ updateDate: Date;
18
+ }
19
+
20
+ export type RadioShowPk = "id";
21
+ export type RadioShowId = RadioShow[RadioShowPk];
22
+ export type RadioShowOptionalAttributes = "scheduledRelease" | "description" | "deleted" | "id" | "createDate" | "updateDate";
23
+ export type RadioShowCreationAttributes = Optional<RadioShowAttributes, RadioShowOptionalAttributes>;
24
+
25
+ export class RadioShow extends Model<RadioShowAttributes, RadioShowCreationAttributes> implements RadioShowAttributes {
26
+ creatorUserId!: string;
27
+ scheduledRelease?: Date;
28
+ title!: string;
29
+ description?: string;
30
+ deleted?: boolean;
31
+ id!: string;
32
+ createDate!: Date;
33
+ updateDate!: Date;
34
+
35
+ // RadioShow belongsTo AppUser via creatorUserId
36
+ creatorUser!: AppUser;
37
+ getCreatorUser!: Sequelize.BelongsToGetAssociationMixin<AppUser>;
38
+ setCreatorUser!: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
39
+ createCreatorUser!: Sequelize.BelongsToCreateAssociationMixin<AppUser>;
40
+ // RadioShow hasMany RadioShowGenres via radioShowId
41
+ radioShowGenres!: RadioShowGenres[];
42
+ getRadioShowGenres!: Sequelize.HasManyGetAssociationsMixin<RadioShowGenres>;
43
+ setRadioShowGenres!: Sequelize.HasManySetAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
44
+ addRadioShowGenre!: Sequelize.HasManyAddAssociationMixin<RadioShowGenres, RadioShowGenresId>;
45
+ addRadioShowGenres!: Sequelize.HasManyAddAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
46
+ createRadioShowGenre!: Sequelize.HasManyCreateAssociationMixin<RadioShowGenres>;
47
+ removeRadioShowGenre!: Sequelize.HasManyRemoveAssociationMixin<RadioShowGenres, RadioShowGenresId>;
48
+ removeRadioShowGenres!: Sequelize.HasManyRemoveAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
49
+ hasRadioShowGenre!: Sequelize.HasManyHasAssociationMixin<RadioShowGenres, RadioShowGenresId>;
50
+ hasRadioShowGenres!: Sequelize.HasManyHasAssociationsMixin<RadioShowGenres, RadioShowGenresId>;
51
+ countRadioShowGenres!: Sequelize.HasManyCountAssociationsMixin;
52
+ // RadioShow hasMany RadioShowMedia via radioShowId
53
+ radioShowMedia!: RadioShowMedia[];
54
+ getRadioShowMedia!: Sequelize.HasManyGetAssociationsMixin<RadioShowMedia>;
55
+ setRadioShowMedia!: Sequelize.HasManySetAssociationsMixin<RadioShowMedia, RadioShowMediaId>;
56
+ addRadioShowMedium!: Sequelize.HasManyAddAssociationMixin<RadioShowMedia, RadioShowMediaId>;
57
+ addRadioShowMedia!: Sequelize.HasManyAddAssociationsMixin<RadioShowMedia, RadioShowMediaId>;
58
+ createRadioShowMedium!: Sequelize.HasManyCreateAssociationMixin<RadioShowMedia>;
59
+ removeRadioShowMedium!: Sequelize.HasManyRemoveAssociationMixin<RadioShowMedia, RadioShowMediaId>;
60
+ removeRadioShowMedia!: Sequelize.HasManyRemoveAssociationsMixin<RadioShowMedia, RadioShowMediaId>;
61
+ hasRadioShowMedium!: Sequelize.HasManyHasAssociationMixin<RadioShowMedia, RadioShowMediaId>;
62
+ hasRadioShowMedia!: Sequelize.HasManyHasAssociationsMixin<RadioShowMedia, RadioShowMediaId>;
63
+ countRadioShowMedia!: Sequelize.HasManyCountAssociationsMixin;
64
+ // RadioShow hasMany RadioShowPlacement via radioShowId
65
+ radioShowPlacements!: RadioShowPlacement[];
66
+ getRadioShowPlacements!: Sequelize.HasManyGetAssociationsMixin<RadioShowPlacement>;
67
+ setRadioShowPlacements!: Sequelize.HasManySetAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
68
+ addRadioShowPlacement!: Sequelize.HasManyAddAssociationMixin<RadioShowPlacement, RadioShowPlacementId>;
69
+ addRadioShowPlacements!: Sequelize.HasManyAddAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
70
+ createRadioShowPlacement!: Sequelize.HasManyCreateAssociationMixin<RadioShowPlacement>;
71
+ removeRadioShowPlacement!: Sequelize.HasManyRemoveAssociationMixin<RadioShowPlacement, RadioShowPlacementId>;
72
+ removeRadioShowPlacements!: Sequelize.HasManyRemoveAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
73
+ hasRadioShowPlacement!: Sequelize.HasManyHasAssociationMixin<RadioShowPlacement, RadioShowPlacementId>;
74
+ hasRadioShowPlacements!: Sequelize.HasManyHasAssociationsMixin<RadioShowPlacement, RadioShowPlacementId>;
75
+ countRadioShowPlacements!: Sequelize.HasManyCountAssociationsMixin;
76
+ // RadioShow hasMany RadioShowPublishRequests via radioShowId
77
+ radioShowPublishRequests!: RadioShowPublishRequests[];
78
+ getRadioShowPublishRequests!: Sequelize.HasManyGetAssociationsMixin<RadioShowPublishRequests>;
79
+ setRadioShowPublishRequests!: Sequelize.HasManySetAssociationsMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
80
+ addRadioShowPublishRequest!: Sequelize.HasManyAddAssociationMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
81
+ addRadioShowPublishRequests!: Sequelize.HasManyAddAssociationsMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
82
+ createRadioShowPublishRequest!: Sequelize.HasManyCreateAssociationMixin<RadioShowPublishRequests>;
83
+ removeRadioShowPublishRequest!: Sequelize.HasManyRemoveAssociationMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
84
+ removeRadioShowPublishRequests!: Sequelize.HasManyRemoveAssociationsMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
85
+ hasRadioShowPublishRequest!: Sequelize.HasManyHasAssociationMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
86
+ hasRadioShowPublishRequests!: Sequelize.HasManyHasAssociationsMixin<RadioShowPublishRequests, RadioShowPublishRequestsId>;
87
+ countRadioShowPublishRequests!: Sequelize.HasManyCountAssociationsMixin;
88
+
89
+ static initModel(sequelize: Sequelize.Sequelize): typeof RadioShow {
90
+ return RadioShow.init({
91
+ creatorUserId: {
92
+ type: DataTypes.UUID,
93
+ allowNull: false,
94
+ references: {
95
+ model: 'app_user',
96
+ key: 'id'
97
+ },
98
+ field: 'creator_user_id'
99
+ },
100
+ scheduledRelease: {
101
+ type: DataTypes.DATE,
102
+ allowNull: true,
103
+ field: 'scheduled_release'
104
+ },
105
+ title: {
106
+ type: DataTypes.STRING(40),
107
+ allowNull: false
108
+ },
109
+ description: {
110
+ type: DataTypes.STRING(512),
111
+ allowNull: true
112
+ },
113
+ deleted: {
114
+ type: DataTypes.BOOLEAN,
115
+ allowNull: true
116
+ },
117
+ id: {
118
+ type: DataTypes.UUID,
119
+ allowNull: false,
120
+ defaultValue: DataTypes.UUIDV4,
121
+ primaryKey: true
122
+ },
123
+ createDate: {
124
+ type: DataTypes.DATE,
125
+ allowNull: false,
126
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
127
+ field: 'create_date'
128
+ },
129
+ updateDate: {
130
+ type: DataTypes.DATE,
131
+ allowNull: false,
132
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
133
+ field: 'update_date'
134
+ }
135
+ }, {
136
+ sequelize,
137
+ tableName: 'radio_show',
138
+ schema: 'eb',
139
+ timestamps: false,
140
+ indexes: [
141
+ {
142
+ name: "radio_show_pkey",
143
+ unique: true,
144
+ fields: [
145
+ { name: "id" },
146
+ ]
147
+ },
148
+ ]
149
+ });
150
+ }
151
+ }
@@ -0,0 +1,81 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { CanonGenre, CanonGenreId } from './CanonGenre';
4
+ import type { RadioShow, RadioShowId } from './RadioShow';
5
+
6
+ export interface RadioShowGenresAttributes {
7
+ canonGenreId: string;
8
+ radioShowId: string;
9
+ title: string;
10
+ id: string;
11
+ }
12
+
13
+ export type RadioShowGenresPk = "id";
14
+ export type RadioShowGenresId = RadioShowGenres[RadioShowGenresPk];
15
+ export type RadioShowGenresOptionalAttributes = "id";
16
+ export type RadioShowGenresCreationAttributes = Optional<RadioShowGenresAttributes, RadioShowGenresOptionalAttributes>;
17
+
18
+ export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowGenresCreationAttributes> implements RadioShowGenresAttributes {
19
+ canonGenreId!: string;
20
+ radioShowId!: string;
21
+ title!: string;
22
+ id!: string;
23
+
24
+ // RadioShowGenres belongsTo CanonGenre via canonGenreId
25
+ canonGenre!: CanonGenre;
26
+ getCanonGenre!: Sequelize.BelongsToGetAssociationMixin<CanonGenre>;
27
+ setCanonGenre!: Sequelize.BelongsToSetAssociationMixin<CanonGenre, CanonGenreId>;
28
+ createCanonGenre!: Sequelize.BelongsToCreateAssociationMixin<CanonGenre>;
29
+ // RadioShowGenres belongsTo RadioShow via radioShowId
30
+ radioShow!: RadioShow;
31
+ getRadioShow!: Sequelize.BelongsToGetAssociationMixin<RadioShow>;
32
+ setRadioShow!: Sequelize.BelongsToSetAssociationMixin<RadioShow, RadioShowId>;
33
+ createRadioShow!: Sequelize.BelongsToCreateAssociationMixin<RadioShow>;
34
+
35
+ static initModel(sequelize: Sequelize.Sequelize): typeof RadioShowGenres {
36
+ return RadioShowGenres.init({
37
+ canonGenreId: {
38
+ type: DataTypes.UUID,
39
+ allowNull: false,
40
+ references: {
41
+ model: 'canon_genre',
42
+ key: 'id'
43
+ },
44
+ field: 'canon_genre_id'
45
+ },
46
+ radioShowId: {
47
+ type: DataTypes.UUID,
48
+ allowNull: false,
49
+ references: {
50
+ model: 'radio_show',
51
+ key: 'id'
52
+ },
53
+ field: 'radio_show_id'
54
+ },
55
+ title: {
56
+ type: DataTypes.STRING(40),
57
+ allowNull: false
58
+ },
59
+ id: {
60
+ type: DataTypes.UUID,
61
+ allowNull: false,
62
+ defaultValue: DataTypes.UUIDV4,
63
+ primaryKey: true
64
+ }
65
+ }, {
66
+ sequelize,
67
+ tableName: 'radio_show_genres',
68
+ schema: 'eb',
69
+ timestamps: false,
70
+ indexes: [
71
+ {
72
+ name: "radio_show_genres_pkey",
73
+ unique: true,
74
+ fields: [
75
+ { name: "id" },
76
+ ]
77
+ },
78
+ ]
79
+ });
80
+ }
81
+ }