MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / addRow

Function addRow

packages/app-core/src/lib/database-cells.ts:83–90  ·  view source on GitHub ↗
(doc: DatabaseDoc)

Source from the content-addressed store, hash-verified

81}
82
83export function addRow(doc: DatabaseDoc): DatabaseDoc {
84 const id = genId()
85 const cells: Record<string, string> = {}
86 for (const f of doc.fields) cells[f.id] = ''
87 cells[doc.idFieldId] = id
88 const row: DbRow = { id, cells }
89 return { ...doc, rows: [...doc.rows, row] }
90}
91
92export function deleteRow(doc: DatabaseDoc, rowId: string): DatabaseDoc {
93 return { ...doc, rows: doc.rows.filter((r) => r.id !== rowId) }

Callers 3

DatabaseViewFunction · 0.90
onGridKeyDownFunction · 0.90
DatabaseTableViewFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected