/
DME
/
Notes
Обзор
Документация
Войти
/
DME
/
Notes
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/server/api/checklists.ts
23 строки
760 B
Karasique333
Commit
19 июн 2025, 15:09
19 июн 2025, 15:09
d96c829
Код
Авторство
О чём код?
import { db } from '../db'; import { checklistItem } from '../db/schema'; import { eq } from 'drizzle-orm'; export async function getChecklist(noteId: string) { return db.select().from(checklistItem).where(eq(checklistItem.noteId, noteId)); } export async function addChecklistItem(noteId: string, content: string) { return db.insert(checklistItem).values({ noteId, content }).returning(); } export async function toggleChecklistItem(id: string, value: boolean) { return db .update(checklistItem) .set({ completed: value }) .where(eq(checklistItem.id, id)) .returning(); } export async function deleteChecklistItem(id: string) { return db.delete(checklistItem).where(eq(checklistItem.id, id)).returning(); }