locationAction: query optimization
This commit is contained in:
@@ -369,7 +369,7 @@ export const deleteLocationById = withUser(async (user:AuthenticatedUser, locati
|
|||||||
if (deleteInSubsequentMonths) {
|
if (deleteInSubsequentMonths) {
|
||||||
// Get the location name first to find all locations with the same name
|
// Get the location name first to find all locations with the same name
|
||||||
const location = await dbClient.collection<BillingLocation>("lokacije")
|
const location = await dbClient.collection<BillingLocation>("lokacije")
|
||||||
.findOne({ _id: locationID, userId }, { projection: { bills: 0 } });
|
.findOne({ _id: locationID, userId }, { projection: { name: 1 } });
|
||||||
|
|
||||||
if (location) {
|
if (location) {
|
||||||
// Delete all locations with the same name in current and subsequent months
|
// Delete all locations with the same name in current and subsequent months
|
||||||
|
|||||||
Reference in New Issue
Block a user