2019-04-14 18:18:52 +08:00
|
|
|
import treeCache from "./tree_cache.js";
|
|
|
|
import server from "./server.js";
|
|
|
|
|
|
|
|
/** @return {NoteShort} */
|
|
|
|
async function getTodayNote() {
|
|
|
|
return await getDateNote(dayjs().format("YYYY-MM-DD"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return {NoteShort} */
|
|
|
|
async function getDateNote(date) {
|
2019-10-28 05:13:38 +08:00
|
|
|
const note = await server.get('date-notes/date/' + date, {'trilium-source-id': "date-note"});
|
2019-04-14 18:18:52 +08:00
|
|
|
|
|
|
|
return await treeCache.getNote(note.noteId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return {NoteShort} */
|
|
|
|
async function getMonthNote(month) {
|
2019-10-28 05:13:38 +08:00
|
|
|
const note = await server.get('date-notes/month/' + month, {'trilium-source-id': "date-note"});
|
2019-04-14 18:18:52 +08:00
|
|
|
|
|
|
|
return await treeCache.getNote(note.noteId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return {NoteShort} */
|
|
|
|
async function getYearNote(year) {
|
2019-10-28 05:13:38 +08:00
|
|
|
const note = await server.get('date-notes/year/' + year, {'trilium-source-id': "date-note"});
|
2019-04-14 18:18:52 +08:00
|
|
|
|
|
|
|
return await treeCache.getNote(note.noteId);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
getTodayNote,
|
|
|
|
getDateNote,
|
|
|
|
getMonthNote,
|
|
|
|
getYearNote
|
|
|
|
}
|