@earbug/db-models 0.0.14 → 0.0.16

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,89 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { MerchItem, MerchItemId } from './MerchItem';
4
+ import type { MerchOrchestration, MerchOrchestrationId } from './MerchOrchestration';
5
+
6
+ export interface MerchTypeAttributes {
7
+ id: string;
8
+ description: string;
9
+ createDate: Date;
10
+ updateDate: Date;
11
+ }
12
+
13
+ export type MerchTypePk = "id";
14
+ export type MerchTypeId = MerchType[MerchTypePk];
15
+ export type MerchTypeOptionalAttributes = "id" | "createDate" | "updateDate";
16
+ export type MerchTypeCreationAttributes = Optional<MerchTypeAttributes, MerchTypeOptionalAttributes>;
17
+
18
+ export class MerchType extends Model<MerchTypeAttributes, MerchTypeCreationAttributes> implements MerchTypeAttributes {
19
+ id!: string;
20
+ description!: string;
21
+ createDate!: Date;
22
+ updateDate!: Date;
23
+
24
+ // MerchType hasMany MerchItem via merchTypeId
25
+ merchItems!: MerchItem[];
26
+ getMerchItems!: Sequelize.HasManyGetAssociationsMixin<MerchItem>;
27
+ setMerchItems!: Sequelize.HasManySetAssociationsMixin<MerchItem, MerchItemId>;
28
+ addMerchItem!: Sequelize.HasManyAddAssociationMixin<MerchItem, MerchItemId>;
29
+ addMerchItems!: Sequelize.HasManyAddAssociationsMixin<MerchItem, MerchItemId>;
30
+ createMerchItem!: Sequelize.HasManyCreateAssociationMixin<MerchItem>;
31
+ removeMerchItem!: Sequelize.HasManyRemoveAssociationMixin<MerchItem, MerchItemId>;
32
+ removeMerchItems!: Sequelize.HasManyRemoveAssociationsMixin<MerchItem, MerchItemId>;
33
+ hasMerchItem!: Sequelize.HasManyHasAssociationMixin<MerchItem, MerchItemId>;
34
+ hasMerchItems!: Sequelize.HasManyHasAssociationsMixin<MerchItem, MerchItemId>;
35
+ countMerchItems!: Sequelize.HasManyCountAssociationsMixin;
36
+ // MerchType hasMany MerchOrchestration via merchTypeId
37
+ merchOrchestrations!: MerchOrchestration[];
38
+ getMerchOrchestrations!: Sequelize.HasManyGetAssociationsMixin<MerchOrchestration>;
39
+ setMerchOrchestrations!: Sequelize.HasManySetAssociationsMixin<MerchOrchestration, MerchOrchestrationId>;
40
+ addMerchOrchestration!: Sequelize.HasManyAddAssociationMixin<MerchOrchestration, MerchOrchestrationId>;
41
+ addMerchOrchestrations!: Sequelize.HasManyAddAssociationsMixin<MerchOrchestration, MerchOrchestrationId>;
42
+ createMerchOrchestration!: Sequelize.HasManyCreateAssociationMixin<MerchOrchestration>;
43
+ removeMerchOrchestration!: Sequelize.HasManyRemoveAssociationMixin<MerchOrchestration, MerchOrchestrationId>;
44
+ removeMerchOrchestrations!: Sequelize.HasManyRemoveAssociationsMixin<MerchOrchestration, MerchOrchestrationId>;
45
+ hasMerchOrchestration!: Sequelize.HasManyHasAssociationMixin<MerchOrchestration, MerchOrchestrationId>;
46
+ hasMerchOrchestrations!: Sequelize.HasManyHasAssociationsMixin<MerchOrchestration, MerchOrchestrationId>;
47
+ countMerchOrchestrations!: Sequelize.HasManyCountAssociationsMixin;
48
+
49
+ static initModel(sequelize: Sequelize.Sequelize): typeof MerchType {
50
+ return MerchType.init({
51
+ id: {
52
+ type: DataTypes.UUID,
53
+ allowNull: false,
54
+ defaultValue: DataTypes.UUIDV4,
55
+ primaryKey: true
56
+ },
57
+ description: {
58
+ type: DataTypes.TEXT,
59
+ allowNull: false
60
+ },
61
+ createDate: {
62
+ type: DataTypes.DATE,
63
+ allowNull: false,
64
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
65
+ field: 'create_date'
66
+ },
67
+ updateDate: {
68
+ type: DataTypes.DATE,
69
+ allowNull: false,
70
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
71
+ field: 'update_date'
72
+ }
73
+ }, {
74
+ sequelize,
75
+ tableName: 'merch_type',
76
+ schema: 'eb',
77
+ timestamps: false,
78
+ indexes: [
79
+ {
80
+ name: "merch_type_pkey",
81
+ unique: true,
82
+ fields: [
83
+ { name: "id" },
84
+ ]
85
+ },
86
+ ]
87
+ });
88
+ }
89
+ }
@@ -49,7 +49,7 @@ export class NewsArticle extends Model<NewsArticleAttributes, NewsArticleCreatio
49
49
  id: {
50
50
  type: DataTypes.UUID,
51
51
  allowNull: false,
52
- defaultValue: Sequelize.Sequelize.fn('uuid_generate_v4'),
52
+ defaultValue: DataTypes.UUIDV4,
53
53
  primaryKey: true
54
54
  },
55
55
  canonArtistId: {
@@ -71,20 +71,20 @@ export class NewsArticle extends Model<NewsArticleAttributes, NewsArticleCreatio
71
71
  field: 'news_platform_id'
72
72
  },
73
73
  title: {
74
- type: DataTypes.CITEXT,
74
+ type: DataTypes.TEXT,
75
75
  allowNull: false
76
76
  },
77
77
  description: {
78
- type: DataTypes.CITEXT,
78
+ type: DataTypes.TEXT,
79
79
  allowNull: false
80
80
  },
81
81
  articleUrl: {
82
- type: DataTypes.CITEXT,
82
+ type: DataTypes.TEXT,
83
83
  allowNull: false,
84
84
  field: 'article_url'
85
85
  },
86
86
  photoUrl: {
87
- type: DataTypes.CITEXT,
87
+ type: DataTypes.TEXT,
88
88
  allowNull: false,
89
89
  field: 'photo_url'
90
90
  },
@@ -123,4 +123,3 @@ export class NewsArticle extends Model<NewsArticleAttributes, NewsArticleCreatio
123
123
  });
124
124
  }
125
125
  }
126
-
@@ -38,11 +38,11 @@ export class NewsPlatform extends Model<NewsPlatformAttributes, NewsPlatformCrea
38
38
  id: {
39
39
  type: DataTypes.UUID,
40
40
  allowNull: false,
41
- defaultValue: Sequelize.Sequelize.fn('uuid_generate_v4'),
41
+ defaultValue: DataTypes.UUIDV4,
42
42
  primaryKey: true
43
43
  },
44
44
  name: {
45
- type: DataTypes.CITEXT,
45
+ type: DataTypes.TEXT,
46
46
  allowNull: false
47
47
  },
48
48
  createDate: {
@@ -74,4 +74,3 @@ export class NewsPlatform extends Model<NewsPlatformAttributes, NewsPlatformCrea
74
74
  });
75
75
  }
76
76
  }
77
-
@@ -2,6 +2,7 @@ import * as Sequelize from 'sequelize';
2
2
  import { DataTypes, Model, Optional } from 'sequelize';
3
3
  import type { CanonToPlatformTrackRelation, CanonToPlatformTrackRelationId } from './CanonToPlatformTrackRelation';
4
4
  import type { CanonTrack, CanonTrackId } from './CanonTrack';
5
+ import type { JukeboxQueueEntry, JukeboxQueueEntryId } from './JukeboxQueueEntry';
5
6
  import type { Platform, PlatformId } from './Platform';
6
7
  import type { PlatformAlbum, PlatformAlbumId } from './PlatformAlbum';
7
8
  import type { PlatformAlbumTrackRelation, PlatformAlbumTrackRelationId } from './PlatformAlbumTrackRelation';
@@ -79,6 +80,18 @@ export class PlatformTrack extends Model<PlatformTrackAttributes, PlatformTrackC
79
80
  hasCanonTrackIdCanonTrackCanonToPlatformTrackRelation!: Sequelize.BelongsToManyHasAssociationMixin<CanonTrack, CanonTrackId>;
80
81
  hasCanonTrackIdCanonTrackCanonToPlatformTrackRelations!: Sequelize.BelongsToManyHasAssociationsMixin<CanonTrack, CanonTrackId>;
81
82
  countCanonTrackIdCanonTrackCanonToPlatformTrackRelations!: Sequelize.BelongsToManyCountAssociationsMixin;
83
+ // PlatformTrack hasMany JukeboxQueueEntry via platformTrackId
84
+ jukeboxQueueEntries!: JukeboxQueueEntry[];
85
+ getJukeboxQueueEntries!: Sequelize.HasManyGetAssociationsMixin<JukeboxQueueEntry>;
86
+ setJukeboxQueueEntries!: Sequelize.HasManySetAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
87
+ addJukeboxQueueEntry!: Sequelize.HasManyAddAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
88
+ addJukeboxQueueEntries!: Sequelize.HasManyAddAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
89
+ createJukeboxQueueEntry!: Sequelize.HasManyCreateAssociationMixin<JukeboxQueueEntry>;
90
+ removeJukeboxQueueEntry!: Sequelize.HasManyRemoveAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
91
+ removeJukeboxQueueEntries!: Sequelize.HasManyRemoveAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
92
+ hasJukeboxQueueEntry!: Sequelize.HasManyHasAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
93
+ hasJukeboxQueueEntries!: Sequelize.HasManyHasAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
94
+ countJukeboxQueueEntries!: Sequelize.HasManyCountAssociationsMixin;
82
95
  // PlatformTrack belongsToMany PlatformAlbum via platformTrackId and platformAlbumId
83
96
  platformAlbumIdPlatformAlbumPlatformAlbumTrackRelations!: PlatformAlbum[];
84
97
  getPlatformAlbumIdPlatformAlbumPlatformAlbumTrackRelations!: Sequelize.BelongsToManyGetAssociationsMixin<PlatformAlbum>;
@@ -138,6 +138,12 @@ export class RadioShow extends Model<RadioShowAttributes, RadioShowCreationAttri
138
138
  schema: 'eb',
139
139
  timestamps: false,
140
140
  indexes: [
141
+ {
142
+ name: "idx_radio_show_creator",
143
+ fields: [
144
+ { name: "creator_user_id" },
145
+ ]
146
+ },
141
147
  {
142
148
  name: "radio_show_pkey",
143
149
  unique: true,
@@ -8,11 +8,12 @@ export interface RadioShowGenresAttributes {
8
8
  radioShowId: string;
9
9
  title: string;
10
10
  id: string;
11
+ seqNum?: number;
11
12
  }
12
13
 
13
14
  export type RadioShowGenresPk = "id";
14
15
  export type RadioShowGenresId = RadioShowGenres[RadioShowGenresPk];
15
- export type RadioShowGenresOptionalAttributes = "id";
16
+ export type RadioShowGenresOptionalAttributes = "id" | "seqNum";
16
17
  export type RadioShowGenresCreationAttributes = Optional<RadioShowGenresAttributes, RadioShowGenresOptionalAttributes>;
17
18
 
18
19
  export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowGenresCreationAttributes> implements RadioShowGenresAttributes {
@@ -20,6 +21,7 @@ export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowG
20
21
  radioShowId!: string;
21
22
  title!: string;
22
23
  id!: string;
24
+ seqNum?: number;
23
25
 
24
26
  // RadioShowGenres belongsTo CanonGenre via canonGenreId
25
27
  canonGenre!: CanonGenre;
@@ -41,6 +43,7 @@ export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowG
41
43
  model: 'canon_genre',
42
44
  key: 'id'
43
45
  },
46
+ unique: "uq_radio_show_genre_unique",
44
47
  field: 'canon_genre_id'
45
48
  },
46
49
  radioShowId: {
@@ -50,6 +53,7 @@ export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowG
50
53
  model: 'radio_show',
51
54
  key: 'id'
52
55
  },
56
+ unique: "uq_radio_show_genre_unique",
53
57
  field: 'radio_show_id'
54
58
  },
55
59
  title: {
@@ -61,6 +65,12 @@ export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowG
61
65
  allowNull: false,
62
66
  defaultValue: DataTypes.UUIDV4,
63
67
  primaryKey: true
68
+ },
69
+ seqNum: {
70
+ type: DataTypes.SMALLINT,
71
+ allowNull: true,
72
+ unique: "uq_radio_show_genre_seq_unique",
73
+ field: 'seq_num'
64
74
  }
65
75
  }, {
66
76
  sequelize,
@@ -75,6 +85,22 @@ export class RadioShowGenres extends Model<RadioShowGenresAttributes, RadioShowG
75
85
  { name: "id" },
76
86
  ]
77
87
  },
88
+ {
89
+ name: "uq_radio_show_genre_seq_unique",
90
+ unique: true,
91
+ fields: [
92
+ { name: "radio_show_id" },
93
+ { name: "seq_num" },
94
+ ]
95
+ },
96
+ {
97
+ name: "uq_radio_show_genre_unique",
98
+ unique: true,
99
+ fields: [
100
+ { name: "radio_show_id" },
101
+ { name: "canon_genre_id" },
102
+ ]
103
+ },
78
104
  ]
79
105
  });
80
106
  }
@@ -61,6 +61,8 @@ import { ConfigParam as _ConfigParam } from "./ConfigParam";
61
61
  import type { ConfigParamAttributes, ConfigParamCreationAttributes } from "./ConfigParam";
62
62
  import { ExternalReference as _ExternalReference } from "./ExternalReference";
63
63
  import type { ExternalReferenceAttributes, ExternalReferenceCreationAttributes } from "./ExternalReference";
64
+ import { GuestUser as _GuestUser } from "./GuestUser";
65
+ import type { GuestUserAttributes, GuestUserCreationAttributes } from "./GuestUser";
64
66
  import { JukeboxAccessType as _JukeboxAccessType } from "./JukeboxAccessType";
65
67
  import type { JukeboxAccessTypeAttributes, JukeboxAccessTypeCreationAttributes } from "./JukeboxAccessType";
66
68
  import { JukeboxCanonGenreRelation as _JukeboxCanonGenreRelation } from "./JukeboxCanonGenreRelation";
@@ -87,10 +89,22 @@ import { KnexMigrations as _KnexMigrations } from "./KnexMigrations";
87
89
  import type { KnexMigrationsAttributes, KnexMigrationsCreationAttributes } from "./KnexMigrations";
88
90
  import { KnexMigrationsLock as _KnexMigrationsLock } from "./KnexMigrationsLock";
89
91
  import type { KnexMigrationsLockAttributes, KnexMigrationsLockCreationAttributes } from "./KnexMigrationsLock";
92
+ import { MerchItem as _MerchItem } from "./MerchItem";
93
+ import type { MerchItemAttributes, MerchItemCreationAttributes } from "./MerchItem";
94
+ import { MerchOrchestration as _MerchOrchestration } from "./MerchOrchestration";
95
+ import type { MerchOrchestrationAttributes, MerchOrchestrationCreationAttributes } from "./MerchOrchestration";
96
+ import { MerchPlatform as _MerchPlatform } from "./MerchPlatform";
97
+ import type { MerchPlatformAttributes, MerchPlatformCreationAttributes } from "./MerchPlatform";
98
+ import { MerchType as _MerchType } from "./MerchType";
99
+ import type { MerchTypeAttributes, MerchTypeCreationAttributes } from "./MerchType";
90
100
  import { MetricsDaily as _MetricsDaily } from "./MetricsDaily";
91
101
  import type { MetricsDailyAttributes, MetricsDailyCreationAttributes } from "./MetricsDaily";
92
102
  import { MetricsEvent as _MetricsEvent } from "./MetricsEvent";
93
103
  import type { MetricsEventAttributes, MetricsEventCreationAttributes } from "./MetricsEvent";
104
+ import { NewsArticle as _NewsArticle } from "./NewsArticle";
105
+ import type { NewsArticleAttributes, NewsArticleCreationAttributes } from "./NewsArticle";
106
+ import { NewsPlatform as _NewsPlatform } from "./NewsPlatform";
107
+ import type { NewsPlatformAttributes, NewsPlatformCreationAttributes } from "./NewsPlatform";
94
108
  import { NewsSite as _NewsSite } from "./NewsSite";
95
109
  import type { NewsSiteAttributes, NewsSiteCreationAttributes } from "./NewsSite";
96
110
  import { Notification as _Notification } from "./Notification";
@@ -186,6 +200,7 @@ export {
186
200
  _CanonTrack as CanonTrack,
187
201
  _ConfigParam as ConfigParam,
188
202
  _ExternalReference as ExternalReference,
203
+ _GuestUser as GuestUser,
189
204
  _JukeboxAccessType as JukeboxAccessType,
190
205
  _JukeboxCanonGenreRelation as JukeboxCanonGenreRelation,
191
206
  _JukeboxInvite as JukeboxInvite,
@@ -199,8 +214,14 @@ export {
199
214
  _JukeboxUserType as JukeboxUserType,
200
215
  _KnexMigrations as KnexMigrations,
201
216
  _KnexMigrationsLock as KnexMigrationsLock,
217
+ _MerchItem as MerchItem,
218
+ _MerchOrchestration as MerchOrchestration,
219
+ _MerchPlatform as MerchPlatform,
220
+ _MerchType as MerchType,
202
221
  _MetricsDaily as MetricsDaily,
203
222
  _MetricsEvent as MetricsEvent,
223
+ _NewsArticle as NewsArticle,
224
+ _NewsPlatform as NewsPlatform,
204
225
  _NewsSite as NewsSite,
205
226
  _Notification as Notification,
206
227
  _NotificationType as NotificationType,
@@ -297,6 +318,8 @@ export type {
297
318
  ConfigParamCreationAttributes,
298
319
  ExternalReferenceAttributes,
299
320
  ExternalReferenceCreationAttributes,
321
+ GuestUserAttributes,
322
+ GuestUserCreationAttributes,
300
323
  JukeboxAccessTypeAttributes,
301
324
  JukeboxAccessTypeCreationAttributes,
302
325
  JukeboxCanonGenreRelationAttributes,
@@ -323,10 +346,22 @@ export type {
323
346
  KnexMigrationsCreationAttributes,
324
347
  KnexMigrationsLockAttributes,
325
348
  KnexMigrationsLockCreationAttributes,
349
+ MerchItemAttributes,
350
+ MerchItemCreationAttributes,
351
+ MerchOrchestrationAttributes,
352
+ MerchOrchestrationCreationAttributes,
353
+ MerchPlatformAttributes,
354
+ MerchPlatformCreationAttributes,
355
+ MerchTypeAttributes,
356
+ MerchTypeCreationAttributes,
326
357
  MetricsDailyAttributes,
327
358
  MetricsDailyCreationAttributes,
328
359
  MetricsEventAttributes,
329
360
  MetricsEventCreationAttributes,
361
+ NewsArticleAttributes,
362
+ NewsArticleCreationAttributes,
363
+ NewsPlatformAttributes,
364
+ NewsPlatformCreationAttributes,
330
365
  NewsSiteAttributes,
331
366
  NewsSiteCreationAttributes,
332
367
  NotificationAttributes,
@@ -423,6 +458,7 @@ export function initModels(sequelize: Sequelize) {
423
458
  const CanonTrack = _CanonTrack.initModel(sequelize);
424
459
  const ConfigParam = _ConfigParam.initModel(sequelize);
425
460
  const ExternalReference = _ExternalReference.initModel(sequelize);
461
+ const GuestUser = _GuestUser.initModel(sequelize);
426
462
  const JukeboxAccessType = _JukeboxAccessType.initModel(sequelize);
427
463
  const JukeboxCanonGenreRelation = _JukeboxCanonGenreRelation.initModel(sequelize);
428
464
  const JukeboxInvite = _JukeboxInvite.initModel(sequelize);
@@ -436,8 +472,14 @@ export function initModels(sequelize: Sequelize) {
436
472
  const JukeboxUserType = _JukeboxUserType.initModel(sequelize);
437
473
  const KnexMigrations = _KnexMigrations.initModel(sequelize);
438
474
  const KnexMigrationsLock = _KnexMigrationsLock.initModel(sequelize);
475
+ const MerchItem = _MerchItem.initModel(sequelize);
476
+ const MerchOrchestration = _MerchOrchestration.initModel(sequelize);
477
+ const MerchPlatform = _MerchPlatform.initModel(sequelize);
478
+ const MerchType = _MerchType.initModel(sequelize);
439
479
  const MetricsDaily = _MetricsDaily.initModel(sequelize);
440
480
  const MetricsEvent = _MetricsEvent.initModel(sequelize);
481
+ const NewsArticle = _NewsArticle.initModel(sequelize);
482
+ const NewsPlatform = _NewsPlatform.initModel(sequelize);
441
483
  const NewsSite = _NewsSite.initModel(sequelize);
442
484
  const Notification = _Notification.initModel(sequelize);
443
485
  const NotificationType = _NotificationType.initModel(sequelize);
@@ -558,6 +600,12 @@ export function initModels(sequelize: Sequelize) {
558
600
  CanonArtist.hasMany(CanonArtistTrackRelation, { as: "canonArtistTrackRelations", foreignKey: "canonArtistId"});
559
601
  CanonToPlatformArtistRelation.belongsTo(CanonArtist, { as: "canonArtist", foreignKey: "canonArtistId"});
560
602
  CanonArtist.hasMany(CanonToPlatformArtistRelation, { as: "canonToPlatformArtistRelations", foreignKey: "canonArtistId"});
603
+ MerchItem.belongsTo(CanonArtist, { as: "canonArtist", foreignKey: "canonArtistId"});
604
+ CanonArtist.hasMany(MerchItem, { as: "merchItems", foreignKey: "canonArtistId"});
605
+ MerchOrchestration.belongsTo(CanonArtist, { as: "canonArtist", foreignKey: "canonArtistId"});
606
+ CanonArtist.hasMany(MerchOrchestration, { as: "merchOrchestrations", foreignKey: "canonArtistId"});
607
+ NewsArticle.belongsTo(CanonArtist, { as: "canonArtist", foreignKey: "canonArtistId"});
608
+ CanonArtist.hasMany(NewsArticle, { as: "newsArticles", foreignKey: "canonArtistId"});
561
609
  CanonAlbumGenreRelation.belongsTo(CanonGenre, { as: "canonGenre", foreignKey: "canonGenreId"});
562
610
  CanonGenre.hasMany(CanonAlbumGenreRelation, { as: "canonAlbumGenreRelations", foreignKey: "canonGenreId"});
563
611
  CanonArtistGenreRelation.belongsTo(CanonGenre, { as: "canonGenre", foreignKey: "canonGenreId"});
@@ -598,12 +646,16 @@ export function initModels(sequelize: Sequelize) {
598
646
  ExternalReference.hasMany(CanonLabelExternalReferenceRelation, { as: "canonLabelExternalReferenceRelations", foreignKey: "externalReferenceId"});
599
647
  CanonMemberExternalReferenceRelation.belongsTo(ExternalReference, { as: "externalReference", foreignKey: "externalReferenceId"});
600
648
  ExternalReference.hasMany(CanonMemberExternalReferenceRelation, { as: "canonMemberExternalReferenceRelations", foreignKey: "externalReferenceId"});
649
+ JukeboxQueueEntry.belongsTo(GuestUser, { as: "trackAddedGuestUser", foreignKey: "trackAddedGuestUserId"});
650
+ GuestUser.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "trackAddedGuestUserId"});
601
651
  JukeboxSession.belongsTo(JukeboxAccessType, { as: "accessType", foreignKey: "accessTypeId"});
602
652
  JukeboxAccessType.hasMany(JukeboxSession, { as: "jukeboxSessions", foreignKey: "accessTypeId"});
603
653
  JukeboxUser.belongsTo(JukeboxQueueEntry, { as: "pausedQueueEntry", foreignKey: "pausedQueueEntryId"});
604
654
  JukeboxQueueEntry.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "pausedQueueEntryId"});
605
655
  JukeboxSession.belongsTo(JukeboxQueueMode, { as: "jukeboxQueueMode", foreignKey: "jukeboxQueueModeId"});
606
656
  JukeboxQueueMode.hasMany(JukeboxSession, { as: "jukeboxSessions", foreignKey: "jukeboxQueueModeId"});
657
+ GuestUser.belongsTo(JukeboxSession, { as: "jukeboxSession", foreignKey: "jukeboxSessionId"});
658
+ JukeboxSession.hasMany(GuestUser, { as: "guestUsers", foreignKey: "jukeboxSessionId"});
607
659
  JukeboxCanonGenreRelation.belongsTo(JukeboxSession, { as: "jukeboxSession", foreignKey: "jukeboxSessionId"});
608
660
  JukeboxSession.hasMany(JukeboxCanonGenreRelation, { as: "jukeboxCanonGenreRelations", foreignKey: "jukeboxSessionId"});
609
661
  JukeboxInvite.belongsTo(JukeboxSession, { as: "jukeboxSession", foreignKey: "jukeboxSessionId"});
@@ -622,6 +674,16 @@ export function initModels(sequelize: Sequelize) {
622
674
  JukeboxType.hasMany(JukeboxSession, { as: "jukeboxSessions", foreignKey: "typeId"});
623
675
  JukeboxUser.belongsTo(JukeboxUserType, { as: "jukeboxUserType", foreignKey: "jukeboxUserTypeId"});
624
676
  JukeboxUserType.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "jukeboxUserTypeId"});
677
+ MerchItem.belongsTo(MerchPlatform, { as: "merchPlatform", foreignKey: "merchPlatformId"});
678
+ MerchPlatform.hasMany(MerchItem, { as: "merchItems", foreignKey: "merchPlatformId"});
679
+ MerchOrchestration.belongsTo(MerchPlatform, { as: "merchPlatform", foreignKey: "merchPlatformId"});
680
+ MerchPlatform.hasMany(MerchOrchestration, { as: "merchOrchestrations", foreignKey: "merchPlatformId"});
681
+ MerchItem.belongsTo(MerchType, { as: "merchType", foreignKey: "merchTypeId"});
682
+ MerchType.hasMany(MerchItem, { as: "merchItems", foreignKey: "merchTypeId"});
683
+ MerchOrchestration.belongsTo(MerchType, { as: "merchType", foreignKey: "merchTypeId"});
684
+ MerchType.hasMany(MerchOrchestration, { as: "merchOrchestrations", foreignKey: "merchTypeId"});
685
+ NewsArticle.belongsTo(NewsPlatform, { as: "newsPlatform", foreignKey: "newsPlatformId"});
686
+ NewsPlatform.hasMany(NewsArticle, { as: "newsArticles", foreignKey: "newsPlatformId"});
625
687
  Notification.belongsTo(NotificationType, { as: "notificationType", foreignKey: "notificationTypeId"});
626
688
  NotificationType.hasMany(Notification, { as: "notifications", foreignKey: "notificationTypeId"});
627
689
  JukeboxUser.belongsTo(PauseStatusType, { as: "pauseStatusType", foreignKey: "pauseStatusTypeId"});
@@ -686,6 +748,8 @@ export function initModels(sequelize: Sequelize) {
686
748
  PlatformGenre.hasMany(PlatformTrackGenreRelation, { as: "platformTrackGenreRelations", foreignKey: "platformGenreId"});
687
749
  CanonToPlatformTrackRelation.belongsTo(PlatformTrack, { as: "platformTrack", foreignKey: "platformTrackId"});
688
750
  PlatformTrack.hasMany(CanonToPlatformTrackRelation, { as: "canonToPlatformTrackRelations", foreignKey: "platformTrackId"});
751
+ JukeboxQueueEntry.belongsTo(PlatformTrack, { as: "platformTrack", foreignKey: "platformTrackId"});
752
+ PlatformTrack.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "platformTrackId"});
689
753
  PlatformAlbumTrackRelation.belongsTo(PlatformTrack, { as: "platformTrack", foreignKey: "platformTrackId"});
690
754
  PlatformTrack.hasMany(PlatformAlbumTrackRelation, { as: "platformAlbumTrackRelations", foreignKey: "platformTrackId"});
691
755
  PlatformArtistTrackRelation.belongsTo(PlatformTrack, { as: "platformTrack", foreignKey: "platformTrackId"});
@@ -700,8 +764,8 @@ export function initModels(sequelize: Sequelize) {
700
764
  PlatformUserAlbum.hasMany(PlatformUserAlbumTrack, { as: "platformUserAlbumTracks", foreignKey: "platformUserAlbumId"});
701
765
  PlatformUserPlaylistTrack.belongsTo(PlatformUserPlaylist, { as: "platformUserPlaylist", foreignKey: "platformUserPlaylistId"});
702
766
  PlatformUserPlaylist.hasMany(PlatformUserPlaylistTrack, { as: "platformUserPlaylistTracks", foreignKey: "platformUserPlaylistId"});
703
- JukeboxQueueEntry.belongsTo(PlaybackStatusType, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
704
- PlaybackStatusType.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
767
+ JukeboxQueueEntry.belongsTo(PlaybackStatus, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
768
+ PlaybackStatus.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
705
769
  RadioShowGenres.belongsTo(RadioShow, { as: "radioShow", foreignKey: "radioShowId"});
706
770
  RadioShow.hasMany(RadioShowGenres, { as: "radioShowGenres", foreignKey: "radioShowId"});
707
771
  RadioShowMedia.belongsTo(RadioShow, { as: "radioShow", foreignKey: "radioShowId"});
@@ -751,6 +815,7 @@ export function initModels(sequelize: Sequelize) {
751
815
  CanonTrack: CanonTrack,
752
816
  ConfigParam: ConfigParam,
753
817
  ExternalReference: ExternalReference,
818
+ GuestUser: GuestUser,
754
819
  JukeboxAccessType: JukeboxAccessType,
755
820
  JukeboxCanonGenreRelation: JukeboxCanonGenreRelation,
756
821
  JukeboxInvite: JukeboxInvite,
@@ -764,8 +829,14 @@ export function initModels(sequelize: Sequelize) {
764
829
  JukeboxUserType: JukeboxUserType,
765
830
  KnexMigrations: KnexMigrations,
766
831
  KnexMigrationsLock: KnexMigrationsLock,
832
+ MerchItem: MerchItem,
833
+ MerchOrchestration: MerchOrchestration,
834
+ MerchPlatform: MerchPlatform,
835
+ MerchType: MerchType,
767
836
  MetricsDaily: MetricsDaily,
768
837
  MetricsEvent: MetricsEvent,
838
+ NewsArticle: NewsArticle,
839
+ NewsPlatform: NewsPlatform,
769
840
  NewsSite: NewsSite,
770
841
  Notification: Notification,
771
842
  NotificationType: NotificationType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earbug/db-models",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "main": "dist/init-models.js",
5
5
  "types": "dist/init-models.d.ts",
6
6
  "scripts": {
package/.env DELETED
@@ -1,5 +0,0 @@
1
- PG_HOST=localhost
2
- PG_PORT=6432
3
- PG_USER=postgres
4
- PG_PASSWORD=
5
- PG_DATABASE=earbug_live