@xuda.io/drive_module 1.1.692 → 1.1.693
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +28 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2348,29 +2348,41 @@ const get_folder_docs = async function (dir, drive_type, app_id) {
|
|
|
2348
2348
|
|
|
2349
2349
|
exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
2350
2350
|
try {
|
|
2351
|
-
const { drive_type, app_id, uid,
|
|
2351
|
+
const { drive_type, app_id, uid, file_path, file_name, tags = [] } = req;
|
|
2352
2352
|
validate_drive_type(drive_type);
|
|
2353
2353
|
|
|
2354
|
+
const check_existing_file_ret = await module.exports.check_drive_file(
|
|
2355
|
+
check_req
|
|
2356
|
+
);
|
|
2357
|
+
|
|
2358
|
+
var target_file = path.join(file_path, file_name);
|
|
2359
|
+
const master_id = await _common.get_project_app_id(app_id, true);
|
|
2360
|
+
const tempPath = file_obj.path;
|
|
2361
|
+
if (drive_type === "studio") {
|
|
2362
|
+
const target_dir = path.join(
|
|
2363
|
+
_conf[`studio_drive_path`],
|
|
2364
|
+
master_id,
|
|
2365
|
+
target_file
|
|
2366
|
+
);
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2354
2369
|
let doc_ret;
|
|
2355
2370
|
|
|
2356
2371
|
switch (drive_type) {
|
|
2357
2372
|
case "studio": {
|
|
2358
2373
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
2359
|
-
doc_ret = await db_module.get_app_couch_doc(
|
|
2360
|
-
app_id_master,
|
|
2361
|
-
file_name_id
|
|
2362
|
-
);
|
|
2374
|
+
doc_ret = await db_module.get_app_couch_doc(app_id_master, target_file);
|
|
2363
2375
|
|
|
2364
|
-
if (doc_ret.code > -1) {
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2376
|
+
// if (doc_ret.code > -1) {
|
|
2377
|
+
// doc_ret.data._delete = true;
|
|
2378
|
+
// save_ret = await db_module.save_app_couch_doc(
|
|
2379
|
+
// app_id_master,
|
|
2380
|
+
// doc_ret.data
|
|
2381
|
+
// );
|
|
2370
2382
|
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
}
|
|
2383
|
+
// doc_ret.data._id = file_name_id;
|
|
2384
|
+
// delete doc_ret.data._rev;
|
|
2385
|
+
// }
|
|
2374
2386
|
|
|
2375
2387
|
break;
|
|
2376
2388
|
}
|
|
@@ -2378,11 +2390,8 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
2378
2390
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
2379
2391
|
doc_ret = await db_module.get_app_couch_doc(
|
|
2380
2392
|
app_id_reference,
|
|
2381
|
-
|
|
2393
|
+
check_existing_file_ret.duplicates[0]._id
|
|
2382
2394
|
);
|
|
2383
|
-
if (doc_ret.code < 0) {
|
|
2384
|
-
throw new Error(doc_ret.data);
|
|
2385
|
-
}
|
|
2386
2395
|
|
|
2387
2396
|
break;
|
|
2388
2397
|
}
|
|
@@ -2390,11 +2399,8 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
2390
2399
|
case "user":
|
|
2391
2400
|
doc_ret = await db_module.get_couch_doc(
|
|
2392
2401
|
"xuda_drive",
|
|
2393
|
-
|
|
2402
|
+
check_existing_file_ret.duplicates[0]._id
|
|
2394
2403
|
);
|
|
2395
|
-
if (doc_ret.code < 0) {
|
|
2396
|
-
throw new Error(doc_ret.data);
|
|
2397
|
-
}
|
|
2398
2404
|
|
|
2399
2405
|
break;
|
|
2400
2406
|
|