feature: the beginnings of chat working
This commit is contained in:
parent
85024c6e62
commit
649ff432bb
24 changed files with 1555 additions and 918 deletions
|
@ -1,10 +1,10 @@
|
|||
# /api/rooms/:room_id/events/:event_id
|
||||
# /api/rooms/:room_id/events
|
||||
|
||||
Interact with a specific event.
|
||||
Interact with a events for a room.
|
||||
|
||||
## GET /api/rooms/:room_id/events/:event_id
|
||||
## GET /api/rooms/:room_id/events
|
||||
|
||||
Get the event specified by the tuple [ `:room_id`, `:event_id` ].
|
||||
Get events for the given room.
|
||||
|
||||
## PUT /api/rooms/:room_id/events/:event_id
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue