This repository was archived by the owner on Sep 16, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathUserSettingNotification.js
More file actions
119 lines (119 loc) · 3.37 KB
/
Copy pathUserSettingNotification.js
File metadata and controls
119 lines (119 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
'use strict'
module.exports = (sequelize, DataTypes) => {
const UserSettingNotification = sequelize.define(
'UserSettingNotification', {
id: {
type: DataTypes.INTEGER(10).UNSIGNED,
primaryKey: true,
allowNull: false,
autoIncrement: true,
comment: 'Unique ID'
},
user_id: {
type: DataTypes.INTEGER(10).UNSIGNED,
allowNull: false,
comment: 'Unique User ID'
},
email_comment_left: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Email Comment Left'
},
email_comment_liked: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Email Comment Liked'
},
email_someone_follows: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Email Someone Follows'
},
email_mentioned_in_comment: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Email Mentioned in Comment'
},
web_comment_left: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Web Comment Left'
},
web_comment_liked: {
type: DataTypes.BOOLEAN,
unique: 'true',
comment: 'Notification Setting for Web Comment Liked'
},
web_someone_follows: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Web Someone Follows'
},
web_mentioned_in_comment: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Notification Setting for Web Mentioned in Comment'
},
newsletter: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: 'Whether User is Subscribed to Newsletter'
}
}, {
timestamps: true,
paranoid: true,
freezeTableName: true,
singular: 'user_settings_notification',
plural: 'user_settings_notifications',
tableName: 'user_settings_notifications',
engine: 'InnoDB',
collate: 'utf8_unicode_ci',
charset: 'utf8mb4',
comment: 'User Setting Notification Model',
indexes: [{
name: 'idx_email_comment_left',
fields: ['email_comment_left']
},
{
name: 'idx_email_comment_liked',
fields: ['email_comment_liked']
},
{
name: 'idx_email_someone_follows',
fields: ['email_someone_follows']
},
{
name: 'idx_email_mentioned_in_comment',
fields: ['email_mentioned_in_comment']
},
{
name: 'idx_web_comment_left',
fields: ['web_comment_left']
},
{
name: 'idx_web_comment_liked',
fields: ['web_comment_liked']
},
{
name: 'idx_web_someone_follows',
fields: ['web_someone_follows']
},
{
name: 'idx_web_mentioned_in_comment',
fields: ['web_mentioned_in_comment']
},
{
name: 'idx_newsletter',
fields: ['newsletter']
}
]
}
)
UserSettingNotification.associate = function(models) {
UserSettingNotification.belongsTo(models.User, {
foreignKey: 'user_id',
target: 'id'
})
}
return UserSettingNotification
}