Delete errors database.js
Change the format of messages into escaped backticked form to solve the cloud not deleting data older than a week.
This commit is contained in:
parent
884e0df822
commit
d445a389fc
@ -508,20 +508,20 @@ DB.deleteData = function (snID, vectorClock) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Data clearing */
|
/* Data clearing */
|
||||||
|
//Fixed the earlier error
|
||||||
DB.clearAuthorisedAppData = function (snID, app, adminID, subAdmins, timestamp) {
|
DB.clearAuthorisedAppData = function (snID, app, adminID, subAdmins, timestamp) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let statement = "DELETE FROM _" + snID +
|
let statement = `DELETE FROM _${snID}
|
||||||
" WHERE ( " +
|
WHERE
|
||||||
H_struct.TIME + " < ? AND " + //data before deleteDelay (ie, 7 days ago)
|
${H_struct.TIME} < ?
|
||||||
H_struct.APPLICATION + " = ? AND " + //data of this app
|
AND ${H_struct.APPLICATION} = ?
|
||||||
T_struct.TAG + " IS NULL " + //tag field is NULL
|
AND ${T_struct.TAG} IS NULL
|
||||||
") AND ( " +
|
AND (
|
||||||
H_struct.RECEIVER_ID + " != ? OR " + //receiver is not admin
|
${H_struct.RECEIVER_ID} != ?
|
||||||
H_struct.SENDER_ID + " NOT IN (?) " + //sender is not subAdmin
|
OR ${H_struct.SENDER_ID} NOT IN (?)
|
||||||
")";
|
)`;
|
||||||
|
|
||||||
queryResolve(statement, [timestamp, app, adminID, subAdmins])
|
queryResolve(statement, [timestamp, app, adminID,subAdmins])
|
||||||
.then(result => resolve(result))
|
.then(result => resolve(result))
|
||||||
.catch(error => reject(error));
|
.catch(error => reject(error));
|
||||||
});
|
});
|
||||||
@ -529,11 +529,11 @@ DB.clearAuthorisedAppData = function (snID, app, adminID, subAdmins, timestamp)
|
|||||||
|
|
||||||
DB.clearUnauthorisedAppData = function (snID, authorisedAppList, timestamp) {
|
DB.clearUnauthorisedAppData = function (snID, authorisedAppList, timestamp) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let statement = "DELETE FROM _" + snID +
|
let statement = `DELETE FROM _${snID}
|
||||||
" WHERE " + H_struct.TIME + " < ? AND " + //data before deleteDelay (ie, 7 days ago)
|
WHERE ${H_struct.TIME} < ?
|
||||||
H_struct.APPLICATION + " NOT IN (?) "; //app not authorised
|
AND ${H_struct.APPLICATION} NOT IN (?) ` ; //app not authorised
|
||||||
|
|
||||||
queryResolve(statement, [timestamp, authorisedAppList])
|
queryResolve(statement, [timestamp,authorisedAppList])
|
||||||
.then(result => resolve(result))
|
.then(result => resolve(result))
|
||||||
.catch(error => reject(error));
|
.catch(error => reject(error));
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user