agrs-sequelize-sdk 1.1.71 → 1.1.73
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/Article.js +26 -5
- package/package.json +1 -1
package/models/Article.js
CHANGED
|
@@ -41,14 +41,14 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
41
41
|
type: DataTypes.STRING,
|
|
42
42
|
allowNull: true,
|
|
43
43
|
},
|
|
44
|
-
topics: {
|
|
45
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
46
|
-
allowNull: true,
|
|
47
|
-
},
|
|
48
44
|
keywords: {
|
|
49
45
|
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
50
46
|
allowNull: true,
|
|
51
47
|
},
|
|
48
|
+
mainKeyword: {
|
|
49
|
+
type: DataTypes.STRING,
|
|
50
|
+
allowNull: false,
|
|
51
|
+
},
|
|
52
52
|
date: {
|
|
53
53
|
type: DataTypes.DATE,
|
|
54
54
|
allowNull: true,
|
|
@@ -78,6 +78,27 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
78
78
|
type: DataTypes.STRING,
|
|
79
79
|
allowNull: false,
|
|
80
80
|
defaultValue: "pending",
|
|
81
|
+
validate: {
|
|
82
|
+
isIn: [
|
|
83
|
+
[
|
|
84
|
+
"pending",
|
|
85
|
+
"approved",
|
|
86
|
+
"rejected",
|
|
87
|
+
"disapproved",
|
|
88
|
+
"duplicated",
|
|
89
|
+
"keyword_already_exists",
|
|
90
|
+
"invalid_vertical",
|
|
91
|
+
"invalid_language",
|
|
92
|
+
"in_review",
|
|
93
|
+
"error",
|
|
94
|
+
],
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
originalStatus: {
|
|
99
|
+
type: DataTypes.STRING,
|
|
100
|
+
allowNull: true,
|
|
101
|
+
comment: "Original status from Predicto before any mapping",
|
|
81
102
|
},
|
|
82
103
|
creationType: {
|
|
83
104
|
type: DataTypes.STRING,
|
|
@@ -124,7 +145,7 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
124
145
|
};
|
|
125
146
|
|
|
126
147
|
Article.prototype.isAvailableForCampaign = function () {
|
|
127
|
-
return this.status
|
|
148
|
+
return ["approved", "keyword_already_exists"].includes(this.status);
|
|
128
149
|
};
|
|
129
150
|
|
|
130
151
|
return Article;
|