From da8db70dda5ffe686cfc98f95c215895ef2654b5 Mon Sep 17 00:00:00 2001 From: Maxim Fomin <62051211+Makcal@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:26:39 +0300 Subject: [PATCH 1/3] fix: customness of ingredient depended on publicity --- src/main/scala/db/repositories/IngredientsRepo.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/db/repositories/IngredientsRepo.scala b/src/main/scala/db/repositories/IngredientsRepo.scala index 835aae7..e42283f 100644 --- a/src/main/scala/db/repositories/IngredientsRepo.scala +++ b/src/main/scala/db/repositories/IngredientsRepo.scala @@ -98,7 +98,7 @@ object IngredientsQueries: ingredientsQ.filter(_.isPublished) inline def customIngredientsQ(inline userId: UserId): EntityQuery[DbIngredient] = - ingredientsQ.filter(i => !i.isPublished && i.ownerId.contains(userId)) + ingredientsQ.filter(i => i.ownerId.contains(userId)) inline def visibleIngredientsQ(inline userId: UserId): EntityQuery[DbIngredient] = ingredientsQ.filter(i => i.ownerId.isEmpty || i.ownerId.contains(userId)) From df897da5fab849af21ed3c3885adf938a94ca38e Mon Sep 17 00:00:00 2001 From: Maxim Fomin <62051211+Makcal@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:28:31 +0300 Subject: [PATCH 2/3] fix: all published ingredients should be visible (not depend on owner) --- src/main/scala/db/repositories/IngredientsRepo.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/db/repositories/IngredientsRepo.scala b/src/main/scala/db/repositories/IngredientsRepo.scala index e42283f..9889b2c 100644 --- a/src/main/scala/db/repositories/IngredientsRepo.scala +++ b/src/main/scala/db/repositories/IngredientsRepo.scala @@ -101,7 +101,7 @@ object IngredientsQueries: ingredientsQ.filter(i => i.ownerId.contains(userId)) inline def visibleIngredientsQ(inline userId: UserId): EntityQuery[DbIngredient] = - ingredientsQ.filter(i => i.ownerId.isEmpty || i.ownerId.contains(userId)) + ingredientsQ.filter(i => i.ownerId.isEmpty || i.ownerId.contains(userId) || i.isPublished) inline def getIngredientsQ(inline ingredientId: IngredientId): EntityQuery[DbIngredient] = ingredientsQ.filter(_.id == ingredientId) From 802d04a24fe4e1aeeb2664e719f612bfe61ec1f9 Mon Sep 17 00:00:00 2001 From: Maxim Fomin <62051211+Makcal@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:32:02 +0300 Subject: [PATCH 3/3] fix: remove not published ingredients without an owner from visibility --- src/main/scala/db/repositories/IngredientsRepo.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/db/repositories/IngredientsRepo.scala b/src/main/scala/db/repositories/IngredientsRepo.scala index 9889b2c..95265b3 100644 --- a/src/main/scala/db/repositories/IngredientsRepo.scala +++ b/src/main/scala/db/repositories/IngredientsRepo.scala @@ -101,7 +101,7 @@ object IngredientsQueries: ingredientsQ.filter(i => i.ownerId.contains(userId)) inline def visibleIngredientsQ(inline userId: UserId): EntityQuery[DbIngredient] = - ingredientsQ.filter(i => i.ownerId.isEmpty || i.ownerId.contains(userId) || i.isPublished) + ingredientsQ.filter(i => i.isPublished || i.ownerId.contains(userId)) inline def getIngredientsQ(inline ingredientId: IngredientId): EntityQuery[DbIngredient] = ingredientsQ.filter(_.id == ingredientId)