2025-04-03 10:11:49 -05:00
|
|
|
import type { AuditLog, AuditLogFilter } from '$lib/types/audit-log.type';
|
2025-01-11 20:14:12 +01:00
|
|
|
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
|
2024-09-09 10:29:41 +02:00
|
|
|
import APIService from './api-service';
|
|
|
|
|
|
|
|
|
|
class AuditLogService extends APIService {
|
2025-01-11 20:14:12 +01:00
|
|
|
async list(options?: SearchPaginationSortRequest) {
|
2024-09-09 10:29:41 +02:00
|
|
|
const res = await this.api.get('/audit-logs', {
|
2025-01-11 20:14:12 +01:00
|
|
|
params: options
|
2024-09-09 10:29:41 +02:00
|
|
|
});
|
|
|
|
|
return res.data as Paginated<AuditLog>;
|
|
|
|
|
}
|
2025-04-03 10:11:49 -05:00
|
|
|
|
|
|
|
|
async listAllLogs(options?: SearchPaginationSortRequest, filters?: AuditLogFilter) {
|
|
|
|
|
const res = await this.api.get('/audit-logs/all', {
|
|
|
|
|
params: {
|
|
|
|
|
...options,
|
|
|
|
|
filters
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return res.data as Paginated<AuditLog>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async listClientNames() {
|
|
|
|
|
const res = await this.api.get<string[]>('/audit-logs/filters/client-names');
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async listUsers() {
|
|
|
|
|
const res = await this.api.get<Record<string, string>>('/audit-logs/filters/users');
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
2024-09-09 10:29:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default AuditLogService;
|