Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor: 💡 rename getWeekNote to getWeekFirstDayNote
Jin674e5976ef2c
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.htmlindex cc2b9f1a12..6114b21a19 100644--- a/docs/frontend_api/FrontendScriptApi.html+++ b/docs/frontend_api/FrontendScriptApi.html@@ -4680,7 +4680,7 @@ otherwise (by e.g. createLink())- <h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date)</span><span class="type-signature"> → {Promise.<<a href="FNote.html">FNote</a>>}</span></h4>+ <h4 class="name" id="getWeekFirstDayNote"><span class="type-signature"></span>getWeekFirstDayNote<span class="signature">(date)</span><span class="type-signature"> → {Promise.<<a href="FNote.html">FNote</a>>}</span></h4>diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.htmlindex 53cd61c4c8..bee5628fa3 100644--- a/docs/frontend_api/services_frontend_script_api.js.html+++ b/docs/frontend_api/services_frontend_script_api.js.html@@ -563,7 +563,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain* @param {string} date - e.g. "2019-04-29"* @returns {Promise<FNote>}*/- this.getWeekNote = dateNotesService.getWeekNote;+ this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote;/*** Returns month-note. If it doesn't exist, it is automatically created.diff --git a/src/etapi/etapi.openapi.yaml b/src/etapi/etapi.openapi.yamlindex eed39fd809..ac2f01f550 100644--- a/src/etapi/etapi.openapi.yaml+++ b/src/etapi/etapi.openapi.yaml@@ -694,7 +694,7 @@ paths:/calendar/weeks/{date}:get:description: returns a week note for a given date. Gets created if doesn't exist.- operationId: getWeekNote+ operationId: getWeekFirstDayNoteparameters:- name: datein: pathdiff --git a/src/etapi/special_notes.ts b/src/etapi/special_notes.tsindex 23411c987a..f8f5bc47c3 100644--- a/src/etapi/special_notes.ts+++ b/src/etapi/special_notes.ts@@ -46,7 +46,7 @@ function register(router: Router) {throw getDateInvalidError(date);}- const note = dateNotesService.getWeekNote(date);+ const note = dateNotesService.getWeekFirstDayNote(date);res.json(mappers.mapNoteToPojo(note));});diff --git a/src/public/app/services/date_notes.ts b/src/public/app/services/date_notes.tsindex 17aa7b9633..8dad0bf374 100644--- a/src/public/app/services/date_notes.ts+++ b/src/public/app/services/date_notes.ts@@ -22,7 +22,7 @@ async function getDayNote(date: string) {return await froca.getNote(note.noteId);}-async function getWeekNote(date: string) {+async function getWeekFirstDayNote(date: string) {const note = await server.get<FNoteRow>(`special-notes/weeks/${date}`, "date-note");await ws.waitForMaxKnownEntityChangeId();@@ -66,7 +66,7 @@ export default {getInboxNote,getTodayNote,getDayNote,- getWeekNote,+ getWeekFirstDayNote,getMonthNote,getYearNote,createSqlConsole,diff --git a/src/public/app/services/frontend_script_api.ts b/src/public/app/services/frontend_script_api.tsindex bd30a58cc8..c20d9dc167 100644--- a/src/public/app/services/frontend_script_api.ts+++ b/src/public/app/services/frontend_script_api.ts@@ -363,7 +363,7 @@ interface Api {** @param date - e.g. "2019-04-29"*/- getWeekNote: typeof dateNotesService.getWeekNote;+ getWeekFirstDayNote: typeof dateNotesService.getWeekFirstDayNote;/*** Returns month-note. If it doesn't exist, it is automatically created.@@ -651,7 +651,7 @@ function FrontendScriptApi(this: Api, startNote: FNote, currentNote: FNote, origthis.getTodayNote = dateNotesService.getTodayNote;this.getDayNote = dateNotesService.getDayNote;- this.getWeekNote = dateNotesService.getWeekNote;+ this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote;this.getMonthNote = dateNotesService.getMonthNote;this.getYearNote = dateNotesService.getYearNote;diff --git a/src/routes/api/special_notes.ts b/src/routes/api/special_notes.tsindex b884c3291b..2c68d3db9b 100644--- a/src/routes/api/special_notes.ts+++ b/src/routes/api/special_notes.ts@@ -15,8 +15,8 @@ function getDayNote(req: Request) {return dateNoteService.getDayNote(req.params.date);}-function getWeekNote(req: Request) {- return dateNoteService.getWeekNote(req.params.date);+function getWeekFirstDayNote(req: Request) {+ return dateNoteService.getWeekFirstDayNote(req.params.date);}function getMonthNote(req: Request) {@@ -101,7 +101,7 @@ function createOrUpdateScriptLauncherFromApi(req: Request) {export default {getInboxNote,getDayNote,- getWeekNote,+ getWeekFirstDayNote,getMonthNote,getYearNote,getDayNotesForMonth,diff --git a/src/routes/routes.ts b/src/routes/routes.tsindex abae1acaa6..a7a0601de6 100644--- a/src/routes/routes.ts+++ b/src/routes/routes.ts@@ -307,7 +307,7 @@ 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.getWeekNote);+ apiRoute(GET, "/api/special-notes/weeks/:date", specialNotesRoute.getWeekFirstDayNote);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);diff --git a/src/services/backend_script_api.ts b/src/services/backend_script_api.tsindex 42b56033fe..3d07384a7d 100644--- a/src/services/backend_script_api.ts+++ b/src/services/backend_script_api.ts@@ -239,7 +239,7 @@ interface Api {* @param date in YYYY-MM-DD format* @param rootNote - specify calendar root note, normally leave empty to use the default calendar*/- getWeekNote(+ getWeekFirstDayNote(date: string,options: {// TODO: Deduplicate type with date_notes.ts once ES modules are added.@@ -552,7 +552,7 @@ function BackendScriptApi(this: Api, currentNote: BNote, apiParams: ApiParams) {this.getRootCalendarNote = dateNoteService.getRootCalendarNote;this.getDayNote = dateNoteService.getDayNote;this.getTodayNote = dateNoteService.getTodayNote;- this.getWeekNote = dateNoteService.getWeekNote;+ this.getWeekFirstDayNote = dateNoteService.getWeekFirstDayNote;this.getMonthNote = dateNoteService.getMonthNote;this.getYearNote = dateNoteService.getYearNote;diff --git a/src/services/date_notes.ts b/src/services/date_notes.tsindex a0292fc1e6..6e64ecc53f 100644--- a/src/services/date_notes.ts+++ b/src/services/date_notes.ts@@ -12,6 +12,7 @@ import { t } from "i18next";const CALENDAR_ROOT_LABEL = "calendarRoot";const YEAR_LABEL = "yearNote";const MONTH_LABEL = "monthNote";+const WEEK_LABEL = "weekNote";const DATE_LABEL = "dateNote";const WEEKDAY_TRANSLATION_IDS = ["weekdays.sunday", "weekdays.monday", "weekdays.tuesday", "weekdays.wednesday", "weekdays.thursday", "weekdays.friday", "weekdays.saturday", "weekdays.sunday"];@@ -225,7 +226,7 @@ interface WeekNoteOpts {startOfTheWeek?: StartOfWeek;}-function getWeekNote(dateStr: string, options: WeekNoteOpts = {}, rootNote: BNote | null = null) {+function getWeekFirstDayNote(dateStr: string, options: WeekNoteOpts = {}, rootNote: BNote | null = null) {const startOfTheWeek = options.startOfTheWeek || "monday";const dateObj = getStartOfTheWeek(dateUtils.parseLocalDate(dateStr), startOfTheWeek);@@ -239,7 +240,7 @@ export default {getRootCalendarNote,getYearNote,getMonthNote,- getWeekNote,+ getWeekFirstDayNote,getDayNote,getTodayNote};