@xuda.io/drive_module 1.1.833 → 1.1.835

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.
Files changed (2) hide show
  1. package/index.js +20 -89
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -868,7 +868,7 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
868
868
  }
869
869
 
870
870
  let doc = await get_drive_doc(
871
- type,
871
+ "file",
872
872
  drive_type,
873
873
  app_id,
874
874
  uid,
@@ -1281,11 +1281,18 @@ exports.rename_drive_folder = async function (req) {
1281
1281
  };
1282
1282
  exports.update_drive_file_sharing_mode = async function (req, job_id, headers) {
1283
1283
  try {
1284
- const { drive_type, uid, app_id, file_path, is_public } = req;
1284
+ const { type, drive_type, uid, app_id, file_path, is_public } = req;
1285
1285
 
1286
1286
  validate_drive_type(drive_type);
1287
1287
 
1288
- let doc = await get_drive_doc(drive_type, app_id, uid, file_path, headers);
1288
+ let doc = await get_drive_doc(
1289
+ type,
1290
+ drive_type,
1291
+ app_id,
1292
+ uid,
1293
+ file_path,
1294
+ headers
1295
+ );
1289
1296
 
1290
1297
  doc.ts = Date.now();
1291
1298
  doc.public = is_public;
@@ -1422,7 +1429,14 @@ exports.extract_drive_file = async function (req, job_id, headers) {
1422
1429
  const app_id_master = await _common.get_project_app_id(app_id, true);
1423
1430
  const app_id_reference = await _common.get_project_app_id(app_id);
1424
1431
 
1425
- let doc = await get_drive_doc(drive_type, app_id, uid, file_path, headers);
1432
+ let doc = await get_drive_doc(
1433
+ "file",
1434
+ drive_type,
1435
+ app_id,
1436
+ uid,
1437
+ file_path,
1438
+ headers
1439
+ );
1426
1440
 
1427
1441
  const ext = path.extname(file_path).toLowerCase();
1428
1442
 
@@ -1879,91 +1893,7 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1879
1893
  data: "ok",
1880
1894
  };
1881
1895
  };
1882
- // exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1883
- // const { drive_type, app_id, uid, file_name, file_path } = req;
1884
- // var master_app_id;
1885
-
1886
- // if (["studio", "workspace"].includes(drive_type)) {
1887
- // master_app_id = await _common.get_project_app_id(app_id, true);
1888
- // }
1889
- // let doc = await get_drive_doc(drive_type, app_id, uid, file_path, headers);
1890
-
1891
- // switch (drive_type) {
1892
- // case "studio": {
1893
- // const target_dir = path.join(_conf[`studio_drive_path`], master_app_id);
1894
-
1895
- // target_file = path.join(
1896
- // file_path !== "/" ? file_path : target_dir,
1897
- // file_name
1898
- // );
1899
1896
 
1900
- // if (await fs_module.file_exists(target_file)) {
1901
- // return {
1902
- // code: -764,
1903
- // data: "file exist",
1904
- // };
1905
- // }
1906
-
1907
- // break;
1908
- // }
1909
- // case "workspace": {
1910
- // const workspace_drive_res = await db_module.find_app_couch_query(
1911
- // master_app_id,
1912
- // {
1913
- // selector: {
1914
- // docType: "workspace_drive",
1915
- // originalname: file_name,
1916
- // file_path,
1917
- // stat: 3,
1918
- // },
1919
- // limit: 99,
1920
- // }
1921
- // );
1922
- // if (workspace_drive_res.docs.length) {
1923
- // return {
1924
- // code: -764,
1925
- // data: "file exist",
1926
- // duplicates: workspace_drive_res.docs,
1927
- // };
1928
- // }
1929
-
1930
- // break;
1931
- // }
1932
- // case "user": {
1933
- // const user_drive_res = await db_module.find_couch_query("xuda_drive", {
1934
- // selector: {
1935
- // docType: "user_drive",
1936
- // originalname: file_name,
1937
- // file_path,
1938
- // uid,
1939
- // stat: 3,
1940
- // },
1941
- // limit: 99,
1942
- // });
1943
- // if (user_drive_res.docs.length) {
1944
- // return {
1945
- // code: -764,
1946
- // data: "file exist",
1947
- // duplicates: user_drive_res.docs,
1948
- // };
1949
- // }
1950
-
1951
- // break;
1952
- // }
1953
-
1954
- // default:
1955
- // return {
1956
- // code: -764,
1957
- // data: "invalid method",
1958
- // };
1959
- // break;
1960
- // }
1961
-
1962
- // return {
1963
- // code: 764,
1964
- // data: "ok",
1965
- // };
1966
- // };
1967
1897
  const ocr_drive_file = async function (doc) {
1968
1898
  const { drive_type, target_file } = doc;
1969
1899
  var doc_ret;
@@ -2614,7 +2544,7 @@ const get_folder_docs = async function (dir, drive_type, app_id) {
2614
2544
  exports.update_drive_file_tags = async function (req, job_id, headers) {
2615
2545
  try {
2616
2546
  const { type, drive_type, app_id, uid, file_path, tags = [] } = req;
2617
- const file_name = path.basename(file_path);
2547
+ // const file_name = path.basename(file_path);
2618
2548
  validate_drive_type(drive_type);
2619
2549
 
2620
2550
  let doc = await get_drive_doc(
@@ -2675,6 +2605,7 @@ const get_drive_doc = async function (
2675
2605
  uid,
2676
2606
  drive_type,
2677
2607
  file_path,
2608
+ type,
2678
2609
  };
2679
2610
  const check_existing_file_ret = await module.exports.check_drive_file(
2680
2611
  check_req
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.833",
3
+ "version": "1.1.835",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {