website refactor

This commit is contained in:
2026-01-16 15:20:25 +01:00
parent 7e02fc3ea5
commit 37b1aa626c
325 changed files with 2167 additions and 2782 deletions

View File

@@ -4,7 +4,7 @@
* Retrieves all notifications for a recipient.
*/
import type { Logger } from '@core/shared/application';
import type { Logger } from '@core/shared/domain/Logger';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { Notification } from '../../domain/entities/Notification';
@@ -23,7 +23,7 @@ export type GetAllNotificationsErrorCode = 'REPOSITORY_ERROR';
export class GetAllNotificationsUseCase {
constructor(
private readonly notificationRepository: INotificationRepository,
private readonly notificationRepository: NotificationRepository,
private readonly logger: Logger,
) {}

View File

@@ -1,13 +1,12 @@
import { describe, it, expect, vi, type Mock } from 'vitest';
import {
GetUnreadNotificationsUseCase,
type GetUnreadNotificationsInput,
} from './GetUnreadNotificationsUseCase';
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
import type { Logger } from '@core/shared/application';
import type { Logger } from '@core/shared/domain/Logger';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import { describe, expect, it, vi, type Mock } from 'vitest';
import { Notification } from '../../domain/entities/Notification';
import {
GetUnreadNotificationsUseCase,
type GetUnreadNotificationsInput,
} from './GetUnreadNotificationsUseCase';
interface NotificationRepositoryMock {
findUnreadByRecipientId: Mock;

View File

@@ -4,15 +4,12 @@
* Retrieves unread notifications for a recipient.
*/
import type { Logger } from '@core/shared/application';
import { NotificationRepository } from '@/notifications/domain/repositories/NotificationRepository';
import type { Logger } from '@core/shared/domain/Logger';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { Notification } from '../../domain/entities/Notification';
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
export type GetUnreadNotificationsInput = {
recipientId: string;
};
export interface GetUnreadNotificationsResult {
notifications: Notification[];
@@ -23,7 +20,7 @@ export type GetUnreadNotificationsErrorCode = 'REPOSITORY_ERROR';
export class GetUnreadNotificationsUseCase {
constructor(
private readonly notificationRepository: INotificationRepository,
private readonly notificationRepository: NotificationRepository,
private readonly logger: Logger,
) {}

View File

@@ -1,17 +1,16 @@
import { describe, it, expect, vi, type Mock } from 'vitest';
import {
MarkNotificationReadUseCase,
type MarkNotificationReadCommand,
MarkAllNotificationsReadUseCase,
type MarkAllNotificationsReadInput,
DismissNotificationUseCase,
type DismissNotificationCommand,
} from './MarkNotificationReadUseCase';
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
import type { Logger } from '@core/shared/application';
import type { Logger } from '@core/shared/domain/Logger';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import { describe, expect, it, vi, type Mock } from 'vitest';
import { Notification } from '../../domain/entities/Notification';
import {
DismissNotificationUseCase,
MarkAllNotificationsReadUseCase,
MarkNotificationReadUseCase,
type DismissNotificationCommand,
type MarkAllNotificationsReadInput,
type MarkNotificationReadCommand,
} from './MarkNotificationReadUseCase';
interface NotificationRepositoryMock {
findById: Mock;

View File

@@ -4,15 +4,11 @@
* Marks a notification as read.
*/
import type { Logger } from '@core/shared/application';
import { NotificationRepository } from '@/notifications/domain/repositories/NotificationRepository';
import type { Logger } from '@core/shared/domain/Logger';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { NotificationRepository } from '../../domain/repositories/NotificationRepository';
export interface MarkNotificationReadCommand {
notificationId: string;
recipientId: string; // For validation
}
export interface MarkNotificationReadResult {
notificationId: string;
@@ -27,7 +23,7 @@ export type MarkNotificationReadErrorCode =
export class MarkNotificationReadUseCase {
constructor(
private readonly notificationRepository: INotificationRepository,
private readonly notificationRepository: NotificationRepository,
private readonly logger: Logger,
) {}

View File

@@ -1,21 +1,20 @@
import type { Logger } from '@core/shared/application';
import type { Logger } from '@core/shared/domain/Logger';
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 { beforeEach, describe, expect, it, vi, type Mock } from 'vitest';
import type { ChannelPreference, NotificationPreference, TypePreference } from '../../domain/entities/NotificationPreference';
import type { NotificationPreferenceRepository } from '../../domain/repositories/NotificationPreferenceRepository';
import type { NotificationChannel, NotificationType } from '../../domain/types/NotificationTypes';
import {
GetNotificationPreferencesQuery,
SetDigestModeUseCase,
UpdateChannelPreferenceUseCase,
UpdateQuietHoursUseCase,
UpdateTypePreferenceUseCase,
type GetNotificationPreferencesInput,
type SetDigestModeCommand,
type UpdateChannelPreferenceCommand,
type UpdateQuietHoursCommand,
type UpdateTypePreferenceCommand,
GetNotificationPreferencesQuery,
SetDigestModeUseCase,
UpdateChannelPreferenceUseCase,
UpdateQuietHoursUseCase,
UpdateTypePreferenceUseCase,
type GetNotificationPreferencesInput,
type SetDigestModeCommand,
type UpdateChannelPreferenceCommand,
type UpdateQuietHoursCommand,
type UpdateTypePreferenceCommand,
} from './NotificationPreferencesUseCases';
describe('NotificationPreferencesUseCases', () => {

View File

@@ -4,13 +4,13 @@
* Manages user notification preferences.
*/
import type { Logger } from '@core/shared/application';
import { NotificationPreferenceRepository } from '@/notifications/domain/repositories/NotificationPreferenceRepository';
import { NotificationChannel, NotificationType } from '@/notifications/domain/types/NotificationTypes';
import type { Logger } from '@core/shared/domain/Logger';
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 { NotificationPreferenceRepository } from '../../domain/repositories/NotificationPreferenceRepository';
import type { NotificationType, NotificationChannel } from '../../domain/types/NotificationTypes';
import { NotificationPreference } from '../../domain/entities/NotificationPreference';
/**
* Query: GetNotificationPreferencesQuery
@@ -27,7 +27,7 @@ export type GetNotificationPreferencesErrorCode = 'REPOSITORY_ERROR';
export class GetNotificationPreferencesQuery {
constructor(
private readonly preferenceRepository: INotificationPreferenceRepository,
private readonly preferenceRepository: NotificationPreferenceRepository,
private readonly logger: Logger,
) {}

View File

@@ -1,19 +1,17 @@
import { describe, it, expect, vi, type Mock } from 'vitest';
import type { Logger } from '@core/shared/application';
import type { Logger } from '@core/shared/domain/Logger';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import { describe, expect, it, vi, type Mock } from 'vitest';
import {
SendNotificationUseCase,
type SendNotificationCommand,
type SendNotificationErrorCode,
type SendNotificationResult,
SendNotificationUseCase,
type SendNotificationCommand,
type SendNotificationErrorCode,
type SendNotificationResult,
} from './SendNotificationUseCase';
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';
import type { NotificationGatewayRegistry } from '../ports/NotificationGateway';
vi.mock('uuid', () => ({
v4: () => 'notif-1',

View File

@@ -5,15 +5,13 @@
* based on their preferences.
*/
import type { Logger } from '@core/shared/application';
import { NotificationChannel, NotificationType } from '@/notifications/domain/types/NotificationTypes';
import type { Logger } from '@core/shared/domain/Logger';
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 { 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';
export interface SendNotificationCommand {