agrs-sequelize-sdk 1.3.27 → 1.3.30
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/models/CampaignCreationLogV2.js +5 -0
- package/models/Users.js +124 -119
- package/package.json +1 -1
|
@@ -132,6 +132,11 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
132
132
|
allowNull: true,
|
|
133
133
|
comment: "black, blue, green, white",
|
|
134
134
|
},
|
|
135
|
+
ads_category: {
|
|
136
|
+
type: DataTypes.STRING(10),
|
|
137
|
+
allowNull: true,
|
|
138
|
+
comment: "l (Low), m (Medium), h (High)",
|
|
139
|
+
},
|
|
135
140
|
ad_title: {
|
|
136
141
|
type: DataTypes.STRING(500),
|
|
137
142
|
allowNull: true,
|
package/models/Users.js
CHANGED
|
@@ -1,119 +1,124 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Users = sequelize.define(
|
|
3
|
-
"Users",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID, // Use UUID for the primary key
|
|
7
|
-
defaultValue: DataTypes.UUIDV4, // Automatically generate a UUID
|
|
8
|
-
primaryKey: true, // Set as primary key
|
|
9
|
-
},
|
|
10
|
-
Username: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
unique: true,
|
|
14
|
-
},
|
|
15
|
-
Image: {
|
|
16
|
-
type: DataTypes.STRING,
|
|
17
|
-
allowNull: true,
|
|
18
|
-
},
|
|
19
|
-
Email: {
|
|
20
|
-
type: DataTypes.STRING,
|
|
21
|
-
allowNull: true,
|
|
22
|
-
unique: true,
|
|
23
|
-
},
|
|
24
|
-
// add name field
|
|
25
|
-
Name: {
|
|
26
|
-
type: DataTypes.STRING,
|
|
27
|
-
allowNull: false,
|
|
28
|
-
},
|
|
29
|
-
Password: {
|
|
30
|
-
type: DataTypes.STRING(1024), // Store hash with max length 256
|
|
31
|
-
allowNull: false,
|
|
32
|
-
},
|
|
33
|
-
Roles: {
|
|
34
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of roles
|
|
35
|
-
allowNull: true,
|
|
36
|
-
defaultValue: [],
|
|
37
|
-
},
|
|
38
|
-
Features: {
|
|
39
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of features
|
|
40
|
-
allowNull: true,
|
|
41
|
-
defaultValue: [],
|
|
42
|
-
},
|
|
43
|
-
Accounts: {
|
|
44
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
|
|
45
|
-
allowNull: true,
|
|
46
|
-
defaultValue: [],
|
|
47
|
-
},
|
|
48
|
-
MediaBuyers: {
|
|
49
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
|
|
50
|
-
allowNull: true,
|
|
51
|
-
defaultValue: [],
|
|
52
|
-
},
|
|
53
|
-
Pages: {
|
|
54
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
|
|
55
|
-
allowNull: true,
|
|
56
|
-
defaultValue: [],
|
|
57
|
-
},
|
|
58
|
-
FeedProvider: {
|
|
59
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of
|
|
60
|
-
allowNull: true,
|
|
61
|
-
defaultValue: [],
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
type: DataTypes.ARRAY(DataTypes.
|
|
65
|
-
allowNull: true,
|
|
66
|
-
defaultValue: [],
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
type: DataTypes.ARRAY(DataTypes.STRING), // Array of
|
|
70
|
-
allowNull: true,
|
|
71
|
-
defaultValue: [],
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
type: DataTypes.
|
|
75
|
-
allowNull: true,
|
|
76
|
-
defaultValue: [],
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
type: DataTypes.
|
|
80
|
-
allowNull: true,
|
|
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
|
-
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Users = sequelize.define(
|
|
3
|
+
"Users",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID, // Use UUID for the primary key
|
|
7
|
+
defaultValue: DataTypes.UUIDV4, // Automatically generate a UUID
|
|
8
|
+
primaryKey: true, // Set as primary key
|
|
9
|
+
},
|
|
10
|
+
Username: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
unique: true,
|
|
14
|
+
},
|
|
15
|
+
Image: {
|
|
16
|
+
type: DataTypes.STRING,
|
|
17
|
+
allowNull: true,
|
|
18
|
+
},
|
|
19
|
+
Email: {
|
|
20
|
+
type: DataTypes.STRING,
|
|
21
|
+
allowNull: true,
|
|
22
|
+
unique: true,
|
|
23
|
+
},
|
|
24
|
+
// add name field
|
|
25
|
+
Name: {
|
|
26
|
+
type: DataTypes.STRING,
|
|
27
|
+
allowNull: false,
|
|
28
|
+
},
|
|
29
|
+
Password: {
|
|
30
|
+
type: DataTypes.STRING(1024), // Store hash with max length 256
|
|
31
|
+
allowNull: false,
|
|
32
|
+
},
|
|
33
|
+
Roles: {
|
|
34
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of roles
|
|
35
|
+
allowNull: true,
|
|
36
|
+
defaultValue: [],
|
|
37
|
+
},
|
|
38
|
+
Features: {
|
|
39
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of features
|
|
40
|
+
allowNull: true,
|
|
41
|
+
defaultValue: [],
|
|
42
|
+
},
|
|
43
|
+
Accounts: {
|
|
44
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
|
|
45
|
+
allowNull: true,
|
|
46
|
+
defaultValue: [],
|
|
47
|
+
},
|
|
48
|
+
MediaBuyers: {
|
|
49
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
|
|
50
|
+
allowNull: true,
|
|
51
|
+
defaultValue: [],
|
|
52
|
+
},
|
|
53
|
+
Pages: {
|
|
54
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
|
|
55
|
+
allowNull: true,
|
|
56
|
+
defaultValue: [],
|
|
57
|
+
},
|
|
58
|
+
FeedProvider: {
|
|
59
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of static feed names (predicto, mine, etc.)
|
|
60
|
+
allowNull: true,
|
|
61
|
+
defaultValue: [],
|
|
62
|
+
},
|
|
63
|
+
DynamicFeedIds: {
|
|
64
|
+
type: DataTypes.ARRAY(DataTypes.UUID), // Array of UUIDs referencing dynamic_feeds.id
|
|
65
|
+
allowNull: true,
|
|
66
|
+
defaultValue: [],
|
|
67
|
+
},
|
|
68
|
+
Organization: {
|
|
69
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of organization IDs
|
|
70
|
+
allowNull: true,
|
|
71
|
+
defaultValue: [],
|
|
72
|
+
},
|
|
73
|
+
Tier2Accounts: {
|
|
74
|
+
type: DataTypes.ARRAY(DataTypes.STRING), // Array of Tier2 Ad Account Facebook IDs
|
|
75
|
+
allowNull: true,
|
|
76
|
+
defaultValue: [],
|
|
77
|
+
},
|
|
78
|
+
LastEntrance: {
|
|
79
|
+
type: DataTypes.DATE, // Array of organization IDs
|
|
80
|
+
allowNull: true,
|
|
81
|
+
defaultValue: [],
|
|
82
|
+
},
|
|
83
|
+
Status: {
|
|
84
|
+
type: DataTypes.STRING, // Array of organization IDs
|
|
85
|
+
allowNull: true,
|
|
86
|
+
},
|
|
87
|
+
access_all_files: {
|
|
88
|
+
type: DataTypes.BOOLEAN,
|
|
89
|
+
allowNull: true,
|
|
90
|
+
},
|
|
91
|
+
managed_by: {
|
|
92
|
+
type: DataTypes.UUID, // A UUID to store the ID of the user who manages this user
|
|
93
|
+
allowNull: true,
|
|
94
|
+
references: {
|
|
95
|
+
model: "Users",
|
|
96
|
+
key: "id",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
tableName: "Users",
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// Define associations for managed_by relationship
|
|
106
|
+
Users.associate = (models) => {
|
|
107
|
+
// A user can manage many users
|
|
108
|
+
Users.hasMany(models.Users, {
|
|
109
|
+
foreignKey: "managed_by",
|
|
110
|
+
as: "managedUsers",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// A user can only be managed by one user
|
|
114
|
+
Users.belongsTo(models.Users, {
|
|
115
|
+
foreignKey: "managed_by",
|
|
116
|
+
as: "manager",
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// A user can have many presets
|
|
120
|
+
Users.hasMany(models.Presets, { foreignKey: "userId", as: "presets" });
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return Users;
|
|
124
|
+
};
|