| 
									
										
										
										
											2021-09-02 11:25:24 +02:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * @description Determines the format of the data response | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * @param {boolean} isListOfEntities - Checks for a multiple entities | 
					
						
							|  |  |  |  * @param {object} attributes - The attributes found on a contentType | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  |  * @returns object | array of attributes | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | module.exports = (isListOfEntities, attributes) => { | 
					
						
							|  |  |  |   if (isListOfEntities) { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       type: 'array', | 
					
						
							|  |  |  |       items: { | 
					
						
							|  |  |  |         type: 'object', | 
					
						
							|  |  |  |         properties: { | 
					
						
							| 
									
										
										
										
											2022-08-31 10:37:08 +00:00
										 |  |  |           id: { type: 'number' }, | 
					
						
							| 
									
										
										
										
											2021-09-02 11:25:24 +02:00
										 |  |  |           attributes: { type: 'object', properties: attributes }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return { | 
					
						
							|  |  |  |     type: 'object', | 
					
						
							|  |  |  |     properties: { | 
					
						
							| 
									
										
										
										
											2022-08-31 10:37:08 +00:00
										 |  |  |       id: { type: 'number' }, | 
					
						
							| 
									
										
										
										
											2021-09-02 11:25:24 +02:00
										 |  |  |       attributes: { type: 'object', properties: attributes }, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | }; |