blob: 1060501a35bb9fba13111f1267154c7ff31a6901 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { db } from "./index";
import crypto from "node:crypto";
export function createGroup(name: string) {
const id = crypto.randomUUID();
const joinCode = crypto
.randomBytes(3)
.toString("hex")
.toUpperCase();
db.prepare(`
INSERT INTO groups
(id, name, join_code, created_at)
VALUES (?, ?, ?, ?)
`).run(
id,
name,
joinCode,
Date.now()
);
return {
id,
name,
joinCode
};
}
|