(body: CaptureRequest)
| 410 | } |
| 411 | |
| 412 | function createNotesCapture(body: CaptureRequest): CaptureResponse { |
| 413 | const storage = useNotesStorage() |
| 414 | const folderId = body.folderId ?? null |
| 415 | const siblings = storage.notes.getNotes({ |
| 416 | isDeleted: 0, |
| 417 | ...(folderId === null ? { isInbox: 1 } : { folderId }), |
| 418 | }) |
| 419 | const name = getUniqueName( |
| 420 | resolveCaptureName(body, 'Captured note'), |
| 421 | siblings.map(item => item.name), |
| 422 | ) |
| 423 | const { id } = storage.notes.createNote({ folderId, name }) |
| 424 | |
| 425 | storage.notes.updateNoteContent(id, createNoteContent(body)) |
| 426 | |
| 427 | return { id, target: 'notes' } |
| 428 | } |
| 429 | |
| 430 | function createHttpCapture(body: CaptureRequest): CaptureResponse { |
| 431 | const storage = useHttpStorage() |
no test coverage detected