Ich habe zwei Modelle und es gibt viele zu viele Assoziationen zwischen ihnen (ich benutze sails.js Rahmen). Ich habe das Additionsfeld in der Zuordnungstabelle hinzugefügt. Ich möchte dieses Zusatzfeld füllen. Wie erreiche ich das? Meine Modelle sind unten angegeben:füllen Sie zusätzliche Informationen der 'Through' Tabelle in Segel
//Store.js file
module.exports = {
autoCreatedAt: false,
autoUpdatedAt: false,
attributes: {
name: "string",
slug: "string",
imageURL: "string",
termsAndConditions: "string",
link: "string",
productID: {
collection: 'product', //This is for association with the product model
via: 'storeID',
through: 'price'
}
}
};
Unten ist mein Product.js
//Product.js
module.exports = {
autoCreatedAt: false,
autoUpdatedAt: false,
attributes: {
name: 'string',
storeID: {
collection: 'stores',
via: 'productID', //This is for association with the Store model
through: 'price'
}
}
};
-Datei und unten ist mein durch Modell Price.js
module.exports = {
autoCreatedAt: false,
autoUpdatedAt: false,
attributes: {
storeID: {
model: 'stores'
},
productID: {
model: 'product'
},
price: 'integer' //I want to populate this additional field when calling api '/product' or '/store'
}
};
Wie das zusätzliche Feld Preis füllen der Preistabelle aus dem Aufruf der API '/ Produkt' oder '/ Store'?