@xuda.io/drive_module 1.1.881 → 1.1.883

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 +36 -26
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -83,21 +83,29 @@ const get_studio_path = function (raw_path, ref, file_name) {
83
83
  };
84
84
 
85
85
  exports.get_drive_files = async function (req) {
86
- const { from = 0, to = 100, drive_type, app_id, uid, type, date } = req;
86
+ const {
87
+ from = 0,
88
+ to = 100,
89
+ drive_type,
90
+ app_id,
91
+ uid,
92
+ type,
93
+ date,
94
+ sort_by = "name",
95
+ sort_dir = "desc",
96
+ } = req;
87
97
  try {
88
98
  let opt = {
89
99
  selector: {
90
- docType: "workspace_drive",
91
100
  stat: 3,
92
101
  type,
93
- file_path: req.path,
94
102
  },
95
103
  limit: to - from,
96
104
  skip: from,
97
105
  };
98
106
 
99
- if (type) {
100
- opt.selector.type = type;
107
+ if (req.path) {
108
+ opt.selector.file_path = req.path;
101
109
  }
102
110
 
103
111
  validate_drive_type(drive_type);
@@ -113,16 +121,16 @@ exports.get_drive_files = async function (req) {
113
121
  const app_id_reference = await _common.get_project_app_id(app_id);
114
122
  opt.selector = "workspace_drive";
115
123
 
116
- var opt = {
117
- selector: {
118
- docType: "workspace_drive",
119
- stat: 3,
120
- type,
121
- file_path: req.path,
122
- },
123
- limit: to - from,
124
- skip: from,
125
- };
124
+ // var opt = {
125
+ // selector: {
126
+ // docType: "workspace_drive",
127
+ // stat: 3,
128
+ // type,
129
+ // file_path: req.path,
130
+ // },
131
+ // limit: to - from,
132
+ // skip: from,
133
+ // };
126
134
 
127
135
  if (date) {
128
136
  opt.sort = [{ date_created: "desc" }];
@@ -193,17 +201,19 @@ exports.get_drive_files = async function (req) {
193
201
  return { code: 1, data: files };
194
202
  };
195
203
  const get_user_files = async function () {
196
- var opt = {
197
- selector: {
198
- docType: "user_drive",
199
- stat: 3,
200
- uid,
201
- type,
202
- file_path: req.path,
203
- },
204
- limit: to - from,
205
- skip: from,
206
- };
204
+ opt.selector = "user_drive";
205
+ opt.uid = uid;
206
+ // var opt = {
207
+ // selector: {
208
+ // docType: "user_drive",
209
+ // stat: 3,
210
+ // uid,
211
+ // type,
212
+ // file_path: req.path,
213
+ // },
214
+ // limit: to - from,
215
+ // skip: from,
216
+ // };
207
217
 
208
218
  if (date) {
209
219
  opt.sort = [{ date_created: "desc" }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.881",
3
+ "version": "1.1.883",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {