1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: segment project null handling (#3300)

~~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.
This commit is contained in:
Nuno Góis 2023-03-10 13:26:48 +00:00 committed by GitHub
parent 55c69610ad
commit db8d4d6f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,7 @@ export default class SegmentStore implements ISegmentStore {
id: segment.id, id: segment.id,
name: segment.name, name: segment.name,
description: segment.description, description: segment.description,
segment_project_id: segment.project, segment_project_id: segment.project || null,
constraints: JSON.stringify(segment.constraints), constraints: JSON.stringify(segment.constraints),
created_by: user.username || user.email, created_by: user.username || user.email,
}) })
@ -83,7 +83,7 @@ export default class SegmentStore implements ISegmentStore {
.update({ .update({
name: segment.name, name: segment.name,
description: segment.description, description: segment.description,
segment_project_id: segment.project, segment_project_id: segment.project || null,
constraints: JSON.stringify(segment.constraints), constraints: JSON.stringify(segment.constraints),
}) })
.returning(COLUMNS); .returning(COLUMNS);