Services: editing a saved service no longer fails validation
PocketBase reads an empty number back as 0, so mapItemRecord gave every service capacity 0 and bufferMinutes 0. The edit form then showed 'Places in a group session: 0', below the field's min of 1, and the browser refused to submit. 0 now maps to null (not set) for both; every reader already treats them alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gWt7pNdAsocjxujY3m
This commit is contained in:
parent
e896fd3c99
commit
80cbe6ddb2
1 changed files with 4 additions and 2 deletions
|
|
@ -27,8 +27,10 @@ export function mapItemRecord(record: Record<string, any>): ItemRecord {
|
||||||
durations: type === 'item_with_time' ? parseDurations(record.durations) : [],
|
durations: type === 'item_with_time' ? parseDurations(record.durations) : [],
|
||||||
bundleParts: type === 'bundle' ? parseBundleParts(record.bundleParts) : [],
|
bundleParts: type === 'bundle' ? parseBundleParts(record.bundleParts) : [],
|
||||||
validMonths: type === 'bundle' ? Number(record.validMonths) || null : null,
|
validMonths: type === 'bundle' ? Number(record.validMonths) || null : null,
|
||||||
bufferMinutes: record.bufferMinutes ?? null,
|
// PocketBase reads an empty number back as 0, never null: 0 means "not set" for both
|
||||||
capacity: record.capacity ?? null,
|
// (and a 0 in the admin form would fail capacity's min of 1, blocking every save).
|
||||||
|
bufferMinutes: Number(record.bufferMinutes) || null,
|
||||||
|
capacity: Number(record.capacity) || null,
|
||||||
active: record.active !== false,
|
active: record.active !== false,
|
||||||
priority: Number(record.priority) || 0,
|
priority: Number(record.priority) || 0,
|
||||||
popularRank: null
|
popularRank: null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue