fix: 🐛 fix async errors

This commit is contained in:
Jin 2025-04-04 13:46:39 +02:00
parent eb514ad4e3
commit 6a0207dc45
3 changed files with 10 additions and 10 deletions

View File

@ -64,8 +64,8 @@ function getDayNotesForMonth(req: Request) {
} }
} }
function saveSqlConsole(req: Request) { async function saveSqlConsole(req: Request) {
return specialNotesService.saveSqlConsole(req.body.sqlConsoleNoteId); return await specialNotesService.saveSqlConsole(req.body.sqlConsoleNoteId);
} }
function createSqlConsole() { function createSqlConsole() {

View File

@ -224,14 +224,14 @@ 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
*/ */
getDayNote(date: string, rootNote?: BNote): BNote | null; getDayNote(date: string, rootNote?: BNote): Promise<BNote | null>;
/** /**
* Returns today's day note. If such note doesn't exist, it is created. * Returns today's day note. If such note doesn't exist, it is created.
* *
* @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
*/ */
getTodayNote(rootNote?: BNote): BNote | null; getTodayNote(rootNote?: BNote): Promise<BNote | null>;
/** /**
* Returns note for the first date of the week of the given date. * Returns note for the first date of the week of the given date.
@ -239,7 +239,7 @@ 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(date: string, rootNote: BNote): BNote | null; getWeekFirstDayNote(date: string, rootNote: BNote): Promise<BNote | null>;
/** /**
* Returns week note for given date. If such a note doesn't exist, it is created. * Returns week note for given date. If such a note doesn't exist, it is created.
@ -247,7 +247,7 @@ 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
*/ */
getWeekNote(date: string, rootNote: BNote): BNote | null; getWeekNote(date: string, rootNote: BNote): Promise<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.
@ -255,7 +255,7 @@ interface Api {
* @param date in YYYY-MM format * @param date in YYYY-MM 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
*/ */
getMonthNote(date: string, rootNote: BNote): BNote | null; getMonthNote(date: string, rootNote: BNote): Promise<BNote | null>;
/** /**
* Returns quarter note for given date. If such a note doesn't exist, it is created. * Returns quarter note for given date. If such a note doesn't exist, it is created.
@ -263,7 +263,7 @@ interface Api {
* @param date in YYYY-MM format * @param date in YYYY-MM 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
*/ */
getQuarterNote(date: string, rootNote: BNote): BNote | null; getQuarterNote(date: string, rootNote: BNote): Promise<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.

View File

@ -51,12 +51,12 @@ function createSqlConsole() {
return note; return note;
} }
function saveSqlConsole(sqlConsoleNoteId: string) { async function saveSqlConsole(sqlConsoleNoteId: string) {
const sqlConsoleNote = becca.getNote(sqlConsoleNoteId); const sqlConsoleNote = becca.getNote(sqlConsoleNoteId);
if (!sqlConsoleNote) throw new Error(`Unable to find SQL console note ID: ${sqlConsoleNoteId}`); if (!sqlConsoleNote) throw new Error(`Unable to find SQL console note ID: ${sqlConsoleNoteId}`);
const today = dateUtils.localNowDate(); const today = dateUtils.localNowDate();
const sqlConsoleHome = attributeService.getNoteWithLabel("sqlConsoleHome") || dateNoteService.getDayNote(today); const sqlConsoleHome = attributeService.getNoteWithLabel("sqlConsoleHome") || await dateNoteService.getDayNote(today);
const result = sqlConsoleNote.cloneTo(sqlConsoleHome.noteId); const result = sqlConsoleNote.cloneTo(sqlConsoleHome.noteId);