sendou.ink/app/features/live-streams/LiveStreamRepository.server.ts
Kalle a004cf33b7
Store Twitch live streams in SQLite3 (#2738)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 16:51:44 +02:00

15 lines
376 B
TypeScript

import { db } from "~/db/sql";
import type { TablesInsertable } from "~/db/tables";
export function replaceAll(
streams: Omit<TablesInsertable["LiveStream"], "id">[],
) {
return db.transaction().execute(async (trx) => {
await trx.deleteFrom("LiveStream").execute();
if (streams.length > 0) {
await trx.insertInto("LiveStream").values(streams).execute();
}
});
}