From d584c119efb1e29ac79bb7e802cbd07940bdc68f Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Sun, 10 Mar 2024 11:48:00 +0100 Subject: [PATCH 1/3] Adding info about self --- frontend/src/rest/Users.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frontend/src/rest/Users.js b/frontend/src/rest/Users.js index cca662d..6c5f0f9 100644 --- a/frontend/src/rest/Users.js +++ b/frontend/src/rest/Users.js @@ -25,3 +25,26 @@ export async function getAllUsers(){ return restGet("/users"); } + +/** + * Get informations about yourself + * - RegNo + * - FirstName / LastName + * - email + * - adressId (?) + * - birthDate + * - role + */ +export async function getSelf(){ + return restGet("/user"); +} + +/** + * Alterable datas are + * - email + * - photo + * - Adress + */ +export async function alterSelf(data){ + return restPatch({data}); +} -- 2.46.0 From 4148d76959c4fbe7f5499f7f93eb40000729a690 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 11 Mar 2024 09:21:36 +0100 Subject: [PATCH 2/3] Adding set for secretary and correcting self --- frontend/src/rest/Users.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/rest/Users.js b/frontend/src/rest/Users.js index 6c5f0f9..b3dac2d 100644 --- a/frontend/src/rest/Users.js +++ b/frontend/src/rest/Users.js @@ -18,6 +18,25 @@ export async function getUser(id){ return restGet(endpoint); } +/** + * Alterable datas of user. + * usage by secretary + * + * @param id regno of the user + * @param data data to change + * + * - lastName + * - firstName + * - birthDate + * - role + * - email + * - photo + * - Adress + */ +export async function alterUser(id, data){ + return restPatch("/user/" + id, data); +} + /** * Reserved for secretary roles. Allow to list all user on the plateform */ @@ -46,5 +65,5 @@ export async function getSelf(){ * - Adress */ export async function alterSelf(data){ - return restPatch({data}); + return restPatch("/user", data); } -- 2.46.0 From fb93c2e369502a0de6aaa21201bd0129b9fd7b58 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 11 Mar 2024 14:07:09 +0100 Subject: [PATCH 3/3] adding password to the comment --- frontend/src/rest/Users.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/rest/Users.js b/frontend/src/rest/Users.js index b3dac2d..f15dac5 100644 --- a/frontend/src/rest/Users.js +++ b/frontend/src/rest/Users.js @@ -63,6 +63,7 @@ export async function getSelf(){ * - email * - photo * - Adress + * - Password */ export async function alterSelf(data){ return restPatch("/user", data); -- 2.46.0