Fix case and add TODO in storage service

Corrected the case for 'MIMEs' in comments for consistency. Added a TODO comment to clarify required file formats in the checkConditions function.
This commit is contained in:
Mathis H (Avnyr) 2024-09-26 14:56:52 +02:00
parent 6523e34328
commit 2aa132e511
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -65,7 +65,7 @@ export class StorageService {
// Fetching MIMEs for the associated machines // Fetching MIMEs for the associated machines
for (const machineId of machineIds) { for (const machineId of machineIds) {
console.debug(`Fetching mimeTypes for machine : ${machineId}`) console.debug(`Fetching mimeTypes for machine : ${machineId}`)
// Get mimes associated to a machine // Get MIMEs associated to a machine
const allowedMimeId = this.dbService.use() const allowedMimeId = this.dbService.use()
.select() .select()
.from(FilesTypeForMachine) .from(FilesTypeForMachine)
@ -78,7 +78,7 @@ export class StorageService {
.from(FilesTypesTable) .from(FilesTypesTable)
.leftJoin(allowedMimeId, eq(FilesTypesTable.id, allowedMimeId.fileTypeId)) .leftJoin(allowedMimeId, eq(FilesTypesTable.id, allowedMimeId.fileTypeId))
console.debug(`Total : ${_allowedMime.length}`) console.debug(`Total : ${_allowedMime.length}`)
// Append each mime of a machine // Append each MIME of a machine
for (const allowedMimeElement of _allowedMime) { for (const allowedMimeElement of _allowedMime) {
_mimes.push(allowedMimeElement.slug) _mimes.push(allowedMimeElement.slug)
} }
@ -167,7 +167,7 @@ export class StorageService {
try { try {
const info = await this.generateInformation(file, fileDisplayName, isDocumentation); const info = await this.generateInformation(file, fileDisplayName, isDocumentation);
console.log(`Trying to append a new file : "${info.fileDisplayName}"...\n > Checksum SHA-256 : ${info.fileChecksum}\n > Size : ${info.fileSize / (1024*1024)}Mio\n > File format : ${info.fileType.mime}\n`) console.log(`Trying to append a new file : "${info.fileDisplayName}"...\n > Checksum SHA-256 : ${info.fileChecksum}\n > Size : ${info.fileSize / (1024*1024)}Mio\n > File format : ${info.fileType.mime}\n`)
const condition = await this.checkConditions([], file) const condition = await this.checkConditions([/* TODO import autorized file format */], file)
if (!condition) { if (!condition) {
console.warn(`File "${info.fileDisplayName}" did not pass the files requirement.\n${info.fileChecksum}`) console.warn(`File "${info.fileDisplayName}" did not pass the files requirement.\n${info.fileChecksum}`)
} }