agrs-sequelize-sdk 1.1.64 → 1.1.65
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 +25 -2
- package/package.json +1 -1
package/models/Ad.js
CHANGED
|
@@ -128,15 +128,38 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
130
|
|
|
131
|
+
// Ad.associate = (models) => {
|
|
132
|
+
// Ad.belongsTo(models.AdSet, { foreignKey: "AdSetID" });
|
|
133
|
+
|
|
134
|
+
// // Association with CodefuelCampaign using AGRS_CID
|
|
135
|
+
// Ad.belongsTo(models.CodefuelCampaign, {
|
|
136
|
+
// foreignKey: "AGRS_CID",
|
|
137
|
+
// targetKey: "AGRSCID",
|
|
138
|
+
// as: "CodefuelCampaign",
|
|
139
|
+
// constraints: false, // Disable FK constraint at the DB level
|
|
140
|
+
// });
|
|
141
|
+
|
|
142
|
+
// Ad.hasMany(models.AdPerformance, {
|
|
143
|
+
// foreignKey: "AdID",
|
|
144
|
+
// });
|
|
145
|
+
// };
|
|
146
|
+
|
|
131
147
|
Ad.associate = (models) => {
|
|
132
148
|
Ad.belongsTo(models.AdSet, { foreignKey: "AdSetID" });
|
|
133
149
|
|
|
134
|
-
//
|
|
150
|
+
// Add a dynamic relationship that supports either CodefuelCampaign or RSOCFeedCampaign
|
|
135
151
|
Ad.belongsTo(models.CodefuelCampaign, {
|
|
136
152
|
foreignKey: "AGRS_CID",
|
|
137
153
|
targetKey: "AGRSCID",
|
|
138
154
|
as: "CodefuelCampaign",
|
|
139
|
-
constraints: false,
|
|
155
|
+
constraints: false,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
Ad.belongsTo(models.RSOCFeedCampaign, {
|
|
159
|
+
foreignKey: "AGRS_CID",
|
|
160
|
+
targetKey: "AGRS_CID",
|
|
161
|
+
as: "RSOCFeedCampaign",
|
|
162
|
+
constraints: false,
|
|
140
163
|
});
|
|
141
164
|
|
|
142
165
|
Ad.hasMany(models.AdPerformance, {
|