@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
61 lines (60 loc) • 1.88 kB
TypeScript
import { PaginatedResponse } from "../../interfaces/PaginatedResponse";
import { Entity } from "../../interfaces/models/Entity";
import { Comment } from "../../interfaces/models/Comment";
import { Space } from "../../interfaces/models/Space";
export interface FetchModeratedReportsParams {
spaceId?: string;
targetType?: "comment" | "entity";
status?: "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
sortBy?: "new" | "old";
page?: number;
limit?: number;
}
export interface ReportUserReport {
id: string;
userId: string;
reason: string;
details: string | null;
createdAt: Date;
}
export interface Report {
id: string;
projectId: string;
spaceId: string | null;
targetId: string;
targetType: "comment" | "entity";
reporterCount: number;
userReports: ReportUserReport[];
status: "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
actionTaken: string | null;
target: Entity | Comment | null;
space: Space | null;
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
}
/**
* Hook to fetch reports for spaces the user can moderate
*
* If spaceId is provided, returns reports for that specific space
* If spaceId is omitted, returns reports from ALL spaces the user moderates
*
* @example
* const fetchModeratedReports = useFetchModeratedReports();
*
* // Fetch reports for a specific space
* const reports = await fetchModeratedReports({
* spaceId: "space-uuid",
* targetType: "entity",
* page: 1,
* limit: 20
* });
*
* // Fetch reports from ALL spaces the user moderates
* const allReports = await fetchModeratedReports({
* page: 1,
* limit: 20
* });
*/
declare function useFetchModeratedReports(): (params: FetchModeratedReportsParams) => Promise<PaginatedResponse<Report>>;
export default useFetchModeratedReports;