From 13e027edd90a1d6770376c243319edcc246230e6 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Wed, 6 Mar 2024 22:57:01 +0100 Subject: [PATCH 1/2] stub for cursus --- frontend/src/rest/cursus.js | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 frontend/src/rest/cursus.js diff --git a/frontend/src/rest/cursus.js b/frontend/src/rest/cursus.js new file mode 100644 index 0000000..c4cd98a --- /dev/null +++ b/frontend/src/rest/cursus.js @@ -0,0 +1,41 @@ +/** + * cursus API + */ + +import { restGet, restPost } 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); +} -- 2.46.0 From 2379b0e14529803d846a03c286f36866bb9c6713 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Wed, 6 Mar 2024 23:10:29 +0100 Subject: [PATCH 2/2] adding the right dependencies --- frontend/src/rest/cursus.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/rest/cursus.js b/frontend/src/rest/cursus.js index c4cd98a..5aad5be 100644 --- a/frontend/src/rest/cursus.js +++ b/frontend/src/rest/cursus.js @@ -2,7 +2,7 @@ * cursus API */ -import { restGet, restPost } from './restConsumer.js' +import { restGet, restPostn, restDelete, restPatch } from './restConsumer.js' /** * Create a new cursus (bundle of courses) -- 2.46.0