refactor use cases

This commit is contained in:
2025-12-21 01:31:31 +01:00
parent 8ecd638396
commit 22f28728ce
17 changed files with 402 additions and 286 deletions

View File

@@ -1,28 +1,27 @@
import { describe, it, expect, vi, type Mock } from 'vitest';
import {
GetNotificationPreferencesQuery,
UpdateChannelPreferenceUseCase,
UpdateTypePreferenceUseCase,
UpdateQuietHoursUseCase,
SetDigestModeUseCase,
type GetNotificationPreferencesInput,
type GetNotificationPreferencesResult,
type UpdateChannelPreferenceCommand,
type UpdateChannelPreferenceResult,
type UpdateTypePreferenceCommand,
type UpdateTypePreferenceResult,
type UpdateQuietHoursCommand,
type UpdateQuietHoursResult,
type SetDigestModeCommand,
type SetDigestModeResult,
} from './NotificationPreferencesUseCases';
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
import type { NotificationPreference , ChannelPreference, TypePreference } from '../../domain/entities/NotificationPreference';
import type { Logger, UseCaseOutputPort } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import { describe, expect, it, vi, type Mock } from 'vitest';
import type { ChannelPreference, NotificationPreference, TypePreference } from '../../domain/entities/NotificationPreference';
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
import type { NotificationChannel, NotificationType } from '../../domain/types/NotificationTypes';
import { NotificationDomainError } from '../../domain/errors/NotificationDomainError';
import {
GetNotificationPreferencesQuery,
SetDigestModeUseCase,
UpdateChannelPreferenceUseCase,
UpdateQuietHoursUseCase,
UpdateTypePreferenceUseCase,
type GetNotificationPreferencesInput,
type GetNotificationPreferencesResult,
type SetDigestModeCommand,
type SetDigestModeResult,
type UpdateChannelPreferenceCommand,
type UpdateChannelPreferenceResult,
type UpdateQuietHoursCommand,
type UpdateQuietHoursResult,
type UpdateTypePreferenceCommand,
type UpdateTypePreferenceResult,
} from './NotificationPreferencesUseCases';
describe('NotificationPreferencesUseCases', () => {
let preferenceRepository: {