mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
15 lines
376 B
TypeScript
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();
|
|
}
|
|
});
|
|
}
|