(store, collection, organizationUuid, body, me)
| 2723 | } |
| 2724 | |
| 2725 | function createItem(store, collection, organizationUuid, body, me) { |
| 2726 | const now = new Date().toISOString(); |
| 2727 | const uuid = stringValue(body.uuid) || stringValue(body.id) || randomUuid(); |
| 2728 | const title = stringValue(body.title) || stringValue(body.name) || "Untitled design"; |
| 2729 | const model = stringValue(body.model) || me.defaultModelId; |
| 2730 | const data = { |
| 2731 | ...body, |
| 2732 | organization_uuid: organizationUuid |
| 2733 | }; |
| 2734 | |
| 2735 | store.database.run( |
| 2736 | "INSERT OR REPLACE INTO claude_design_items (collection, uuid, created_at, updated_at, title, model, data_json, messages_json) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", |
| 2737 | [collection, uuid, now, now, title, model, JSON.stringify(data), JSON.stringify([])] |
| 2738 | ); |
| 2739 | store.persist(); |
| 2740 | return getItem(store, collection, organizationUuid, uuid, me); |
| 2741 | } |
| 2742 | |
| 2743 | function getItem(store, collection, organizationUuid, uuid, me) { |
| 2744 | const row = queryRows( |
no test coverage detected
searching dependent graphs…