Added 'updated' field for operations
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
7f8650b0cf
commit
6655677605
@ -56,6 +56,7 @@ function init() {
|
||||
filename: Sequelize.STRING,
|
||||
added: Sequelize.DATE,
|
||||
modified: Sequelize.DATE,
|
||||
updated: Sequelize.DATE,
|
||||
scanned: Sequelize.DATE,
|
||||
taken: Sequelize.DATE,
|
||||
width: Sequelize.INTEGER,
|
||||
|
@ -126,7 +126,7 @@ router.put("/:id", function(req, res/*, next*/) {
|
||||
switch (req.query.a) {
|
||||
case "undelete":
|
||||
console.log("Undeleting " + req.params.id);
|
||||
return photoDB.sequelize.query("UPDATE photos SET deleted=0 WHERE id=:id", {
|
||||
return photoDB.sequelize.query("UPDATE photos SET deleted=0,updated=CURRENT_TIMESTAMP WHERE id=:id", {
|
||||
replacements: replacements
|
||||
}).then(function() {
|
||||
return res.status(200).send(req.params.id + " updated.");
|
||||
@ -210,7 +210,7 @@ router.put("/:id", function(req, res/*, next*/) {
|
||||
return rename(target, original);
|
||||
}).then(function() {
|
||||
return photoDB.sequelize.query("UPDATE photos SET " +
|
||||
"modified=:modified,width=:width,height=:height,size=:size,scanned=CURRENT_TIMESTAMP " +
|
||||
"modified=:modified,width=:width,height=:height,size=:size,updated=CURRENT_TIMESTAMP,scanned=CURRENT_TIMESTAMP " +
|
||||
"WHERE id=:id", {
|
||||
replacements: asset
|
||||
});
|
||||
@ -341,7 +341,7 @@ router.delete("/:id", function(req, res/*, next*/) {
|
||||
|
||||
const photo = photos[0];
|
||||
if (!req.query.permanent) {
|
||||
return photoDB.sequelize.query("UPDATE photos SET deleted=1 WHERE id=:id", {
|
||||
return photoDB.sequelize.query("UPDATE photos SET deleted=1,updated=CURRENT_TIMESTAMP WHERE id=:id", {
|
||||
replacements: replacements
|
||||
}).then(function() {
|
||||
return false;
|
||||
@ -487,7 +487,6 @@ router.get("/memories/:date?", function(req, res/*, next*/) {
|
||||
// console.log("Cursor" + cursor.toISOString().replace(/T.*/, ""));
|
||||
// }
|
||||
|
||||
|
||||
return photoDB.sequelize.query(query, {
|
||||
replacements: {
|
||||
cursor: cursor,
|
||||
@ -566,7 +565,7 @@ router.get("/trash", function(req, res/*, next*/) {
|
||||
return photoDB.sequelize.query(
|
||||
"SELECT photos.*,albums.path AS path,(albums.path || photos.filename) AS filepath FROM photos " +
|
||||
"LEFT JOIN albums ON albums.id=photos.albumId " +
|
||||
"WHERE deleted=1 ORDER BY photos.filename", {
|
||||
"WHERE deleted=1 ORDER BY photos.updated", {
|
||||
type: photoDB.Sequelize.QueryTypes.SELECT,
|
||||
raw: true
|
||||
}).then(function(photos) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user