feat(refboard): add LOD tier generation and video support to upload route

- Upload route now generates 3-tier LOD (thumb/medium/full) for images via
  lod-generator service, storing each tier at boards/{boardId}/{imageId}/
- Video uploads (mp4, webm, quicktime) supported as single-file storage
- New DB columns: asset_key (prefix path) and media_type ('image'/'video')
- Backward compatible: minio_path and public_url still populated (point to full tier)
- SVG and GIF skip LOD processing (single file stored)
- Added putBuffer() and MIME_TO_EXT export to minio.js
This commit is contained in:
Hiren Kangad
2026-03-09 23:00:09 +05:30
parent 02a04d6e24
commit e1b71aa774
3 changed files with 117 additions and 15 deletions
+16
View File
@@ -23,6 +23,9 @@ const MIME_TO_EXT = {
'image/gif': '.gif',
'image/webp': '.webp',
'image/svg+xml': '.svg',
'video/mp4': '.mp4',
'video/webm': '.webm',
'video/quicktime': '.mov',
};
/**
@@ -65,6 +68,17 @@ async function uploadImage(boardId, imageId, buffer, mimeType) {
return objectName;
}
/**
* Upload a raw buffer to MinIO at the given object name.
* Returns the object name.
*/
async function putBuffer(objectName, buffer, contentType) {
await minioClient.putObject(MINIO_BUCKET, objectName, buffer, buffer.length, {
'Content-Type': contentType,
});
return objectName;
}
/**
* Delete a single object by its minio path.
*/
@@ -106,8 +120,10 @@ module.exports = {
minioClient,
initBucket,
uploadImage,
putBuffer,
deleteImage,
deleteBoardImages,
getImageUrl,
MINIO_BUCKET,
MIME_TO_EXT,
};