Skip to content
Snippets Groups Projects
Commit 501181b6 authored by MonaS8's avatar MonaS8
Browse files

update api.ts

parent 486b810c
No related branches found
No related tags found
No related merge requests found
......@@ -161,6 +161,14 @@ export interface RoomSession {
}[];
roomId: number;
roomName: string;
modeName?: string;
activities: {
activity: string;
timestamp: Date;
userId: string;
}[];
points: Points;
sessionId: number;
}
export type RoomSessionUser = {
......@@ -168,6 +176,8 @@ export type RoomSessionUser = {
roomSession: RoomSession;
userId: string;
name: string;
points: Points;
roleName?: string;
}
export type Activity = {
......@@ -181,10 +191,14 @@ export type Activity = {
timestamp: Date;
}
export interface Role {
id: number;
name: string;
description?: string;
export type Roles = {
userId: number;
roleNames?: string[];
}
export type Mode = {
sessionId: number;
modeName: string;
}
/**
......@@ -382,11 +396,11 @@ const api = {
},
async getPointsByUser(userId: number): Promise<Points> {
return fetch.getOrFail(`/sessionPoints/user/${userId}`);
return fetch.getOrFail(`/roomSessionUser/user/${userId}`);
},
async getPointsBySession(sessionId: number): Promise<Points> {
return fetch.getOrFail(`/sessionPoints/session/${sessionId}`);
return fetch.getOrFail(`/roomSession/session/${sessionId}`);
},
async getRoomSessions(roomId: string, categoryId: number): Promise<RoomSession[]> {
......@@ -398,8 +412,12 @@ const api = {
return await fetch.getOrFail(`/category/${categoryId}/room/${roomId}/sessions/${sessionId}`);
},
async getRoles(): Promise<Role[]> {
return await fetch.getOrFail('/roles');
async getRolesByUser(userId: number): Promise<Roles> {
return fetch.getOrFail(`/roomSessionUser/${userId}/role`);
},
async getModeBySession(sessionId: number): Promise<Mode> {
return fetch.getOrFail(`/roomSession/${sessionId}/mode`);
},
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment