Skip to content

Commit aba3adb

Browse files
committed
Fix report save validation error for topics with empty indicators
Remove `required: true` from the indicators array field in the topics CMS schema. Topic 7 ("Knowledge products") has no default indicators, causing a Payload validation error when saving reports with all topics.
1 parent 0c758b5 commit aba3adb

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

client/src/cms/fields/topics.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const TopicsField: Field = {
1919
{
2020
name: "indicators",
2121
type: "array",
22-
required: true,
2322
fields: [
2423
{
2524
name: "indicator_id",

client/src/payload-types.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -300,28 +300,30 @@ export interface Report {
300300
| {
301301
topic_id: number;
302302
description?: string | null;
303-
indicators: {
304-
indicator_id: number;
305-
type: 'map' | 'chart' | 'table' | 'numeric' | 'custom' | 'ai';
306-
x: number;
307-
y: number;
308-
w: number;
309-
h: number;
310-
basemapId?:
311-
| (
312-
| 'gray-vector'
313-
| 'dark-gray-vector'
314-
| 'satellite'
315-
| 'streets'
316-
| 'hybrid'
317-
| 'osm'
318-
| 'topo-vector'
319-
| 'terrain'
320-
)
321-
| null;
322-
opacity?: number | null;
323-
id?: string | null;
324-
}[];
303+
indicators?:
304+
| {
305+
indicator_id: number;
306+
type: 'map' | 'chart' | 'table' | 'numeric' | 'custom' | 'ai';
307+
x: number;
308+
y: number;
309+
w: number;
310+
h: number;
311+
basemapId?:
312+
| (
313+
| 'gray-vector'
314+
| 'dark-gray-vector'
315+
| 'satellite'
316+
| 'streets'
317+
| 'hybrid'
318+
| 'osm'
319+
| 'topo-vector'
320+
| 'terrain'
321+
)
322+
| null;
323+
opacity?: number | null;
324+
id?: string | null;
325+
}[]
326+
| null;
325327
id?: string | null;
326328
}[]
327329
| null;

0 commit comments

Comments
 (0)