stub for courses
This commit is contained in:
parent
0e7c18e088
commit
c1e3c6f657
52
frontend/src/rest/courses.js
Normal file
52
frontend/src/rest/courses.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Courses API
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { restGet, restPost } from './restConsumer.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new course
|
||||||
|
*/
|
||||||
|
export async function createCourse(name, credits, faculty, teacher, assistants){
|
||||||
|
return restPost("/courses", {name: name, credits: credits, faculty: faculty, teacher: teacher, assistants: assistants} )
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the specified course
|
||||||
|
*/
|
||||||
|
export async function deleteCourse(id){
|
||||||
|
return restDelete("/course/" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get informations on a particular course
|
||||||
|
*
|
||||||
|
* @param id identification of the course
|
||||||
|
*
|
||||||
|
* @return all atribute of the specified course
|
||||||
|
* - name
|
||||||
|
* - credits
|
||||||
|
* - faculty
|
||||||
|
* - teacher
|
||||||
|
* - assistants : list
|
||||||
|
*/
|
||||||
|
export async function getCourse(id){
|
||||||
|
return restGet("/course/" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 alterCourse(id, changes){
|
||||||
|
return restPatch("/course/" + id, changes);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user