@earbug/db-models 0.0.6 → 0.0.8

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 (137) hide show
  1. package/dist/AppUser.d.ts +5 -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 +29 -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/CanonAlbumTrackRelation.d.ts +10 -10
  14. package/dist/CanonAlbumTrackRelation.js +2 -2
  15. package/dist/CanonArtist.d.ts +14 -14
  16. package/dist/CanonArtist.js +6 -6
  17. package/dist/CanonArtistImageHarvested.d.ts +9 -9
  18. package/dist/CanonArtistImageHarvested.js +24 -24
  19. package/dist/CanonGenre.d.ts +3 -3
  20. package/dist/CanonGenre.js +6 -6
  21. package/dist/CanonLabel.d.ts +2 -2
  22. package/dist/CanonLabel.js +6 -6
  23. package/dist/CanonMember.d.ts +3 -3
  24. package/dist/CanonMember.js +6 -6
  25. package/dist/CanonMemberExternalReferenceRelation.d.ts +2 -2
  26. package/dist/CanonMemberExternalReferenceRelation.js +5 -5
  27. package/dist/CanonTrack.d.ts +29 -5
  28. package/dist/CanonTrack.js +11 -11
  29. package/dist/ConfigParam.d.ts +2 -2
  30. package/dist/ConfigParam.js +5 -5
  31. package/dist/ExternalReference.d.ts +2 -2
  32. package/dist/ExternalReference.js +5 -5
  33. package/dist/JukeboxAccessType.d.ts +2 -2
  34. package/dist/JukeboxAccessType.js +4 -4
  35. package/dist/JukeboxCanonGenreRelation.d.ts +2 -2
  36. package/dist/JukeboxCanonGenreRelation.js +6 -6
  37. package/dist/JukeboxInvite.d.ts +3 -3
  38. package/dist/JukeboxInvite.js +6 -6
  39. package/dist/JukeboxQueueEntry.d.ts +10 -10
  40. package/dist/JukeboxQueueEntry.js +12 -12
  41. package/dist/JukeboxQueueMode.d.ts +2 -2
  42. package/dist/JukeboxQueueMode.js +4 -4
  43. package/dist/JukeboxSession.d.ts +9 -9
  44. package/dist/JukeboxSession.js +20 -20
  45. package/dist/JukeboxTerminationCondition.d.ts +2 -2
  46. package/dist/JukeboxTerminationCondition.js +4 -4
  47. package/dist/JukeboxType.d.ts +2 -2
  48. package/dist/JukeboxType.js +4 -4
  49. package/dist/JukeboxUser.d.ts +7 -7
  50. package/dist/JukeboxUser.js +20 -20
  51. package/dist/KnexMigrations.d.ts +3 -3
  52. package/dist/KnexMigrations.js +6 -6
  53. package/dist/KnexMigrationsLock.d.ts +3 -3
  54. package/dist/KnexMigrationsLock.js +5 -5
  55. package/dist/MetricsDaily.d.ts +3 -3
  56. package/dist/MetricsDaily.js +4 -4
  57. package/dist/MetricsEvent.d.ts +5 -1
  58. package/dist/MetricsEvent.js +6 -0
  59. package/dist/NewsSite.d.ts +3 -3
  60. package/dist/NewsSite.js +6 -6
  61. package/dist/Platform.d.ts +2 -2
  62. package/dist/Platform.js +7 -7
  63. package/dist/PlatformAlbum.d.ts +5 -28
  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 -26
  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.js +9 -9
  91. package/models/AppUser.ts +18 -18
  92. package/models/AppUserDevice.ts +12 -12
  93. package/models/AppUserFollowRelation.ts +9 -9
  94. package/models/AppUserPlatformRelation.ts +25 -25
  95. package/models/CanonAlbum.ts +41 -15
  96. package/models/CanonAlbumImageHarvested.ts +33 -41
  97. package/models/CanonAlbumTrackRelation.ts +14 -14
  98. package/models/CanonArtist.ts +20 -20
  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 +42 -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 +29 -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/MetricsEvent.ts +11 -1
  120. package/models/NewsSite.ts +9 -9
  121. package/models/Platform.ts +9 -9
  122. package/models/PlatformAlbum.ts +15 -40
  123. package/models/PlatformArtist.ts +15 -15
  124. package/models/PlatformGenre.ts +8 -8
  125. package/models/PlatformTrack.ts +9 -34
  126. package/models/PlatformUserAlbum.ts +8 -8
  127. package/models/PlatformUserAlbumTrack.ts +15 -15
  128. package/models/PlatformUserPlaylist.ts +16 -16
  129. package/models/PlatformUserPlaylistTrack.ts +24 -24
  130. package/models/PlaybackStatus.ts +6 -19
  131. package/models/PlaybackStatusType.ts +13 -0
  132. package/models/State.ts +6 -6
  133. package/models/UnmatchedAlbum.ts +8 -8
  134. package/models/UnmatchedArtist.ts +8 -8
  135. package/models/UserContacts.ts +10 -10
  136. package/models/init-models.ts +9 -9
  137. package/package.json +1 -1
@@ -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,
@@ -422,9 +422,10 @@ export function initModels(sequelize: Sequelize) {
422
422
  const UnmatchedArtist = _UnmatchedArtist.initModel(sequelize);
423
423
  const UserContacts = _UserContacts.initModel(sequelize);
424
424
 
425
+ CanonAlbum.belongsToMany(CanonTrack, { as: 'canonTrackIdCanonTracks', through: CanonAlbumTrackRelation, foreignKey: "canonAlbumId", otherKey: "canonTrackId" });
425
426
  CanonAlbum.belongsToMany(ExternalReference, { as: 'externalReferenceIdExternalReferences', through: CanonAlbumExternalReferenceRelation, foreignKey: "canonAlbumId", otherKey: "externalReferenceId" });
426
427
  CanonAlbum.belongsToMany(PlatformAlbum, { as: 'platformAlbumIdPlatformAlbums', through: CanonToPlatformAlbumRelation, foreignKey: "canonAlbumId", otherKey: "platformAlbumId" });
427
- CanonArtist.belongsToMany(CanonTrack, { as: 'canonTrackIdCanonTracks', through: CanonArtistTrackRelation, foreignKey: "canonArtistId", otherKey: "canonTrackId" });
428
+ CanonArtist.belongsToMany(CanonTrack, { as: 'canonTrackIdCanonTrackCanonArtistTrackRelations', through: CanonArtistTrackRelation, foreignKey: "canonArtistId", otherKey: "canonTrackId" });
428
429
  CanonArtist.belongsToMany(PlatformAlbum, { as: 'canonAlbumIdPlatformAlbumCanonArtistAlbumRelations', through: CanonArtistAlbumRelation, foreignKey: "canonArtistId", otherKey: "canonAlbumId" });
429
430
  CanonArtist.belongsToMany(PlatformArtist, { as: 'platformArtistIdPlatformArtists', through: CanonToPlatformArtistRelation, foreignKey: "canonArtistId", otherKey: "platformArtistId" });
430
431
  CanonGenre.belongsToMany(ExternalReference, { as: 'externalReferenceIdExternalReferenceCanonGenreExternalReferenceRelations', through: CanonGenreExternalReferenceRelation, foreignKey: "canonGenreId", otherKey: "externalReferenceId" });
@@ -435,6 +436,7 @@ export function initModels(sequelize: Sequelize) {
435
436
  CanonLabel.belongsToMany(PlatformAlbum, { as: 'canonAlbumIdPlatformAlbumCanonAlbumLabelRelations', through: CanonAlbumLabelRelation, foreignKey: "canonLabelId", otherKey: "canonAlbumId" });
436
437
  CanonMember.belongsToMany(ExternalReference, { as: 'externalReferenceIdExternalReferenceCanonMemberExternalReferenceRelations', through: CanonMemberExternalReferenceRelation, foreignKey: "canonMemberId", otherKey: "externalReferenceId" });
437
438
  CanonMember.belongsToMany(PlatformArtist, { as: 'canonArtistIdPlatformArtistCanonArtistMemberRelations', through: CanonArtistMemberRelation, foreignKey: "canonMemberId", otherKey: "canonArtistId" });
439
+ CanonTrack.belongsToMany(CanonAlbum, { as: 'canonAlbumIdCanonAlbumCanonAlbumTrackRelations', through: CanonAlbumTrackRelation, foreignKey: "canonTrackId", otherKey: "canonAlbumId" });
438
440
  CanonTrack.belongsToMany(CanonArtist, { as: 'canonArtistIdCanonArtistCanonArtistTrackRelations', through: CanonArtistTrackRelation, foreignKey: "canonTrackId", otherKey: "canonArtistId" });
439
441
  CanonTrack.belongsToMany(PlatformTrack, { as: 'platformTrackIdPlatformTracks', through: CanonToPlatformTrackRelation, foreignKey: "canonTrackId", otherKey: "platformTrackId" });
440
442
  ExternalReference.belongsToMany(CanonAlbum, { as: 'canonAlbumIdCanonAlbums', through: CanonAlbumExternalReferenceRelation, foreignKey: "externalReferenceId", otherKey: "canonAlbumId" });
@@ -448,7 +450,6 @@ export function initModels(sequelize: Sequelize) {
448
450
  PlatformAlbum.belongsToMany(CanonLabel, { as: 'canonLabelIdCanonLabels', through: CanonAlbumLabelRelation, foreignKey: "canonAlbumId", otherKey: "canonLabelId" });
449
451
  PlatformAlbum.belongsToMany(PlatformArtist, { as: 'platformArtistIdPlatformArtistPlatformArtistAlbumRelations', through: PlatformArtistAlbumRelation, foreignKey: "platformAlbumId", otherKey: "platformArtistId" });
450
452
  PlatformAlbum.belongsToMany(PlatformGenre, { as: 'platformGenreIdPlatformGenrePlatformAlbumGenreRelations', through: PlatformAlbumGenreRelation, foreignKey: "platformAlbumId", otherKey: "platformGenreId" });
451
- PlatformAlbum.belongsToMany(PlatformTrack, { as: 'canonTrackIdPlatformTracks', through: CanonAlbumTrackRelation, foreignKey: "canonAlbumId", otherKey: "canonTrackId" });
452
453
  PlatformAlbum.belongsToMany(PlatformTrack, { as: 'platformTrackIdPlatformTrackPlatformAlbumTrackRelations', through: PlatformAlbumTrackRelation, foreignKey: "platformAlbumId", otherKey: "platformTrackId" });
453
454
  PlatformArtist.belongsToMany(CanonArtist, { as: 'canonArtistIdCanonArtistCanonToPlatformArtistRelations', through: CanonToPlatformArtistRelation, foreignKey: "platformArtistId", otherKey: "canonArtistId" });
454
455
  PlatformArtist.belongsToMany(CanonGenre, { as: 'canonGenreIdCanonGenreCanonArtistGenreRelations', through: CanonArtistGenreRelation, foreignKey: "canonArtistId", otherKey: "canonGenreId" });
@@ -462,7 +463,6 @@ export function initModels(sequelize: Sequelize) {
462
463
  PlatformGenre.belongsToMany(PlatformArtist, { as: 'platformArtistIdPlatformArtistPlatformArtistGenreRelations', through: PlatformArtistGenreRelation, foreignKey: "platformGenreId", otherKey: "platformArtistId" });
463
464
  PlatformGenre.belongsToMany(PlatformTrack, { as: 'platformTrackIdPlatformTrackPlatformTrackGenreRelations', through: PlatformTrackGenreRelation, foreignKey: "platformGenreId", otherKey: "platformTrackId" });
464
465
  PlatformTrack.belongsToMany(CanonTrack, { as: 'canonTrackIdCanonTrackCanonToPlatformTrackRelations', through: CanonToPlatformTrackRelation, foreignKey: "platformTrackId", otherKey: "canonTrackId" });
465
- PlatformTrack.belongsToMany(PlatformAlbum, { as: 'canonAlbumIdPlatformAlbumCanonAlbumTrackRelations', through: CanonAlbumTrackRelation, foreignKey: "canonTrackId", otherKey: "canonAlbumId" });
466
466
  PlatformTrack.belongsToMany(PlatformAlbum, { as: 'platformAlbumIdPlatformAlbumPlatformAlbumTrackRelations', through: PlatformAlbumTrackRelation, foreignKey: "platformTrackId", otherKey: "platformAlbumId" });
467
467
  PlatformTrack.belongsToMany(PlatformArtist, { as: 'platformArtistIdPlatformArtistPlatformArtistTrackRelations', through: PlatformArtistTrackRelation, foreignKey: "platformTrackId", otherKey: "platformArtistId" });
468
468
  PlatformTrack.belongsToMany(PlatformGenre, { as: 'platformGenreIdPlatformGenrePlatformTrackGenreRelations', through: PlatformTrackGenreRelation, foreignKey: "platformTrackId", otherKey: "platformGenreId" });
@@ -492,6 +492,8 @@ export function initModels(sequelize: Sequelize) {
492
492
  CanonAlbum.hasMany(CanonAlbumExternalReferenceRelation, { as: "canonAlbumExternalReferenceRelations", foreignKey: "canonAlbumId"});
493
493
  CanonAlbumImageHarvested.belongsTo(CanonAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
494
494
  CanonAlbum.hasMany(CanonAlbumImageHarvested, { as: "canonAlbumImageHarvesteds", foreignKey: "canonAlbumId"});
495
+ CanonAlbumTrackRelation.belongsTo(CanonAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
496
+ CanonAlbum.hasMany(CanonAlbumTrackRelation, { as: "canonAlbumTrackRelations", foreignKey: "canonAlbumId"});
495
497
  CanonToPlatformAlbumRelation.belongsTo(CanonAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
496
498
  CanonAlbum.hasMany(CanonToPlatformAlbumRelation, { as: "canonToPlatformAlbumRelations", foreignKey: "canonAlbumId"});
497
499
  CanonArtistAlbumRelation.belongsTo(CanonArtist, { as: "canonArtist", foreignKey: "canonArtistId"});
@@ -520,6 +522,8 @@ export function initModels(sequelize: Sequelize) {
520
522
  CanonMember.hasMany(CanonArtistMemberRelation, { as: "canonArtistMemberRelations", foreignKey: "canonMemberId"});
521
523
  CanonMemberExternalReferenceRelation.belongsTo(CanonMember, { as: "canonMember", foreignKey: "canonMemberId"});
522
524
  CanonMember.hasMany(CanonMemberExternalReferenceRelation, { as: "canonMemberExternalReferenceRelations", foreignKey: "canonMemberId"});
525
+ CanonAlbumTrackRelation.belongsTo(CanonTrack, { as: "canonTrack", foreignKey: "canonTrackId"});
526
+ CanonTrack.hasMany(CanonAlbumTrackRelation, { as: "canonAlbumTrackRelations", foreignKey: "canonTrackId"});
523
527
  CanonArtistTrackRelation.belongsTo(CanonTrack, { as: "canonTrack", foreignKey: "canonTrackId"});
524
528
  CanonTrack.hasMany(CanonArtistTrackRelation, { as: "canonArtistTrackRelations", foreignKey: "canonTrackId"});
525
529
  CanonToPlatformTrackRelation.belongsTo(CanonTrack, { as: "canonTrack", foreignKey: "canonTrackId"});
@@ -582,8 +586,6 @@ export function initModels(sequelize: Sequelize) {
582
586
  PlatformAlbum.hasMany(CanonAlbumGenreRelation, { as: "canonAlbumGenreRelations", foreignKey: "canonAlbumId"});
583
587
  CanonAlbumLabelRelation.belongsTo(PlatformAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
584
588
  PlatformAlbum.hasMany(CanonAlbumLabelRelation, { as: "canonAlbumLabelRelations", foreignKey: "canonAlbumId"});
585
- CanonAlbumTrackRelation.belongsTo(PlatformAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
586
- PlatformAlbum.hasMany(CanonAlbumTrackRelation, { as: "canonAlbumTrackRelations", foreignKey: "canonAlbumId"});
587
589
  CanonArtistAlbumRelation.belongsTo(PlatformAlbum, { as: "canonAlbum", foreignKey: "canonAlbumId"});
588
590
  PlatformAlbum.hasMany(CanonArtistAlbumRelation, { as: "canonArtistAlbumRelations", foreignKey: "canonAlbumId"});
589
591
  CanonToPlatformAlbumRelation.belongsTo(PlatformAlbum, { as: "platformAlbum", foreignKey: "platformAlbumId"});
@@ -620,8 +622,6 @@ export function initModels(sequelize: Sequelize) {
620
622
  PlatformGenre.hasMany(PlatformArtistGenreRelation, { as: "platformArtistGenreRelations", foreignKey: "platformGenreId"});
621
623
  PlatformTrackGenreRelation.belongsTo(PlatformGenre, { as: "platformGenre", foreignKey: "platformGenreId"});
622
624
  PlatformGenre.hasMany(PlatformTrackGenreRelation, { as: "platformTrackGenreRelations", foreignKey: "platformGenreId"});
623
- CanonAlbumTrackRelation.belongsTo(PlatformTrack, { as: "canonTrack", foreignKey: "canonTrackId"});
624
- PlatformTrack.hasMany(CanonAlbumTrackRelation, { as: "canonAlbumTrackRelations", foreignKey: "canonTrackId"});
625
625
  CanonToPlatformTrackRelation.belongsTo(PlatformTrack, { as: "platformTrack", foreignKey: "platformTrackId"});
626
626
  PlatformTrack.hasMany(CanonToPlatformTrackRelation, { as: "canonToPlatformTrackRelations", foreignKey: "platformTrackId"});
627
627
  PlatformAlbumTrackRelation.belongsTo(PlatformTrack, { as: "platformTrack", foreignKey: "platformTrackId"});
@@ -638,8 +638,8 @@ export function initModels(sequelize: Sequelize) {
638
638
  PlatformUserAlbum.hasMany(PlatformUserAlbumTrack, { as: "platformUserAlbumTracks", foreignKey: "platformUserAlbumId"});
639
639
  PlatformUserPlaylistTrack.belongsTo(PlatformUserPlaylist, { as: "platformUserPlaylist", foreignKey: "platformUserPlaylistId"});
640
640
  PlatformUserPlaylist.hasMany(PlatformUserPlaylistTrack, { as: "platformUserPlaylistTracks", foreignKey: "platformUserPlaylistId"});
641
- JukeboxQueueEntry.belongsTo(PlaybackStatus, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
642
- PlaybackStatus.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
641
+ JukeboxQueueEntry.belongsTo(PlaybackStatusType, { as: "playbackStatusType", foreignKey: "playbackStatusTypeId"});
642
+ PlaybackStatusType.hasMany(JukeboxQueueEntry, { as: "jukeboxQueueEntries", foreignKey: "playbackStatusTypeId"});
643
643
  AppUser.belongsTo(State, { as: "state", foreignKey: "stateId"});
644
644
  State.hasMany(AppUser, { as: "appUsers", foreignKey: "stateId"});
645
645
  PlatformUserPlaylist.belongsTo(State, { as: "state", foreignKey: "stateId"});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earbug/db-models",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "dist/init-models.js",
5
5
  "types": "dist/init-models.d.ts",
6
6
  "scripts": {