Skip to content

Commit 22c17d0

Browse files
fix: tighten story and map feature admin schemas
1 parent f964e87 commit 22c17d0

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

agent/TOOLS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ There is NO generic `POST /map/features` endpoint. Use these concrete routes:
179179

180180
### Map story endpoints
181181

182-
`POST /map/stories`: `{id, title, tagline, iconName, category, narrative, viewState: {longitude, latitude, zoom}, timestamp, primaryEventId?, sourceEventIds?[], highlightStrikeIds?[], highlightMissileIds?[], highlightTargetIds?[], highlightAssetIds?[], keyFacts?[], events?: [{time, label, type}]}`
182+
`POST /map/stories`: `{id, title, tagline, iconName, category, narrative, viewState: {longitude, latitude, zoom}, timestamp, primaryEventId?, sourceEventIds?[], highlightStrikeIds?[], highlightMissileIds?[], highlightTargetIds?[], highlightAssetIds?[], keyFacts?[], events: [{time, label, type}]}`
183183
`PUT /map/stories/{storyId}`: update story (partial)
184184
`POST /map/stories/{storyId}/events`: append timeline events
185185
`PUT /map/stories/{storyId}/events`: replace all timeline events

package-lock.json

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
"homepage": "https://conflicts.app",
1111
"bugs": "https://github.com/Juliusolsson05/pharos-ai/issues",
1212
"author": "Julius Olsson",
13-
"engines": {
14-
"node": "22.x"
15-
},
1613
"scripts": {
1714
"dev": "next dev",
1815
"build": "next build",

src/app/api/v1/admin/[conflictId]/bulk/events/route.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ export async function POST(
5959
})),
6060
}
6161
: undefined,
62+
actorResponses: item.actorResponses?.length
63+
? {
64+
create: item.actorResponses.map((response) => ({
65+
actorId: response.actorId,
66+
actorName: response.actorName,
67+
stance: response.stance,
68+
type: response.type,
69+
statement: response.statement,
70+
})),
71+
}
72+
: undefined,
6273
},
6374
});
6475
created.push(item.id);

src/server/lib/admin-schemas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ const strikeArcPropertiesSchema = z
168168
.object({
169169
label: requiredString,
170170
})
171-
.strict();
171+
.passthrough();
172172

173173
const threatZonePropertiesSchema = z
174174
.object({
175175
name: requiredString,
176176
color: requiredString,
177177
})
178-
.strict();
178+
.passthrough();
179179

180180
/* ------------------------------------------------------------------ */
181181
/* Map feature base (shared across all 6 feature types) */
@@ -448,7 +448,7 @@ export const adminMapStoryCreateSchema = z
448448
viewState: storyViewStateSchema,
449449
keyFacts: optionalStringArray,
450450
timestamp: isoDateTime,
451-
events: z.array(mapStoryEventSchema).min(1, 'Stories must have at least 1 timeline event').optional(),
451+
events: z.array(mapStoryEventSchema).min(1, 'Stories must have at least 1 timeline event'),
452452
})
453453
.strict()
454454
.refine(

0 commit comments

Comments
 (0)