@earbug/db-models 0.0.7 → 0.0.9

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 (138) hide show
  1. package/dist/AppUser.d.ts +28 -5
  2. package/dist/AppUser.js +13 -13
  3. package/dist/AppUserDevice.d.ts +4 -4
  4. package/dist/AppUserDevice.js +8 -8
  5. package/dist/AppUserFollowRelation.d.ts +3 -3
  6. package/dist/AppUserFollowRelation.js +6 -6
  7. package/dist/AppUserPlatformRelation.d.ts +7 -7
  8. package/dist/AppUserPlatformRelation.js +18 -18
  9. package/dist/CanonAlbum.d.ts +5 -5
  10. package/dist/CanonAlbum.js +10 -10
  11. package/dist/CanonAlbumImageHarvested.d.ts +9 -9
  12. package/dist/CanonAlbumImageHarvested.js +24 -32
  13. package/dist/CanonArtist.d.ts +3 -3
  14. package/dist/CanonArtist.js +6 -6
  15. package/dist/CanonArtistImageHarvested.d.ts +9 -9
  16. package/dist/CanonArtistImageHarvested.js +24 -24
  17. package/dist/CanonGenre.d.ts +3 -3
  18. package/dist/CanonGenre.js +6 -6
  19. package/dist/CanonLabel.d.ts +2 -2
  20. package/dist/CanonLabel.js +6 -6
  21. package/dist/CanonMember.d.ts +3 -3
  22. package/dist/CanonMember.js +6 -6
  23. package/dist/CanonMemberExternalReferenceRelation.d.ts +2 -2
  24. package/dist/CanonMemberExternalReferenceRelation.js +5 -5
  25. package/dist/CanonTrack.d.ts +5 -5
  26. package/dist/CanonTrack.js +11 -11
  27. package/dist/ConfigParam.d.ts +2 -2
  28. package/dist/ConfigParam.js +5 -5
  29. package/dist/ExternalReference.d.ts +2 -2
  30. package/dist/ExternalReference.js +5 -5
  31. package/dist/JukeboxAccessType.d.ts +2 -2
  32. package/dist/JukeboxAccessType.js +4 -4
  33. package/dist/JukeboxCanonGenreRelation.d.ts +2 -2
  34. package/dist/JukeboxCanonGenreRelation.js +6 -6
  35. package/dist/JukeboxInvite.d.ts +3 -3
  36. package/dist/JukeboxInvite.js +6 -6
  37. package/dist/JukeboxQueueEntry.d.ts +10 -10
  38. package/dist/JukeboxQueueEntry.js +12 -12
  39. package/dist/JukeboxQueueMode.d.ts +2 -2
  40. package/dist/JukeboxQueueMode.js +4 -4
  41. package/dist/JukeboxSession.d.ts +21 -9
  42. package/dist/JukeboxSession.js +20 -20
  43. package/dist/JukeboxTerminationCondition.d.ts +2 -2
  44. package/dist/JukeboxTerminationCondition.js +4 -4
  45. package/dist/JukeboxType.d.ts +2 -2
  46. package/dist/JukeboxType.js +4 -4
  47. package/dist/JukeboxUser.d.ts +7 -7
  48. package/dist/JukeboxUser.js +20 -20
  49. package/dist/KnexMigrations.d.ts +3 -3
  50. package/dist/KnexMigrations.js +6 -6
  51. package/dist/KnexMigrationsLock.d.ts +3 -3
  52. package/dist/KnexMigrationsLock.js +5 -5
  53. package/dist/MetricsDaily.d.ts +3 -3
  54. package/dist/MetricsDaily.js +4 -4
  55. package/dist/NewsSite.d.ts +3 -3
  56. package/dist/NewsSite.js +6 -6
  57. package/dist/Notification.d.ts +62 -0
  58. package/dist/Notification.js +163 -0
  59. package/dist/NotificationType.d.ts +26 -0
  60. package/dist/NotificationType.js +42 -0
  61. package/dist/Platform.d.ts +2 -2
  62. package/dist/Platform.js +7 -7
  63. package/dist/PlatformAlbum.d.ts +5 -5
  64. package/dist/PlatformAlbum.js +10 -10
  65. package/dist/PlatformArtist.d.ts +5 -5
  66. package/dist/PlatformArtist.js +10 -10
  67. package/dist/PlatformGenre.d.ts +2 -2
  68. package/dist/PlatformGenre.js +6 -6
  69. package/dist/PlatformTrack.d.ts +3 -3
  70. package/dist/PlatformTrack.js +6 -6
  71. package/dist/PlatformUserAlbum.d.ts +2 -2
  72. package/dist/PlatformUserAlbum.js +6 -6
  73. package/dist/PlatformUserAlbumTrack.d.ts +4 -4
  74. package/dist/PlatformUserAlbumTrack.js +11 -11
  75. package/dist/PlatformUserPlaylist.d.ts +5 -5
  76. package/dist/PlatformUserPlaylist.js +11 -11
  77. package/dist/PlatformUserPlaylistTrack.d.ts +7 -7
  78. package/dist/PlatformUserPlaylistTrack.js +17 -17
  79. package/dist/PlaybackStatus.d.ts +2 -14
  80. package/dist/PlaybackStatus.js +4 -4
  81. package/dist/PlaybackStatusType.d.ts +12 -0
  82. package/dist/State.d.ts +2 -2
  83. package/dist/State.js +4 -4
  84. package/dist/UnmatchedAlbum.d.ts +2 -2
  85. package/dist/UnmatchedAlbum.js +6 -6
  86. package/dist/UnmatchedArtist.d.ts +2 -2
  87. package/dist/UnmatchedArtist.js +6 -6
  88. package/dist/UserContacts.d.ts +3 -3
  89. package/dist/UserContacts.js +7 -7
  90. package/dist/init-models.d.ts +8 -2
  91. package/dist/init-models.js +20 -4
  92. package/models/AppUser.ts +43 -18
  93. package/models/AppUserDevice.ts +12 -12
  94. package/models/AppUserFollowRelation.ts +9 -9
  95. package/models/AppUserPlatformRelation.ts +25 -25
  96. package/models/CanonAlbum.ts +15 -15
  97. package/models/CanonAlbumImageHarvested.ts +33 -41
  98. package/models/CanonArtist.ts +9 -9
  99. package/models/CanonArtistImageHarvested.ts +33 -33
  100. package/models/CanonGenre.ts +9 -9
  101. package/models/CanonLabel.ts +8 -8
  102. package/models/CanonMember.ts +9 -9
  103. package/models/CanonMemberExternalReferenceRelation.ts +7 -7
  104. package/models/CanonTrack.ts +16 -16
  105. package/models/ConfigParam.ts +7 -7
  106. package/models/ExternalReference.ts +7 -7
  107. package/models/JukeboxAccessType.ts +6 -6
  108. package/models/JukeboxCanonGenreRelation.ts +8 -8
  109. package/models/JukeboxInvite.ts +9 -9
  110. package/models/JukeboxQueueEntry.ts +23 -23
  111. package/models/JukeboxQueueMode.ts +6 -6
  112. package/models/JukeboxSession.ts +42 -29
  113. package/models/JukeboxTerminationCondition.ts +6 -6
  114. package/models/JukeboxType.ts +6 -6
  115. package/models/JukeboxUser.ts +27 -27
  116. package/models/KnexMigrations.ts +9 -9
  117. package/models/KnexMigrationsLock.ts +8 -8
  118. package/models/MetricsDaily.ts +7 -7
  119. package/models/NewsSite.ts +9 -9
  120. package/models/Notification.ts +202 -0
  121. package/models/NotificationType.ts +66 -0
  122. package/models/Platform.ts +9 -9
  123. package/models/PlatformAlbum.ts +15 -15
  124. package/models/PlatformArtist.ts +15 -15
  125. package/models/PlatformGenre.ts +8 -8
  126. package/models/PlatformTrack.ts +9 -9
  127. package/models/PlatformUserAlbum.ts +8 -8
  128. package/models/PlatformUserAlbumTrack.ts +15 -15
  129. package/models/PlatformUserPlaylist.ts +16 -16
  130. package/models/PlatformUserPlaylistTrack.ts +24 -24
  131. package/models/PlaybackStatus.ts +6 -19
  132. package/models/PlaybackStatusType.ts +13 -0
  133. package/models/State.ts +6 -6
  134. package/models/UnmatchedAlbum.ts +8 -8
  135. package/models/UnmatchedArtist.ts +8 -8
  136. package/models/UserContacts.ts +10 -10
  137. package/models/init-models.ts +24 -2
  138. package/package.json +1 -1
@@ -5,14 +5,14 @@ import type { PlatformTrack, PlatformTrackId } from './PlatformTrack';
5
5
  import type { PlatformUserAlbum, PlatformUserAlbumId } from './PlatformUserAlbum';
6
6
 
7
7
  export interface PlatformUserAlbumTrackAttributes {
8
- id: string;
9
8
  platformUserAlbumId: string;
10
9
  platformId: number;
11
10
  externalUserAlbumTrackId: string;
12
11
  platformTrackId: string;
12
+ stateId: number;
13
+ id: string;
13
14
  createdAt: Date;
14
15
  updatedAt: Date;
15
- stateId: number;
16
16
  }
17
17
 
18
18
  export type PlatformUserAlbumTrackPk = "id";
@@ -21,14 +21,14 @@ export type PlatformUserAlbumTrackOptionalAttributes = "id" | "createdAt" | "upd
21
21
  export type PlatformUserAlbumTrackCreationAttributes = Optional<PlatformUserAlbumTrackAttributes, PlatformUserAlbumTrackOptionalAttributes>;
22
22
 
23
23
  export class PlatformUserAlbumTrack extends Model<PlatformUserAlbumTrackAttributes, PlatformUserAlbumTrackCreationAttributes> implements PlatformUserAlbumTrackAttributes {
24
- id!: string;
25
24
  platformUserAlbumId!: string;
26
25
  platformId!: number;
27
26
  externalUserAlbumTrackId!: string;
28
27
  platformTrackId!: string;
28
+ stateId!: number;
29
+ id!: string;
29
30
  createdAt!: Date;
30
31
  updatedAt!: Date;
31
- stateId!: number;
32
32
 
33
33
  // PlatformUserAlbumTrack belongsTo Platform via platformId
34
34
  platform!: Platform;
@@ -48,12 +48,6 @@ export class PlatformUserAlbumTrack extends Model<PlatformUserAlbumTrackAttribut
48
48
 
49
49
  static initModel(sequelize: Sequelize.Sequelize): typeof PlatformUserAlbumTrack {
50
50
  return PlatformUserAlbumTrack.init({
51
- id: {
52
- type: DataTypes.UUID,
53
- allowNull: false,
54
- defaultValue: DataTypes.UUIDV4,
55
- primaryKey: true
56
- },
57
51
  platformUserAlbumId: {
58
52
  type: DataTypes.UUID,
59
53
  allowNull: false,
@@ -88,6 +82,17 @@ export class PlatformUserAlbumTrack extends Model<PlatformUserAlbumTrackAttribut
88
82
  unique: "platform_user_album_track_platform_user_album_id_platform_track",
89
83
  field: 'platform_track_id'
90
84
  },
85
+ stateId: {
86
+ type: DataTypes.SMALLINT,
87
+ allowNull: false,
88
+ field: 'state_id'
89
+ },
90
+ id: {
91
+ type: DataTypes.UUID,
92
+ allowNull: false,
93
+ defaultValue: DataTypes.UUIDV4,
94
+ primaryKey: true
95
+ },
91
96
  createdAt: {
92
97
  type: DataTypes.DATE,
93
98
  allowNull: false,
@@ -99,11 +104,6 @@ export class PlatformUserAlbumTrack extends Model<PlatformUserAlbumTrackAttribut
99
104
  allowNull: false,
100
105
  defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
101
106
  field: 'updated_at'
102
- },
103
- stateId: {
104
- type: DataTypes.SMALLINT,
105
- allowNull: false,
106
- field: 'state_id'
107
107
  }
108
108
  }, {
109
109
  sequelize,
@@ -6,14 +6,14 @@ import type { PlatformUserPlaylistTrack, PlatformUserPlaylistTrackId } from './P
6
6
  import type { State, StateId } from './State';
7
7
 
8
8
  export interface PlatformUserPlaylistAttributes {
9
- id: string;
10
9
  appUserId: string;
11
10
  platformId: number;
12
11
  externalPlaylistId: string;
13
12
  name: string;
14
13
  description?: string;
15
- public?: boolean;
16
14
  snapshotId: string;
15
+ id: string;
16
+ public?: boolean;
17
17
  collaborative: boolean;
18
18
  createDate: Date;
19
19
  updateDate: Date;
@@ -22,18 +22,18 @@ export interface PlatformUserPlaylistAttributes {
22
22
 
23
23
  export type PlatformUserPlaylistPk = "id";
24
24
  export type PlatformUserPlaylistId = PlatformUserPlaylist[PlatformUserPlaylistPk];
25
- export type PlatformUserPlaylistOptionalAttributes = "id" | "description" | "public" | "createDate" | "updateDate" | "stateId";
25
+ export type PlatformUserPlaylistOptionalAttributes = "description" | "id" | "public" | "createDate" | "updateDate" | "stateId";
26
26
  export type PlatformUserPlaylistCreationAttributes = Optional<PlatformUserPlaylistAttributes, PlatformUserPlaylistOptionalAttributes>;
27
27
 
28
28
  export class PlatformUserPlaylist extends Model<PlatformUserPlaylistAttributes, PlatformUserPlaylistCreationAttributes> implements PlatformUserPlaylistAttributes {
29
- id!: string;
30
29
  appUserId!: string;
31
30
  platformId!: number;
32
31
  externalPlaylistId!: string;
33
32
  name!: string;
34
33
  description?: string;
35
- public?: boolean;
36
34
  snapshotId!: string;
35
+ id!: string;
36
+ public?: boolean;
37
37
  collaborative!: boolean;
38
38
  createDate!: Date;
39
39
  updateDate!: Date;
@@ -69,12 +69,6 @@ export class PlatformUserPlaylist extends Model<PlatformUserPlaylistAttributes,
69
69
 
70
70
  static initModel(sequelize: Sequelize.Sequelize): typeof PlatformUserPlaylist {
71
71
  return PlatformUserPlaylist.init({
72
- id: {
73
- type: DataTypes.UUID,
74
- allowNull: false,
75
- defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
76
- primaryKey: true
77
- },
78
72
  appUserId: {
79
73
  type: DataTypes.UUID,
80
74
  allowNull: false,
@@ -109,16 +103,22 @@ export class PlatformUserPlaylist extends Model<PlatformUserPlaylistAttributes,
109
103
  type: DataTypes.TEXT,
110
104
  allowNull: true
111
105
  },
112
- public: {
113
- type: DataTypes.BOOLEAN,
114
- allowNull: true,
115
- defaultValue: false
116
- },
117
106
  snapshotId: {
118
107
  type: DataTypes.TEXT,
119
108
  allowNull: false,
120
109
  field: 'snapshot_id'
121
110
  },
111
+ id: {
112
+ type: DataTypes.UUID,
113
+ allowNull: false,
114
+ defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
115
+ primaryKey: true
116
+ },
117
+ public: {
118
+ type: DataTypes.BOOLEAN,
119
+ allowNull: true,
120
+ defaultValue: false
121
+ },
122
122
  collaborative: {
123
123
  type: DataTypes.BOOLEAN,
124
124
  allowNull: false,
@@ -5,36 +5,36 @@ import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUse
5
5
  import type { State, StateId } from './State';
6
6
 
7
7
  export interface PlatformUserPlaylistTrackAttributes {
8
- id: string;
9
8
  platformTrackId: string;
10
9
  platformUserPlaylistId: string;
11
- trackPosition: number;
12
10
  addedDate?: Date;
13
11
  addedByPlatformUserId?: string;
12
+ externalPlaylistTrackId: string;
13
+ id: string;
14
+ trackPosition: number;
14
15
  isLocal: boolean;
15
16
  createDate: Date;
16
17
  updateDate: Date;
17
18
  stateId: number;
18
- externalPlaylistTrackId: string;
19
19
  }
20
20
 
21
21
  export type PlatformUserPlaylistTrackPk = "id";
22
22
  export type PlatformUserPlaylistTrackId = PlatformUserPlaylistTrack[PlatformUserPlaylistTrackPk];
23
- export type PlatformUserPlaylistTrackOptionalAttributes = "id" | "trackPosition" | "addedDate" | "addedByPlatformUserId" | "createDate" | "updateDate" | "stateId";
23
+ export type PlatformUserPlaylistTrackOptionalAttributes = "addedDate" | "addedByPlatformUserId" | "id" | "trackPosition" | "createDate" | "updateDate" | "stateId";
24
24
  export type PlatformUserPlaylistTrackCreationAttributes = Optional<PlatformUserPlaylistTrackAttributes, PlatformUserPlaylistTrackOptionalAttributes>;
25
25
 
26
26
  export class PlatformUserPlaylistTrack extends Model<PlatformUserPlaylistTrackAttributes, PlatformUserPlaylistTrackCreationAttributes> implements PlatformUserPlaylistTrackAttributes {
27
- id!: string;
28
27
  platformTrackId!: string;
29
28
  platformUserPlaylistId!: string;
30
- trackPosition!: number;
31
29
  addedDate?: Date;
32
30
  addedByPlatformUserId?: string;
31
+ externalPlaylistTrackId!: string;
32
+ id!: string;
33
+ trackPosition!: number;
33
34
  isLocal!: boolean;
34
35
  createDate!: Date;
35
36
  updateDate!: Date;
36
37
  stateId!: number;
37
- externalPlaylistTrackId!: string;
38
38
 
39
39
  // PlatformUserPlaylistTrack belongsTo PlatformTrack via platformTrackId
40
40
  platformTrack!: PlatformTrack;
@@ -54,12 +54,6 @@ export class PlatformUserPlaylistTrack extends Model<PlatformUserPlaylistTrackAt
54
54
 
55
55
  static initModel(sequelize: Sequelize.Sequelize): typeof PlatformUserPlaylistTrack {
56
56
  return PlatformUserPlaylistTrack.init({
57
- id: {
58
- type: DataTypes.UUID,
59
- allowNull: false,
60
- defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
61
- primaryKey: true
62
- },
63
57
  platformTrackId: {
64
58
  type: DataTypes.UUID,
65
59
  allowNull: false,
@@ -80,12 +74,6 @@ export class PlatformUserPlaylistTrack extends Model<PlatformUserPlaylistTrackAt
80
74
  unique: "uk_playlist_id_track_id",
81
75
  field: 'platform_user_playlist_id'
82
76
  },
83
- trackPosition: {
84
- type: DataTypes.INTEGER,
85
- allowNull: false,
86
- defaultValue: 0,
87
- field: 'track_position'
88
- },
89
77
  addedDate: {
90
78
  type: DataTypes.DATE,
91
79
  allowNull: true,
@@ -96,6 +84,23 @@ export class PlatformUserPlaylistTrack extends Model<PlatformUserPlaylistTrackAt
96
84
  allowNull: true,
97
85
  field: 'added_by_platform_user_id'
98
86
  },
87
+ externalPlaylistTrackId: {
88
+ type: DataTypes.STRING(255),
89
+ allowNull: false,
90
+ field: 'external_playlist_track_id'
91
+ },
92
+ id: {
93
+ type: DataTypes.UUID,
94
+ allowNull: false,
95
+ defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
96
+ primaryKey: true
97
+ },
98
+ trackPosition: {
99
+ type: DataTypes.INTEGER,
100
+ allowNull: false,
101
+ defaultValue: 0,
102
+ field: 'track_position'
103
+ },
99
104
  isLocal: {
100
105
  type: DataTypes.BOOLEAN,
101
106
  allowNull: false,
@@ -123,11 +128,6 @@ export class PlatformUserPlaylistTrack extends Model<PlatformUserPlaylistTrackAt
123
128
  key: 'id'
124
129
  },
125
130
  field: 'state_id'
126
- },
127
- externalPlaylistTrackId: {
128
- type: DataTypes.STRING(255),
129
- allowNull: false,
130
- field: 'external_playlist_track_id'
131
131
  }
132
132
  }, {
133
133
  sequelize,
@@ -1,10 +1,9 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { DataTypes, Model, Optional } from 'sequelize';
3
- import type { JukeboxQueueEntry, JukeboxQueueEntryId } from './JukeboxQueueEntry';
4
3
 
5
4
  export interface PlaybackStatusAttributes {
6
- id: number;
7
5
  description: string;
6
+ id: number;
8
7
  }
9
8
 
10
9
  export type PlaybackStatusPk = "id";
@@ -12,34 +11,22 @@ export type PlaybackStatusId = PlaybackStatus[PlaybackStatusPk];
12
11
  export type PlaybackStatusCreationAttributes = PlaybackStatusAttributes;
13
12
 
14
13
  export class PlaybackStatus extends Model<PlaybackStatusAttributes, PlaybackStatusCreationAttributes> implements PlaybackStatusAttributes {
15
- id!: number;
16
14
  description!: string;
15
+ id!: number;
17
16
 
18
- // PlaybackStatus hasMany JukeboxQueueEntry via playbackStatusTypeId
19
- jukeboxQueueEntries!: JukeboxQueueEntry[];
20
- getJukeboxQueueEntries!: Sequelize.HasManyGetAssociationsMixin<JukeboxQueueEntry>;
21
- setJukeboxQueueEntries!: Sequelize.HasManySetAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
22
- addJukeboxQueueEntry!: Sequelize.HasManyAddAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
23
- addJukeboxQueueEntries!: Sequelize.HasManyAddAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
24
- createJukeboxQueueEntry!: Sequelize.HasManyCreateAssociationMixin<JukeboxQueueEntry>;
25
- removeJukeboxQueueEntry!: Sequelize.HasManyRemoveAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
26
- removeJukeboxQueueEntries!: Sequelize.HasManyRemoveAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
27
- hasJukeboxQueueEntry!: Sequelize.HasManyHasAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
28
- hasJukeboxQueueEntries!: Sequelize.HasManyHasAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
29
- countJukeboxQueueEntries!: Sequelize.HasManyCountAssociationsMixin;
30
17
 
31
18
  static initModel(sequelize: Sequelize.Sequelize): typeof PlaybackStatus {
32
19
  return PlaybackStatus.init({
20
+ description: {
21
+ type: DataTypes.TEXT,
22
+ allowNull: false
23
+ },
33
24
  id: {
34
25
  autoIncrement: true,
35
26
  autoIncrementIdentity: true,
36
27
  type: DataTypes.SMALLINT,
37
28
  allowNull: false,
38
29
  primaryKey: true
39
- },
40
- description: {
41
- type: DataTypes.TEXT,
42
- allowNull: false
43
30
  }
44
31
  }, {
45
32
  sequelize,
@@ -1,5 +1,6 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { DataTypes, Model, Optional } from 'sequelize';
3
+ import type { JukeboxQueueEntry, JukeboxQueueEntryId } from './JukeboxQueueEntry';
3
4
 
4
5
  export interface PlaybackStatusTypeAttributes {
5
6
  id: number;
@@ -14,6 +15,18 @@ export class PlaybackStatusType extends Model<PlaybackStatusTypeAttributes, Play
14
15
  id!: number;
15
16
  description!: string;
16
17
 
18
+ // PlaybackStatusType hasMany JukeboxQueueEntry via playbackStatusTypeId
19
+ jukeboxQueueEntries!: JukeboxQueueEntry[];
20
+ getJukeboxQueueEntries!: Sequelize.HasManyGetAssociationsMixin<JukeboxQueueEntry>;
21
+ setJukeboxQueueEntries!: Sequelize.HasManySetAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
22
+ addJukeboxQueueEntry!: Sequelize.HasManyAddAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
23
+ addJukeboxQueueEntries!: Sequelize.HasManyAddAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
24
+ createJukeboxQueueEntry!: Sequelize.HasManyCreateAssociationMixin<JukeboxQueueEntry>;
25
+ removeJukeboxQueueEntry!: Sequelize.HasManyRemoveAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
26
+ removeJukeboxQueueEntries!: Sequelize.HasManyRemoveAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
27
+ hasJukeboxQueueEntry!: Sequelize.HasManyHasAssociationMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
28
+ hasJukeboxQueueEntries!: Sequelize.HasManyHasAssociationsMixin<JukeboxQueueEntry, JukeboxQueueEntryId>;
29
+ countJukeboxQueueEntries!: Sequelize.HasManyCountAssociationsMixin;
17
30
 
18
31
  static initModel(sequelize: Sequelize.Sequelize): typeof PlaybackStatusType {
19
32
  return PlaybackStatusType.init({
package/models/State.ts CHANGED
@@ -5,8 +5,8 @@ import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUse
5
5
  import type { PlatformUserPlaylistTrack, PlatformUserPlaylistTrackId } from './PlatformUserPlaylistTrack';
6
6
 
7
7
  export interface StateAttributes {
8
- id: number;
9
8
  description: string;
9
+ id: number;
10
10
  }
11
11
 
12
12
  export type StatePk = "id";
@@ -14,8 +14,8 @@ export type StateId = State[StatePk];
14
14
  export type StateCreationAttributes = StateAttributes;
15
15
 
16
16
  export class State extends Model<StateAttributes, StateCreationAttributes> implements StateAttributes {
17
- id!: number;
18
17
  description!: string;
18
+ id!: number;
19
19
 
20
20
  // State hasMany AppUser via stateId
21
21
  appUsers!: AppUser[];
@@ -56,16 +56,16 @@ export class State extends Model<StateAttributes, StateCreationAttributes> imple
56
56
 
57
57
  static initModel(sequelize: Sequelize.Sequelize): typeof State {
58
58
  return State.init({
59
+ description: {
60
+ type: DataTypes.TEXT,
61
+ allowNull: false
62
+ },
59
63
  id: {
60
64
  autoIncrement: true,
61
65
  autoIncrementIdentity: true,
62
66
  type: DataTypes.SMALLINT,
63
67
  allowNull: false,
64
68
  primaryKey: true
65
- },
66
- description: {
67
- type: DataTypes.TEXT,
68
- allowNull: false
69
69
  }
70
70
  }, {
71
71
  sequelize,
@@ -3,8 +3,8 @@ import { DataTypes, Model, Optional } from 'sequelize';
3
3
  import type { PlatformAlbum, PlatformAlbumId } from './PlatformAlbum';
4
4
 
5
5
  export interface UnmatchedAlbumAttributes {
6
- id: string;
7
6
  platformAlbumId: string;
7
+ id: string;
8
8
  createDate: Date;
9
9
  }
10
10
 
@@ -14,8 +14,8 @@ export type UnmatchedAlbumOptionalAttributes = "id" | "createDate";
14
14
  export type UnmatchedAlbumCreationAttributes = Optional<UnmatchedAlbumAttributes, UnmatchedAlbumOptionalAttributes>;
15
15
 
16
16
  export class UnmatchedAlbum extends Model<UnmatchedAlbumAttributes, UnmatchedAlbumCreationAttributes> implements UnmatchedAlbumAttributes {
17
- id!: string;
18
17
  platformAlbumId!: string;
18
+ id!: string;
19
19
  createDate!: Date;
20
20
 
21
21
  // UnmatchedAlbum belongsTo PlatformAlbum via platformAlbumId
@@ -26,12 +26,6 @@ export class UnmatchedAlbum extends Model<UnmatchedAlbumAttributes, UnmatchedAlb
26
26
 
27
27
  static initModel(sequelize: Sequelize.Sequelize): typeof UnmatchedAlbum {
28
28
  return UnmatchedAlbum.init({
29
- id: {
30
- type: DataTypes.UUID,
31
- allowNull: false,
32
- defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
33
- primaryKey: true
34
- },
35
29
  platformAlbumId: {
36
30
  type: DataTypes.UUID,
37
31
  allowNull: false,
@@ -41,6 +35,12 @@ export class UnmatchedAlbum extends Model<UnmatchedAlbumAttributes, UnmatchedAlb
41
35
  },
42
36
  field: 'platform_album_id'
43
37
  },
38
+ id: {
39
+ type: DataTypes.UUID,
40
+ allowNull: false,
41
+ defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
42
+ primaryKey: true
43
+ },
44
44
  createDate: {
45
45
  type: DataTypes.DATE,
46
46
  allowNull: false,
@@ -3,9 +3,9 @@ import { DataTypes, Model, Optional } from 'sequelize';
3
3
  import type { Platform, PlatformId } from './Platform';
4
4
 
5
5
  export interface UnmatchedArtistAttributes {
6
- id: string;
7
6
  platformId: number;
8
7
  externalArtistId: number;
8
+ id: string;
9
9
  createDate: Date;
10
10
  updateDate: Date;
11
11
  }
@@ -16,9 +16,9 @@ export type UnmatchedArtistOptionalAttributes = "id" | "createDate" | "updateDat
16
16
  export type UnmatchedArtistCreationAttributes = Optional<UnmatchedArtistAttributes, UnmatchedArtistOptionalAttributes>;
17
17
 
18
18
  export class UnmatchedArtist extends Model<UnmatchedArtistAttributes, UnmatchedArtistCreationAttributes> implements UnmatchedArtistAttributes {
19
- id!: string;
20
19
  platformId!: number;
21
20
  externalArtistId!: number;
21
+ id!: string;
22
22
  createDate!: Date;
23
23
  updateDate!: Date;
24
24
 
@@ -30,12 +30,6 @@ export class UnmatchedArtist extends Model<UnmatchedArtistAttributes, UnmatchedA
30
30
 
31
31
  static initModel(sequelize: Sequelize.Sequelize): typeof UnmatchedArtist {
32
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
33
  platformId: {
40
34
  type: DataTypes.SMALLINT,
41
35
  allowNull: false,
@@ -50,6 +44,12 @@ export class UnmatchedArtist extends Model<UnmatchedArtistAttributes, UnmatchedA
50
44
  allowNull: false,
51
45
  field: 'external_artist_id'
52
46
  },
47
+ id: {
48
+ type: DataTypes.UUID,
49
+ allowNull: false,
50
+ defaultValue: Sequelize.Sequelize.fn('uuid_generate_v1'),
51
+ primaryKey: true
52
+ },
53
53
  createDate: {
54
54
  type: DataTypes.DATE,
55
55
  allowNull: false,
@@ -4,7 +4,6 @@ import type { AppUser, AppUserId } from './AppUser';
4
4
 
5
5
  export interface UserContactsAttributes {
6
6
  appUserId: string;
7
- contactId: string;
8
7
  contactAppUserId?: string;
9
8
  firstName?: string;
10
9
  lastName?: string;
@@ -18,16 +17,16 @@ export interface UserContactsAttributes {
18
17
  contactPhone3?: string;
19
18
  contactPhone3Type?: "mobile" | "work" | "home" | "main";
20
19
  active?: boolean;
20
+ contactId: string;
21
21
  }
22
22
 
23
23
  export type UserContactsPk = "contactId";
24
24
  export type UserContactsId = UserContacts[UserContactsPk];
25
- export type UserContactsOptionalAttributes = "contactId" | "contactAppUserId" | "firstName" | "lastName" | "contactEmail1" | "contactEmail2" | "contactEmail3" | "contactPhone1" | "contactPhone1Type" | "contactPhone2" | "contactPhone2Type" | "contactPhone3" | "contactPhone3Type" | "active";
25
+ export type UserContactsOptionalAttributes = "contactAppUserId" | "firstName" | "lastName" | "contactEmail1" | "contactEmail2" | "contactEmail3" | "contactPhone1" | "contactPhone1Type" | "contactPhone2" | "contactPhone2Type" | "contactPhone3" | "contactPhone3Type" | "active" | "contactId";
26
26
  export type UserContactsCreationAttributes = Optional<UserContactsAttributes, UserContactsOptionalAttributes>;
27
27
 
28
28
  export class UserContacts extends Model<UserContactsAttributes, UserContactsCreationAttributes> implements UserContactsAttributes {
29
29
  appUserId!: string;
30
- contactId!: string;
31
30
  contactAppUserId?: string;
32
31
  firstName?: string;
33
32
  lastName?: string;
@@ -41,6 +40,7 @@ export class UserContacts extends Model<UserContactsAttributes, UserContactsCrea
41
40
  contactPhone3?: string;
42
41
  contactPhone3Type?: "mobile" | "work" | "home" | "main";
43
42
  active?: boolean;
43
+ contactId!: string;
44
44
 
45
45
  // UserContacts belongsTo AppUser via appUserId
46
46
  appUser!: AppUser;
@@ -59,13 +59,6 @@ export class UserContacts extends Model<UserContactsAttributes, UserContactsCrea
59
59
  },
60
60
  field: 'app_user_id'
61
61
  },
62
- contactId: {
63
- type: DataTypes.UUID,
64
- allowNull: false,
65
- defaultValue: DataTypes.UUIDV4,
66
- primaryKey: true,
67
- field: 'contact_id'
68
- },
69
62
  contactAppUserId: {
70
63
  type: DataTypes.UUID,
71
64
  allowNull: true,
@@ -129,6 +122,13 @@ export class UserContacts extends Model<UserContactsAttributes, UserContactsCrea
129
122
  active: {
130
123
  type: DataTypes.BOOLEAN,
131
124
  allowNull: true
125
+ },
126
+ contactId: {
127
+ type: DataTypes.UUID,
128
+ allowNull: false,
129
+ defaultValue: DataTypes.UUIDV4,
130
+ primaryKey: true,
131
+ field: 'contact_id'
132
132
  }
133
133
  }, {
134
134
  sequelize,
@@ -91,6 +91,10 @@ import { MetricsEvent as _MetricsEvent } from "./MetricsEvent";
91
91
  import type { MetricsEventAttributes, MetricsEventCreationAttributes } from "./MetricsEvent";
92
92
  import { NewsSite as _NewsSite } from "./NewsSite";
93
93
  import type { NewsSiteAttributes, NewsSiteCreationAttributes } from "./NewsSite";
94
+ import { Notification as _Notification } from "./Notification";
95
+ import type { NotificationAttributes, NotificationCreationAttributes } from "./Notification";
96
+ import { NotificationType as _NotificationType } from "./NotificationType";
97
+ import type { NotificationTypeAttributes, NotificationTypeCreationAttributes } from "./NotificationType";
94
98
  import { PauseStatusType as _PauseStatusType } from "./PauseStatusType";
95
99
  import type { PauseStatusTypeAttributes, PauseStatusTypeCreationAttributes } from "./PauseStatusType";
96
100
  import { Platform as _Platform } from "./Platform";
@@ -185,6 +189,8 @@ export {
185
189
  _MetricsDaily as MetricsDaily,
186
190
  _MetricsEvent as MetricsEvent,
187
191
  _NewsSite as NewsSite,
192
+ _Notification as Notification,
193
+ _NotificationType as NotificationType,
188
194
  _PauseStatusType as PauseStatusType,
189
195
  _Platform as Platform,
190
196
  _PlatformAlbum as PlatformAlbum,
@@ -303,6 +309,10 @@ export type {
303
309
  MetricsEventCreationAttributes,
304
310
  NewsSiteAttributes,
305
311
  NewsSiteCreationAttributes,
312
+ NotificationAttributes,
313
+ NotificationCreationAttributes,
314
+ NotificationTypeAttributes,
315
+ NotificationTypeCreationAttributes,
306
316
  PauseStatusTypeAttributes,
307
317
  PauseStatusTypeCreationAttributes,
308
318
  PlatformAttributes,
@@ -398,6 +408,8 @@ export function initModels(sequelize: Sequelize) {
398
408
  const MetricsDaily = _MetricsDaily.initModel(sequelize);
399
409
  const MetricsEvent = _MetricsEvent.initModel(sequelize);
400
410
  const NewsSite = _NewsSite.initModel(sequelize);
411
+ const Notification = _Notification.initModel(sequelize);
412
+ const NotificationType = _NotificationType.initModel(sequelize);
401
413
  const PauseStatusType = _PauseStatusType.initModel(sequelize);
402
414
  const Platform = _Platform.initModel(sequelize);
403
415
  const PlatformAlbum = _PlatformAlbum.initModel(sequelize);
@@ -482,6 +494,10 @@ export function initModels(sequelize: Sequelize) {
482
494
  AppUser.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "trackAddedUserId"});
483
495
  JukeboxUser.belongsTo(AppUser, { as: "appUser", foreignKey: "appUserId"});
484
496
  AppUser.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "appUserId"});
497
+ Notification.belongsTo(AppUser, { as: "sourceUser", foreignKey: "sourceUserId"});
498
+ AppUser.hasMany(Notification, { as: "notifications", foreignKey: "sourceUserId"});
499
+ Notification.belongsTo(AppUser, { as: "targetUser", foreignKey: "targetUserId"});
500
+ AppUser.hasMany(Notification, { as: "targetUserNotifications", foreignKey: "targetUserId"});
485
501
  PlatformUserAlbum.belongsTo(AppUser, { as: "appUser", foreignKey: "appUserId"});
486
502
  AppUser.hasMany(PlatformUserAlbum, { as: "platformUserAlbums", foreignKey: "appUserId"});
487
503
  PlatformUserPlaylist.belongsTo(AppUser, { as: "appUser", foreignKey: "appUserId"});
@@ -554,6 +570,8 @@ export function initModels(sequelize: Sequelize) {
554
570
  JukeboxSession.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "jukeboxSessionId"});
555
571
  JukeboxUser.belongsTo(JukeboxSession, { as: "jukeboxSession", foreignKey: "jukeboxSessionId"});
556
572
  JukeboxSession.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "jukeboxSessionId"});
573
+ Notification.belongsTo(JukeboxSession, { as: "jukeboxSession", foreignKey: "jukeboxSessionId"});
574
+ JukeboxSession.hasMany(Notification, { as: "notifications", foreignKey: "jukeboxSessionId"});
557
575
  JukeboxSession.belongsTo(JukeboxStatus, { as: "jukeboxStatus", foreignKey: "jukeboxStatusId"});
558
576
  JukeboxStatus.hasMany(JukeboxSession, { as: "jukeboxSessions", foreignKey: "jukeboxStatusId"});
559
577
  JukeboxSession.belongsTo(JukeboxTerminationCondition, { as: "terminationCondition", foreignKey: "terminationConditionId"});
@@ -562,6 +580,8 @@ export function initModels(sequelize: Sequelize) {
562
580
  JukeboxType.hasMany(JukeboxSession, { as: "jukeboxSessions", foreignKey: "typeId"});
563
581
  JukeboxUser.belongsTo(JukeboxUserType, { as: "jukeboxUserType", foreignKey: "jukeboxUserTypeId"});
564
582
  JukeboxUserType.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "jukeboxUserTypeId"});
583
+ Notification.belongsTo(NotificationType, { as: "notificationType", foreignKey: "notificationTypeId"});
584
+ NotificationType.hasMany(Notification, { as: "notifications", foreignKey: "notificationTypeId"});
565
585
  JukeboxUser.belongsTo(PauseStatusType, { as: "pauseStatusType", foreignKey: "pauseStatusTypeId"});
566
586
  PauseStatusType.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "pauseStatusTypeId"});
567
587
  AppUserPlatformRelation.belongsTo(Platform, { as: "platform", foreignKey: "platformId"});
@@ -638,8 +658,8 @@ export function initModels(sequelize: Sequelize) {
638
658
  PlatformUserAlbum.hasMany(PlatformUserAlbumTrack, { as: "platformUserAlbumTracks", foreignKey: "platformUserAlbumId"});
639
659
  PlatformUserPlaylistTrack.belongsTo(PlatformUserPlaylist, { as: "platformUserPlaylist", foreignKey: "platformUserPlaylistId"});
640
660
  PlatformUserPlaylist.hasMany(PlatformUserPlaylistTrack, { as: "platformUserPlaylistTracks", foreignKey: "platformUserPlaylistId"});
641
- JukeboxQueueEntry.belongsTo(PlaybackStatus, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
642
- PlaybackStatus.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
661
+ JukeboxQueueEntry.belongsTo(PlaybackStatusType, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
662
+ PlaybackStatusType.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
643
663
  AppUser.belongsTo(State, { as: "state", foreignKey: "stateId"});
644
664
  State.hasMany(AppUser, { as: "appUsers", foreignKey: "stateId"});
645
665
  PlatformUserPlaylist.belongsTo(State, { as: "state", foreignKey: "stateId"});
@@ -696,6 +716,8 @@ export function initModels(sequelize: Sequelize) {
696
716
  MetricsDaily: MetricsDaily,
697
717
  MetricsEvent: MetricsEvent,
698
718
  NewsSite: NewsSite,
719
+ Notification: Notification,
720
+ NotificationType: NotificationType,
699
721
  PauseStatusType: PauseStatusType,
700
722
  Platform: Platform,
701
723
  PlatformAlbum: PlatformAlbum,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earbug/db-models",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "dist/init-models.js",
5
5
  "types": "dist/init-models.d.ts",
6
6
  "scripts": {