@earbug/db-models 0.0.9 → 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.
@@ -0,0 +1,103 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { CanonTrack, CanonTrackId } from './CanonTrack';
4
+ import type { RadioShow, RadioShowId } from './RadioShow';
5
+
6
+ export interface RadioShowPlacementAttributes {
7
+ radioShowId: string;
8
+ canonTrackId?: string;
9
+ radioShowMediaId?: string;
10
+ seqNum: number;
11
+ startTime?: string;
12
+ endTime?: string;
13
+ id: string;
14
+ }
15
+
16
+ export type RadioShowPlacementPk = "id";
17
+ export type RadioShowPlacementId = RadioShowPlacement[RadioShowPlacementPk];
18
+ export type RadioShowPlacementOptionalAttributes = "canonTrackId" | "radioShowMediaId" | "startTime" | "endTime" | "id";
19
+ export type RadioShowPlacementCreationAttributes = Optional<RadioShowPlacementAttributes, RadioShowPlacementOptionalAttributes>;
20
+
21
+ export class RadioShowPlacement extends Model<RadioShowPlacementAttributes, RadioShowPlacementCreationAttributes> implements RadioShowPlacementAttributes {
22
+ radioShowId!: string;
23
+ canonTrackId?: string;
24
+ radioShowMediaId?: string;
25
+ seqNum!: number;
26
+ startTime?: string;
27
+ endTime?: string;
28
+ id!: string;
29
+
30
+ // RadioShowPlacement belongsTo CanonTrack via canonTrackId
31
+ canonTrack!: CanonTrack;
32
+ getCanonTrack!: Sequelize.BelongsToGetAssociationMixin<CanonTrack>;
33
+ setCanonTrack!: Sequelize.BelongsToSetAssociationMixin<CanonTrack, CanonTrackId>;
34
+ createCanonTrack!: Sequelize.BelongsToCreateAssociationMixin<CanonTrack>;
35
+ // RadioShowPlacement belongsTo RadioShow via radioShowId
36
+ radioShow!: RadioShow;
37
+ getRadioShow!: Sequelize.BelongsToGetAssociationMixin<RadioShow>;
38
+ setRadioShow!: Sequelize.BelongsToSetAssociationMixin<RadioShow, RadioShowId>;
39
+ createRadioShow!: Sequelize.BelongsToCreateAssociationMixin<RadioShow>;
40
+
41
+ static initModel(sequelize: Sequelize.Sequelize): typeof RadioShowPlacement {
42
+ return RadioShowPlacement.init({
43
+ radioShowId: {
44
+ type: DataTypes.UUID,
45
+ allowNull: false,
46
+ references: {
47
+ model: 'radio_show',
48
+ key: 'id'
49
+ },
50
+ field: 'radio_show_id'
51
+ },
52
+ canonTrackId: {
53
+ type: DataTypes.UUID,
54
+ allowNull: true,
55
+ references: {
56
+ model: 'canon_track',
57
+ key: 'id'
58
+ },
59
+ field: 'canon_track_id'
60
+ },
61
+ radioShowMediaId: {
62
+ type: DataTypes.UUID,
63
+ allowNull: true,
64
+ field: 'radio_show_media_id'
65
+ },
66
+ seqNum: {
67
+ type: DataTypes.INTEGER,
68
+ allowNull: false,
69
+ field: 'seq_num'
70
+ },
71
+ startTime: {
72
+ type: DataTypes.TIME,
73
+ allowNull: true,
74
+ field: 'start_time'
75
+ },
76
+ endTime: {
77
+ type: DataTypes.TIME,
78
+ allowNull: true,
79
+ field: 'end_time'
80
+ },
81
+ id: {
82
+ type: DataTypes.UUID,
83
+ allowNull: false,
84
+ defaultValue: DataTypes.UUIDV4,
85
+ primaryKey: true
86
+ }
87
+ }, {
88
+ sequelize,
89
+ tableName: 'radio_show_placement',
90
+ schema: 'eb',
91
+ timestamps: false,
92
+ indexes: [
93
+ {
94
+ name: "radio_show_placement_pkey",
95
+ unique: true,
96
+ fields: [
97
+ { name: "id" },
98
+ ]
99
+ },
100
+ ]
101
+ });
102
+ }
103
+ }
@@ -0,0 +1,80 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { RadioShow, RadioShowId } from './RadioShow';
4
+
5
+ export interface RadioShowPublishRequestsAttributes {
6
+ radioShowId: string;
7
+ approved?: boolean;
8
+ id: string;
9
+ createDate: Date;
10
+ updateDate: Date;
11
+ }
12
+
13
+ export type RadioShowPublishRequestsPk = "id";
14
+ export type RadioShowPublishRequestsId = RadioShowPublishRequests[RadioShowPublishRequestsPk];
15
+ export type RadioShowPublishRequestsOptionalAttributes = "approved" | "id" | "createDate" | "updateDate";
16
+ export type RadioShowPublishRequestsCreationAttributes = Optional<RadioShowPublishRequestsAttributes, RadioShowPublishRequestsOptionalAttributes>;
17
+
18
+ export class RadioShowPublishRequests extends Model<RadioShowPublishRequestsAttributes, RadioShowPublishRequestsCreationAttributes> implements RadioShowPublishRequestsAttributes {
19
+ radioShowId!: string;
20
+ approved?: boolean;
21
+ id!: string;
22
+ createDate!: Date;
23
+ updateDate!: Date;
24
+
25
+ // RadioShowPublishRequests belongsTo RadioShow via radioShowId
26
+ radioShow!: RadioShow;
27
+ getRadioShow!: Sequelize.BelongsToGetAssociationMixin<RadioShow>;
28
+ setRadioShow!: Sequelize.BelongsToSetAssociationMixin<RadioShow, RadioShowId>;
29
+ createRadioShow!: Sequelize.BelongsToCreateAssociationMixin<RadioShow>;
30
+
31
+ static initModel(sequelize: Sequelize.Sequelize): typeof RadioShowPublishRequests {
32
+ return RadioShowPublishRequests.init({
33
+ radioShowId: {
34
+ type: DataTypes.UUID,
35
+ allowNull: false,
36
+ references: {
37
+ model: 'radio_show',
38
+ key: 'id'
39
+ },
40
+ field: 'radio_show_id'
41
+ },
42
+ approved: {
43
+ type: DataTypes.BOOLEAN,
44
+ allowNull: true
45
+ },
46
+ id: {
47
+ type: DataTypes.UUID,
48
+ allowNull: false,
49
+ defaultValue: DataTypes.UUIDV4,
50
+ primaryKey: true
51
+ },
52
+ createDate: {
53
+ type: DataTypes.DATE,
54
+ allowNull: false,
55
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
56
+ field: 'create_date'
57
+ },
58
+ updateDate: {
59
+ type: DataTypes.DATE,
60
+ allowNull: false,
61
+ defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
62
+ field: 'update_date'
63
+ }
64
+ }, {
65
+ sequelize,
66
+ tableName: 'radio_show_publish_requests',
67
+ schema: 'eb',
68
+ timestamps: false,
69
+ indexes: [
70
+ {
71
+ name: "radio_show_publish_requests_pkey",
72
+ unique: true,
73
+ fields: [
74
+ { name: "id" },
75
+ ]
76
+ },
77
+ ]
78
+ });
79
+ }
80
+ }
@@ -131,6 +131,16 @@ import { PlaybackStatus as _PlaybackStatus } from "./PlaybackStatus";
131
131
  import type { PlaybackStatusAttributes, PlaybackStatusCreationAttributes } from "./PlaybackStatus";
132
132
  import { PlaybackStatusType as _PlaybackStatusType } from "./PlaybackStatusType";
133
133
  import type { PlaybackStatusTypeAttributes, PlaybackStatusTypeCreationAttributes } from "./PlaybackStatusType";
134
+ import { RadioShow as _RadioShow } from "./RadioShow";
135
+ import type { RadioShowAttributes, RadioShowCreationAttributes } from "./RadioShow";
136
+ import { RadioShowGenres as _RadioShowGenres } from "./RadioShowGenres";
137
+ import type { RadioShowGenresAttributes, RadioShowGenresCreationAttributes } from "./RadioShowGenres";
138
+ import { RadioShowMedia as _RadioShowMedia } from "./RadioShowMedia";
139
+ import type { RadioShowMediaAttributes, RadioShowMediaCreationAttributes } from "./RadioShowMedia";
140
+ import { RadioShowPlacement as _RadioShowPlacement } from "./RadioShowPlacement";
141
+ import type { RadioShowPlacementAttributes, RadioShowPlacementCreationAttributes } from "./RadioShowPlacement";
142
+ import { RadioShowPublishRequests as _RadioShowPublishRequests } from "./RadioShowPublishRequests";
143
+ import type { RadioShowPublishRequestsAttributes, RadioShowPublishRequestsCreationAttributes } from "./RadioShowPublishRequests";
134
144
  import { State as _State } from "./State";
135
145
  import type { StateAttributes, StateCreationAttributes } from "./State";
136
146
  import { TrackDeletionReason as _TrackDeletionReason } from "./TrackDeletionReason";
@@ -209,6 +219,11 @@ export {
209
219
  _PlatformUserPlaylistTrack as PlatformUserPlaylistTrack,
210
220
  _PlaybackStatus as PlaybackStatus,
211
221
  _PlaybackStatusType as PlaybackStatusType,
222
+ _RadioShow as RadioShow,
223
+ _RadioShowGenres as RadioShowGenres,
224
+ _RadioShowMedia as RadioShowMedia,
225
+ _RadioShowPlacement as RadioShowPlacement,
226
+ _RadioShowPublishRequests as RadioShowPublishRequests,
212
227
  _State as State,
213
228
  _TrackDeletionReason as TrackDeletionReason,
214
229
  _UnmatchedAlbum as UnmatchedAlbum,
@@ -349,6 +364,16 @@ export type {
349
364
  PlaybackStatusCreationAttributes,
350
365
  PlaybackStatusTypeAttributes,
351
366
  PlaybackStatusTypeCreationAttributes,
367
+ RadioShowAttributes,
368
+ RadioShowCreationAttributes,
369
+ RadioShowGenresAttributes,
370
+ RadioShowGenresCreationAttributes,
371
+ RadioShowMediaAttributes,
372
+ RadioShowMediaCreationAttributes,
373
+ RadioShowPlacementAttributes,
374
+ RadioShowPlacementCreationAttributes,
375
+ RadioShowPublishRequestsAttributes,
376
+ RadioShowPublishRequestsCreationAttributes,
352
377
  StateAttributes,
353
378
  StateCreationAttributes,
354
379
  TrackDeletionReasonAttributes,
@@ -428,6 +453,11 @@ export function initModels(sequelize: Sequelize) {
428
453
  const PlatformUserPlaylistTrack = _PlatformUserPlaylistTrack.initModel(sequelize);
429
454
  const PlaybackStatus = _PlaybackStatus.initModel(sequelize);
430
455
  const PlaybackStatusType = _PlaybackStatusType.initModel(sequelize);
456
+ const RadioShow = _RadioShow.initModel(sequelize);
457
+ const RadioShowGenres = _RadioShowGenres.initModel(sequelize);
458
+ const RadioShowMedia = _RadioShowMedia.initModel(sequelize);
459
+ const RadioShowPlacement = _RadioShowPlacement.initModel(sequelize);
460
+ const RadioShowPublishRequests = _RadioShowPublishRequests.initModel(sequelize);
431
461
  const State = _State.initModel(sequelize);
432
462
  const TrackDeletionReason = _TrackDeletionReason.initModel(sequelize);
433
463
  const UnmatchedAlbum = _UnmatchedAlbum.initModel(sequelize);
@@ -502,6 +532,8 @@ export function initModels(sequelize: Sequelize) {
502
532
  AppUser.hasMany(PlatformUserAlbum, { as: "platformUserAlbums", foreignKey: "appUserId"});
503
533
  PlatformUserPlaylist.belongsTo(AppUser, { as: "appUser", foreignKey: "appUserId"});
504
534
  AppUser.hasMany(PlatformUserPlaylist, { as: "platformUserPlaylists", foreignKey: "appUserId"});
535
+ RadioShow.belongsTo(AppUser, { as: "creatorUser", foreignKey: "creatorUserId"});
536
+ AppUser.hasMany(RadioShow, { as: "radioShows", foreignKey: "creatorUserId"});
505
537
  UserContacts.belongsTo(AppUser, { as: "appUser", foreignKey: "appUserId"});
506
538
  AppUser.hasMany(UserContacts, { as: "userContacts", foreignKey: "appUserId"});
507
539
  CanonAlbumExternalReferenceRelation.belongsTo(CanonAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
@@ -530,6 +562,8 @@ export function initModels(sequelize: Sequelize) {
530
562
  CanonGenre.hasMany(CanonToPlatformGenreRelation, { as: "canonToPlatformGenreRelations", foreignKey: "canonGenreId"});
531
563
  JukeboxCanonGenreRelation.belongsTo(CanonGenre, { as: "canonGenre", foreignKey: "canonGenreId"});
532
564
  CanonGenre.hasMany(JukeboxCanonGenreRelation, { as: "jukeboxCanonGenreRelations", foreignKey: "canonGenreId"});
565
+ RadioShowGenres.belongsTo(CanonGenre, { as: "canonGenre", foreignKey: "canonGenreId"});
566
+ CanonGenre.hasMany(RadioShowGenres, { as: "radioShowGenres", foreignKey: "canonGenreId"});
533
567
  CanonAlbumLabelRelation.belongsTo(CanonLabel, { as: "canonLabel", foreignKey: "canonLabelId"});
534
568
  CanonLabel.hasMany(CanonAlbumLabelRelation, { as: "canonAlbumLabelRelations", foreignKey: "canonLabelId"});
535
569
  CanonLabelExternalReferenceRelation.belongsTo(CanonLabel, { as: "canonLabel", foreignKey: "canonLabelId"});
@@ -546,6 +580,8 @@ export function initModels(sequelize: Sequelize) {
546
580
  CanonTrack.hasMany(CanonToPlatformTrackRelation, { as: "canonToPlatformTrackRelations", foreignKey: "canonTrackId"});
547
581
  JukeboxQueueEntry.belongsTo(CanonTrack, { as: "track", foreignKey: "trackId"});
548
582
  CanonTrack.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "trackId"});
583
+ RadioShowPlacement.belongsTo(CanonTrack, { as: "canonTrack", foreignKey: "canonTrackId"});
584
+ CanonTrack.hasMany(RadioShowPlacement, { as: "radioShowPlacements", foreignKey: "canonTrackId"});
549
585
  CanonAlbumExternalReferenceRelation.belongsTo(ExternalReference, { as: "externalReference", foreignKey: "externalReferenceId"});
550
586
  ExternalReference.hasMany(CanonAlbumExternalReferenceRelation, { as: "canonAlbumExternalReferenceRelations", foreignKey: "externalReferenceId"});
551
587
  CanonArtistExternalReferenceRelation.belongsTo(ExternalReference, { as: "externalReference", foreignKey: "externalReferenceId"});
@@ -660,6 +696,14 @@ export function initModels(sequelize: Sequelize) {
660
696
  PlatformUserPlaylist.hasMany(PlatformUserPlaylistTrack, { as: "platformUserPlaylistTracks", foreignKey: "platformUserPlaylistId"});
661
697
  JukeboxQueueEntry.belongsTo(PlaybackStatusType, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
662
698
  PlaybackStatusType.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
699
+ RadioShowGenres.belongsTo(RadioShow, { as: "radioShow", foreignKey: "radioShowId"});
700
+ RadioShow.hasMany(RadioShowGenres, { as: "radioShowGenres", foreignKey: "radioShowId"});
701
+ RadioShowMedia.belongsTo(RadioShow, { as: "radioShow", foreignKey: "radioShowId"});
702
+ RadioShow.hasMany(RadioShowMedia, { as: "radioShowMedia", foreignKey: "radioShowId"});
703
+ RadioShowPlacement.belongsTo(RadioShow, { as: "radioShow", foreignKey: "radioShowId"});
704
+ RadioShow.hasMany(RadioShowPlacement, { as: "radioShowPlacements", foreignKey: "radioShowId"});
705
+ RadioShowPublishRequests.belongsTo(RadioShow, { as: "radioShow", foreignKey: "radioShowId"});
706
+ RadioShow.hasMany(RadioShowPublishRequests, { as: "radioShowPublishRequests", foreignKey: "radioShowId"});
663
707
  AppUser.belongsTo(State, { as: "state", foreignKey: "stateId"});
664
708
  State.hasMany(AppUser, { as: "appUsers", foreignKey: "stateId"});
665
709
  PlatformUserPlaylist.belongsTo(State, { as: "state", foreignKey: "stateId"});
@@ -736,6 +780,11 @@ export function initModels(sequelize: Sequelize) {
736
780
  PlatformUserPlaylistTrack: PlatformUserPlaylistTrack,
737
781
  PlaybackStatus: PlaybackStatus,
738
782
  PlaybackStatusType: PlaybackStatusType,
783
+ RadioShow: RadioShow,
784
+ RadioShowGenres: RadioShowGenres,
785
+ RadioShowMedia: RadioShowMedia,
786
+ RadioShowPlacement: RadioShowPlacement,
787
+ RadioShowPublishRequests: RadioShowPublishRequests,
739
788
  State: State,
740
789
  TrackDeletionReason: TrackDeletionReason,
741
790
  UnmatchedAlbum: UnmatchedAlbum,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earbug/db-models",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "main": "dist/init-models.js",
5
5
  "types": "dist/init-models.d.ts",
6
6
  "scripts": {