feat: 🎸 add and fix week note api services

This commit is contained in:
Jin 2025-04-01 16:25:03 +02:00
parent b13abf3098
commit c43cca6c22
2 changed files with 12 additions and 4 deletions

View File

@ -23,13 +23,21 @@ async function getDayNote(date: string) {
}
async function getWeekFirstDayNote(date: string) {
const note = await server.get<FNoteRow>(`special-notes/weeks/${date}`, "date-note");
const note = await server.get<FNoteRow>(`special-notes/week-first-day/${date}`, "date-note");
await ws.waitForMaxKnownEntityChangeId();
return await froca.getNote(note.noteId);
}
async function getWeekNote(week: string) {
const note = await server.get<FNoteRow>(`special-notes/weeks/${week}`, "date-note");
await ws.waitForMaxKnownEntityChangeId();
return await froca.getNote(note?.noteId);
}
async function getMonthNote(month: string) {
const note = await server.get<FNoteRow>(`special-notes/months/${month}`, "date-note");
@ -67,6 +75,7 @@ export default {
getTodayNote,
getDayNote,
getWeekFirstDayNote,
getWeekNote,
getMonthNote,
getYearNote,
createSqlConsole,

View File

@ -1,5 +1,3 @@
"use strict";
import { isElectron, safeExtractMessageAndStackFromError } from "../services/utils.js";
import multer from "multer";
import log from "../services/log.js";
@ -307,7 +305,8 @@ function register(app: express.Application) {
apiRoute(GET, "/api/special-notes/inbox/:date", specialNotesRoute.getInboxNote);
apiRoute(GET, "/api/special-notes/days/:date", specialNotesRoute.getDayNote);
apiRoute(GET, "/api/special-notes/weeks/: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/months/:month", specialNotesRoute.getMonthNote);
apiRoute(GET, "/api/special-notes/years/:year", specialNotesRoute.getYearNote);
apiRoute(GET, "/api/special-notes/notes-for-month/:month", specialNotesRoute.getDayNotesForMonth);