backend Schedule
This commit is contained in:
65
frontend/src/rest/lessonSchedule.js
Normal file
65
frontend/src/rest/lessonSchedule.js
Normal file
@ -0,0 +1,65 @@
|
||||
import {restGet,restPatch,restPost,restDelete} from "@/rest/restConsumer.js";
|
||||
|
||||
/**
|
||||
* Create a new lesson
|
||||
*/
|
||||
export async function createLesson(course, start, end, color, local){
|
||||
return restPost("/lesson", {course: course , start: start, end: end, color : color , local : local} )
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(role){
|
||||
if(role==="Teacher"){
|
||||
return restGet("/lessons/owned")
|
||||
}
|
||||
return restGet("/lessons")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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("/course/" + id, changes);
|
||||
}
|
Reference in New Issue
Block a user