Skip to content

Commit

Permalink
MapMembershipDestroy to top of deletions in updateMap function (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms0ur1s authored May 20, 2024
1 parent c6c0203 commit 39a8bdf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/queries/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ export const updateMap: MapUpdateFunction = async (mapId, name, data) => {
}
}

await MapMembership.destroy({
where: { map_id: mapId },
});

if (markerIds.length) {
console.log(
`Removing ${markerIds.length} markers from DB for map ${mapId}`
Expand All @@ -381,9 +385,6 @@ export const updateMap: MapUpdateFunction = async (mapId, name, data) => {
});
}

await MapMembership.destroy({
where: { map_id: mapId },
});

console.log(
`Adding ${mapData.markers.markers.length} markers to DB for map ${mapId}`
Expand Down

0 comments on commit 39a8bdf

Please sign in to comment.