From c43cca6c22324f411ac6a9c45fe64ac6b57c9a6a Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:25:03 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20and=20fix=20week?= =?UTF-8?q?=20note=20api=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/app/services/date_notes.ts | 11 ++++++++++- src/routes/routes.ts | 5 ++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/public/app/services/date_notes.ts b/src/public/app/services/date_notes.ts index 8dad0bf37..013b900f7 100644 --- a/src/public/app/services/date_notes.ts +++ b/src/public/app/services/date_notes.ts @@ -23,13 +23,21 @@ async function getDayNote(date: string) { } async function getWeekFirstDayNote(date: string) { - const note = await server.get(`special-notes/weeks/${date}`, "date-note"); + const note = await server.get(`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(`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(`special-notes/months/${month}`, "date-note"); @@ -67,6 +75,7 @@ export default { getTodayNote, getDayNote, getWeekFirstDayNote, + getWeekNote, getMonthNote, getYearNote, createSqlConsole, diff --git a/src/routes/routes.ts b/src/routes/routes.ts index a7a0601de..4a18ad87c 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -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);