| 
									
										
										
										
											2023-11-21 11:40:51 +00:00
										 |  |  |  | import { errors } from '@strapi/utils'; | 
					
						
							|  |  |  |  | import { Entity, Pagination, SanitizedAdminUser } from './shared'; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-08 18:17:33 +01:00
										 |  |  |  | // displayName seems to be used only for audit logs
 | 
					
						
							|  |  |  |  | export interface SanitizedAdminUserForAuditLogs extends SanitizedAdminUser { | 
					
						
							|  |  |  |  |   displayName: string; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 11:40:51 +00:00
										 |  |  |  | interface AuditLog extends Pick<Entity, 'id'> { | 
					
						
							|  |  |  |  |   date: string; | 
					
						
							|  |  |  |  |   action: string; | 
					
						
							|  |  |  |  |   /** | 
					
						
							|  |  |  |  |    * TODO: could this be better typed – working on the server-side code could indicate this. | 
					
						
							|  |  |  |  |    * However, we know it's JSON. | 
					
						
							|  |  |  |  |    */ | 
					
						
							|  |  |  |  |   payload: Record<string, unknown>; | 
					
						
							| 
									
										
										
										
											2023-12-08 18:17:33 +01:00
										 |  |  |  |   user?: SanitizedAdminUserForAuditLogs; | 
					
						
							| 
									
										
										
										
											2023-11-21 11:40:51 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace GetAll { | 
					
						
							|  |  |  |  |   export interface Request { | 
					
						
							|  |  |  |  |     body: {}; | 
					
						
							|  |  |  |  |     query: {}; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-02 17:01:58 +00:00
										 |  |  |  |   export type Response = | 
					
						
							|  |  |  |  |     | { | 
					
						
							|  |  |  |  |         pagination: Pagination; | 
					
						
							|  |  |  |  |         results: AuditLog[]; | 
					
						
							|  |  |  |  |         error?: never; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     | { | 
					
						
							|  |  |  |  |         pagination?: never; | 
					
						
							|  |  |  |  |         results?: never; | 
					
						
							|  |  |  |  |         error?: errors.ApplicationError; | 
					
						
							|  |  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2023-11-21 11:40:51 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace Get { | 
					
						
							|  |  |  |  |   export interface Request { | 
					
						
							|  |  |  |  |     body: {}; | 
					
						
							|  |  |  |  |     query: {}; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   export interface Params { | 
					
						
							|  |  |  |  |     id: Entity['id']; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   export type Response = | 
					
						
							|  |  |  |  |     | AuditLog | 
					
						
							|  |  |  |  |     | { | 
					
						
							|  |  |  |  |         error?: errors.ApplicationError; | 
					
						
							|  |  |  |  |       }; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | export { AuditLog, GetAll, Get }; |