feature: chat is working?
This commit is contained in:
parent
b700251278
commit
200b89954b
9 changed files with 189 additions and 71 deletions
|
@ -4,6 +4,7 @@ import { get_session, get_user, require_user } from '../../../utils/prechecks.ts
|
|||
import * as CANNED_RESPONSES from '../../../utils/canned_responses.ts';
|
||||
import { PRECHECK_TABLE } from '../../../utils/prechecks.ts';
|
||||
import { ROOM, ROOMS } from '../../../models/room.ts';
|
||||
import { WALK_ENTRY } from 'jsr:@andyburke/fsdb';
|
||||
|
||||
export const PRECHECKS: PRECHECK_TABLE = {};
|
||||
|
||||
|
@ -17,9 +18,14 @@ PRECHECKS.GET = [get_session, get_user, require_user, (_req: Request, meta: Reco
|
|||
}];
|
||||
export async function GET(_req: Request, meta: Record<string, any>): Promise<Response> {
|
||||
const limit = Math.min(parseInt(meta.query.limit ?? '100'), 100);
|
||||
const rooms = await ROOMS.all({
|
||||
limit
|
||||
});
|
||||
const rooms = (await ROOMS.all({
|
||||
limit,
|
||||
filter: (entry: WALK_ENTRY<ROOM>) => {
|
||||
// we push our event collections into the rooms, and fsdb
|
||||
// doesn't yet filter that out in its all() logic
|
||||
return entry.path.indexOf('/events/') === -1;
|
||||
}
|
||||
})).map((item) => item.load());
|
||||
|
||||
return Response.json(rooms, {
|
||||
status: 200
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue