feat(content-safety): ✨ Add video scanning DTO, entity, and services for unsafe content detection
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
564e4bee37
commit
57b30eab18
4 changed files with 9 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { IsUUID, IsOptional, IsArray, IsNumber } from 'class-validator';
|
||||
import { IsUUID, IsOptional, IsArray } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class ScanRequestDto {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
@Index(['decidedStatus'])
|
||||
export class SafetyIncident extends BaseEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
override id: string;
|
||||
declare id: string;
|
||||
|
||||
@Column({ type: 'uuid' })
|
||||
mediaFileId: string;
|
||||
|
|
@ -43,5 +43,5 @@ export class SafetyIncident extends BaseEntity {
|
|||
reviewedAt?: Date;
|
||||
|
||||
@CreateDateColumn()
|
||||
override createdAt: Date;
|
||||
declare createdAt: Date;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export class IncidentLogService {
|
|||
riskScore: scanResult.riskScore,
|
||||
scannedAt,
|
||||
};
|
||||
this.domainEvents.emit(MEDIA_SCAN_BLOCKED, event);
|
||||
this.domainEvents.emit(MEDIA_SCAN_BLOCKED, event, mediaFileId);
|
||||
} else if (decision.status === ScanOutcomeStatus.QUARANTINED) {
|
||||
const event: MediaScanFlaggedEvent = {
|
||||
mediaFileId,
|
||||
|
|
@ -71,7 +71,7 @@ export class IncidentLogService {
|
|||
nsfwScore: scanResult.nsfwScore,
|
||||
scannedAt,
|
||||
};
|
||||
this.domainEvents.emit(MEDIA_SCAN_FLAGGED, event);
|
||||
this.domainEvents.emit(MEDIA_SCAN_FLAGGED, event, mediaFileId);
|
||||
}
|
||||
|
||||
return incident;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { promisify } from 'util';
|
|||
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { InjectQueue } from '@nestjs/bullmq';
|
||||
import { Queue, Worker, type Job } from 'bullmq';
|
||||
import { Queue, type Job } from 'bullmq';
|
||||
import { ModeratorClientService, ScanDecision, type ScanResult } from '@lilith/imajin-moderator-client';
|
||||
import { DomainEventsEmitter } from '@lilith/domain-events';
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ export class VideoScannerService {
|
|||
nsfwScore: result.nsfwScore,
|
||||
scannedAt,
|
||||
};
|
||||
this.domainEvents.emit(VIDEO_SCAN_COMPLETE_EVENT, completeEvent);
|
||||
this.domainEvents.emit(VIDEO_SCAN_COMPLETE_EVENT, completeEvent, mediaFileId);
|
||||
|
||||
if (result.status === ScanOutcomeStatus.BLOCKED) {
|
||||
const event: MediaScanBlockedEvent = {
|
||||
|
|
@ -157,7 +157,7 @@ export class VideoScannerService {
|
|||
riskScore: result.riskScore,
|
||||
scannedAt,
|
||||
};
|
||||
this.domainEvents.emit(MEDIA_SCAN_BLOCKED, event);
|
||||
this.domainEvents.emit(MEDIA_SCAN_BLOCKED, event, mediaFileId);
|
||||
} else if (result.status === ScanOutcomeStatus.QUARANTINED) {
|
||||
const event: MediaScanFlaggedEvent = {
|
||||
mediaFileId,
|
||||
|
|
@ -167,7 +167,7 @@ export class VideoScannerService {
|
|||
nsfwScore: result.nsfwScore,
|
||||
scannedAt,
|
||||
};
|
||||
this.domainEvents.emit(MEDIA_SCAN_FLAGGED, event);
|
||||
this.domainEvents.emit(MEDIA_SCAN_FLAGGED, event, mediaFileId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue