@earbug/db-models 0.0.50 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/AppUser.d.ts CHANGED
@@ -48,10 +48,11 @@ export interface AppUserAttributes {
48
48
  softBounce2?: Date;
49
49
  softBounce3?: Date;
50
50
  isGuest: boolean;
51
+ bio?: string;
51
52
  }
52
53
  export type AppUserPk = "id";
53
54
  export type AppUserId = AppUser[AppUserPk];
54
- export type AppUserOptionalAttributes = "email" | "id" | "createDate" | "updateDate" | "syncContacts" | "stateId" | "lastName" | "autoApproveFollowers" | "lastHarvested" | "lastHarvestedError" | "earbugAccessControlPreference" | "unsubscribeAll" | "unsubscribeBiweeklyEmail" | "unsubscribeFollowingNotifications" | "unsubscribeInterestNotifications" | "unsubscribeFunNotifications" | "hardBounce" | "softBounce1" | "softBounce2" | "softBounce3";
55
+ export type AppUserOptionalAttributes = "email" | "id" | "createDate" | "updateDate" | "syncContacts" | "stateId" | "lastName" | "autoApproveFollowers" | "lastHarvested" | "lastHarvestedError" | "earbugAccessControlPreference" | "unsubscribeAll" | "unsubscribeBiweeklyEmail" | "unsubscribeFollowingNotifications" | "unsubscribeInterestNotifications" | "unsubscribeFunNotifications" | "hardBounce" | "softBounce1" | "softBounce2" | "softBounce3" | "bio";
55
56
  export type AppUserCreationAttributes = Optional<AppUserAttributes, AppUserOptionalAttributes>;
56
57
  export declare class AppUser extends Model<AppUserAttributes, AppUserCreationAttributes> implements AppUserAttributes {
57
58
  firstName: string;
@@ -76,6 +77,7 @@ export declare class AppUser extends Model<AppUserAttributes, AppUserCreationAtt
76
77
  softBounce2?: Date;
77
78
  softBounce3?: Date;
78
79
  isGuest: boolean;
80
+ bio?: string;
79
81
  appUserDevices: AppUserDevice[];
80
82
  getAppUserDevices: Sequelize.HasManyGetAssociationsMixin<AppUserDevice>;
81
83
  setAppUserDevices: Sequelize.HasManySetAssociationsMixin<AppUserDevice, AppUserDeviceId>;
package/dist/AppUser.js CHANGED
@@ -150,6 +150,10 @@ class AppUser extends sequelize_1.Model {
150
150
  allowNull: false,
151
151
  defaultValue: false,
152
152
  field: 'is_guest'
153
+ },
154
+ bio: {
155
+ type: sequelize_1.DataTypes.TEXT,
156
+ allowNull: true
153
157
  }
154
158
  }, {
155
159
  sequelize,
@@ -4,6 +4,8 @@ import type { CanonArtist, CanonArtistId } from './CanonArtist';
4
4
  import type { MerchPlatform, MerchPlatformId } from './MerchPlatform';
5
5
  import type { MerchType, MerchTypeId } from './MerchType';
6
6
  import type { UserBookmarks, UserBookmarksId } from './UserBookmarks';
7
+ import type { UserComments, UserCommentsId } from './UserComments';
8
+ import type { UserLikes, UserLikesId } from './UserLikes';
7
9
  export interface MerchItemAttributes {
8
10
  canonArtistId: string;
9
11
  merchTypeId: string;
@@ -50,6 +52,28 @@ export declare class MerchItem extends Model<MerchItemAttributes, MerchItemCreat
50
52
  hasUserBookmark: Sequelize.HasManyHasAssociationMixin<UserBookmarks, UserBookmarksId>;
51
53
  hasUserBookmarks: Sequelize.HasManyHasAssociationsMixin<UserBookmarks, UserBookmarksId>;
52
54
  countUserBookmarks: Sequelize.HasManyCountAssociationsMixin;
55
+ userComments: UserComments[];
56
+ getUserComments: Sequelize.HasManyGetAssociationsMixin<UserComments>;
57
+ setUserComments: Sequelize.HasManySetAssociationsMixin<UserComments, UserCommentsId>;
58
+ addUserComment: Sequelize.HasManyAddAssociationMixin<UserComments, UserCommentsId>;
59
+ addUserComments: Sequelize.HasManyAddAssociationsMixin<UserComments, UserCommentsId>;
60
+ createUserComment: Sequelize.HasManyCreateAssociationMixin<UserComments>;
61
+ removeUserComment: Sequelize.HasManyRemoveAssociationMixin<UserComments, UserCommentsId>;
62
+ removeUserComments: Sequelize.HasManyRemoveAssociationsMixin<UserComments, UserCommentsId>;
63
+ hasUserComment: Sequelize.HasManyHasAssociationMixin<UserComments, UserCommentsId>;
64
+ hasUserComments: Sequelize.HasManyHasAssociationsMixin<UserComments, UserCommentsId>;
65
+ countUserComments: Sequelize.HasManyCountAssociationsMixin;
66
+ userLikes: UserLikes[];
67
+ getUserLikes: Sequelize.HasManyGetAssociationsMixin<UserLikes>;
68
+ setUserLikes: Sequelize.HasManySetAssociationsMixin<UserLikes, UserLikesId>;
69
+ addUserLike: Sequelize.HasManyAddAssociationMixin<UserLikes, UserLikesId>;
70
+ addUserLikes: Sequelize.HasManyAddAssociationsMixin<UserLikes, UserLikesId>;
71
+ createUserLike: Sequelize.HasManyCreateAssociationMixin<UserLikes>;
72
+ removeUserLike: Sequelize.HasManyRemoveAssociationMixin<UserLikes, UserLikesId>;
73
+ removeUserLikes: Sequelize.HasManyRemoveAssociationsMixin<UserLikes, UserLikesId>;
74
+ hasUserLike: Sequelize.HasManyHasAssociationMixin<UserLikes, UserLikesId>;
75
+ hasUserLikes: Sequelize.HasManyHasAssociationsMixin<UserLikes, UserLikesId>;
76
+ countUserLikes: Sequelize.HasManyCountAssociationsMixin;
53
77
  merchPlatform: MerchPlatform;
54
78
  getMerchPlatform: Sequelize.BelongsToGetAssociationMixin<MerchPlatform>;
55
79
  setMerchPlatform: Sequelize.BelongsToSetAssociationMixin<MerchPlatform, MerchPlatformId>;
@@ -3,6 +3,8 @@ import { Model, Optional } from 'sequelize';
3
3
  import type { CanonArtist, CanonArtistId } from './CanonArtist';
4
4
  import type { NewsPlatform, NewsPlatformId } from './NewsPlatform';
5
5
  import type { UserBookmarks, UserBookmarksId } from './UserBookmarks';
6
+ import type { UserComments, UserCommentsId } from './UserComments';
7
+ import type { UserLikes, UserLikesId } from './UserLikes';
6
8
  export interface NewsArticleAttributes {
7
9
  id: string;
8
10
  canonArtistId: string;
@@ -45,6 +47,28 @@ export declare class NewsArticle extends Model<NewsArticleAttributes, NewsArticl
45
47
  hasUserBookmark: Sequelize.HasManyHasAssociationMixin<UserBookmarks, UserBookmarksId>;
46
48
  hasUserBookmarks: Sequelize.HasManyHasAssociationsMixin<UserBookmarks, UserBookmarksId>;
47
49
  countUserBookmarks: Sequelize.HasManyCountAssociationsMixin;
50
+ userComments: UserComments[];
51
+ getUserComments: Sequelize.HasManyGetAssociationsMixin<UserComments>;
52
+ setUserComments: Sequelize.HasManySetAssociationsMixin<UserComments, UserCommentsId>;
53
+ addUserComment: Sequelize.HasManyAddAssociationMixin<UserComments, UserCommentsId>;
54
+ addUserComments: Sequelize.HasManyAddAssociationsMixin<UserComments, UserCommentsId>;
55
+ createUserComment: Sequelize.HasManyCreateAssociationMixin<UserComments>;
56
+ removeUserComment: Sequelize.HasManyRemoveAssociationMixin<UserComments, UserCommentsId>;
57
+ removeUserComments: Sequelize.HasManyRemoveAssociationsMixin<UserComments, UserCommentsId>;
58
+ hasUserComment: Sequelize.HasManyHasAssociationMixin<UserComments, UserCommentsId>;
59
+ hasUserComments: Sequelize.HasManyHasAssociationsMixin<UserComments, UserCommentsId>;
60
+ countUserComments: Sequelize.HasManyCountAssociationsMixin;
61
+ userLikes: UserLikes[];
62
+ getUserLikes: Sequelize.HasManyGetAssociationsMixin<UserLikes>;
63
+ setUserLikes: Sequelize.HasManySetAssociationsMixin<UserLikes, UserLikesId>;
64
+ addUserLike: Sequelize.HasManyAddAssociationMixin<UserLikes, UserLikesId>;
65
+ addUserLikes: Sequelize.HasManyAddAssociationsMixin<UserLikes, UserLikesId>;
66
+ createUserLike: Sequelize.HasManyCreateAssociationMixin<UserLikes>;
67
+ removeUserLike: Sequelize.HasManyRemoveAssociationMixin<UserLikes, UserLikesId>;
68
+ removeUserLikes: Sequelize.HasManyRemoveAssociationsMixin<UserLikes, UserLikesId>;
69
+ hasUserLike: Sequelize.HasManyHasAssociationMixin<UserLikes, UserLikesId>;
70
+ hasUserLikes: Sequelize.HasManyHasAssociationsMixin<UserLikes, UserLikesId>;
71
+ countUserLikes: Sequelize.HasManyCountAssociationsMixin;
48
72
  newsPlatform: NewsPlatform;
49
73
  getNewsPlatform: Sequelize.BelongsToGetAssociationMixin<NewsPlatform>;
50
74
  setNewsPlatform: Sequelize.BelongsToSetAssociationMixin<NewsPlatform, NewsPlatformId>;
@@ -2,6 +2,8 @@ import * as Sequelize from 'sequelize';
2
2
  import { Model, Optional } from 'sequelize';
3
3
  import type { AppUser, AppUserId } from './AppUser';
4
4
  import type { JukeboxSession, JukeboxSessionId } from './JukeboxSession';
5
+ import type { MerchItem, MerchItemId } from './MerchItem';
6
+ import type { NewsArticle, NewsArticleId } from './NewsArticle';
5
7
  import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUserPlaylist';
6
8
  import type { RadioShow, RadioShowId } from './RadioShow';
7
9
  import type { UserAbuseReports, UserAbuseReportsId } from './UserAbuseReports';
@@ -20,10 +22,12 @@ export interface UserCommentsAttributes {
20
22
  moderationScore?: number;
21
23
  moderationLevel?: string;
22
24
  strippedUrls?: object;
25
+ newsArticleId?: string;
26
+ merchItemId?: string;
23
27
  }
24
28
  export type UserCommentsPk = "id";
25
29
  export type UserCommentsId = UserComments[UserCommentsPk];
26
- export type UserCommentsOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "replyCommentId" | "createDate" | "updateDate" | "modifiedComment" | "moderationScore" | "moderationLevel" | "strippedUrls";
30
+ export type UserCommentsOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "replyCommentId" | "createDate" | "updateDate" | "modifiedComment" | "moderationScore" | "moderationLevel" | "strippedUrls" | "newsArticleId" | "merchItemId";
27
31
  export type UserCommentsCreationAttributes = Optional<UserCommentsAttributes, UserCommentsOptionalAttributes>;
28
32
  export declare class UserComments extends Model<UserCommentsAttributes, UserCommentsCreationAttributes> implements UserCommentsAttributes {
29
33
  appUserId: string;
@@ -40,6 +44,8 @@ export declare class UserComments extends Model<UserCommentsAttributes, UserComm
40
44
  moderationScore?: number;
41
45
  moderationLevel?: string;
42
46
  strippedUrls?: object;
47
+ newsArticleId?: string;
48
+ merchItemId?: string;
43
49
  appUser: AppUser;
44
50
  getAppUser: Sequelize.BelongsToGetAssociationMixin<AppUser>;
45
51
  setAppUser: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
@@ -48,6 +54,14 @@ export declare class UserComments extends Model<UserCommentsAttributes, UserComm
48
54
  getJukebox: Sequelize.BelongsToGetAssociationMixin<JukeboxSession>;
49
55
  setJukebox: Sequelize.BelongsToSetAssociationMixin<JukeboxSession, JukeboxSessionId>;
50
56
  createJukebox: Sequelize.BelongsToCreateAssociationMixin<JukeboxSession>;
57
+ merchItem: MerchItem;
58
+ getMerchItem: Sequelize.BelongsToGetAssociationMixin<MerchItem>;
59
+ setMerchItem: Sequelize.BelongsToSetAssociationMixin<MerchItem, MerchItemId>;
60
+ createMerchItem: Sequelize.BelongsToCreateAssociationMixin<MerchItem>;
61
+ newsArticle: NewsArticle;
62
+ getNewsArticle: Sequelize.BelongsToGetAssociationMixin<NewsArticle>;
63
+ setNewsArticle: Sequelize.BelongsToSetAssociationMixin<NewsArticle, NewsArticleId>;
64
+ createNewsArticle: Sequelize.BelongsToCreateAssociationMixin<NewsArticle>;
51
65
  playlist: PlatformUserPlaylist;
52
66
  getPlaylist: Sequelize.BelongsToGetAssociationMixin<PlatformUserPlaylist>;
53
67
  setPlaylist: Sequelize.BelongsToSetAssociationMixin<PlatformUserPlaylist, PlatformUserPlaylistId>;
@@ -120,6 +120,24 @@ class UserComments extends sequelize_1.Model {
120
120
  type: sequelize_1.DataTypes.JSONB,
121
121
  allowNull: true,
122
122
  field: 'stripped_urls'
123
+ },
124
+ newsArticleId: {
125
+ type: sequelize_1.DataTypes.UUID,
126
+ allowNull: true,
127
+ references: {
128
+ model: 'news_article',
129
+ key: 'id'
130
+ },
131
+ field: 'news_article_id'
132
+ },
133
+ merchItemId: {
134
+ type: sequelize_1.DataTypes.UUID,
135
+ allowNull: true,
136
+ references: {
137
+ model: 'merch_item',
138
+ key: 'id'
139
+ },
140
+ field: 'merch_item_id'
123
141
  }
124
142
  }, {
125
143
  sequelize,
@@ -133,6 +151,18 @@ class UserComments extends sequelize_1.Model {
133
151
  { name: "jukebox_id" },
134
152
  ]
135
153
  },
154
+ {
155
+ name: "idx_user_comments_merch_item",
156
+ fields: [
157
+ { name: "merch_item_id" },
158
+ ]
159
+ },
160
+ {
161
+ name: "idx_user_comments_news_article",
162
+ fields: [
163
+ { name: "news_article_id" },
164
+ ]
165
+ },
136
166
  {
137
167
  name: "idx_user_comments_playlist",
138
168
  fields: [
@@ -2,6 +2,8 @@ import * as Sequelize from 'sequelize';
2
2
  import { Model, Optional } from 'sequelize';
3
3
  import type { AppUser, AppUserId } from './AppUser';
4
4
  import type { JukeboxSession, JukeboxSessionId } from './JukeboxSession';
5
+ import type { MerchItem, MerchItemId } from './MerchItem';
6
+ import type { NewsArticle, NewsArticleId } from './NewsArticle';
5
7
  import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUserPlaylist';
6
8
  import type { RadioShow, RadioShowId } from './RadioShow';
7
9
  export interface UserLikesAttributes {
@@ -12,10 +14,12 @@ export interface UserLikesAttributes {
12
14
  id: string;
13
15
  createDate: Date;
14
16
  updateDate: Date;
17
+ merchItemId?: string;
18
+ newsArticleId?: string;
15
19
  }
16
20
  export type UserLikesPk = "id";
17
21
  export type UserLikesId = UserLikes[UserLikesPk];
18
- export type UserLikesOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "createDate" | "updateDate";
22
+ export type UserLikesOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "createDate" | "updateDate" | "merchItemId" | "newsArticleId";
19
23
  export type UserLikesCreationAttributes = Optional<UserLikesAttributes, UserLikesOptionalAttributes>;
20
24
  export declare class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttributes> implements UserLikesAttributes {
21
25
  appUserId: string;
@@ -25,6 +29,8 @@ export declare class UserLikes extends Model<UserLikesAttributes, UserLikesCreat
25
29
  id: string;
26
30
  createDate: Date;
27
31
  updateDate: Date;
32
+ merchItemId?: string;
33
+ newsArticleId?: string;
28
34
  appUser: AppUser;
29
35
  getAppUser: Sequelize.BelongsToGetAssociationMixin<AppUser>;
30
36
  setAppUser: Sequelize.BelongsToSetAssociationMixin<AppUser, AppUserId>;
@@ -33,6 +39,14 @@ export declare class UserLikes extends Model<UserLikesAttributes, UserLikesCreat
33
39
  getJukebox: Sequelize.BelongsToGetAssociationMixin<JukeboxSession>;
34
40
  setJukebox: Sequelize.BelongsToSetAssociationMixin<JukeboxSession, JukeboxSessionId>;
35
41
  createJukebox: Sequelize.BelongsToCreateAssociationMixin<JukeboxSession>;
42
+ merchItem: MerchItem;
43
+ getMerchItem: Sequelize.BelongsToGetAssociationMixin<MerchItem>;
44
+ setMerchItem: Sequelize.BelongsToSetAssociationMixin<MerchItem, MerchItemId>;
45
+ createMerchItem: Sequelize.BelongsToCreateAssociationMixin<MerchItem>;
46
+ newsArticle: NewsArticle;
47
+ getNewsArticle: Sequelize.BelongsToGetAssociationMixin<NewsArticle>;
48
+ setNewsArticle: Sequelize.BelongsToSetAssociationMixin<NewsArticle, NewsArticleId>;
49
+ createNewsArticle: Sequelize.BelongsToCreateAssociationMixin<NewsArticle>;
36
50
  playlist: PlatformUserPlaylist;
37
51
  getPlaylist: Sequelize.BelongsToGetAssociationMixin<PlatformUserPlaylist>;
38
52
  setPlaylist: Sequelize.BelongsToSetAssociationMixin<PlatformUserPlaylist, PlatformUserPlaylistId>;
package/dist/UserLikes.js CHANGED
@@ -82,6 +82,24 @@ class UserLikes extends sequelize_1.Model {
82
82
  allowNull: false,
83
83
  defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
84
84
  field: 'update_date'
85
+ },
86
+ merchItemId: {
87
+ type: sequelize_1.DataTypes.UUID,
88
+ allowNull: true,
89
+ references: {
90
+ model: 'merch_item',
91
+ key: 'id'
92
+ },
93
+ field: 'merch_item_id'
94
+ },
95
+ newsArticleId: {
96
+ type: sequelize_1.DataTypes.UUID,
97
+ allowNull: true,
98
+ references: {
99
+ model: 'news_article',
100
+ key: 'id'
101
+ },
102
+ field: 'news_article_id'
85
103
  }
86
104
  }, {
87
105
  sequelize,
@@ -95,6 +113,18 @@ class UserLikes extends sequelize_1.Model {
95
113
  { name: "jukebox_id" },
96
114
  ]
97
115
  },
116
+ {
117
+ name: "idx_user_likes_merch_item",
118
+ fields: [
119
+ { name: "merch_item_id" },
120
+ ]
121
+ },
122
+ {
123
+ name: "idx_user_likes_news_article",
124
+ fields: [
125
+ { name: "news_article_id" },
126
+ ]
127
+ },
98
128
  {
99
129
  name: "idx_user_likes_playlist",
100
130
  fields: [
@@ -121,6 +151,22 @@ class UserLikes extends sequelize_1.Model {
121
151
  { name: "jukebox_id" },
122
152
  ]
123
153
  },
154
+ {
155
+ name: "uq_user_likes_user_merch_item",
156
+ unique: true,
157
+ fields: [
158
+ { name: "app_user_id" },
159
+ { name: "merch_item_id" },
160
+ ]
161
+ },
162
+ {
163
+ name: "uq_user_likes_user_news_article",
164
+ unique: true,
165
+ fields: [
166
+ { name: "app_user_id" },
167
+ { name: "news_article_id" },
168
+ ]
169
+ },
124
170
  {
125
171
  name: "uq_user_likes_user_playlist",
126
172
  unique: true,
@@ -593,6 +593,10 @@ function initModels(sequelize) {
593
593
  JukeboxUserType.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "jukeboxUserTypeId" });
594
594
  UserBookmarks.belongsTo(MerchItem, { as: "merchItem", foreignKey: "merchItemId" });
595
595
  MerchItem.hasMany(UserBookmarks, { as: "userBookmarks", foreignKey: "merchItemId" });
596
+ UserComments.belongsTo(MerchItem, { as: "merchItem", foreignKey: "merchItemId" });
597
+ MerchItem.hasMany(UserComments, { as: "userComments", foreignKey: "merchItemId" });
598
+ UserLikes.belongsTo(MerchItem, { as: "merchItem", foreignKey: "merchItemId" });
599
+ MerchItem.hasMany(UserLikes, { as: "userLikes", foreignKey: "merchItemId" });
596
600
  MerchItem.belongsTo(MerchPlatform, { as: "merchPlatform", foreignKey: "merchPlatformId" });
597
601
  MerchPlatform.hasMany(MerchItem, { as: "merchItems", foreignKey: "merchPlatformId" });
598
602
  MerchOrchestration.belongsTo(MerchPlatform, { as: "merchPlatform", foreignKey: "merchPlatformId" });
@@ -603,6 +607,10 @@ function initModels(sequelize) {
603
607
  MerchType.hasMany(MerchOrchestration, { as: "merchOrchestrations", foreignKey: "merchTypeId" });
604
608
  UserBookmarks.belongsTo(NewsArticle, { as: "newsArticle", foreignKey: "newsArticleId" });
605
609
  NewsArticle.hasMany(UserBookmarks, { as: "userBookmarks", foreignKey: "newsArticleId" });
610
+ UserComments.belongsTo(NewsArticle, { as: "newsArticle", foreignKey: "newsArticleId" });
611
+ NewsArticle.hasMany(UserComments, { as: "userComments", foreignKey: "newsArticleId" });
612
+ UserLikes.belongsTo(NewsArticle, { as: "newsArticle", foreignKey: "newsArticleId" });
613
+ NewsArticle.hasMany(UserLikes, { as: "userLikes", foreignKey: "newsArticleId" });
606
614
  NewsArticle.belongsTo(NewsPlatform, { as: "newsPlatform", foreignKey: "newsPlatformId" });
607
615
  NewsPlatform.hasMany(NewsArticle, { as: "newsArticles", foreignKey: "newsPlatformId" });
608
616
  Notification.belongsTo(NotificationType, { as: "notificationType", foreignKey: "notificationTypeId" });
package/models/AppUser.ts CHANGED
@@ -49,11 +49,12 @@ export interface AppUserAttributes {
49
49
  softBounce2?: Date;
50
50
  softBounce3?: Date;
51
51
  isGuest: boolean;
52
+ bio?: string;
52
53
  }
53
54
 
54
55
  export type AppUserPk = "id";
55
56
  export type AppUserId = AppUser[AppUserPk];
56
- export type AppUserOptionalAttributes = "email" | "id" | "createDate" | "updateDate" | "syncContacts" | "stateId" | "lastName" | "autoApproveFollowers" | "lastHarvested" | "lastHarvestedError" | "earbugAccessControlPreference" | "unsubscribeAll" | "unsubscribeBiweeklyEmail" | "unsubscribeFollowingNotifications" | "unsubscribeInterestNotifications" | "unsubscribeFunNotifications" | "hardBounce" | "softBounce1" | "softBounce2" | "softBounce3";
57
+ export type AppUserOptionalAttributes = "email" | "id" | "createDate" | "updateDate" | "syncContacts" | "stateId" | "lastName" | "autoApproveFollowers" | "lastHarvested" | "lastHarvestedError" | "earbugAccessControlPreference" | "unsubscribeAll" | "unsubscribeBiweeklyEmail" | "unsubscribeFollowingNotifications" | "unsubscribeInterestNotifications" | "unsubscribeFunNotifications" | "hardBounce" | "softBounce1" | "softBounce2" | "softBounce3" | "bio";
57
58
  export type AppUserCreationAttributes = Optional<AppUserAttributes, AppUserOptionalAttributes>;
58
59
 
59
60
  export class AppUser extends Model<AppUserAttributes, AppUserCreationAttributes> implements AppUserAttributes {
@@ -79,6 +80,7 @@ export class AppUser extends Model<AppUserAttributes, AppUserCreationAttributes>
79
80
  softBounce2?: Date;
80
81
  softBounce3?: Date;
81
82
  isGuest!: boolean;
83
+ bio?: string;
82
84
 
83
85
  // AppUser hasMany AppUserDevice via appUserId
84
86
  appUserDevices!: AppUserDevice[];
@@ -538,6 +540,10 @@ export class AppUser extends Model<AppUserAttributes, AppUserCreationAttributes>
538
540
  allowNull: false,
539
541
  defaultValue: false,
540
542
  field: 'is_guest'
543
+ },
544
+ bio: {
545
+ type: DataTypes.TEXT,
546
+ allowNull: true
541
547
  }
542
548
  }, {
543
549
  sequelize,
@@ -4,6 +4,8 @@ import type { CanonArtist, CanonArtistId } from './CanonArtist';
4
4
  import type { MerchPlatform, MerchPlatformId } from './MerchPlatform';
5
5
  import type { MerchType, MerchTypeId } from './MerchType';
6
6
  import type { UserBookmarks, UserBookmarksId } from './UserBookmarks';
7
+ import type { UserComments, UserCommentsId } from './UserComments';
8
+ import type { UserLikes, UserLikesId } from './UserLikes';
7
9
 
8
10
  export interface MerchItemAttributes {
9
11
  canonArtistId: string;
@@ -56,6 +58,30 @@ export class MerchItem extends Model<MerchItemAttributes, MerchItemCreationAttri
56
58
  hasUserBookmark!: Sequelize.HasManyHasAssociationMixin<UserBookmarks, UserBookmarksId>;
57
59
  hasUserBookmarks!: Sequelize.HasManyHasAssociationsMixin<UserBookmarks, UserBookmarksId>;
58
60
  countUserBookmarks!: Sequelize.HasManyCountAssociationsMixin;
61
+ // MerchItem hasMany UserComments via merchItemId
62
+ userComments!: UserComments[];
63
+ getUserComments!: Sequelize.HasManyGetAssociationsMixin<UserComments>;
64
+ setUserComments!: Sequelize.HasManySetAssociationsMixin<UserComments, UserCommentsId>;
65
+ addUserComment!: Sequelize.HasManyAddAssociationMixin<UserComments, UserCommentsId>;
66
+ addUserComments!: Sequelize.HasManyAddAssociationsMixin<UserComments, UserCommentsId>;
67
+ createUserComment!: Sequelize.HasManyCreateAssociationMixin<UserComments>;
68
+ removeUserComment!: Sequelize.HasManyRemoveAssociationMixin<UserComments, UserCommentsId>;
69
+ removeUserComments!: Sequelize.HasManyRemoveAssociationsMixin<UserComments, UserCommentsId>;
70
+ hasUserComment!: Sequelize.HasManyHasAssociationMixin<UserComments, UserCommentsId>;
71
+ hasUserComments!: Sequelize.HasManyHasAssociationsMixin<UserComments, UserCommentsId>;
72
+ countUserComments!: Sequelize.HasManyCountAssociationsMixin;
73
+ // MerchItem hasMany UserLikes via merchItemId
74
+ userLikes!: UserLikes[];
75
+ getUserLikes!: Sequelize.HasManyGetAssociationsMixin<UserLikes>;
76
+ setUserLikes!: Sequelize.HasManySetAssociationsMixin<UserLikes, UserLikesId>;
77
+ addUserLike!: Sequelize.HasManyAddAssociationMixin<UserLikes, UserLikesId>;
78
+ addUserLikes!: Sequelize.HasManyAddAssociationsMixin<UserLikes, UserLikesId>;
79
+ createUserLike!: Sequelize.HasManyCreateAssociationMixin<UserLikes>;
80
+ removeUserLike!: Sequelize.HasManyRemoveAssociationMixin<UserLikes, UserLikesId>;
81
+ removeUserLikes!: Sequelize.HasManyRemoveAssociationsMixin<UserLikes, UserLikesId>;
82
+ hasUserLike!: Sequelize.HasManyHasAssociationMixin<UserLikes, UserLikesId>;
83
+ hasUserLikes!: Sequelize.HasManyHasAssociationsMixin<UserLikes, UserLikesId>;
84
+ countUserLikes!: Sequelize.HasManyCountAssociationsMixin;
59
85
  // MerchItem belongsTo MerchPlatform via merchPlatformId
60
86
  merchPlatform!: MerchPlatform;
61
87
  getMerchPlatform!: Sequelize.BelongsToGetAssociationMixin<MerchPlatform>;
@@ -3,6 +3,8 @@ import { DataTypes, Model, Optional } from 'sequelize';
3
3
  import type { CanonArtist, CanonArtistId } from './CanonArtist';
4
4
  import type { NewsPlatform, NewsPlatformId } from './NewsPlatform';
5
5
  import type { UserBookmarks, UserBookmarksId } from './UserBookmarks';
6
+ import type { UserComments, UserCommentsId } from './UserComments';
7
+ import type { UserLikes, UserLikesId } from './UserLikes';
6
8
 
7
9
  export interface NewsArticleAttributes {
8
10
  id: string;
@@ -51,6 +53,30 @@ export class NewsArticle extends Model<NewsArticleAttributes, NewsArticleCreatio
51
53
  hasUserBookmark!: Sequelize.HasManyHasAssociationMixin<UserBookmarks, UserBookmarksId>;
52
54
  hasUserBookmarks!: Sequelize.HasManyHasAssociationsMixin<UserBookmarks, UserBookmarksId>;
53
55
  countUserBookmarks!: Sequelize.HasManyCountAssociationsMixin;
56
+ // NewsArticle hasMany UserComments via newsArticleId
57
+ userComments!: UserComments[];
58
+ getUserComments!: Sequelize.HasManyGetAssociationsMixin<UserComments>;
59
+ setUserComments!: Sequelize.HasManySetAssociationsMixin<UserComments, UserCommentsId>;
60
+ addUserComment!: Sequelize.HasManyAddAssociationMixin<UserComments, UserCommentsId>;
61
+ addUserComments!: Sequelize.HasManyAddAssociationsMixin<UserComments, UserCommentsId>;
62
+ createUserComment!: Sequelize.HasManyCreateAssociationMixin<UserComments>;
63
+ removeUserComment!: Sequelize.HasManyRemoveAssociationMixin<UserComments, UserCommentsId>;
64
+ removeUserComments!: Sequelize.HasManyRemoveAssociationsMixin<UserComments, UserCommentsId>;
65
+ hasUserComment!: Sequelize.HasManyHasAssociationMixin<UserComments, UserCommentsId>;
66
+ hasUserComments!: Sequelize.HasManyHasAssociationsMixin<UserComments, UserCommentsId>;
67
+ countUserComments!: Sequelize.HasManyCountAssociationsMixin;
68
+ // NewsArticle hasMany UserLikes via newsArticleId
69
+ userLikes!: UserLikes[];
70
+ getUserLikes!: Sequelize.HasManyGetAssociationsMixin<UserLikes>;
71
+ setUserLikes!: Sequelize.HasManySetAssociationsMixin<UserLikes, UserLikesId>;
72
+ addUserLike!: Sequelize.HasManyAddAssociationMixin<UserLikes, UserLikesId>;
73
+ addUserLikes!: Sequelize.HasManyAddAssociationsMixin<UserLikes, UserLikesId>;
74
+ createUserLike!: Sequelize.HasManyCreateAssociationMixin<UserLikes>;
75
+ removeUserLike!: Sequelize.HasManyRemoveAssociationMixin<UserLikes, UserLikesId>;
76
+ removeUserLikes!: Sequelize.HasManyRemoveAssociationsMixin<UserLikes, UserLikesId>;
77
+ hasUserLike!: Sequelize.HasManyHasAssociationMixin<UserLikes, UserLikesId>;
78
+ hasUserLikes!: Sequelize.HasManyHasAssociationsMixin<UserLikes, UserLikesId>;
79
+ countUserLikes!: Sequelize.HasManyCountAssociationsMixin;
54
80
  // NewsArticle belongsTo NewsPlatform via newsPlatformId
55
81
  newsPlatform!: NewsPlatform;
56
82
  getNewsPlatform!: Sequelize.BelongsToGetAssociationMixin<NewsPlatform>;
@@ -2,6 +2,8 @@ import * as Sequelize from 'sequelize';
2
2
  import { DataTypes, Model, Optional } from 'sequelize';
3
3
  import type { AppUser, AppUserId } from './AppUser';
4
4
  import type { JukeboxSession, JukeboxSessionId } from './JukeboxSession';
5
+ import type { MerchItem, MerchItemId } from './MerchItem';
6
+ import type { NewsArticle, NewsArticleId } from './NewsArticle';
5
7
  import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUserPlaylist';
6
8
  import type { RadioShow, RadioShowId } from './RadioShow';
7
9
  import type { UserAbuseReports, UserAbuseReportsId } from './UserAbuseReports';
@@ -21,11 +23,13 @@ export interface UserCommentsAttributes {
21
23
  moderationScore?: number;
22
24
  moderationLevel?: string;
23
25
  strippedUrls?: object;
26
+ newsArticleId?: string;
27
+ merchItemId?: string;
24
28
  }
25
29
 
26
30
  export type UserCommentsPk = "id";
27
31
  export type UserCommentsId = UserComments[UserCommentsPk];
28
- export type UserCommentsOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "replyCommentId" | "createDate" | "updateDate" | "modifiedComment" | "moderationScore" | "moderationLevel" | "strippedUrls";
32
+ export type UserCommentsOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "replyCommentId" | "createDate" | "updateDate" | "modifiedComment" | "moderationScore" | "moderationLevel" | "strippedUrls" | "newsArticleId" | "merchItemId";
29
33
  export type UserCommentsCreationAttributes = Optional<UserCommentsAttributes, UserCommentsOptionalAttributes>;
30
34
 
31
35
  export class UserComments extends Model<UserCommentsAttributes, UserCommentsCreationAttributes> implements UserCommentsAttributes {
@@ -43,6 +47,8 @@ export class UserComments extends Model<UserCommentsAttributes, UserCommentsCrea
43
47
  moderationScore?: number;
44
48
  moderationLevel?: string;
45
49
  strippedUrls?: object;
50
+ newsArticleId?: string;
51
+ merchItemId?: string;
46
52
 
47
53
  // UserComments belongsTo AppUser via appUserId
48
54
  appUser!: AppUser;
@@ -54,6 +60,16 @@ export class UserComments extends Model<UserCommentsAttributes, UserCommentsCrea
54
60
  getJukebox!: Sequelize.BelongsToGetAssociationMixin<JukeboxSession>;
55
61
  setJukebox!: Sequelize.BelongsToSetAssociationMixin<JukeboxSession, JukeboxSessionId>;
56
62
  createJukebox!: Sequelize.BelongsToCreateAssociationMixin<JukeboxSession>;
63
+ // UserComments belongsTo MerchItem via merchItemId
64
+ merchItem!: MerchItem;
65
+ getMerchItem!: Sequelize.BelongsToGetAssociationMixin<MerchItem>;
66
+ setMerchItem!: Sequelize.BelongsToSetAssociationMixin<MerchItem, MerchItemId>;
67
+ createMerchItem!: Sequelize.BelongsToCreateAssociationMixin<MerchItem>;
68
+ // UserComments belongsTo NewsArticle via newsArticleId
69
+ newsArticle!: NewsArticle;
70
+ getNewsArticle!: Sequelize.BelongsToGetAssociationMixin<NewsArticle>;
71
+ setNewsArticle!: Sequelize.BelongsToSetAssociationMixin<NewsArticle, NewsArticleId>;
72
+ createNewsArticle!: Sequelize.BelongsToCreateAssociationMixin<NewsArticle>;
57
73
  // UserComments belongsTo PlatformUserPlaylist via playlistId
58
74
  playlist!: PlatformUserPlaylist;
59
75
  getPlaylist!: Sequelize.BelongsToGetAssociationMixin<PlatformUserPlaylist>;
@@ -175,6 +191,24 @@ export class UserComments extends Model<UserCommentsAttributes, UserCommentsCrea
175
191
  type: DataTypes.JSONB,
176
192
  allowNull: true,
177
193
  field: 'stripped_urls'
194
+ },
195
+ newsArticleId: {
196
+ type: DataTypes.UUID,
197
+ allowNull: true,
198
+ references: {
199
+ model: 'news_article',
200
+ key: 'id'
201
+ },
202
+ field: 'news_article_id'
203
+ },
204
+ merchItemId: {
205
+ type: DataTypes.UUID,
206
+ allowNull: true,
207
+ references: {
208
+ model: 'merch_item',
209
+ key: 'id'
210
+ },
211
+ field: 'merch_item_id'
178
212
  }
179
213
  }, {
180
214
  sequelize,
@@ -188,6 +222,18 @@ export class UserComments extends Model<UserCommentsAttributes, UserCommentsCrea
188
222
  { name: "jukebox_id" },
189
223
  ]
190
224
  },
225
+ {
226
+ name: "idx_user_comments_merch_item",
227
+ fields: [
228
+ { name: "merch_item_id" },
229
+ ]
230
+ },
231
+ {
232
+ name: "idx_user_comments_news_article",
233
+ fields: [
234
+ { name: "news_article_id" },
235
+ ]
236
+ },
191
237
  {
192
238
  name: "idx_user_comments_playlist",
193
239
  fields: [
@@ -2,6 +2,8 @@ import * as Sequelize from 'sequelize';
2
2
  import { DataTypes, Model, Optional } from 'sequelize';
3
3
  import type { AppUser, AppUserId } from './AppUser';
4
4
  import type { JukeboxSession, JukeboxSessionId } from './JukeboxSession';
5
+ import type { MerchItem, MerchItemId } from './MerchItem';
6
+ import type { NewsArticle, NewsArticleId } from './NewsArticle';
5
7
  import type { PlatformUserPlaylist, PlatformUserPlaylistId } from './PlatformUserPlaylist';
6
8
  import type { RadioShow, RadioShowId } from './RadioShow';
7
9
 
@@ -13,11 +15,13 @@ export interface UserLikesAttributes {
13
15
  id: string;
14
16
  createDate: Date;
15
17
  updateDate: Date;
18
+ merchItemId?: string;
19
+ newsArticleId?: string;
16
20
  }
17
21
 
18
22
  export type UserLikesPk = "id";
19
23
  export type UserLikesId = UserLikes[UserLikesPk];
20
- export type UserLikesOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "createDate" | "updateDate";
24
+ export type UserLikesOptionalAttributes = "jukeboxId" | "playlistId" | "radioShowId" | "id" | "createDate" | "updateDate" | "merchItemId" | "newsArticleId";
21
25
  export type UserLikesCreationAttributes = Optional<UserLikesAttributes, UserLikesOptionalAttributes>;
22
26
 
23
27
  export class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttributes> implements UserLikesAttributes {
@@ -28,6 +32,8 @@ export class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttri
28
32
  id!: string;
29
33
  createDate!: Date;
30
34
  updateDate!: Date;
35
+ merchItemId?: string;
36
+ newsArticleId?: string;
31
37
 
32
38
  // UserLikes belongsTo AppUser via appUserId
33
39
  appUser!: AppUser;
@@ -39,6 +45,16 @@ export class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttri
39
45
  getJukebox!: Sequelize.BelongsToGetAssociationMixin<JukeboxSession>;
40
46
  setJukebox!: Sequelize.BelongsToSetAssociationMixin<JukeboxSession, JukeboxSessionId>;
41
47
  createJukebox!: Sequelize.BelongsToCreateAssociationMixin<JukeboxSession>;
48
+ // UserLikes belongsTo MerchItem via merchItemId
49
+ merchItem!: MerchItem;
50
+ getMerchItem!: Sequelize.BelongsToGetAssociationMixin<MerchItem>;
51
+ setMerchItem!: Sequelize.BelongsToSetAssociationMixin<MerchItem, MerchItemId>;
52
+ createMerchItem!: Sequelize.BelongsToCreateAssociationMixin<MerchItem>;
53
+ // UserLikes belongsTo NewsArticle via newsArticleId
54
+ newsArticle!: NewsArticle;
55
+ getNewsArticle!: Sequelize.BelongsToGetAssociationMixin<NewsArticle>;
56
+ setNewsArticle!: Sequelize.BelongsToSetAssociationMixin<NewsArticle, NewsArticleId>;
57
+ createNewsArticle!: Sequelize.BelongsToCreateAssociationMixin<NewsArticle>;
42
58
  // UserLikes belongsTo PlatformUserPlaylist via playlistId
43
59
  playlist!: PlatformUserPlaylist;
44
60
  getPlaylist!: Sequelize.BelongsToGetAssociationMixin<PlatformUserPlaylist>;
@@ -105,6 +121,24 @@ export class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttri
105
121
  allowNull: false,
106
122
  defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
107
123
  field: 'update_date'
124
+ },
125
+ merchItemId: {
126
+ type: DataTypes.UUID,
127
+ allowNull: true,
128
+ references: {
129
+ model: 'merch_item',
130
+ key: 'id'
131
+ },
132
+ field: 'merch_item_id'
133
+ },
134
+ newsArticleId: {
135
+ type: DataTypes.UUID,
136
+ allowNull: true,
137
+ references: {
138
+ model: 'news_article',
139
+ key: 'id'
140
+ },
141
+ field: 'news_article_id'
108
142
  }
109
143
  }, {
110
144
  sequelize,
@@ -118,6 +152,18 @@ export class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttri
118
152
  { name: "jukebox_id" },
119
153
  ]
120
154
  },
155
+ {
156
+ name: "idx_user_likes_merch_item",
157
+ fields: [
158
+ { name: "merch_item_id" },
159
+ ]
160
+ },
161
+ {
162
+ name: "idx_user_likes_news_article",
163
+ fields: [
164
+ { name: "news_article_id" },
165
+ ]
166
+ },
121
167
  {
122
168
  name: "idx_user_likes_playlist",
123
169
  fields: [
@@ -144,6 +190,22 @@ export class UserLikes extends Model<UserLikesAttributes, UserLikesCreationAttri
144
190
  { name: "jukebox_id" },
145
191
  ]
146
192
  },
193
+ {
194
+ name: "uq_user_likes_user_merch_item",
195
+ unique: true,
196
+ fields: [
197
+ { name: "app_user_id" },
198
+ { name: "merch_item_id" },
199
+ ]
200
+ },
201
+ {
202
+ name: "uq_user_likes_user_news_article",
203
+ unique: true,
204
+ fields: [
205
+ { name: "app_user_id" },
206
+ { name: "news_article_id" },
207
+ ]
208
+ },
147
209
  {
148
210
  name: "uq_user_likes_user_playlist",
149
211
  unique: true,
@@ -938,6 +938,10 @@ export function initModels(sequelize: Sequelize) {
938
938
  JukeboxUserType.hasMany(JukeboxUser, { as: "jukeboxUsers", foreignKey: "jukeboxUserTypeId"});
939
939
  UserBookmarks.belongsTo(MerchItem, { as: "merchItem", foreignKey: "merchItemId"});
940
940
  MerchItem.hasMany(UserBookmarks, { as: "userBookmarks", foreignKey: "merchItemId"});
941
+ UserComments.belongsTo(MerchItem, { as: "merchItem", foreignKey: "merchItemId"});
942
+ MerchItem.hasMany(UserComments, { as: "userComments", foreignKey: "merchItemId"});
943
+ UserLikes.belongsTo(MerchItem, { as: "merchItem", foreignKey: "merchItemId"});
944
+ MerchItem.hasMany(UserLikes, { as: "userLikes", foreignKey: "merchItemId"});
941
945
  MerchItem.belongsTo(MerchPlatform, { as: "merchPlatform", foreignKey: "merchPlatformId"});
942
946
  MerchPlatform.hasMany(MerchItem, { as: "merchItems", foreignKey: "merchPlatformId"});
943
947
  MerchOrchestration.belongsTo(MerchPlatform, { as: "merchPlatform", foreignKey: "merchPlatformId"});
@@ -948,6 +952,10 @@ export function initModels(sequelize: Sequelize) {
948
952
  MerchType.hasMany(MerchOrchestration, { as: "merchOrchestrations", foreignKey: "merchTypeId"});
949
953
  UserBookmarks.belongsTo(NewsArticle, { as: "newsArticle", foreignKey: "newsArticleId"});
950
954
  NewsArticle.hasMany(UserBookmarks, { as: "userBookmarks", foreignKey: "newsArticleId"});
955
+ UserComments.belongsTo(NewsArticle, { as: "newsArticle", foreignKey: "newsArticleId"});
956
+ NewsArticle.hasMany(UserComments, { as: "userComments", foreignKey: "newsArticleId"});
957
+ UserLikes.belongsTo(NewsArticle, { as: "newsArticle", foreignKey: "newsArticleId"});
958
+ NewsArticle.hasMany(UserLikes, { as: "userLikes", foreignKey: "newsArticleId"});
951
959
  NewsArticle.belongsTo(NewsPlatform, { as: "newsPlatform", foreignKey: "newsPlatformId"});
952
960
  NewsPlatform.hasMany(NewsArticle, { as: "newsArticles", foreignKey: "newsPlatformId"});
953
961
  Notification.belongsTo(NotificationType, { as: "notificationType", foreignKey: "notificationTypeId"});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earbug/db-models",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {