Serve rooms ("Räume"), which are not courses however the urls read
The account this was built against is in no rooms, so the whole space was invisible and easy to dismiss as an empty endpoint. It is not empty in general — the user had rooms until a teacher removed access — and the UI's naming actively hides the distinction: the sidebar's *Kurse* entry links to `/rooms/courses-overview` and lists courses, while *Räume* links to `/rooms` and lists rooms. A url containing `/rooms` identifies neither. list_rooms and get_room cover the latter. A room holds boards and nothing else, so get_room lists boards for get_board (which already reports "in room" from the board context) plus who else is in it. Room boards report `isVisible`, which the course-page projection does not, so a draft is named as a draft instead of being offered and then answering 403. Rooms also go through the crawl, or they would have become the next blind spot: their boards are indexed, searchable by both the index and the live-crawl path, diffed by what_changed, and mirrored by the CLI under the room's name. The board traversal and the snapshot matcher are now shared between courses and rooms rather than duplicated, which also fixed the live-crawl path silently not searching pad contents. The CLI needed no new command — it is file-centric and inherits rooms through the manifest — but `--course` now accepts a room id, and says so. `kind` gains 'room'; the column is plain TEXT, so no migration. 112 tests. Smoke: 42/42 and 44/44 local, 41/41 and 43/43 live. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,10 @@ import type {
|
||||
Paginated,
|
||||
SubmissionStatus,
|
||||
LessonLinkedTask,
|
||||
RoomBoardItem,
|
||||
RoomDetails,
|
||||
RoomItem,
|
||||
RoomMember,
|
||||
TaskContent,
|
||||
} from './types.ts';
|
||||
|
||||
@@ -323,6 +327,44 @@ export class SchulcloudClient {
|
||||
return Array.isArray(body) ? body : (body.data ?? []);
|
||||
}
|
||||
|
||||
// --- rooms ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The rooms this account belongs to.
|
||||
*
|
||||
* Returns `{data}` with no `total` — not the usual paginated envelope. The
|
||||
* server derives the list from actual room memberships, so an empty result
|
||||
* means exactly that, and a room a teacher revoked access to simply stops
|
||||
* appearing.
|
||||
*/
|
||||
async listRooms(): Promise<RoomItem[]> {
|
||||
const body = await this.getJson<{ data?: RoomItem[] }>('/api/v3/rooms');
|
||||
return body.data ?? [];
|
||||
}
|
||||
|
||||
getRoom(roomId: string): Promise<RoomDetails> {
|
||||
return this.getJson<RoomDetails>(`/api/v3/rooms/${encodeURIComponent(roomId)}`);
|
||||
}
|
||||
|
||||
async listRoomBoards(roomId: string): Promise<RoomBoardItem[]> {
|
||||
const body = await this.getJson<Paginated<RoomBoardItem>>(
|
||||
`/api/v3/rooms/${encodeURIComponent(roomId)}/boards`,
|
||||
);
|
||||
return body.data ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* A room's members. Needs no special permission for a member to see who else
|
||||
* is in the room, but it can still be refused — callers treat that as "not
|
||||
* available" rather than as an error worth surfacing.
|
||||
*/
|
||||
async listRoomMembers(roomId: string): Promise<RoomMember[]> {
|
||||
const body = await this.getJson<{ data?: RoomMember[] }>(
|
||||
`/api/v3/rooms/${encodeURIComponent(roomId)}/members`,
|
||||
);
|
||||
return body.data ?? [];
|
||||
}
|
||||
|
||||
// --- column boards ---------------------------------------------------
|
||||
|
||||
getBoardSkeleton(boardId: string): Promise<BoardSkeleton> {
|
||||
|
||||
Reference in New Issue
Block a user