feat: added dml and crud for get timer

This commit is contained in:
Arduinum authored and Arduinum628 committed 2026-04-23 22:12:29 +03:00
1 parent e7b768c926
commit a431f70c25
2 files changed
+9 -2

No files matched your search

+8 -2
View File
@@ -1,6 +1,6 @@
import { getDb } from "@/db/initDb";
import { SELECT_TIMERS } from "@/db/dml/timerDML";
import { TimersRow } from "@/types/timerType"
import { SELECT_TIMERS, SELECT_TIMER } from "@/db/dml/timerDML";
import { TimersRow, TimerRow } from "@/types/timerType";
/** Получает список таймеров */
@@ -8,3 +8,9 @@ export async function getTimers(): Promise<TimersRow[]> {
const db = await getDb();
return await db.select<TimersRow[]>(SELECT_TIMERS);
}
/* Получает таймер по его id **/
export async function getTimer(TimerId: number): Promise<TimerRow> {
const db = await getDb();
return await db.select<TimerRow>(SELECT_TIMER, [TimerId]);
}