(noteId?: NoteId)
| 283 | ) |
| 284 | }, |
| 285 | async getNewNotesToUploadDom(noteId?: NoteId) { |
| 286 | const remoteNotes = await ky |
| 287 | .selectFrom('remoteNote') |
| 288 | .selectAll() |
| 289 | .where('remoteId', 'is', null) |
| 290 | .execute() |
| 291 | const localIds = [...new Set(remoteNotes.map((t) => t.localId))] |
| 292 | return await ky |
| 293 | .selectFrom('note') |
| 294 | .selectAll('note') |
| 295 | .innerJoin('template', 'note.templateId', 'template.id') |
| 296 | .select(templateSelection) |
| 297 | .where('note.id', 'in', localIds) |
| 298 | .$if(noteId != null, (db) => db.where('note.id', '=', toLDbId(noteId!))) |
| 299 | .execute() |
| 300 | .then((n) => |
| 301 | n.map((entity) => { |
| 302 | const note = noteEntityToDomain( |
| 303 | entity, |
| 304 | remoteNotes.filter((rn) => rn.localId === entity.id), |
| 305 | ) |
| 306 | if (objKeys(note.remotes).length === 0) |
| 307 | C.toastImpossible( |
| 308 | 'Zero remotes - is something wrong with the SQL query?', |
| 309 | ) |
| 310 | return [getTemplate(entity), note] as const |
| 311 | }), |
| 312 | ) |
| 313 | }, |
| 314 | async getEditedNotesToUpload(noteId?: NoteId, nook?: NookId) { |
| 315 | const remoteTemplates = await ky |
| 316 | .selectFrom('remoteTemplate') |
nothing calls this directly
no test coverage detected