@xuda.io/drive_module 1.1.798 → 1.1.800

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 +6 -59
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1097,67 +1097,14 @@ exports.rename_drive_file = async function (req, job_id, headers) {
1097
1097
 
1098
1098
  let doc = await get_drive_doc(drive_type, app_id, uid, file_path, headers);
1099
1099
 
1100
- let check_req = {
1101
- app_id,
1102
- uid,
1103
- drive_type,
1104
- file_path,
1105
- };
1106
- const check_existing_file_ret = await module.exports.check_drive_file(
1107
- check_req
1108
- );
1109
-
1110
- // var target_file = file_name;
1111
-
1112
- let doc_ret;
1113
-
1114
- switch (drive_type) {
1115
- case "studio": {
1116
- const app_id_master = await _common.get_project_app_id(app_id, true);
1117
- doc_ret = await db_module.get_app_couch_doc(app_id_master, file_path);
1118
- await fs_module.rename(file_path, file_name_to);
1119
- if (doc_ret.code > -1) {
1120
- doc_ret.data._delete = true;
1121
- save_ret = await db_module.save_app_couch_doc(
1122
- app_id_master,
1123
- doc_ret.data
1124
- );
1125
-
1126
- doc_ret.data._id = file_name_to;
1127
- delete doc_ret.data._rev;
1128
- }
1129
- misc_module.rsync_drive_resources_to_remote_servers(
1130
- "studio",
1131
- app_id_master
1132
- );
1133
- break;
1134
- }
1135
- case "workspace": {
1136
- const app_id_reference = await _common.get_project_app_id(app_id);
1137
- doc_ret = await db_module.get_app_couch_doc(
1138
- app_id_reference,
1139
- check_existing_file_ret.duplicates[0]._id
1140
- );
1141
- if (doc_ret.code < 0) {
1142
- throw new Error(doc_ret.data);
1143
- }
1144
-
1145
- break;
1146
- }
1147
-
1148
- case "user":
1149
- doc_ret = await db_module.get_couch_doc(
1150
- "xuda_drive",
1151
- check_existing_file_ret.duplicates[0]._id
1152
- );
1153
- if (doc_ret.code < 0) {
1154
- throw new Error(doc_ret.data);
1155
- }
1100
+ if (drive_type === "studio") {
1101
+ await fs_module.rename(file_path, file_name_to);
1156
1102
 
1157
- break;
1103
+ doc._delete = true;
1104
+ await db_module.save_app_couch_doc(app_id_master, doc_ret.data);
1158
1105
 
1159
- default:
1160
- break;
1106
+ doc._id = file_name_to;
1107
+ delete doc._rev;
1161
1108
  }
1162
1109
 
1163
1110
  if (doc_ret.code > -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.798",
3
+ "version": "1.1.800",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {