website cleanup
This commit is contained in:
@@ -8,6 +8,8 @@ import type { GetMediaOutputDTO } from './dtos/GetMediaOutputDTO';
|
||||
import type { DeleteMediaOutputDTO } from './dtos/DeleteMediaOutputDTO';
|
||||
import type { GetAvatarOutputDTO } from './dtos/GetAvatarOutputDTO';
|
||||
import type { UpdateAvatarOutputDTO } from './dtos/UpdateAvatarOutputDTO';
|
||||
import type { ValidateFaceInputDTO } from './dtos/ValidateFaceInputDTO';
|
||||
import type { ValidateFaceOutputDTO } from './dtos/ValidateFaceOutputDTO';
|
||||
import type { RacingSuitColor } from '@core/media/domain/types/AvatarGenerationRequest';
|
||||
import type { MulterFile } from './types/MulterFile';
|
||||
|
||||
@@ -179,4 +181,24 @@ export class MediaService {
|
||||
|
||||
return this.updateAvatarPresenter.responseModel;
|
||||
}
|
||||
|
||||
async validateFacePhoto(input: ValidateFaceInputDTO): Promise<ValidateFaceOutputDTO> {
|
||||
this.logger.debug('[MediaService] Validating face photo.');
|
||||
|
||||
// Simple validation: check if it's a valid base64 image
|
||||
if (!input.imageData || !input.imageData.startsWith('data:image/')) {
|
||||
return { isValid: false, errorMessage: 'Invalid image data' };
|
||||
}
|
||||
|
||||
// Check file size (rough estimate from base64 length)
|
||||
const base64Length = input.imageData.length;
|
||||
const fileSizeInBytes = (base64Length * 3) / 4; // Rough estimate
|
||||
const maxSize = 5 * 1024 * 1024; // 5MB
|
||||
|
||||
if (fileSizeInBytes > maxSize) {
|
||||
return { isValid: false, errorMessage: 'Image too large (max 5MB)' };
|
||||
}
|
||||
|
||||
return { isValid: true };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user