@xuda.io/drive_module 1.1.759 → 1.1.761
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 +34 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1140,19 +1140,46 @@ exports.rename_drive_folder = async function (req) {
|
|
|
1140
1140
|
exports.update_drive_file_sharing_mode = async function (req, job_id, headers) {
|
|
1141
1141
|
try {
|
|
1142
1142
|
const { drive_type, uid, app_id, file_id, is_public } = req;
|
|
1143
|
+
|
|
1143
1144
|
validate_drive_type(drive_type);
|
|
1144
1145
|
|
|
1146
|
+
const file_name = path.basename(file_path);
|
|
1147
|
+
|
|
1148
|
+
let check_req = {
|
|
1149
|
+
app_id,
|
|
1150
|
+
uid,
|
|
1151
|
+
drive_type,
|
|
1152
|
+
file_path,
|
|
1153
|
+
};
|
|
1154
|
+
const check_existing_file_ret = await module.exports.check_drive_file(
|
|
1155
|
+
check_req
|
|
1156
|
+
);
|
|
1157
|
+
|
|
1145
1158
|
let doc_ret;
|
|
1146
1159
|
|
|
1147
1160
|
switch (drive_type) {
|
|
1148
|
-
case "workspace":
|
|
1149
1161
|
case "studio":
|
|
1150
1162
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
1151
|
-
doc_ret = await db_module.get_app_couch_doc(
|
|
1163
|
+
doc_ret = await db_module.get_app_couch_doc(
|
|
1164
|
+
app_id_reference,
|
|
1165
|
+
file_path
|
|
1166
|
+
);
|
|
1152
1167
|
break;
|
|
1153
1168
|
|
|
1154
1169
|
case "user":
|
|
1155
|
-
doc_ret = await db_module.get_couch_doc(
|
|
1170
|
+
doc_ret = await db_module.get_couch_doc(
|
|
1171
|
+
"xuda_drive",
|
|
1172
|
+
check_existing_file_ret.duplicates[0]._id
|
|
1173
|
+
);
|
|
1174
|
+
break;
|
|
1175
|
+
|
|
1176
|
+
case "workspace":
|
|
1177
|
+
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
1178
|
+
doc_ret = await db_module.get_app_couch_doc(
|
|
1179
|
+
app_id_reference,
|
|
1180
|
+
check_existing_file_ret.duplicates[0]._id
|
|
1181
|
+
);
|
|
1182
|
+
|
|
1156
1183
|
break;
|
|
1157
1184
|
|
|
1158
1185
|
default:
|
|
@@ -2373,21 +2400,22 @@ const get_folder_docs = async function (dir, drive_type, app_id) {
|
|
|
2373
2400
|
|
|
2374
2401
|
exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
2375
2402
|
try {
|
|
2376
|
-
const { drive_type, app_id, uid, file_path,
|
|
2403
|
+
const { drive_type, app_id, uid, file_path, tags = [] } = req;
|
|
2404
|
+
const file_name = path.basename(file_path);
|
|
2377
2405
|
validate_drive_type(drive_type);
|
|
2378
2406
|
|
|
2379
2407
|
let check_req = {
|
|
2380
2408
|
app_id,
|
|
2381
2409
|
uid,
|
|
2382
2410
|
drive_type,
|
|
2383
|
-
|
|
2411
|
+
|
|
2384
2412
|
file_path,
|
|
2385
2413
|
};
|
|
2386
2414
|
const check_existing_file_ret = await module.exports.check_drive_file(
|
|
2387
2415
|
check_req
|
|
2388
2416
|
);
|
|
2389
2417
|
|
|
2390
|
-
var target_file =
|
|
2418
|
+
var target_file = file_name;
|
|
2391
2419
|
// const master_id = await _common.get_project_app_id(app_id, true);
|
|
2392
2420
|
|
|
2393
2421
|
let doc_ret;
|