30 lines
697 B
TypeScript
30 lines
697 B
TypeScript
import api, { ApiResponse } from './api';
|
|
|
|
interface CreateReportDto {
|
|
reportedUserId: string;
|
|
conversationId?: string;
|
|
reason: string;
|
|
description?: string;
|
|
}
|
|
|
|
interface UserReport {
|
|
id: string;
|
|
reporterId: string;
|
|
reportedUserId: string;
|
|
conversationId: string | null;
|
|
reason: string;
|
|
description: string | null;
|
|
status: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
class UserReportsService {
|
|
async createReport(dto: CreateReportDto): Promise<UserReport> {
|
|
const response = await api.post<ApiResponse<UserReport>>('/user-reports', dto);
|
|
return response.data.data;
|
|
}
|
|
}
|
|
|
|
export const userReportsService = new UserReportsService();
|
|
export type { CreateReportDto, UserReport };
|