mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:45:18 +00:00
fix: remove through.updateAssociations
This commit is contained in:
parent
c5d4e0ff24
commit
40bcfb7edc
@ -456,9 +456,11 @@ export abstract class Model extends SequelizeModel {
|
|||||||
const ThroughModel = (association as BELONGSTOMANY).getThroughModel();
|
const ThroughModel = (association as BELONGSTOMANY).getThroughModel();
|
||||||
const throughName = (association as BELONGSTOMANY).getThroughName();
|
const throughName = (association as BELONGSTOMANY).getThroughName();
|
||||||
|
|
||||||
|
|
||||||
for (const { item, target } of belongsToManyList) {
|
for (const { item, target } of belongsToManyList) {
|
||||||
const throughValues = item[throughName];
|
const throughValues = item[throughName];
|
||||||
if (typeof throughValues === 'object') {
|
console.log({ThroughModel: ThroughModel.options, throughName, item, throughValues})
|
||||||
|
if (throughValues && typeof throughValues === 'object') {
|
||||||
const { foreignKey, sourceKey, otherKey } = association.options;
|
const { foreignKey, sourceKey, otherKey } = association.options;
|
||||||
const through = await ThroughModel.findOne({
|
const through = await ThroughModel.findOne({
|
||||||
where: {
|
where: {
|
||||||
@ -468,7 +470,8 @@ export abstract class Model extends SequelizeModel {
|
|||||||
transaction
|
transaction
|
||||||
});
|
});
|
||||||
await through.update(throughValues, opts);
|
await through.update(throughValues, opts);
|
||||||
await through.updateAssociations(throughValues, opts);
|
// TODO:有 BUG,未知
|
||||||
|
// await through.updateAssociations(throughValues, opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user