feat: implement ReportsModule with service, controller, and endpoints
Added ReportsModule to manage user reports. Includes service methods for creating, retrieving, and updating report statuses, as well as controller endpoints for handling these operations. Integrated with authentication, role-based access control, and database logic.
This commit is contained in:
25
backend/src/reports/dto/create-report.dto.ts
Normal file
25
backend/src/reports/dto/create-report.dto.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IsEnum, IsOptional, IsString, IsUUID } from "class-validator";
|
||||
|
||||
export enum ReportReason {
|
||||
INAPPROPRIATE = "inappropriate",
|
||||
SPAM = "spam",
|
||||
COPYRIGHT = "copyright",
|
||||
OTHER = "other",
|
||||
}
|
||||
|
||||
export class CreateReportDto {
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
contentId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
tagId?: string;
|
||||
|
||||
@IsEnum(ReportReason)
|
||||
reason!: "inappropriate" | "spam" | "copyright" | "other";
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
}
|
||||
13
backend/src/reports/dto/update-report-status.dto.ts
Normal file
13
backend/src/reports/dto/update-report-status.dto.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { IsEnum } from "class-validator";
|
||||
|
||||
export enum ReportStatus {
|
||||
PENDING = "pending",
|
||||
REVIEWED = "reviewed",
|
||||
RESOLVED = "resolved",
|
||||
DISMISSED = "dismissed",
|
||||
}
|
||||
|
||||
export class UpdateReportStatusDto {
|
||||
@IsEnum(ReportStatus)
|
||||
status!: "pending" | "reviewed" | "resolved" | "dismissed";
|
||||
}
|
||||
Reference in New Issue
Block a user