Files
Edu/services/teacher-bff/src/clients/msg/msg-client.interface.ts

40 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// MsgClient 接口 + DI tokenB8 裁决DownstreamClient 抽象)
// 接口定义所有 P5+ 需要的 msg RPC实现分 gRPC + mock 两种
// 选择策略TEACHER_BFF_DEV_MODE=true → mockfalse → gRPC
import type { CallContext } from "../types.js";
import type {
ListNotificationsRequest,
ListNotificationsResponse,
SearchNotificationsRequest,
SearchNotificationsResponse,
MarkAsReadRequest,
MarkAsReadResponse,
} from "./msg.types.js";
/** MsgClient DI tokenNestJS 注入用) */
export const MSG_CLIENT = Symbol("MSG_CLIENT");
/** MsgClient 接口(所有 BFF 统一依赖此接口,不依赖具体实现) */
export interface MsgClient {
// ===== NotificationService =====
listNotifications(
ctx: CallContext,
req: ListNotificationsRequest,
): Promise<ListNotificationsResponse>;
searchNotifications(
ctx: CallContext,
req: SearchNotificationsRequest,
): Promise<SearchNotificationsResponse>;
markAsRead(
ctx: CallContext,
req: MarkAsReadRequest,
): Promise<MarkAsReadResponse>;
// ===== 健康检查 =====
checkHealth(): Promise<{
serving: boolean;
latencyMs: number;
error?: string;
}>;
}