@xuda.io/drive_module 1.1.810 → 1.1.812

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 +88 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1389,7 +1389,7 @@ exports.update_drive_file_sharing_mode = async function (req, job_id, headers) {
1389
1389
  // };
1390
1390
 
1391
1391
  exports.extract_drive_file = async function (req, job_id, headers) {
1392
- const { app_id, file_path, file_id, uid } = req;
1392
+ const { app_id, file_path, uid } = req;
1393
1393
 
1394
1394
  const app_id_master = await _common.get_project_app_id(app_id, true);
1395
1395
  const app_id_reference = await _common.get_project_app_id(app_id);
@@ -1433,11 +1433,6 @@ exports.extract_drive_file = async function (req, job_id, headers) {
1433
1433
  ext;
1434
1434
  }
1435
1435
 
1436
- // const folder_name = fileName.replaceAll("/", "");
1437
- // doc.drive_type === "studio"
1438
- // ? fileName
1439
- // : "drive_folder_" + crypto.randomUUID();
1440
-
1441
1436
  const folder_name =
1442
1437
  "drive_folder_" +
1443
1438
  (doc.drive_type === "studio"
@@ -1774,6 +1769,7 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
1774
1769
  };
1775
1770
  exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1776
1771
  const { drive_type, app_id, uid, file_name, file_path } = req;
1772
+
1777
1773
  var master_app_id;
1778
1774
 
1779
1775
  if (["studio", "workspace"].includes(drive_type)) {
@@ -1784,10 +1780,7 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1784
1780
  case "studio": {
1785
1781
  const target_dir = path.join(_conf[`studio_drive_path`], master_app_id);
1786
1782
 
1787
- target_file = path.join(
1788
- file_path !== "/" ? file_path : target_dir,
1789
- file_name
1790
- );
1783
+ target_file = path.join(target_dir, file_name);
1791
1784
 
1792
1785
  if (await fs_module.file_exists(target_file)) {
1793
1786
  return {
@@ -1856,6 +1849,91 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1856
1849
  data: "ok",
1857
1850
  };
1858
1851
  };
1852
+ // exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1853
+ // const { drive_type, app_id, uid, file_name, file_path } = req;
1854
+ // var master_app_id;
1855
+
1856
+ // if (["studio", "workspace"].includes(drive_type)) {
1857
+ // master_app_id = await _common.get_project_app_id(app_id, true);
1858
+ // }
1859
+ // let doc = await get_drive_doc(drive_type, app_id, uid, file_path, headers);
1860
+
1861
+ // switch (drive_type) {
1862
+ // case "studio": {
1863
+ // const target_dir = path.join(_conf[`studio_drive_path`], master_app_id);
1864
+
1865
+ // target_file = path.join(
1866
+ // file_path !== "/" ? file_path : target_dir,
1867
+ // file_name
1868
+ // );
1869
+
1870
+ // if (await fs_module.file_exists(target_file)) {
1871
+ // return {
1872
+ // code: -764,
1873
+ // data: "file exist",
1874
+ // };
1875
+ // }
1876
+
1877
+ // break;
1878
+ // }
1879
+ // case "workspace": {
1880
+ // const workspace_drive_res = await db_module.find_app_couch_query(
1881
+ // master_app_id,
1882
+ // {
1883
+ // selector: {
1884
+ // docType: "workspace_drive",
1885
+ // originalname: file_name,
1886
+ // file_path,
1887
+ // stat: 3,
1888
+ // },
1889
+ // limit: 99,
1890
+ // }
1891
+ // );
1892
+ // if (workspace_drive_res.docs.length) {
1893
+ // return {
1894
+ // code: -764,
1895
+ // data: "file exist",
1896
+ // duplicates: workspace_drive_res.docs,
1897
+ // };
1898
+ // }
1899
+
1900
+ // break;
1901
+ // }
1902
+ // case "user": {
1903
+ // const user_drive_res = await db_module.find_couch_query("xuda_drive", {
1904
+ // selector: {
1905
+ // docType: "user_drive",
1906
+ // originalname: file_name,
1907
+ // file_path,
1908
+ // uid,
1909
+ // stat: 3,
1910
+ // },
1911
+ // limit: 99,
1912
+ // });
1913
+ // if (user_drive_res.docs.length) {
1914
+ // return {
1915
+ // code: -764,
1916
+ // data: "file exist",
1917
+ // duplicates: user_drive_res.docs,
1918
+ // };
1919
+ // }
1920
+
1921
+ // break;
1922
+ // }
1923
+
1924
+ // default:
1925
+ // return {
1926
+ // code: -764,
1927
+ // data: "invalid method",
1928
+ // };
1929
+ // break;
1930
+ // }
1931
+
1932
+ // return {
1933
+ // code: 764,
1934
+ // data: "ok",
1935
+ // };
1936
+ // };
1859
1937
  const ocr_drive_file = async function (doc) {
1860
1938
  const { drive_type, target_file } = doc;
1861
1939
  var doc_ret;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.810",
3
+ "version": "1.1.812",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {