Skip to content

Commit fa27b9a

Browse files
committed
chor(remove unnecessary map)
1 parent b615b25 commit fa27b9a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/utilities/relationship-utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,13 @@ function updateHasManyThrough (
157157
return PivotModel.find({ where: { [leftFKName]: leftPKValue } })
158158
.then(models => {
159159
const existingIds = models.map(model => model[rightFKName])
160-
const newIds = rightFKValues.map(id => id)
161-
const idsToDelete = _.difference(existingIds, newIds)
160+
const idsToDelete = _.difference(existingIds, rightFKValues)
162161
return PivotModel.destroyAll({
163162
[leftFKName]: leftPKValue,
164163
[rightFKName]: { inq: idsToDelete }
165164
})
166165
.then(() => {
167-
const idsToAdd = _.difference(newIds, existingIds)
166+
const idsToAdd = _.difference(rightFKValues, existingIds)
168167
return PivotModel.create(
169168
idsToAdd.map(id => ({
170169
[leftFKName]: leftPKValue,

0 commit comments

Comments
 (0)