feat: 🎸 add backend script api

This commit is contained in:
Jin 2025-04-01 19:05:12 +02:00
parent bbf7bc9324
commit 486696220f
2 changed files with 21 additions and 5 deletions

View File

@ -239,10 +239,15 @@ interface Api {
* @param date in YYYY-MM-DD format * @param date in YYYY-MM-DD format
* @param rootNote - specify calendar root note, normally leave empty to use the default calendar * @param rootNote - specify calendar root note, normally leave empty to use the default calendar
*/ */
getWeekFirstDayNote( getWeekFirstDayNote(date: string, rootNote: BNote): BNote | null;
date: string,
rootNote: BNote /**
): BNote | null; * Returns week note for given date. If such a note doesn't exist, it is created.
*
* @param date in YYYY-MM-DD format
* @param rootNote - specify calendar root note, normally leave empty to use the default calendar
*/
getWeekNote(date: string, rootNote: BNote): BNote | null;
/** /**
* Returns month note for given date. If such a note doesn't exist, it is created. * Returns month note for given date. If such a note doesn't exist, it is created.
@ -252,6 +257,14 @@ interface Api {
*/ */
getMonthNote(date: string, rootNote: BNote): BNote | null; getMonthNote(date: string, rootNote: BNote): BNote | null;
/**
* Returns quarter note for given date. If such a note doesn't exist, it is created.
*
* @param date in YYYY-MM format
* @param rootNote - specify calendar root note, normally leave empty to use the default calendar
*/
getQuarterNote(date: string, rootNote: BNote): BNote | null;
/** /**
* Returns year note for given year. If such a note doesn't exist, it is created. * Returns year note for given year. If such a note doesn't exist, it is created.
* *
@ -548,7 +561,9 @@ function BackendScriptApi(this: Api, currentNote: BNote, apiParams: ApiParams) {
this.getDayNote = dateNoteService.getDayNote; this.getDayNote = dateNoteService.getDayNote;
this.getTodayNote = dateNoteService.getTodayNote; this.getTodayNote = dateNoteService.getTodayNote;
this.getWeekFirstDayNote = dateNoteService.getWeekFirstDayNote; this.getWeekFirstDayNote = dateNoteService.getWeekFirstDayNote;
this.getWeekNote = dateNoteService.getWeekNote;
this.getMonthNote = dateNoteService.getMonthNote; this.getMonthNote = dateNoteService.getMonthNote;
this.getQuarterNote = dateNoteService.getQuarterNote;
this.getYearNote = dateNoteService.getYearNote; this.getYearNote = dateNoteService.getYearNote;
this.sortNotes = (parentNoteId, sortConfig = {}) => treeService.sortNotes(parentNoteId, sortConfig.sortBy || "title", !!sortConfig.reverse, !!sortConfig.foldersFirst); this.sortNotes = (parentNoteId, sortConfig = {}) => treeService.sortNotes(parentNoteId, sortConfig.sortBy || "title", !!sortConfig.reverse, !!sortConfig.foldersFirst);

View File

@ -418,6 +418,7 @@ function getTodayNote(rootNote: BNote | null = null) {
export default { export default {
getRootCalendarNote, getRootCalendarNote,
getYearNote, getYearNote,
getQuarterNote,
getMonthNote, getMonthNote,
getWeekNote, getWeekNote,
getWeekFirstDayNote, getWeekFirstDayNote,