Files
memegoat/backend/src/reports/reports.service.ts
Mathis HERRIOT 0c045e8d3c refactor: remove unused tests, mocks, and outdated e2e configurations
Deleted unused e2e tests, mocks (`cuid2`, `jose`, `ml-kem`, `sha3`), and their associated jest configurations. Simplified services by ensuring proper dependency imports, resolving circular references, and improving TypeScript type usage for enhanced maintainability and testability. Upgraded Dockerfile base image to match new development standards.
2026-01-14 13:51:32 +01:00

34 lines
1012 B
TypeScript

import { Injectable, Logger } from "@nestjs/common";
import { CreateReportDto } from "./dto/create-report.dto";
import { ReportsRepository } from "./repositories/reports.repository";
@Injectable()
export class ReportsService {
private readonly logger = new Logger(ReportsService.name);
constructor(private readonly reportsRepository: ReportsRepository) {}
async create(reporterId: string, data: CreateReportDto) {
this.logger.log(`Creating report from user ${reporterId}`);
return await this.reportsRepository.create({
reporterId,
contentId: data.contentId,
tagId: data.tagId,
reason: data.reason,
description: data.description,
});
}
async findAll(limit: number, offset: number) {
return await this.reportsRepository.findAll(limit, offset);
}
async updateStatus(
id: string,
status: "pending" | "reviewed" | "resolved" | "dismissed",
) {
this.logger.log(`Updating report ${id} status to ${status}`);
return await this.reportsRepository.updateStatus(id, status);
}
}