From 9c74129489709af9714bfeb86031d9ec1350a142 Mon Sep 17 00:00:00 2001 From: orangecoding Date: Tue, 7 Oct 2025 21:22:29 +0200 Subject: [PATCH] fixing listings --- lib/services/storage/listingsStorage.js | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/services/storage/listingsStorage.js b/lib/services/storage/listingsStorage.js index 47748c5..5a74bbe 100755 --- a/lib/services/storage/listingsStorage.js +++ b/lib/services/storage/listingsStorage.js @@ -213,7 +213,10 @@ export const queryListings = ({ params.userId = userId || '__NO_USER__'; // user scoping (non-admin only): restrict to listings whose job belongs to user if (!isAdmin) { - whereParts.push(`(j.user_id = @userId)`); + // Include listings from jobs owned by the user or jobs shared with the user + whereParts.push( + `(j.user_id = @userId OR EXISTS (SELECT 1 FROM json_each(j.shared_with_user) AS sw WHERE sw.value = @userId))`, + ); } if (freeTextFilter && String(freeTextFilter).trim().length > 0) { params.filter = `%${String(freeTextFilter).trim()}%`; diff --git a/package.json b/package.json index 81196e9..bb6ba7b 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fredy", - "version": "14.2.0", + "version": "14.2.1", "description": "[F]ind [R]eal [E]states [d]amn eas[y].", "scripts": { "prepare": "husky",