MCPcopy Index your code
hub / github.com/massCodeIO/massCode / createNote

Function createNote

src/main/import/notes/persist.ts:145–164  ·  view source on GitHub ↗
(
  candidate: NoteImportCandidate,
  folderId: number,
)

Source from the content-addressed store, hash-verified

143}
144
145function createNote(
146 candidate: NoteImportCandidate,
147 folderId: number,
148): { name: string, tagCount: number } {
149 const storage = useNotesStorage()
150 const name = getUniqueNoteName(
151 storage.notes.getNotes({ folderId, isDeleted: 0 }),
152 normalizeImportEntryName(candidate.name, 'Untitled note'),
153 )
154 const { id } = storage.notes.createNote({ folderId, name })
155
156 storage.notes.updateNoteContent(id, candidate.content)
157
158 const { created, tagIds } = getOrCreateTagIds(candidate.tags)
159 tagIds.forEach((tagId) => {
160 storage.notes.addTagToNote(id, tagId)
161 })
162
163 return { name, tagCount: created }
164}
165
166export function applyNotesImportResult(
167 result: NoteImportParseResult,

Callers 1

applyNotesImportResultFunction · 0.70

Calls 4

useNotesStorageFunction · 0.90
normalizeImportEntryNameFunction · 0.90
getUniqueNoteNameFunction · 0.85
getOrCreateTagIdsFunction · 0.70

Tested by

no test coverage detected