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
client-ts: Port services/app/date_notes
Elian Dorancd5ea28e1492
diff --git a/src/public/app/services/date_notes.js b/src/public/app/services/date_notes.tssimilarity index 55%rename from src/public/app/services/date_notes.jsrename to src/public/app/services/date_notes.tsindex 0c3e84e533..bab4deb05e 100644--- a/src/public/app/services/date_notes.js+++ b/src/public/app/services/date_notes.ts@@ -1,67 +1,61 @@+import dayjs from "dayjs";+import { FNoteRow } from "../entities/fnote.js";import froca from "./froca.js";import server from "./server.js";import ws from "./ws.js";-/** @returns {FNote} */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);}-/** @returns {FNote} */async function getTodayNote() {return await getDayNote(dayjs().format("YYYY-MM-DD"));}-/** @returns {FNote} */-async function getDayNote(date) {- const note = await server.get(`special-notes/days/${date}`, "date-note");+async function getDayNote(date: string) {+ const note = await server.get<FNoteRow>(`special-notes/days/${date}`, "date-note");await ws.waitForMaxKnownEntityChangeId();return await froca.getNote(note.noteId);}-/** @returns {FNote} */-async function getWeekNote(date) {- const note = await server.get(`special-notes/weeks/${date}`, "date-note");+async function getWeekNote(date: string) {+ const note = await server.get<FNoteRow>(`special-notes/weeks/${date}`, "date-note");await ws.waitForMaxKnownEntityChangeId();return await froca.getNote(note.noteId);}-/** @returns {FNote} */-async function getMonthNote(month) {- const note = await server.get(`special-notes/months/${month}`, "date-note");+async function getMonthNote(month: string) {+ const note = await server.get<FNoteRow>(`special-notes/months/${month}`, "date-note");await ws.waitForMaxKnownEntityChangeId();return await froca.getNote(note.noteId);}-/** @returns {FNote} */-async function getYearNote(year) {- const note = await server.get(`special-notes/years/${year}`, "date-note");+async function getYearNote(year: string) {+ const note = await server.get<FNoteRow>(`special-notes/years/${year}`, "date-note");await ws.waitForMaxKnownEntityChangeId();return await froca.getNote(note.noteId);}-/** @returns {FNote} */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();return await froca.getNote(note.noteId);}-/** @returns {FNote} */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();