From 14f1051f4d13d090f35f6dee333f7efd95e36876 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 11 Oct 2018 20:52:52 -0700 Subject: [PATCH] Delete and rename now working on duplicates Signed-off-by: James Ketrenos --- server/routes/photos.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server/routes/photos.js b/server/routes/photos.js index 13c1c35..510bdd9 100755 --- a/server/routes/photos.js +++ b/server/routes/photos.js @@ -184,7 +184,20 @@ const getPhoto = function(id) { return null; } - return photos[0]; + if (!photos[0].duplicate) { + return photos[0]; + } + + return photoDB.sequelize.query("SELECT hash FROM photohashes WHERE photoId=:duplicate", { + replacements: photos[0], + type: photoDB.Sequelize.QueryTypes.SELECT, + raw: true + }).then(function(results) { + if (results.length != 0) { + photos[0].hash = results[0].hash; + } + return photos[0]; + }); }); }