R50 通知推送:dispatcher 投递服务、业务事件接入与员工推送开关
这个提交包含在:
@@ -85,6 +85,28 @@ export type NotificationChannelTestResponse = {
|
||||
};
|
||||
};
|
||||
|
||||
export type NotificationDeliveryStatus = "pending" | "success" | "failed";
|
||||
|
||||
export type NotificationDeliveryRecord = {
|
||||
notificationId: string;
|
||||
channelId: string;
|
||||
channelName: string;
|
||||
channelType: NotificationChannelType;
|
||||
notificationType: string;
|
||||
notificationTitle: string;
|
||||
status: NotificationDeliveryStatus;
|
||||
attemptCount: number;
|
||||
latestAttemptAt: string | null;
|
||||
resultCode: string | null;
|
||||
errorMessage: string | null;
|
||||
responseBody: unknown;
|
||||
notificationCreatedAt: string | null;
|
||||
};
|
||||
|
||||
export type NotificationDeliveryListResponse = {
|
||||
items: NotificationDeliveryRecord[];
|
||||
};
|
||||
|
||||
export async function fetchNotificationChannels() {
|
||||
return apiRequestData<NotificationChannelListResponse>("/api/notifications/channels");
|
||||
}
|
||||
@@ -109,3 +131,25 @@ export async function testNotificationChannel(id: string) {
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchNotificationDeliveries(filters: {
|
||||
notificationId?: string | null;
|
||||
channelId?: string | null;
|
||||
status?: NotificationDeliveryStatus | "" | null;
|
||||
}) {
|
||||
const params = new URLSearchParams();
|
||||
if (filters.notificationId) {
|
||||
params.set("notificationId", filters.notificationId);
|
||||
}
|
||||
if (filters.channelId) {
|
||||
params.set("channelId", filters.channelId);
|
||||
}
|
||||
if (filters.status) {
|
||||
params.set("status", filters.status);
|
||||
}
|
||||
|
||||
const queryString = params.toString();
|
||||
return apiRequestData<NotificationDeliveryListResponse>(
|
||||
`/api/notifications/deliveries${queryString ? `?${queryString}` : ""}`,
|
||||
);
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户