diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts index baed3c9..057f757 100644 --- a/app/lib/actions/locationActions.ts +++ b/app/lib/actions/locationActions.ts @@ -76,7 +76,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat if(locationId) { // Get the current location first to find its name const currentLocation = await dbClient.collection("lokacije") - .findOne({ _id: locationId, userId }); + .findOne({ _id: locationId, userId }, { projection: { bills: 0 } }); if (!currentLocation) { return { @@ -198,7 +198,7 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat name: locationName, "yearMonth.year": monthData.year, "yearMonth.month": monthData.month - }); + }, { projection: { bills: 0 } }); // Only add if location with same name doesn't already exist in that month if (!existingLocation) { @@ -369,7 +369,7 @@ export const deleteLocationById = withUser(async (user:AuthenticatedUser, locati if (deleteInSubsequentMonths) { // Get the location name first to find all locations with the same name const location = await dbClient.collection("lokacije") - .findOne({ _id: locationID, userId }); + .findOne({ _id: locationID, userId }, { projection: { bills: 0 } }); if (location) { // Delete all locations with the same name in current and subsequent months