// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.11.8 // protoc v4.25.9 // source: notifications/notifications.proto /* eslint-disable */ import type { Metadata } from "@grpc/grpc-js"; import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices"; import { wrappers } from "protobufjs"; import { Observable } from "rxjs"; import { Struct } from "../google/protobuf/struct"; import { Timestamp } from "../google/protobuf/timestamp"; export const protobufPackage = "notifications.v1"; /** Структура самого уведомления */ export interface Notification { id: string; userId: string; /** Например: "SYSTEM_ALERT", "NEW_MESSAGE", "TASK_ASSIGNED" */ type: string; /** Заголовок (опционально) */ title: string; /** Текст уведомления */ text: string; /** Любая динамическая JSON-нагрузка (например, { "task_id": 123 }) */ payload: { [key: string]: any } | undefined; isRead: boolean; createdAt: Timestamp | undefined; } export interface GetNotificationsRequest { /** ID пользователя запрашивающего данные (Gateway берет это из JWT) */ userId: string; /** Для пагинации (например, 20) */ limit: number; /** Для пагинации (например, 0) */ offset: number; /** Фильтр: получить только непрочитанные */ unreadOnly?: boolean | undefined; } export interface GetNotificationsResponse { /** Массив уведомлений */ notifications: Notification[]; /** Общее количество (для UI пагинации) */ totalCount: number; } export interface GetUnreadCountRequest { userId: string; } export interface GetUnreadCountResponse { count: number; } export interface MarkAsReadRequest { userId: string; notificationId: string; } export interface MarkAsReadResponse { success: boolean; } export interface MarkAllAsReadRequest { userId: string; } export interface MarkAllAsReadResponse { success: boolean; /** Сколько уведомлений было обновлено */ updatedCount: number; } export interface SendNotificationRequest { /** Кому отправляем (если пусто — можно сделать бродкаст, но лучше отдельный метод) */ userId: string; type: string; title: string; text: string; /** Метаданные для UI (ссылки, ID сущностей) */ payload: { [key: string]: any } | undefined; } export interface SendNotificationResponse { success: boolean; /** ID созданного уведомления в Postgres */ notificationId: string; } export const NOTIFICATIONS_V1_PACKAGE_NAME = "notifications.v1"; wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any; /** * ----------------------------------------------------------------------------- * Сервис Уведомлений * ----------------------------------------------------------------------------- */ export interface NotificationServiceClient { /** Получить список уведомлений пользователя с пагинацией */ getUserNotifications(request: GetNotificationsRequest, metadata?: Metadata): Observable; /** Получить количество непрочитанных уведомлений (для бейджика на иконке) */ getUnreadCount(request: GetUnreadCountRequest, metadata?: Metadata): Observable; /** Отметить конкретное уведомление как прочитанное */ markAsRead(request: MarkAsReadRequest, metadata?: Metadata): Observable; /** Отметить все уведомления пользователя как прочитанные */ markAllAsRead(request: MarkAllAsReadRequest, metadata?: Metadata): Observable; /** Отправить уведомление (CRM/ERP вызывает этот метод, а NestJS уже кидает в RabbitMQ) */ sendNotification(request: SendNotificationRequest, metadata?: Metadata): Observable; } /** * ----------------------------------------------------------------------------- * Сервис Уведомлений * ----------------------------------------------------------------------------- */ export interface NotificationServiceController { /** Получить список уведомлений пользователя с пагинацией */ getUserNotifications( request: GetNotificationsRequest, metadata?: Metadata, ): Promise | Observable | GetNotificationsResponse; /** Получить количество непрочитанных уведомлений (для бейджика на иконке) */ getUnreadCount( request: GetUnreadCountRequest, metadata?: Metadata, ): Promise | Observable | GetUnreadCountResponse; /** Отметить конкретное уведомление как прочитанное */ markAsRead( request: MarkAsReadRequest, metadata?: Metadata, ): Promise | Observable | MarkAsReadResponse; /** Отметить все уведомления пользователя как прочитанные */ markAllAsRead( request: MarkAllAsReadRequest, metadata?: Metadata, ): Promise | Observable | MarkAllAsReadResponse; /** Отправить уведомление (CRM/ERP вызывает этот метод, а NestJS уже кидает в RabbitMQ) */ sendNotification( request: SendNotificationRequest, metadata?: Metadata, ): Promise | Observable | SendNotificationResponse; } export function NotificationServiceControllerMethods() { return function (constructor: Function) { const grpcMethods: string[] = [ "getUserNotifications", "getUnreadCount", "markAsRead", "markAllAsRead", "sendNotification", ]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcMethod("NotificationService", method)(constructor.prototype[method], method, descriptor); } const grpcStreamMethods: string[] = []; for (const method of grpcStreamMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcStreamMethod("NotificationService", method)(constructor.prototype[method], method, descriptor); } }; } export const NOTIFICATION_SERVICE_NAME = "NotificationService";