MCPcopy Create free account
hub / github.com/massCodeIO/massCode / getNotes

Function getNotes

src/renderer/composables/spaces/notes/useNotes.ts:383–408  ·  view source on GitHub ↗
(query?: NotesQuery)

Source from the content-addressed store, hash-verified

381// --- CRUD ---
382
383export async function getNotes(query?: NotesQuery) {
384 return withNotesLoading(async () => {
385 // Защита от гонки ответов: применяется только самый свежий запрос.
386 const requestToken = ++notesRequestToken
387 const forSearch = isSearch.value
388 const resolvedQuery = {
389 ...(query || queryByLibraryOrFolderOrSearch.value),
390 ...getContentSortQuery('notes'),
391 }
392
393 const { data: responseData } = await api.notes.getNotes(resolvedQuery)
394
395 if (requestToken !== notesRequestToken) {
396 return
397 }
398
399 const data = responseData as NotesResponse
400
401 if (forSearch) {
402 notesBySearch.value = data
403 }
404 else {
405 notes.value = data
406 }
407 })
408}
409
410async function withNotesLoading<T>(loader: () => Promise<T>): Promise<T> {
411 notesLoadingCounter.value += 1

Callers 15

searchFunction · 0.90
updateNoteFolderFunction · 0.70
openTagInNotesWorkspaceFunction · 0.70
createNoteFunction · 0.70
updateNoteFunction · 0.70
updateNotesFunction · 0.70
updateNotePropertiesFunction · 0.70
deleteNoteFunction · 0.70
deleteNotesFunction · 0.70
emptyTrashFunction · 0.70

Calls 2

withNotesLoadingFunction · 0.85
getContentSortQueryFunction · 0.85

Tested by

no test coverage detected