notification

This commit is contained in:
vadim committed 2026-09-29 18:42:29 +03:00
1 parent 382cafa152
commit 60391ee123
26 files changed
+1077 -14

No files matched your search

@@ -0,0 +1,11 @@
import type { NotificationDeviceToken } from '../../../../generated/prisma/client.js';
/** DI-токен, т.к. интерфейсы стираются при компиляции TS */
export const DEVICE_TOKEN_REPOSITORY = Symbol('DEVICE_TOKEN_REPOSITORY');
export interface IDeviceTokenRepository {
/** Регистрирует токен устройства, обновляет запись при повторной регистрации того же токена */
upsert(userId: string, token: string, platform: string): Promise<void>;
remove(userId: string, token: string): Promise<void>;
findByUserId(userId: string): Promise<NotificationDeviceToken[]>;
}
@@ -0,0 +1,16 @@
import type { NotificationMessage } from '../../../../generated/prisma/client.js';
import type { NotificationChannelValue } from '../value-objects/notification-channel.vo.js';
import type { NotificationStatusValue } from '../value-objects/notification-status.vo.js';
/** DI-токен, т.к. интерфейсы стираются при компиляции TS */
export const NOTIFICATION_MESSAGE_REPOSITORY = Symbol('NOTIFICATION_MESSAGE_REPOSITORY');
export interface INotificationMessageRepository {
create(params: {
userId: string;
channel: NotificationChannelValue;
subject?: string;
content: string;
}): Promise<NotificationMessage>;
markStatus(id: string, status: NotificationStatusValue, error?: string): Promise<void>;
}
@@ -0,0 +1,10 @@
import type { NotificationPreference } from '../../../../generated/prisma/client.js';
import type { NotificationChannelValue } from '../value-objects/notification-channel.vo.js';
/** DI-токен, т.к. интерфейсы стираются при компиляции TS */
export const NOTIFICATION_PREFERENCE_REPOSITORY = Symbol('NOTIFICATION_PREFERENCE_REPOSITORY');
export interface INotificationPreferenceRepository {
findByUserId(userId: string): Promise<NotificationPreference[]>;
set(userId: string, channel: NotificationChannelValue, enabled: boolean): Promise<void>;
}