website refactor
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import {
|
||||
DeleteMediaUseCase,
|
||||
type DeleteMediaInput,
|
||||
type DeleteMediaErrorCode,
|
||||
} from './DeleteMediaUseCase';
|
||||
import type { MediaRepository } from '../../domain/repositories/MediaRepository';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
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 { Media } from '../../domain/entities/Media';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
import {
|
||||
DeleteMediaUseCase,
|
||||
type DeleteMediaErrorCode,
|
||||
type DeleteMediaInput,
|
||||
} from './DeleteMediaUseCase';
|
||||
|
||||
describe('DeleteMediaUseCase', () => {
|
||||
let mediaRepo: {
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
* Handles the business logic for deleting media files.
|
||||
*/
|
||||
|
||||
import type { MediaRepository } from '../../domain/repositories/MediaRepository';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
|
||||
export interface DeleteMediaInput {
|
||||
mediaId: string;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import {
|
||||
GetAvatarUseCase,
|
||||
type GetAvatarInput,
|
||||
type GetAvatarErrorCode,
|
||||
} from './GetAvatarUseCase';
|
||||
import type { AvatarRepository } from '../../domain/repositories/AvatarRepository';
|
||||
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 { Avatar } from '../../domain/entities/Avatar';
|
||||
import {
|
||||
GetAvatarUseCase,
|
||||
type GetAvatarErrorCode,
|
||||
type GetAvatarInput,
|
||||
} from './GetAvatarUseCase';
|
||||
|
||||
describe('GetAvatarUseCase', () => {
|
||||
let avatarRepo: {
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
* Handles the business logic for retrieving a driver's avatar.
|
||||
*/
|
||||
|
||||
import type { AvatarRepository } from '../../domain/repositories/AvatarRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import {
|
||||
GetMediaUseCase,
|
||||
type GetMediaInput,
|
||||
type GetMediaErrorCode,
|
||||
} from './GetMediaUseCase';
|
||||
import type { MediaRepository } from '../../domain/repositories/MediaRepository';
|
||||
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 { Media } from '../../domain/entities/Media';
|
||||
import {
|
||||
GetMediaUseCase,
|
||||
type GetMediaErrorCode,
|
||||
type GetMediaInput,
|
||||
} from './GetMediaUseCase';
|
||||
|
||||
describe('GetMediaUseCase', () => {
|
||||
let mediaRepo: {
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
* Handles the business logic for retrieving media information.
|
||||
*/
|
||||
|
||||
import type { MediaRepository } from '../../domain/repositories/MediaRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
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 {
|
||||
RequestAvatarGenerationUseCase,
|
||||
type RequestAvatarGenerationInput,
|
||||
type RequestAvatarGenerationErrorCode,
|
||||
type RequestAvatarGenerationResult,
|
||||
} from './RequestAvatarGenerationUseCase';
|
||||
import type { AvatarGenerationRepository } from '../../domain/repositories/AvatarGenerationRepository';
|
||||
import type { FaceValidationPort } from '../ports/FaceValidationPort';
|
||||
import { describe, expect, it, vi, type Mock } from 'vitest';
|
||||
import type { AvatarGenerationPort } from '../ports/AvatarGenerationPort';
|
||||
import type { FaceValidationPort } from '../ports/FaceValidationPort';
|
||||
import {
|
||||
RequestAvatarGenerationUseCase,
|
||||
type RequestAvatarGenerationErrorCode,
|
||||
type RequestAvatarGenerationInput,
|
||||
type RequestAvatarGenerationResult,
|
||||
} from './RequestAvatarGenerationUseCase';
|
||||
|
||||
vi.mock('uuid', () => ({
|
||||
v4: () => 'request-1',
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
* Handles the business logic for requesting avatar generation from a face photo.
|
||||
*/
|
||||
|
||||
import { Result } from '@/shared/domain/Result';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import type { AvatarGenerationRepository } from '../../domain/repositories/AvatarGenerationRepository';
|
||||
import type { FaceValidationPort } from '../ports/FaceValidationPort';
|
||||
import type { AvatarGenerationPort } from '../ports/AvatarGenerationPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { AvatarGenerationRequest } from '../../domain/entities/AvatarGenerationRequest';
|
||||
import type { RacingSuitColor } from '../../domain/types/AvatarGenerationRequest';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { AvatarGenerationPort } from '../ports/AvatarGenerationPort';
|
||||
import type { FaceValidationPort } from '../ports/FaceValidationPort';
|
||||
|
||||
export interface RequestAvatarGenerationInput {
|
||||
userId: string;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
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 {
|
||||
SelectAvatarUseCase,
|
||||
type SelectAvatarErrorCode,
|
||||
type SelectAvatarInput,
|
||||
} from './SelectAvatarUseCase';
|
||||
import type { AvatarGenerationRepository } from '../../domain/repositories/AvatarGenerationRepository';
|
||||
import { describe, expect, it, vi, type Mock } from 'vitest';
|
||||
import { AvatarGenerationRequest } from '../../domain/entities/AvatarGenerationRequest';
|
||||
import {
|
||||
SelectAvatarUseCase,
|
||||
type SelectAvatarErrorCode,
|
||||
type SelectAvatarInput,
|
||||
} from './SelectAvatarUseCase';
|
||||
|
||||
describe('SelectAvatarUseCase', () => {
|
||||
let avatarRepo: { findById: Mock; save: Mock };
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
* Handles the business logic for selecting a generated avatar from the options.
|
||||
*/
|
||||
|
||||
import type { AvatarGenerationRepository } from '../../domain/repositories/AvatarGenerationRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
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 {
|
||||
UpdateAvatarUseCase,
|
||||
type UpdateAvatarErrorCode,
|
||||
type UpdateAvatarInput,
|
||||
type UpdateAvatarResult,
|
||||
} from './UpdateAvatarUseCase';
|
||||
import type { AvatarRepository } from '../../domain/repositories/AvatarRepository';
|
||||
import { describe, expect, it, vi, type Mock } from 'vitest';
|
||||
import { Avatar } from '../../domain/entities/Avatar';
|
||||
import {
|
||||
UpdateAvatarUseCase,
|
||||
type UpdateAvatarErrorCode,
|
||||
type UpdateAvatarInput,
|
||||
type UpdateAvatarResult,
|
||||
} from './UpdateAvatarUseCase';
|
||||
|
||||
vi.mock('uuid', () => ({
|
||||
v4: () => 'avatar-1',
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
* Handles the business logic for updating a driver's avatar.
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { AvatarId } from '@/media/domain/value-objects/AvatarId';
|
||||
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 uuidv4 } from 'uuid';
|
||||
import { Avatar } from '../../domain/entities/Avatar';
|
||||
import type { AvatarRepository } from '../../domain/repositories/AvatarRepository';
|
||||
import { AvatarId } from '../../domain/value-objects/AvatarId';
|
||||
|
||||
export interface UpdateAvatarInput {
|
||||
driverId: string;
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { Readable } from 'node:stream';
|
||||
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 {
|
||||
UploadMediaUseCase,
|
||||
type MulterFile,
|
||||
type UploadMediaErrorCode,
|
||||
type UploadMediaInput,
|
||||
type UploadMediaResult,
|
||||
} from './UploadMediaUseCase';
|
||||
import type { MediaRepository } from '../../domain/repositories/MediaRepository';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
import { Readable } from 'node:stream';
|
||||
import { describe, expect, it, vi, type Mock } from 'vitest';
|
||||
import { Media } from '../../domain/entities/Media';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
import {
|
||||
UploadMediaUseCase,
|
||||
type MulterFile,
|
||||
type UploadMediaErrorCode,
|
||||
type UploadMediaInput,
|
||||
type UploadMediaResult,
|
||||
} from './UploadMediaUseCase';
|
||||
|
||||
vi.mock('uuid', () => ({
|
||||
v4: () => 'media-1',
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
* Handles the business logic for uploading media files.
|
||||
*/
|
||||
|
||||
import type { MediaRepository } from '../../domain/repositories/MediaRepository';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import { Media } from '../../domain/entities/Media';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { Media } from '../../domain/entities/Media';
|
||||
import type { MediaStoragePort } from '../ports/MediaStoragePort';
|
||||
|
||||
// Define Multer file type locally since @types/multer is not available
|
||||
export interface MulterFile {
|
||||
|
||||
Reference in New Issue
Block a user