fix issues in core
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
export interface UploadOptions {
|
||||
filename: string;
|
||||
mimeType: string;
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface UploadResult {
|
||||
|
||||
@@ -33,11 +33,11 @@ describe('DeleteMediaUseCase', () => {
|
||||
mediaRepo = {
|
||||
findById: vi.fn(),
|
||||
delete: vi.fn(),
|
||||
} as unknown as IMediaRepository as any;
|
||||
};
|
||||
|
||||
mediaStorage = {
|
||||
deleteMedia: vi.fn(),
|
||||
} as unknown as MediaStoragePort as any;
|
||||
};
|
||||
|
||||
logger = {
|
||||
debug: vi.fn(),
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('GetAvatarUseCase', () => {
|
||||
avatarRepo = {
|
||||
findActiveByDriverId: vi.fn(),
|
||||
save: vi.fn(),
|
||||
} as unknown as IAvatarRepository as any;
|
||||
};
|
||||
|
||||
logger = {
|
||||
debug: vi.fn(),
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('GetMediaUseCase', () => {
|
||||
beforeEach(() => {
|
||||
mediaRepo = {
|
||||
findById: vi.fn(),
|
||||
} as unknown as IMediaRepository as any;
|
||||
};
|
||||
|
||||
logger = {
|
||||
debug: vi.fn(),
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface GetMediaResult {
|
||||
type: string;
|
||||
uploadedBy: string;
|
||||
uploadedAt: Date;
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface MulterFile {
|
||||
export interface UploadMediaInput {
|
||||
file: MulterFile;
|
||||
uploadedBy: string;
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface UploadMediaResult {
|
||||
@@ -60,7 +60,11 @@ export class UploadMediaUseCase {
|
||||
|
||||
try {
|
||||
// Upload file to storage service
|
||||
const uploadOptions: { filename: string; mimeType: string; metadata?: Record<string, any> } = {
|
||||
const uploadOptions: {
|
||||
filename: string;
|
||||
mimeType: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
} = {
|
||||
filename: input.file.originalname,
|
||||
mimeType: input.file.mimetype,
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface MediaProps {
|
||||
type: MediaType;
|
||||
uploadedBy: string;
|
||||
uploadedAt: Date;
|
||||
metadata?: Record<string, any> | undefined;
|
||||
metadata?: Record<string, unknown> | undefined;
|
||||
}
|
||||
|
||||
export class Media implements IEntity<string> {
|
||||
@@ -32,7 +32,7 @@ export class Media implements IEntity<string> {
|
||||
readonly type: MediaType;
|
||||
readonly uploadedBy: string;
|
||||
readonly uploadedAt: Date;
|
||||
readonly metadata?: Record<string, any> | undefined;
|
||||
readonly metadata?: Record<string, unknown> | undefined;
|
||||
|
||||
private constructor(props: MediaProps) {
|
||||
this.id = props.id;
|
||||
@@ -56,7 +56,7 @@ export class Media implements IEntity<string> {
|
||||
url: string;
|
||||
type: MediaType;
|
||||
uploadedBy: string;
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
}): Media {
|
||||
if (!props.filename) {
|
||||
throw new Error('Filename is required');
|
||||
|
||||
Reference in New Issue
Block a user