zet-lib 1.5.2 → 1.5.4
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.
- package/lib/Form.js +1 -1
- package/lib/zAppRouter.js +2 -1
- package/lib/zDropbox.js +24 -2
- package/lib/zRoute.js +9 -7
- package/package.json +1 -1
package/lib/Form.js
CHANGED
|
@@ -502,7 +502,7 @@ Form.field = (obj) => {
|
|
|
502
502
|
//dataObject
|
|
503
503
|
let leftButtons = ``;
|
|
504
504
|
let rightButtons = ``;
|
|
505
|
-
let all = Object.keys(obj.dataObject);
|
|
505
|
+
let all = obj.dataObject ? Object.keys(obj.dataObject) : [];
|
|
506
506
|
all.map((item, index) => {
|
|
507
507
|
if (!value.includes(item)) {
|
|
508
508
|
rightButtons += `<li><button class="btn btn-danger boxy" type="button">${obj.dataObject[item]}<input type="hidden" name='trashx' value="${item}"></button></li>`;
|
package/lib/zAppRouter.js
CHANGED
|
@@ -1882,8 +1882,9 @@ router.post("/zdropbox-file/:index", async (req, res) => {
|
|
|
1882
1882
|
"errormessage",
|
|
1883
1883
|
`Please reload your browser !! Error ${pathFile} not exist in dropbox, `
|
|
1884
1884
|
);
|
|
1885
|
+
res.json(datas);
|
|
1885
1886
|
}
|
|
1886
|
-
},
|
|
1887
|
+
}, 2000);
|
|
1887
1888
|
}
|
|
1888
1889
|
} catch (e) {
|
|
1889
1890
|
console.log(e);
|
package/lib/zDropbox.js
CHANGED
|
@@ -141,6 +141,11 @@ zDropbox.file = async (fileName, table, field, index) => {
|
|
|
141
141
|
const metadata = await dbx.filesGetMetadata({
|
|
142
142
|
path: pathFile,
|
|
143
143
|
});
|
|
144
|
+
if (!metadata) {
|
|
145
|
+
// File tidak ditemukan, handle sesuai kebutuhan
|
|
146
|
+
console.log("File tidak ditemukan");
|
|
147
|
+
return jsonMessage;
|
|
148
|
+
}
|
|
144
149
|
let link = ``;
|
|
145
150
|
try {
|
|
146
151
|
const response = await dbx.filesGetTemporaryLink({
|
|
@@ -163,11 +168,28 @@ zDropbox.file = async (fileName, table, field, index) => {
|
|
|
163
168
|
jsonMessage.datas = mockFile;
|
|
164
169
|
} catch (error) {
|
|
165
170
|
console.log(error);
|
|
171
|
+
return {
|
|
172
|
+
success: false,
|
|
173
|
+
status: 0,
|
|
174
|
+
error: "FILE_NOT_FOUND",
|
|
175
|
+
message: "File tidak ditemukan di Dropbox",
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
} catch (error) {
|
|
179
|
+
if (
|
|
180
|
+
error.status === 409 &&
|
|
181
|
+
error.error?.error_summary?.startsWith("path/not_found")
|
|
182
|
+
) {
|
|
183
|
+
return {
|
|
184
|
+
success: false,
|
|
185
|
+
status: 0,
|
|
186
|
+
error: "FILE_NOT_FOUND",
|
|
187
|
+
message: "File tidak ditemukan di Dropbox",
|
|
188
|
+
};
|
|
166
189
|
}
|
|
167
|
-
} catch (e) {
|
|
168
|
-
console.log(e);
|
|
169
190
|
}
|
|
170
191
|
|
|
171
192
|
return jsonMessage;
|
|
172
193
|
};
|
|
194
|
+
|
|
173
195
|
module.exports = zDropbox;
|
package/lib/zRoute.js
CHANGED
|
@@ -4840,6 +4840,7 @@ zRoute.updateSQL = async (req, res, table, data, whereData) => {
|
|
|
4840
4840
|
let MYMODEL = MYMODELS[table];
|
|
4841
4841
|
let fields = MYMODEL.keys;
|
|
4842
4842
|
const userId = res.locals.userId;
|
|
4843
|
+
const room = res.locals.token;
|
|
4843
4844
|
if (fields.includes("updated_at")) {
|
|
4844
4845
|
data.updated_at = Util.now();
|
|
4845
4846
|
}
|
|
@@ -4912,14 +4913,17 @@ zRoute.updateSQL = async (req, res, table, data, whereData) => {
|
|
|
4912
4913
|
const metadata = await dbx.filesGetMetadata({
|
|
4913
4914
|
path: filepath1,
|
|
4914
4915
|
});
|
|
4915
|
-
|
|
4916
|
+
newArr.push(item);
|
|
4917
|
+
io.to(room).emit("info", filepath1);
|
|
4918
|
+
/*const finalPath = metadata.result.path_display;
|
|
4916
4919
|
if (finalPath) {
|
|
4917
4920
|
newArr.push(item);
|
|
4918
|
-
|
|
4921
|
+
io.to(room).emit("info",filepath1)
|
|
4922
|
+
}*/
|
|
4919
4923
|
} catch (e) {
|
|
4920
4924
|
//check in dir2 temp folder
|
|
4925
|
+
let filepath2 = `${dir2}/${item}`;
|
|
4921
4926
|
try {
|
|
4922
|
-
let filepath2 = `${dir2}/${item}`;
|
|
4923
4927
|
const metadata = await dbx.filesGetMetadata({
|
|
4924
4928
|
path: filepath2,
|
|
4925
4929
|
});
|
|
@@ -4933,13 +4937,11 @@ zRoute.updateSQL = async (req, res, table, data, whereData) => {
|
|
|
4933
4937
|
to_dir: dir1,
|
|
4934
4938
|
});
|
|
4935
4939
|
newArr.push(newItem);
|
|
4936
|
-
|
|
4937
|
-
from_path: `${dir2}/${item}`,
|
|
4938
|
-
to_path: `${dir1}/${newItem}`,
|
|
4939
|
-
});*/
|
|
4940
|
+
io.to(room).emit("info", `${filepath2}`);
|
|
4940
4941
|
}
|
|
4941
4942
|
} catch (e) {
|
|
4942
4943
|
console.log(e);
|
|
4944
|
+
io.to(room).emit("errormessage", `no file ${filepath2}`);
|
|
4943
4945
|
}
|
|
4944
4946
|
}
|
|
4945
4947
|
}
|