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,23 @@
export const NOTIFICATION_CHANNELS = ['EMAIL', 'PUSH'] as const;
export type NotificationChannelValue = (typeof NOTIFICATION_CHANNELS)[number];
export class NotificationChannel {
private constructor(private readonly _value: NotificationChannelValue) {}
static create(value: string): NotificationChannel {
if (!NOTIFICATION_CHANNELS.includes(value as NotificationChannelValue)) {
throw new Error(`Недопустимый канал уведомлений: "${value}". Разрешены: ${NOTIFICATION_CHANNELS.join(', ')}`);
}
return new NotificationChannel(value as NotificationChannelValue);
}
get value(): NotificationChannelValue {
return this._value;
}
equals(other: NotificationChannel): boolean {
return this._value === other.value;
}
}