agrs-sequelize-sdk 1.1.62 → 1.1.64
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/Ad.js +13 -2
- package/models/Article.js +4 -0
- package/package.json +1 -1
package/models/Ad.js
CHANGED
|
@@ -170,9 +170,20 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// do the same with RSOCFeedCampaign
|
|
174
|
+
const rsocFeedCampaign = await sequelize.models.RSOCFeedCampaign.findOne({
|
|
175
|
+
where: { AGRS_CID: this.AGRS_CID },
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
if (rsocFeedCampaign) {
|
|
179
|
+
return {
|
|
180
|
+
type: "RSOCFeedCampaign",
|
|
181
|
+
data: rsocFeedCampaign,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
173
184
|
return null;
|
|
174
185
|
};
|
|
175
|
-
|
|
186
|
+
|
|
176
187
|
Ad.addHook("afterCreate", async (ad, options) => {
|
|
177
188
|
if (ad.publish === false) {
|
|
178
189
|
// If publish is false on creation, save a snapshot to AdHistory
|
|
@@ -182,7 +193,7 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
182
193
|
});
|
|
183
194
|
}
|
|
184
195
|
});
|
|
185
|
-
|
|
196
|
+
|
|
186
197
|
Ad.addHook("beforeUpdate", async (ad, options) => {
|
|
187
198
|
if (ad.changed("publish")) {
|
|
188
199
|
if (ad.previous("publish") === true && ad.publish === false) {
|
package/models/Article.js
CHANGED