agrs-sequelize-sdk 1.1.79 → 1.1.81
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.
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const ExplorAdsChannel = sequelize.define(
|
|
3
|
+
"ExplorAdsChannel",
|
|
4
|
+
{
|
|
5
|
+
channelId: {
|
|
6
|
+
type: DataTypes.STRING,
|
|
7
|
+
allowNull: false,
|
|
8
|
+
validate: {
|
|
9
|
+
// Validate channel format (br_vt_ch1401 to br_vt_ch1500)
|
|
10
|
+
is: /^br_vt_ch(14[0-9][0-9]|1500)$/
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
status: {
|
|
14
|
+
type: DataTypes.STRING,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
defaultValue: "free",
|
|
17
|
+
validate: {
|
|
18
|
+
isIn: [["free", "used", "archived"]],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
domain: {
|
|
22
|
+
type: DataTypes.STRING,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
defaultValue: "nexoreach.com"
|
|
25
|
+
},
|
|
26
|
+
connectedCampaigns: {
|
|
27
|
+
type: DataTypes.JSONB,
|
|
28
|
+
allowNull: false,
|
|
29
|
+
defaultValue: [],
|
|
30
|
+
},
|
|
31
|
+
lastUsed: {
|
|
32
|
+
type: DataTypes.DATE,
|
|
33
|
+
allowNull: true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
tableName: "explorads_channels",
|
|
38
|
+
timestamps: true,
|
|
39
|
+
indexes: [
|
|
40
|
+
{
|
|
41
|
+
unique: true,
|
|
42
|
+
fields: ["channelId"],
|
|
43
|
+
name: "unique_explorads_channel"
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// Define associations
|
|
50
|
+
ExplorAdsChannel.associate = (models) => {
|
|
51
|
+
if (models.RSOCFeedCampaign) {
|
|
52
|
+
ExplorAdsChannel.hasMany(models.RSOCFeedCampaign, {
|
|
53
|
+
foreignKey: "channelId",
|
|
54
|
+
sourceKey: "channelId",
|
|
55
|
+
as: "RSOCFeedCampaigns",
|
|
56
|
+
constraints: false, // Disable FK constraint
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return ExplorAdsChannel;
|
|
62
|
+
};
|
|
@@ -10,12 +10,12 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
10
10
|
},
|
|
11
11
|
AGRSAID: {
|
|
12
12
|
type: DataTypes.STRING,
|
|
13
|
-
allowNull:
|
|
13
|
+
allowNull: true,
|
|
14
14
|
comment: "ID referencing Article.AGRSAID",
|
|
15
15
|
},
|
|
16
16
|
articleName: {
|
|
17
17
|
type: DataTypes.STRING,
|
|
18
|
-
allowNull:
|
|
18
|
+
allowNull: true,
|
|
19
19
|
comment: "Name of the associated article",
|
|
20
20
|
},
|
|
21
21
|
channelId: {
|