Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #9 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
34 lines
811 B
TypeScript
34 lines
811 B
TypeScript
import type { AuditLog } from './dto/audit-log'
|
|
|
|
export type AuditLogFilters = {
|
|
employeeId?: number
|
|
from?: string
|
|
to?: string
|
|
entityType?: string
|
|
page?: number
|
|
}
|
|
|
|
export type AuditLogPage = {
|
|
items: AuditLog[]
|
|
total: number
|
|
page: number
|
|
perPage: number
|
|
}
|
|
|
|
export const fetchAuditLogs = async (filters: AuditLogFilters = {}): Promise<AuditLogPage> => {
|
|
const api = useApi()
|
|
const params: Record<string, string> = {}
|
|
|
|
if (filters.employeeId) params.employeeId = String(filters.employeeId)
|
|
if (filters.from) params.from = filters.from
|
|
if (filters.to) params.to = filters.to
|
|
if (filters.entityType) params.entityType = filters.entityType
|
|
if (filters.page) params.page = String(filters.page)
|
|
|
|
return api.get<AuditLogPage>(
|
|
'/audit-logs',
|
|
params,
|
|
{ toast: false }
|
|
)
|
|
}
|