mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Add week notes to frontend_script_api (#2253)
Note: getWeekNote can take `startOfTheWeek` as options but is not passed to the api route.
This commit is contained in:
parent
3d98644bf6
commit
3b551e3e4d
@ -23,6 +23,15 @@ async function getDateNote(date) {
|
||||
return await froca.getNote(note.noteId);
|
||||
}
|
||||
|
||||
/** @return {NoteShort} */
|
||||
async function getWeekNote(date) {
|
||||
const note = await server.get('special-notes/week/' + date, "date-note");
|
||||
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
return await froca.getNote(note.noteId);
|
||||
}
|
||||
|
||||
/** @return {NoteShort} */
|
||||
async function getMonthNote(month) {
|
||||
const note = await server.get('special-notes/month/' + month, "date-note");
|
||||
@ -63,6 +72,7 @@ export default {
|
||||
getInboxNote,
|
||||
getTodayNote,
|
||||
getDateNote,
|
||||
getWeekNote,
|
||||
getMonthNote,
|
||||
getYearNote,
|
||||
createSqlConsole,
|
||||
|
@ -396,6 +396,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
*/
|
||||
this.getDateNote = dateNotesService.getDateNote;
|
||||
|
||||
/**
|
||||
* Returns date-note for the first date of the week of the given date. If it doesn't exist, it is automatically created.
|
||||
*
|
||||
* @method
|
||||
* @param {string} date - e.g. "2019-04-29"
|
||||
* @return {Promise<NoteShort>}
|
||||
*/
|
||||
this.getWeekNote = dateNotesService.getWeekNote;
|
||||
|
||||
/**
|
||||
* Returns month-note. If it doesn't exist, it is automatically created.
|
||||
*
|
||||
|
@ -14,6 +14,10 @@ function getDateNote(req) {
|
||||
return dateNoteService.getDateNote(req.params.date);
|
||||
}
|
||||
|
||||
function getWeekNote(req) {
|
||||
return dateNoteService.getWeekNote(req.params.date);
|
||||
}
|
||||
|
||||
function getMonthNote(req) {
|
||||
return dateNoteService.getMonthNote(req.params.month);
|
||||
}
|
||||
@ -65,6 +69,7 @@ function getHoistedNote() {
|
||||
module.exports = {
|
||||
getInboxNote,
|
||||
getDateNote,
|
||||
getWeekNote,
|
||||
getMonthNote,
|
||||
getYearNote,
|
||||
getDateNotesForMonth,
|
||||
|
@ -262,6 +262,7 @@ function register(app) {
|
||||
|
||||
apiRoute(GET, '/api/special-notes/inbox/:date', specialNotesRoute.getInboxNote);
|
||||
apiRoute(GET, '/api/special-notes/date/:date', specialNotesRoute.getDateNote);
|
||||
apiRoute(GET, '/api/special-notes/week/:date', specialNotesRoute.getWeekNote);
|
||||
apiRoute(GET, '/api/special-notes/month/:month', specialNotesRoute.getMonthNote);
|
||||
apiRoute(GET, '/api/special-notes/year/:year', specialNotesRoute.getYearNote);
|
||||
apiRoute(GET, '/api/special-notes/notes-for-month/:month', specialNotesRoute.getDateNotesForMonth);
|
||||
|
Loading…
x
Reference in New Issue
Block a user