mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	client-ts: Port services/app/date_notes
This commit is contained in:
		
							parent
							
								
									ac7316ae93
								
							
						
					
					
						commit
						cd5ea28e14
					
				| @ -1,67 +1,61 @@ | |||||||
|  | import dayjs from "dayjs"; | ||||||
|  | import { FNoteRow } from "../entities/fnote.js"; | ||||||
| import froca from "./froca.js"; | import froca from "./froca.js"; | ||||||
| import server from "./server.js"; | import server from "./server.js"; | ||||||
| import ws from "./ws.js"; | import ws from "./ws.js"; | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ |  | ||||||
| async function getInboxNote() { | async function getInboxNote() { | ||||||
|     const note = await server.get(`special-notes/inbox/${dayjs().format("YYYY-MM-DD")}`, "date-note"); |     const note = await server.get<FNoteRow>(`special-notes/inbox/${dayjs().format("YYYY-MM-DD")}`, "date-note"); | ||||||
| 
 | 
 | ||||||
|     return await froca.getNote(note.noteId); |     return await froca.getNote(note.noteId); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ |  | ||||||
| async function getTodayNote() { | async function getTodayNote() { | ||||||
|     return await getDayNote(dayjs().format("YYYY-MM-DD")); |     return await getDayNote(dayjs().format("YYYY-MM-DD")); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ | async function getDayNote(date: string) { | ||||||
| async function getDayNote(date) { |     const note = await server.get<FNoteRow>(`special-notes/days/${date}`, "date-note"); | ||||||
|     const note = await server.get(`special-notes/days/${date}`, "date-note"); |  | ||||||
| 
 | 
 | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| 
 | 
 | ||||||
|     return await froca.getNote(note.noteId); |     return await froca.getNote(note.noteId); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ | async function getWeekNote(date: string) { | ||||||
| async function getWeekNote(date) { |     const note = await server.get<FNoteRow>(`special-notes/weeks/${date}`, "date-note"); | ||||||
|     const note = await server.get(`special-notes/weeks/${date}`, "date-note"); |  | ||||||
| 
 | 
 | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| 
 | 
 | ||||||
|     return await froca.getNote(note.noteId); |     return await froca.getNote(note.noteId); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ | async function getMonthNote(month: string) { | ||||||
| async function getMonthNote(month) { |     const note = await server.get<FNoteRow>(`special-notes/months/${month}`, "date-note"); | ||||||
|     const note = await server.get(`special-notes/months/${month}`, "date-note"); |  | ||||||
| 
 | 
 | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| 
 | 
 | ||||||
|     return await froca.getNote(note.noteId); |     return await froca.getNote(note.noteId); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ | async function getYearNote(year: string) { | ||||||
| async function getYearNote(year) { |     const note = await server.get<FNoteRow>(`special-notes/years/${year}`, "date-note"); | ||||||
|     const note = await server.get(`special-notes/years/${year}`, "date-note"); |  | ||||||
| 
 | 
 | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| 
 | 
 | ||||||
|     return await froca.getNote(note.noteId); |     return await froca.getNote(note.noteId); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ |  | ||||||
| async function createSqlConsole() { | async function createSqlConsole() { | ||||||
|     const note = await server.post('special-notes/sql-console'); |     const note = await server.post<FNoteRow>('special-notes/sql-console'); | ||||||
| 
 | 
 | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| 
 | 
 | ||||||
|     return await froca.getNote(note.noteId); |     return await froca.getNote(note.noteId); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** @returns {FNote} */ |  | ||||||
| async function createSearchNote(opts = {}) { | async function createSearchNote(opts = {}) { | ||||||
|     const note = await server.post('special-notes/search-note', opts); |     const note = await server.post<FNoteRow>('special-notes/search-note', opts); | ||||||
| 
 | 
 | ||||||
|     await ws.waitForMaxKnownEntityChangeId(); |     await ws.waitForMaxKnownEntityChangeId(); | ||||||
| 
 | 
 | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran