@xuda.io/drive_module 1.1.692 → 1.1.694
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 +20 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2348,29 +2348,33 @@ 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
|
+
|
|
2354
2361
|
let doc_ret;
|
|
2355
2362
|
|
|
2356
2363
|
switch (drive_type) {
|
|
2357
2364
|
case "studio": {
|
|
2358
2365
|
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
|
-
);
|
|
2366
|
+
doc_ret = await db_module.get_app_couch_doc(app_id_master, target_file);
|
|
2363
2367
|
|
|
2364
|
-
if (doc_ret.code > -1) {
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2368
|
+
// if (doc_ret.code > -1) {
|
|
2369
|
+
// doc_ret.data._delete = true;
|
|
2370
|
+
// save_ret = await db_module.save_app_couch_doc(
|
|
2371
|
+
// app_id_master,
|
|
2372
|
+
// doc_ret.data
|
|
2373
|
+
// );
|
|
2370
2374
|
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
}
|
|
2375
|
+
// doc_ret.data._id = file_name_id;
|
|
2376
|
+
// delete doc_ret.data._rev;
|
|
2377
|
+
// }
|
|
2374
2378
|
|
|
2375
2379
|
break;
|
|
2376
2380
|
}
|
|
@@ -2378,11 +2382,8 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
2378
2382
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
2379
2383
|
doc_ret = await db_module.get_app_couch_doc(
|
|
2380
2384
|
app_id_reference,
|
|
2381
|
-
|
|
2385
|
+
check_existing_file_ret.duplicates[0]._id
|
|
2382
2386
|
);
|
|
2383
|
-
if (doc_ret.code < 0) {
|
|
2384
|
-
throw new Error(doc_ret.data);
|
|
2385
|
-
}
|
|
2386
2387
|
|
|
2387
2388
|
break;
|
|
2388
2389
|
}
|
|
@@ -2390,11 +2391,8 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
2390
2391
|
case "user":
|
|
2391
2392
|
doc_ret = await db_module.get_couch_doc(
|
|
2392
2393
|
"xuda_drive",
|
|
2393
|
-
|
|
2394
|
+
check_existing_file_ret.duplicates[0]._id
|
|
2394
2395
|
);
|
|
2395
|
-
if (doc_ret.code < 0) {
|
|
2396
|
-
throw new Error(doc_ret.data);
|
|
2397
|
-
}
|
|
2398
2396
|
|
|
2399
2397
|
break;
|
|
2400
2398
|
|