feat: filter SMS routes by channel sensitive words
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { request, withQuery } from '../core/httpClient';
|
||||
import type { PagedResult } from '../types';
|
||||
|
||||
export type ChannelWord = {
|
||||
id: string;
|
||||
channelId: string;
|
||||
word: string;
|
||||
status: string;
|
||||
remark: string;
|
||||
version: number;
|
||||
updatedAt: string;
|
||||
channel: { id: string; name: string; status: string };
|
||||
};
|
||||
export type ChannelWordForm = { channelId: string; word: string; status: string; remark: string };
|
||||
export type ChannelWordQuery = { channelId: string; keyword: string; status: string; page: number; pageSize: number };
|
||||
const path = '/admin/dictionaries/channel-sensitive-words';
|
||||
export const channelWordsApi = {
|
||||
list: (query: ChannelWordQuery) => request<PagedResult<ChannelWord>>(withQuery(path, query)),
|
||||
save: (form: ChannelWordForm, item?: ChannelWord) =>
|
||||
request<ChannelWord>(item ? `${path}/${encodeURIComponent(item.id)}` : path, {
|
||||
method: item ? 'PATCH' : 'POST',
|
||||
body: JSON.stringify({ ...form, ...(item ? { version: item.version } : {}) }),
|
||||
}),
|
||||
remove: (item: ChannelWord) =>
|
||||
request<{ deleted: boolean }>(`${path}/${encodeURIComponent(item.id)}`, {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify({ version: item.version }),
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user