From db8d4d6f49aac0cf996b58257597bf0d1a2ecb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Fri, 10 Mar 2023 13:26:48 +0000 Subject: [PATCH] fix: segment project null handling (#3300) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~~Should we handle this on the store layer instead~~? 🤔 Fixing this on the store layer. Effectively, frontend is able to send `project: null` and even if that gets magically converted to `""` it's OK since we're covering that use case on the store layer. Backend response will be `project: null` as well, so it should be consistent. --- src/lib/db/segment-store.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/db/segment-store.ts b/src/lib/db/segment-store.ts index a2fc24ce4c..18085b6420 100644 --- a/src/lib/db/segment-store.ts +++ b/src/lib/db/segment-store.ts @@ -68,7 +68,7 @@ export default class SegmentStore implements ISegmentStore { id: segment.id, name: segment.name, description: segment.description, - segment_project_id: segment.project, + segment_project_id: segment.project || null, constraints: JSON.stringify(segment.constraints), created_by: user.username || user.email, }) @@ -83,7 +83,7 @@ export default class SegmentStore implements ISegmentStore { .update({ name: segment.name, description: segment.description, - segment_project_id: segment.project, + segment_project_id: segment.project || null, constraints: JSON.stringify(segment.constraints), }) .returning(COLUMNS);