1
0
forked from PGL/Clyde
Clyde/frontend/src/rest/lessonSchedule.js

70 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-04-07 14:33:51 +02:00
import {restGet,restPatch,restPost,restDelete} from "@/rest/restConsumer.js";
/**
* Create a new lesson
*/
2024-04-16 22:03:48 +02:00
export async function createLesson(datas){
return restPost("/lesson", datas )
2024-04-07 14:33:51 +02:00
}
/**
* Delete a lesson
*/
export async function deleteLesson(id){
return restDelete("/lesson/" + id);
}
/**
* Get information on a particular course
*
* @return all attribute of the lesson
* - course
* - start
* - end
* - color
* - local
*/
export async function getLesson(id){
return restGet("/lesson/" + id);
}
/**
* Get the list of courses to display on secretary's option
*
* @return list of courses of the form
* - id
* - name
* - credits
* - facutly
* - teacher
* - Assistants
*/
export async function getLessons(){
2024-04-07 14:33:51 +02:00
return restGet("/lessons")
}
export async function getOwnedLessons(){
return restGet("/lessons/owned")
2024-04-21 00:10:33 +02:00
}
export async function getOnesLessons(){
return restGet("/lessons/OwnCurriculum");
}
2024-04-07 14:33:51 +02:00
/**
* Change the options of a course
*
* @param id the id of the course
* @param changes Object with value to changes
*
* The changes object can contain:
* - name
* - credits
* - faculty
* - teacher
* - assistants: should be a list and will replace all assistants
*/
export async function alterLesson(id, changes){
2024-04-14 13:52:09 +02:00
return restPatch("/lesson/" + id, changes);
2024-04-07 14:33:51 +02:00
}