feat: add content report governance

This commit is contained in:
2026-01-16 11:36:04 +08:00
parent 3af3c854c9
commit 609ca7b980
18 changed files with 2480 additions and 101 deletions

View File

@@ -190,5 +190,80 @@ export const ContentService = {
method: 'POST',
body: { reason }
});
},
async listContentReports({
page,
limit,
id,
tenant_id,
tenant_code,
tenant_name,
content_id,
content_title,
reporter_id,
reporter_name,
handled_by,
handled_by_name,
reason,
keyword,
status,
created_at_from,
created_at_to,
handled_at_from,
handled_at_to,
sortField,
sortOrder
} = {}) {
const iso = (d) => {
if (!d) return undefined;
const date = d instanceof Date ? d : new Date(d);
if (Number.isNaN(date.getTime())) return undefined;
return date.toISOString();
};
const query = {
page,
limit,
id,
tenant_id,
tenant_code,
tenant_name,
content_id,
content_title,
reporter_id,
reporter_name,
handled_by,
handled_by_name,
reason,
keyword,
status,
created_at_from: iso(created_at_from),
created_at_to: iso(created_at_to),
handled_at_from: iso(handled_at_from),
handled_at_to: iso(handled_at_to)
};
if (sortField && sortOrder) {
if (sortOrder === 1) query.asc = sortField;
if (sortOrder === -1) query.desc = sortField;
}
const data = await requestJson('/super/v1/content-reports', { query });
return {
page: data?.page ?? page ?? 1,
limit: data?.limit ?? limit ?? 10,
total: data?.total ?? 0,
items: normalizeItems(data?.items)
};
},
async processContentReport(id, { action, content_action, reason } = {}) {
if (!id) throw new Error('id is required');
return requestJson(`/super/v1/content-reports/${id}/process`, {
method: 'POST',
body: {
action,
content_action,
reason
}
});
}
};