(repoMap: Y.Map<unknown>, preview: { id: string; slug: string; title: string; createdAt: string }, updatedAt: string)
| 209 | } |
| 210 | |
| 211 | function ensureTaskPreview(repoMap: Y.Map<unknown>, preview: { id: string; slug: string; title: string; createdAt: string }, updatedAt: string): void { |
| 212 | const tasks = ensureYArray(repoMap, "tasks") |
| 213 | const existing = tasks.toArray().some((task) => { |
| 214 | const plain = toPlain(task) |
| 215 | return isRecord(plain) && plain.id === preview.id |
| 216 | }) |
| 217 | if (!existing) tasks.push([toYValue(preview)]) |
| 218 | repoMap.set("updatedAt", updatedAt) |
| 219 | } |
| 220 | |
| 221 | function deleteTaskPreview(repoMap: Y.Map<unknown>, taskId: string, updatedAt: string): boolean { |
| 222 | const tasks = ensureYArray(repoMap, "tasks") |
no test coverage detected