feature: the beginnings of chat working

This commit is contained in:
Andy Burke 2025-07-01 15:37:35 -07:00
parent 85024c6e62
commit 649ff432bb
24 changed files with 1555 additions and 918 deletions

View file

@ -9,15 +9,14 @@ export const PRECHECKS: PRECHECK_TABLE = {};
// GET /api/rooms - get rooms
PRECHECKS.GET = [get_session, get_user, require_user, (_req: Request, meta: Record<string, any>): Response | undefined => {
const can_read_rooms = meta.user?.permissions?.includes('rooms.read');
const can_read_rooms = meta.user.permissions.includes('rooms.read');
if (!can_read_rooms) {
return CANNED_RESPONSES.permission_denied();
}
}];
export async function GET(_req: Request, meta: Record<string, any>): Promise<Response> {
const query: URLSearchParams = meta.query;
const limit = Math.min(parseInt(query.get('limit') ?? '100'), 100);
const limit = Math.min(parseInt(meta.query.limit ?? '100'), 100);
const rooms = await ROOMS.all({
limit
});
@ -29,7 +28,7 @@ export async function GET(_req: Request, meta: Record<string, any>): Promise<Res
// POST /api/rooms - Create a room
PRECHECKS.POST = [get_session, get_user, require_user, (_req: Request, meta: Record<string, any>): Response | undefined => {
const can_create_rooms = meta.user?.permissions?.includes('rooms.create');
const can_create_rooms = meta.user.permissions.includes('rooms.create');
if (!can_create_rooms) {
return CANNED_RESPONSES.permission_denied();