Merge branch 'master' into tonitch/front/pagesAPI
This commit is contained in:
@ -3,14 +3,14 @@
|
||||
*
|
||||
* TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
|
||||
*/
|
||||
import { restGet, restPost } from './restConsumer.js'
|
||||
import {restGet, restPatch} from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* create a new register requests that can be recovered by the registering service
|
||||
* TODO: add info in the Object (I don't know what will be needed)
|
||||
*/
|
||||
export async function createRegister(){
|
||||
return restPost("/requests/register");
|
||||
return restPost("/request/register");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -24,18 +24,18 @@ export async function createRegister(){
|
||||
* - country
|
||||
* - birthdate
|
||||
* - email
|
||||
* - cursus
|
||||
* - curriculum
|
||||
* - degree
|
||||
*/
|
||||
export async function getRegisters(id){
|
||||
if(id != null)
|
||||
return restGet("/requests/register/" + id);
|
||||
return restGet("/requests/register")
|
||||
return restGet("/request/register/" + id);
|
||||
return restGet("/request/register")
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the state of a requests.
|
||||
*/
|
||||
export async function validateRegister(id, state){
|
||||
return restPost("/requests/register/" + id, {state: state});
|
||||
return restPatch("/request/register/" + id, {state: state});
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ export async function login(user, pass, exp){
|
||||
* @param mail
|
||||
* @param address
|
||||
* @param country
|
||||
* @param cursus
|
||||
* @param curriculum
|
||||
* @param imageId id of the image in database returned when uploaded
|
||||
*/
|
||||
export async function register(firstname, lastname, birthDate, password, email, address, country, cursus, imageId){
|
||||
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculum, imageId){
|
||||
return restPost("/register", {
|
||||
firstname: firstname,
|
||||
lastname: lastname,
|
||||
@ -26,7 +26,7 @@ export async function register(firstname, lastname, birthDate, password, email,
|
||||
email: email,
|
||||
address: address,
|
||||
country: country,
|
||||
cursus: cursus
|
||||
curriculum: curriculum
|
||||
});
|
||||
}
|
||||
|
||||
|
41
frontend/src/rest/curriculum.js
Normal file
41
frontend/src/rest/curriculum.js
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* curriculum API
|
||||
*/
|
||||
|
||||
import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* Create a new curriculum (bundle of courses)
|
||||
* @param courses list of courses
|
||||
*/
|
||||
export async function createcurriculum(courses){
|
||||
return restPost("/curriculum", {courses: courses} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the specified curriculum
|
||||
*/
|
||||
export async function deletecurriculum(id){
|
||||
return restDelete("/curriculum/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get informations on a particular curriculum
|
||||
*
|
||||
* @param id identification of the curriculum
|
||||
*
|
||||
* @return list of courses
|
||||
*/
|
||||
export async function getcurriculum(id){
|
||||
return restGet("/curriculum/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the courses of a curriculum
|
||||
*
|
||||
* @param id the id of the curriculum
|
||||
* @param courses list of new courses
|
||||
*/
|
||||
export async function altercurriculum(id, courses){
|
||||
return restPatch("/curriculum/" + id, courses);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/**
|
||||
* cursus API
|
||||
*/
|
||||
|
||||
import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* Create a new cursus (bundle of courses)
|
||||
* @param courses list of courses
|
||||
*/
|
||||
export async function createCursus(courses){
|
||||
return restPost("/cursus", {courses: courses} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the specified cursus
|
||||
*/
|
||||
export async function deleteCursus(id){
|
||||
return restDelete("/cursus/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get informations on a particular cursus
|
||||
*
|
||||
* @param id identification of the cursus
|
||||
*
|
||||
* @return list of courses
|
||||
*/
|
||||
export async function getCursus(id){
|
||||
return restGet("/cursus/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the courses of a cursus
|
||||
*
|
||||
* @param id the id of the cursus
|
||||
* @param courses list of new courses
|
||||
*/
|
||||
export async function alterCursus(id, courses){
|
||||
return restPatch("/cursus/" + id, courses);
|
||||
}
|
Reference in New Issue
Block a user