Add title to json and ddb export

This commit is contained in:
1ilit 2024-02-28 23:03:40 +02:00
parent a5e1eec3c5
commit 3ab820d7ee
2 changed files with 7 additions and 2 deletions

View File

@ -163,6 +163,9 @@ export default function ControlPanel({
setRelationships(data.relationships); setRelationships(data.relationships);
setAreas(data.subjectAreas); setAreas(data.subjectAreas);
setNotes(data.notes); setNotes(data.notes);
if (data.title) {
setTitle(data.title);
}
}; };
const undo = () => { const undo = () => {
@ -880,6 +883,7 @@ export default function ControlPanel({
notes: notes, notes: notes,
subjectAreas: areas, subjectAreas: areas,
types: types, types: types,
title: title,
}, },
null, null,
2 2
@ -931,7 +935,7 @@ export default function ControlPanel({
const result = JSON.stringify( const result = JSON.stringify(
{ {
author: "Unnamed", author: "Unnamed",
filename: title, title: title,
date: new Date().toISOString(), date: new Date().toISOString(),
tables: tables, tables: tables,
relationships: relationships, relationships: relationships,

View File

@ -161,6 +161,7 @@ const jsonSchema = {
type: "array", type: "array",
items: { ...areaSchema }, items: { ...areaSchema },
}, },
title: { type: "string" },
}, },
required: ["tables", "relationships", "notes", "subjectAreas"], required: ["tables", "relationships", "notes", "subjectAreas"],
}; };
@ -170,7 +171,7 @@ const ddbSchema = {
properties: { properties: {
author: { type: "string" }, author: { type: "string" },
project: { type: "string" }, project: { type: "string" },
filename: { type: "string" }, title: { type: "string" },
date: { type: "string" }, date: { type: "string" },
...jsonSchema.properties, ...jsonSchema.properties,
}, },