mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	refactor: 💡 rename getWeekNote to getWeekFirstDayNote
This commit is contained in:
		| @@ -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> | ||||
|      | ||||
|  | ||||
|      | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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: getWeekFirstDayNote | ||||
|             parameters: | ||||
|                 - name: date | ||||
|                   in: path | ||||
|   | ||||
| @@ -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)); | ||||
|     }); | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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, orig | ||||
|  | ||||
|     this.getTodayNote = dateNotesService.getTodayNote; | ||||
|     this.getDayNote = dateNotesService.getDayNote; | ||||
|     this.getWeekNote = dateNotesService.getWeekNote; | ||||
|     this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote; | ||||
|     this.getMonthNote = dateNotesService.getMonthNote; | ||||
|     this.getYearNote = dateNotesService.getYearNote; | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user