operation-log.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Operation Log Types
  3. */
  4. export enum DocumentOperationType {
  5. // Document operations
  6. DOCUMENT_CREATE = 'document.create',
  7. DOCUMENT_UPDATE = 'document.update',
  8. DOCUMENT_DELETE = 'document.delete',
  9. DOCUMENT_RENAME = 'document.rename',
  10. // Document status operations
  11. DOCUMENT_ENABLE = 'document.enable',
  12. DOCUMENT_DISABLE = 'document.disable',
  13. DOCUMENT_ARCHIVE = 'document.archive',
  14. DOCUMENT_UNARCHIVE = 'document.unarchive',
  15. DOCUMENT_BATCH_ENABLE = 'document.batch_enable',
  16. DOCUMENT_BATCH_DISABLE = 'document.batch_disable',
  17. DOCUMENT_BATCH_ARCHIVE = 'document.batch_archive',
  18. DOCUMENT_BATCH_UNARCHIVE = 'document.batch_unarchive',
  19. // Document schedule operations
  20. DOCUMENT_SCHEDULE_CREATE = 'document.schedule.create',
  21. DOCUMENT_SCHEDULE_CANCEL = 'document.schedule.cancel',
  22. DOCUMENT_SCHEDULE_EXECUTE = 'document.schedule.execute',
  23. }
  24. export type OperationLog = {
  25. id: string
  26. action: string
  27. created_at: string
  28. created_ip: string
  29. content: {
  30. dataset_id: string
  31. resource_type: string
  32. resource_id: string
  33. action: string
  34. timestamp: string
  35. changes?: {
  36. old: Record<string, any>
  37. new: Record<string, any>
  38. }
  39. metadata?: Record<string, any>
  40. }
  41. }
  42. export type OperationLogListResponse = {
  43. logs: OperationLog[]
  44. total: number
  45. page: number
  46. per_page: number
  47. pages: number
  48. }
  49. export type OperationLogQueryParams = {
  50. action?: string
  51. start_date?: string
  52. end_date?: string
  53. page?: number
  54. per_page?: number
  55. resource_type?: 'document' | 'segment' | 'metadata' | 'dataset'
  56. }