diff --git a/backend/db.js b/backend/db.js index b7298d0..38dfdcb 100644 --- a/backend/db.js +++ b/backend/db.js @@ -15,7 +15,7 @@ function initialize(input_db, input_users_db, input_logger) { setLogger(input_logger); } -function registerFileDB(file_path, type, multiUserMode = null, sub = null, customPath = null) { +function registerFileDB(file_path, type, multiUserMode = null, sub = null, customPath = null, category = null) { let db_path = null; const file_id = file_path.substring(0, file_path.length-4); const file_object = generateFileObject(file_id, type, customPath || multiUserMode && multiUserMode.file_path, sub); @@ -29,6 +29,9 @@ function registerFileDB(file_path, type, multiUserMode = null, sub = null, custo // add thumbnail path file_object['thumbnailPath'] = utils.getDownloadedThumbnail(file_id, type, customPath || multiUserMode && multiUserMode.file_path); + // if category exists, only include essential info + if (category) file_object['category'] = {name: category['name'], uid: category['uid']}; + if (!sub) { if (multiUserMode) { const user_uid = multiUserMode.user;