feat: add super comment governance and finance oversight
This commit is contained in:
@@ -146,5 +146,49 @@ export const ContentService = {
|
||||
granularity
|
||||
};
|
||||
return requestJson('/super/v1/contents/statistics', { query });
|
||||
},
|
||||
async listComments({ page, limit, id, tenant_id, tenant_code, tenant_name, content_id, content_title, user_id, username, keyword, status, created_at_from, created_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,
|
||||
user_id,
|
||||
username,
|
||||
keyword,
|
||||
status,
|
||||
created_at_from: iso(created_at_from),
|
||||
created_at_to: iso(created_at_to)
|
||||
};
|
||||
if (sortField && sortOrder) {
|
||||
if (sortOrder === 1) query.asc = sortField;
|
||||
if (sortOrder === -1) query.desc = sortField;
|
||||
}
|
||||
|
||||
const data = await requestJson('/super/v1/comments', { query });
|
||||
return {
|
||||
page: data?.page ?? page ?? 1,
|
||||
limit: data?.limit ?? limit ?? 10,
|
||||
total: data?.total ?? 0,
|
||||
items: normalizeItems(data?.items)
|
||||
};
|
||||
},
|
||||
async deleteComment(id, { reason } = {}) {
|
||||
if (!id) throw new Error('id is required');
|
||||
return requestJson(`/super/v1/comments/${id}/delete`, {
|
||||
method: 'POST',
|
||||
body: { reason }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user