70 lines
1.3 KiB
JavaScript
70 lines
1.3 KiB
JavaScript
import {restGet,restPatch,restPost,restDelete} from "@/rest/restConsumer.js";
|
|
|
|
/**
|
|
* Create a new lesson
|
|
*/
|
|
export async function createLesson(datas){
|
|
return restPost("/lesson", datas )
|
|
}
|
|
|
|
/**
|
|
* 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(){
|
|
return restGet("/lessons")
|
|
}
|
|
|
|
export async function getOwnedLessons(){
|
|
return restGet("/lessons/owned")
|
|
}
|
|
|
|
export async function getOnesLessons(){
|
|
return restGet("/lessons/OwnCurriculum");
|
|
}
|
|
|
|
/**
|
|
* 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){
|
|
return restPatch("/lesson/" + id, changes);
|
|
}
|