]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/audit-logger.ts
emit more specific status codes on video upload (#3423)
[github/Chocobozzz/PeerTube.git] / server / helpers / audit-logger.ts
index a4cfeef76c11cb0e0a50e48c29056f6ece7746a4..6aae5e82112725fc6d843d91c68315e4469741e8 100644 (file)
@@ -1,15 +1,15 @@
-import * as path from 'path'
-import * as express from 'express'
 import { diff } from 'deep-object-diff'
-import { chain } from 'lodash'
+import * as express from 'express'
 import * as flatten from 'flat'
+import { chain } from 'lodash'
+import * as path from 'path'
 import * as winston from 'winston'
-import { jsonLoggerFormat, labelFormatter } from './logger'
-import { User, VideoAbuse, VideoChannel, VideoDetails, VideoImport } from '../../shared'
-import { VideoComment } from '../../shared/models/videos/video-comment.model'
+import { AUDIT_LOG_FILENAME } from '@server/initializers/constants'
+import { AdminAbuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared'
 import { CustomConfig } from '../../shared/models/server/custom-config.model'
+import { VideoComment } from '../../shared/models/videos/video-comment.model'
 import { CONFIG } from '../initializers/config'
-import { AUDIT_LOG_FILENAME } from '@server/initializers/constants'
+import { jsonLoggerFormat, labelFormatter } from './logger'
 
 function getAuditIdFromRes (res: express.Response) {
   return res.locals.oauth.token.User.username
@@ -36,7 +36,7 @@ const auditLogger = winston.createLogger({
       maxFiles: 5,
       format: winston.format.combine(
         winston.format.timestamp(),
-        labelFormatter,
+        labelFormatter(),
         winston.format.splat(),
         jsonLoggerFormat
       )
@@ -212,18 +212,15 @@ class VideoChannelAuditView extends EntityAuditView {
   }
 }
 
-const videoAbuseKeysToKeep = [
+const abuseKeysToKeep = [
   'id',
   'reason',
   'reporterAccount',
-  'video-id',
-  'video-name',
-  'video-uuid',
   'createdAt'
 ]
-class VideoAbuseAuditView extends EntityAuditView {
-  constructor (private readonly videoAbuse: VideoAbuse) {
-    super(videoAbuseKeysToKeep, 'abuse', videoAbuse)
+class AbuseAuditView extends EntityAuditView {
+  constructor (private readonly abuse: AdminAbuse) {
+    super(abuseKeysToKeep, 'abuse', abuse)
   }
 }
 
@@ -274,6 +271,6 @@ export {
   CommentAuditView,
   UserAuditView,
   VideoAuditView,
-  VideoAbuseAuditView,
+  AbuseAuditView,
   CustomConfigAuditView
 }