@xuda.io/drive_module 1.1.760 → 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.
Files changed (2) hide show
  1. package/index.js +30 -3
  2. 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(app_id_reference, file_id);
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("xuda_drive", file_id);
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:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.760",
3
+ "version": "1.1.761",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {