website refactor
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* Notifications Application Layer
|
||||
*
|
||||
* Exports all use cases, queries, and ports.
|
||||
*/
|
||||
|
||||
// Use Cases
|
||||
export * from './use-cases/GetUnreadNotificationsUseCase';
|
||||
export * from './use-cases/MarkNotificationReadUseCase';
|
||||
export * from './use-cases/NotificationPreferencesUseCases';
|
||||
export * from './use-cases/SendNotificationUseCase';
|
||||
|
||||
// Ports
|
||||
export * from './ports/NotificationGateway';
|
||||
|
||||
// Re-export domain types for convenience
|
||||
export type {
|
||||
Notification, NotificationAction, NotificationData, NotificationProps,
|
||||
NotificationStatus, NotificationUrgency
|
||||
} from '../domain/entities/Notification';
|
||||
export type { ChannelPreference, NotificationPreference, NotificationPreferenceProps, TypePreference } from '../domain/entities/NotificationPreference';
|
||||
export { ALL_CHANNELS, DEFAULT_ENABLED_CHANNELS, getChannelDisplayName, getNotificationTypePriority, getNotificationTypeTitle, isExternalChannel } from '../domain/types/NotificationTypes';
|
||||
export type { NotificationChannel, NotificationType } from '../domain/types/NotificationTypes';
|
||||
|
||||
// Re-export repository interfaces
|
||||
export type { INotificationPreferenceRepository } from '../domain/repositories/INotificationPreferenceRepository';
|
||||
export type { INotificationRepository } from '../domain/repositories/INotificationRepository';
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Notification } from '../../domain/entities/Notification';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
|
||||
export type GetAllNotificationsInput = {
|
||||
recipientId: string;
|
||||
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
GetUnreadNotificationsUseCase,
|
||||
type GetUnreadNotificationsInput,
|
||||
} from './GetUnreadNotificationsUseCase';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { Notification } from '../../domain/entities/Notification';
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Notification } from '../../domain/entities/Notification';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
|
||||
export type GetUnreadNotificationsInput = {
|
||||
recipientId: string;
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
DismissNotificationUseCase,
|
||||
type DismissNotificationCommand,
|
||||
} from './MarkNotificationReadUseCase';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { Notification } from '../../domain/entities/Notification';
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
|
||||
export interface MarkNotificationReadCommand {
|
||||
notificationId: string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { describe, expect, it, vi, type Mock, beforeEach } from 'vitest';
|
||||
import type { ChannelPreference, NotificationPreference, TypePreference } from '../../domain/entities/NotificationPreference';
|
||||
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
|
||||
import type { NotificationPreferenceRepository } from '../../domain/repositories/NotificationPreferenceRepository';
|
||||
import type { NotificationChannel, NotificationType } from '../../domain/types/NotificationTypes';
|
||||
import {
|
||||
GetNotificationPreferencesQuery,
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { NotificationPreference } from '../../domain/entities/NotificationPreference';
|
||||
import type { ChannelPreference, TypePreference } from '../../domain/entities/NotificationPreference';
|
||||
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
|
||||
import type { NotificationPreferenceRepository } from '../../domain/repositories/NotificationPreferenceRepository';
|
||||
import type { NotificationType, NotificationChannel } from '../../domain/types/NotificationTypes';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
|
||||
import {
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
type SendNotificationResult,
|
||||
} from './SendNotificationUseCase';
|
||||
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
import type { NotificationPreferenceRepository } from '../../domain/repositories/NotificationPreferenceRepository';
|
||||
import type { NotificationGatewayRegistry } from '../ports/NotificationGateway';
|
||||
import type { NotificationChannel, NotificationType } from '../../domain/types/NotificationTypes';
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import type { NotificationData } from '../../domain/entities/Notification';
|
||||
import { Notification } from '../../domain/entities/Notification';
|
||||
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
import type { NotificationPreferenceRepository } from '../../domain/repositories/NotificationPreferenceRepository';
|
||||
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
|
||||
import type { NotificationChannel, NotificationType } from '../../domain/types/NotificationTypes';
|
||||
import type { NotificationDeliveryResult, NotificationGatewayRegistry } from '../ports/NotificationGateway';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { NotificationDomainError } from '../errors/NotificationDomainError';
|
||||
import { NotificationId } from '../value-objects/NotificationId';
|
||||
|
||||
@@ -86,7 +86,7 @@ export interface NotificationProps {
|
||||
respondedAt?: Date;
|
||||
}
|
||||
|
||||
export class Notification implements IEntity<string> {
|
||||
export class Notification implements Entity<string> {
|
||||
private constructor(private readonly props: NotificationProps) {}
|
||||
|
||||
static create(props: Omit<NotificationProps, 'id' | 'status' | 'createdAt' | 'urgency'> & {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a user's notification preferences for different channels and types.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { NotificationType, NotificationChannel } from '../types/NotificationTypes';
|
||||
import { NotificationDomainError } from '../errors/NotificationDomainError';
|
||||
import { QuietHours } from '../value-objects/QuietHours';
|
||||
@@ -44,7 +44,7 @@ export interface NotificationPreferenceProps {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export class NotificationPreference implements IEntity<string> {
|
||||
export class NotificationPreference implements Entity<string> {
|
||||
private constructor(private readonly props: NotificationPreferenceProps) {}
|
||||
|
||||
static create(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IDomainError, CommonDomainErrorKind } from '@core/shared/errors';
|
||||
import type { DomainError, CommonDomainErrorKind } from '@core/shared/errors';
|
||||
|
||||
/**
|
||||
* Domain Error: NotificationDomainError
|
||||
*
|
||||
* Implements the shared IDomainError contract for notification domain failures.
|
||||
*/
|
||||
export class NotificationDomainError extends Error implements IDomainError<CommonDomainErrorKind> {
|
||||
export class NotificationDomainError extends Error implements DomainError<CommonDomainErrorKind> {
|
||||
readonly name = 'NotificationDomainError';
|
||||
readonly type = 'domain' as const;
|
||||
readonly context = 'notifications';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { NotificationPreference } from '../entities/NotificationPreference';
|
||||
|
||||
export interface INotificationPreferenceRepository {
|
||||
export interface NotificationPreferenceRepository {
|
||||
/**
|
||||
* Find preferences for a driver
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
import type { Notification } from '../entities/Notification';
|
||||
import type { NotificationType } from '../types/NotificationTypes';
|
||||
|
||||
export interface INotificationRepository {
|
||||
export interface NotificationRepository {
|
||||
/**
|
||||
* Find a notification by ID
|
||||
*/
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { NotificationDomainError } from '../errors/NotificationDomainError';
|
||||
|
||||
export interface NotificationIdProps {
|
||||
@@ -11,7 +11,7 @@ export interface NotificationIdProps {
|
||||
* Encapsulates the unique identifier for a notification and
|
||||
* enforces basic invariants (non-empty trimmed string).
|
||||
*/
|
||||
export class NotificationId implements IValueObject<NotificationIdProps> {
|
||||
export class NotificationId implements ValueObject<NotificationIdProps> {
|
||||
public readonly props: NotificationIdProps;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { NotificationDomainError } from '../errors/NotificationDomainError';
|
||||
|
||||
export interface QuietHoursProps {
|
||||
@@ -14,7 +14,7 @@ export interface QuietHoursProps {
|
||||
*
|
||||
* Supports both normal ranges (start < end) and overnight ranges (start > end).
|
||||
*/
|
||||
export class QuietHours implements IValueObject<QuietHoursProps> {
|
||||
export class QuietHours implements ValueObject<QuietHoursProps> {
|
||||
public readonly props: QuietHoursProps;
|
||||
|
||||
private constructor(startHour: number, endHour: number) {
|
||||
|
||||
Reference in New Issue
Block a user