mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +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" |      * @param {string} date - e.g. "2019-04-29" | ||||||
|      * @returns {Promise<FNote>} |      * @returns {Promise<FNote>} | ||||||
|      */ |      */ | ||||||
|     this.getWeekNote = dateNotesService.getWeekNote; |     this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Returns month-note. If it doesn't exist, it is automatically created. |      * Returns month-note. If it doesn't exist, it is automatically created. | ||||||
|   | |||||||
| @@ -694,7 +694,7 @@ paths: | |||||||
|     /calendar/weeks/{date}: |     /calendar/weeks/{date}: | ||||||
|         get: |         get: | ||||||
|             description: returns a week note for a given date. Gets created if doesn't exist. |             description: returns a week note for a given date. Gets created if doesn't exist. | ||||||
|             operationId: getWeekNote |             operationId: getWeekFirstDayNote | ||||||
|             parameters: |             parameters: | ||||||
|                 - name: date |                 - name: date | ||||||
|                   in: path |                   in: path | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ function register(router: Router) { | |||||||
|             throw getDateInvalidError(date); |             throw getDateInvalidError(date); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         const note = dateNotesService.getWeekNote(date); |         const note = dateNotesService.getWeekFirstDayNote(date); | ||||||
|         res.json(mappers.mapNoteToPojo(note)); |         res.json(mappers.mapNoteToPojo(note)); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ async function getDayNote(date: string) { | |||||||
|     return await froca.getNote(note.noteId); |     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"); |     const note = await server.get<FNoteRow>(`special-notes/weeks/${date}`, "date-note"); | ||||||
|  |  | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| @@ -66,7 +66,7 @@ export default { | |||||||
|     getInboxNote, |     getInboxNote, | ||||||
|     getTodayNote, |     getTodayNote, | ||||||
|     getDayNote, |     getDayNote, | ||||||
|     getWeekNote, |     getWeekFirstDayNote, | ||||||
|     getMonthNote, |     getMonthNote, | ||||||
|     getYearNote, |     getYearNote, | ||||||
|     createSqlConsole, |     createSqlConsole, | ||||||
|   | |||||||
| @@ -363,7 +363,7 @@ interface Api { | |||||||
|      * |      * | ||||||
|      * @param date - e.g. "2019-04-29" |      * @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. |      * 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.getTodayNote = dateNotesService.getTodayNote; | ||||||
|     this.getDayNote = dateNotesService.getDayNote; |     this.getDayNote = dateNotesService.getDayNote; | ||||||
|     this.getWeekNote = dateNotesService.getWeekNote; |     this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote; | ||||||
|     this.getMonthNote = dateNotesService.getMonthNote; |     this.getMonthNote = dateNotesService.getMonthNote; | ||||||
|     this.getYearNote = dateNotesService.getYearNote; |     this.getYearNote = dateNotesService.getYearNote; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,8 +15,8 @@ function getDayNote(req: Request) { | |||||||
|     return dateNoteService.getDayNote(req.params.date); |     return dateNoteService.getDayNote(req.params.date); | ||||||
| } | } | ||||||
|  |  | ||||||
| function getWeekNote(req: Request) { | function getWeekFirstDayNote(req: Request) { | ||||||
|     return dateNoteService.getWeekNote(req.params.date); |     return dateNoteService.getWeekFirstDayNote(req.params.date); | ||||||
| } | } | ||||||
|  |  | ||||||
| function getMonthNote(req: Request) { | function getMonthNote(req: Request) { | ||||||
| @@ -101,7 +101,7 @@ function createOrUpdateScriptLauncherFromApi(req: Request) { | |||||||
| export default { | export default { | ||||||
|     getInboxNote, |     getInboxNote, | ||||||
|     getDayNote, |     getDayNote, | ||||||
|     getWeekNote, |     getWeekFirstDayNote, | ||||||
|     getMonthNote, |     getMonthNote, | ||||||
|     getYearNote, |     getYearNote, | ||||||
|     getDayNotesForMonth, |     getDayNotesForMonth, | ||||||
|   | |||||||
| @@ -307,7 +307,7 @@ function register(app: express.Application) { | |||||||
|  |  | ||||||
|     apiRoute(GET, "/api/special-notes/inbox/:date", specialNotesRoute.getInboxNote); |     apiRoute(GET, "/api/special-notes/inbox/:date", specialNotesRoute.getInboxNote); | ||||||
|     apiRoute(GET, "/api/special-notes/days/:date", specialNotesRoute.getDayNote); |     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/months/:month", specialNotesRoute.getMonthNote); | ||||||
|     apiRoute(GET, "/api/special-notes/years/:year", specialNotesRoute.getYearNote); |     apiRoute(GET, "/api/special-notes/years/:year", specialNotesRoute.getYearNote); | ||||||
|     apiRoute(GET, "/api/special-notes/notes-for-month/:month", specialNotesRoute.getDayNotesForMonth); |     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 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( |     getWeekFirstDayNote( | ||||||
|         date: string, |         date: string, | ||||||
|         options: { |         options: { | ||||||
|             // TODO: Deduplicate type with date_notes.ts once ES modules are added. |             // 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.getRootCalendarNote = dateNoteService.getRootCalendarNote; | ||||||
|     this.getDayNote = dateNoteService.getDayNote; |     this.getDayNote = dateNoteService.getDayNote; | ||||||
|     this.getTodayNote = dateNoteService.getTodayNote; |     this.getTodayNote = dateNoteService.getTodayNote; | ||||||
|     this.getWeekNote = dateNoteService.getWeekNote; |     this.getWeekFirstDayNote = dateNoteService.getWeekFirstDayNote; | ||||||
|     this.getMonthNote = dateNoteService.getMonthNote; |     this.getMonthNote = dateNoteService.getMonthNote; | ||||||
|     this.getYearNote = dateNoteService.getYearNote; |     this.getYearNote = dateNoteService.getYearNote; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ import { t } from "i18next"; | |||||||
| const CALENDAR_ROOT_LABEL = "calendarRoot"; | const CALENDAR_ROOT_LABEL = "calendarRoot"; | ||||||
| const YEAR_LABEL = "yearNote"; | const YEAR_LABEL = "yearNote"; | ||||||
| const MONTH_LABEL = "monthNote"; | const MONTH_LABEL = "monthNote"; | ||||||
|  | const WEEK_LABEL = "weekNote"; | ||||||
| const DATE_LABEL = "dateNote"; | const DATE_LABEL = "dateNote"; | ||||||
|  |  | ||||||
| const WEEKDAY_TRANSLATION_IDS = ["weekdays.sunday", "weekdays.monday", "weekdays.tuesday", "weekdays.wednesday", "weekdays.thursday", "weekdays.friday", "weekdays.saturday", "weekdays.sunday"]; | 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; |     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 startOfTheWeek = options.startOfTheWeek || "monday"; | ||||||
|  |  | ||||||
|     const dateObj = getStartOfTheWeek(dateUtils.parseLocalDate(dateStr), startOfTheWeek); |     const dateObj = getStartOfTheWeek(dateUtils.parseLocalDate(dateStr), startOfTheWeek); | ||||||
| @@ -239,7 +240,7 @@ export default { | |||||||
|     getRootCalendarNote, |     getRootCalendarNote, | ||||||
|     getYearNote, |     getYearNote, | ||||||
|     getMonthNote, |     getMonthNote, | ||||||
|     getWeekNote, |     getWeekFirstDayNote, | ||||||
|     getDayNote, |     getDayNote, | ||||||
|     getTodayNote |     getTodayNote | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user