| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * functions to handle register requests.  | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2024-04-06 16:12:11 +02:00
										 |  |  | import {restGet, restPatch, restPost} from './restConsumer.js' | 
					
						
							| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * 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(){ | 
					
						
							| 
									
										
										
										
											2024-03-15 18:53:58 +01:00
										 |  |  | 	return restPost("/request/register"); | 
					
						
							| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * list all register request in a list of Objects | 
					
						
							| 
									
										
										
										
											2024-03-10 20:32:23 +01:00
										 |  |  |  * Shall return a list of | 
					
						
							|  |  |  |  * - id | 
					
						
							|  |  |  |  * - type | 
					
						
							|  |  |  |  * - lastName | 
					
						
							|  |  |  |  * - firstName | 
					
						
							|  |  |  |  * - address | 
					
						
							|  |  |  |  * - country | 
					
						
							|  |  |  |  * - birthdate | 
					
						
							|  |  |  |  * - email | 
					
						
							| 
									
										
										
										
											2024-03-16 10:17:04 +01:00
										 |  |  |  * - curriculum | 
					
						
							| 
									
										
										
										
											2024-03-10 20:32:23 +01:00
										 |  |  |  * - degree | 
					
						
							| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | export async function getRegisters(id){ | 
					
						
							| 
									
										
										
										
											2024-03-10 20:32:23 +01:00
										 |  |  | 	if(id != null) | 
					
						
							| 
									
										
										
										
											2024-03-15 17:40:42 +01:00
										 |  |  | 		return restGet("/request/register/" + id); | 
					
						
							|  |  |  | 	return restGet("/request/register") | 
					
						
							| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-17 23:19:36 +01:00
										 |  |  | export async function getAllRegisters(){ | 
					
						
							|  |  |  |   return restGet("/requests/register") | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Change the state of a requests. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export async function validateRegister(id, state){ | 
					
						
							| 
									
										
										
										
											2024-03-18 11:55:51 +01:00
										 |  |  |   return restPatch("/request/register/" + id, state); | 
					
						
							| 
									
										
										
										
											2024-03-06 19:22:10 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2024-04-11 16:45:48 +02:00
										 |  |  | 
 |