mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat: 🎸 add frontend api support
This commit is contained in:
parent
486696220f
commit
50009bfb6e
@ -46,6 +46,14 @@ async function getMonthNote(month: string) {
|
|||||||
return await froca.getNote(note.noteId);
|
return await froca.getNote(note.noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getQuarterNote(quarter: string) {
|
||||||
|
const note = await server.get<FNoteRow>(`special-notes/quarters/${quarter}`, "date-note");
|
||||||
|
|
||||||
|
await ws.waitForMaxKnownEntityChangeId();
|
||||||
|
|
||||||
|
return await froca.getNote(note.noteId);
|
||||||
|
}
|
||||||
|
|
||||||
async function getYearNote(year: string) {
|
async function getYearNote(year: string) {
|
||||||
const note = await server.get<FNoteRow>(`special-notes/years/${year}`, "date-note");
|
const note = await server.get<FNoteRow>(`special-notes/years/${year}`, "date-note");
|
||||||
|
|
||||||
@ -76,6 +84,7 @@ export default {
|
|||||||
getDayNote,
|
getDayNote,
|
||||||
getWeekFirstDayNote,
|
getWeekFirstDayNote,
|
||||||
getWeekNote,
|
getWeekNote,
|
||||||
|
getQuarterNote,
|
||||||
getMonthNote,
|
getMonthNote,
|
||||||
getYearNote,
|
getYearNote,
|
||||||
createSqlConsole,
|
createSqlConsole,
|
||||||
|
@ -365,6 +365,14 @@ interface Api {
|
|||||||
*/
|
*/
|
||||||
getWeekFirstDayNote: typeof dateNotesService.getWeekFirstDayNote;
|
getWeekFirstDayNote: typeof dateNotesService.getWeekFirstDayNote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns week note for given date. If such a note doesn't exist, it is automatically created.
|
||||||
|
*
|
||||||
|
* @param date in YYYY-MM-DD format
|
||||||
|
* @param rootNote - specify calendar root note, normally leave empty to use the default calendar
|
||||||
|
*/
|
||||||
|
getWeekNote: typeof dateNotesService.getWeekNote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns month-note. If it doesn't exist, it is automatically created.
|
* Returns month-note. If it doesn't exist, it is automatically created.
|
||||||
*
|
*
|
||||||
@ -372,6 +380,14 @@ interface Api {
|
|||||||
*/
|
*/
|
||||||
getMonthNote: typeof dateNotesService.getMonthNote;
|
getMonthNote: typeof dateNotesService.getMonthNote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns quarter note for given date. If such a note doesn't exist, it is automatically created.
|
||||||
|
*
|
||||||
|
* @param date in YYYY-MM format
|
||||||
|
* @param rootNote - specify calendar root note, normally leave empty to use the default calendar
|
||||||
|
*/
|
||||||
|
getQuarterNote: typeof dateNotesService.getQuarterNote;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns year-note. If it doesn't exist, it is automatically created.
|
* Returns year-note. If it doesn't exist, it is automatically created.
|
||||||
*
|
*
|
||||||
@ -652,7 +668,9 @@ function FrontendScriptApi(this: Api, startNote: FNote, currentNote: FNote, orig
|
|||||||
this.getTodayNote = dateNotesService.getTodayNote;
|
this.getTodayNote = dateNotesService.getTodayNote;
|
||||||
this.getDayNote = dateNotesService.getDayNote;
|
this.getDayNote = dateNotesService.getDayNote;
|
||||||
this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote;
|
this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote;
|
||||||
|
this.getWeekNote = dateNotesService.getWeekNote;
|
||||||
this.getMonthNote = dateNotesService.getMonthNote;
|
this.getMonthNote = dateNotesService.getMonthNote;
|
||||||
|
this.getQuarterNote = dateNotesService.getQuarterNote;
|
||||||
this.getYearNote = dateNotesService.getYearNote;
|
this.getYearNote = dateNotesService.getYearNote;
|
||||||
|
|
||||||
this.setHoistedNoteId = (noteId) => {
|
this.setHoistedNoteId = (noteId) => {
|
||||||
|
@ -25,6 +25,10 @@ function getMonthNote(req: Request) {
|
|||||||
return dateNoteService.getMonthNote(req.params.month);
|
return dateNoteService.getMonthNote(req.params.month);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getQuarterNote(req: Request) {
|
||||||
|
return dateNoteService.getQuarterNote(req.params.quarter);
|
||||||
|
}
|
||||||
|
|
||||||
function getYearNote(req: Request) {
|
function getYearNote(req: Request) {
|
||||||
return dateNoteService.getYearNote(req.params.year);
|
return dateNoteService.getYearNote(req.params.year);
|
||||||
}
|
}
|
||||||
@ -106,6 +110,7 @@ export default {
|
|||||||
getWeekFirstDayNote,
|
getWeekFirstDayNote,
|
||||||
getWeekNote,
|
getWeekNote,
|
||||||
getMonthNote,
|
getMonthNote,
|
||||||
|
getQuarterNote,
|
||||||
getYearNote,
|
getYearNote,
|
||||||
getDayNotesForMonth,
|
getDayNotesForMonth,
|
||||||
createSqlConsole,
|
createSqlConsole,
|
||||||
|
@ -308,6 +308,7 @@ function register(app: express.Application) {
|
|||||||
apiRoute(GET, "/api/special-notes/week-first-day/:date", specialNotesRoute.getWeekFirstDayNote);
|
apiRoute(GET, "/api/special-notes/week-first-day/:date", specialNotesRoute.getWeekFirstDayNote);
|
||||||
apiRoute(GET, "/api/special-notes/weeks/:week", specialNotesRoute.getWeekNote);
|
apiRoute(GET, "/api/special-notes/weeks/:week", specialNotesRoute.getWeekNote);
|
||||||
apiRoute(GET, "/api/special-notes/months/:month", specialNotesRoute.getMonthNote);
|
apiRoute(GET, "/api/special-notes/months/:month", specialNotesRoute.getMonthNote);
|
||||||
|
apiRoute(GET, "/api/special-notes/quarters/:quarter", specialNotesRoute.getQuarterNote);
|
||||||
apiRoute(GET, "/api/special-notes/years/:year", specialNotesRoute.getYearNote);
|
apiRoute(GET, "/api/special-notes/years/:year", specialNotesRoute.getYearNote);
|
||||||
apiRoute(GET, "/api/special-notes/notes-for-month/:month", specialNotesRoute.getDayNotesForMonth);
|
apiRoute(GET, "/api/special-notes/notes-for-month/:month", specialNotesRoute.getDayNotesForMonth);
|
||||||
apiRoute(PST, "/api/special-notes/sql-console", specialNotesRoute.createSqlConsole);
|
apiRoute(PST, "/api/special-notes/sql-console", specialNotesRoute.createSqlConsole);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user