website cleanup

This commit is contained in:
2025-12-25 00:19:36 +01:00
parent d78854a4c6
commit 9486455b9e
82 changed files with 1223 additions and 363 deletions

View File

@@ -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 };
}
}