38 lines
659 B
JavaScript
38 lines
659 B
JavaScript
"use strict";
|
|
|
|
const express = require("express"),
|
|
fs = require("fs"),
|
|
url = require("url"),
|
|
config = require("config");
|
|
|
|
let photoDB;
|
|
|
|
require("../db").then(function(db) {
|
|
photoDB = db;
|
|
});
|
|
|
|
const router = express.Router();
|
|
|
|
/* Each photos has:
|
|
|
|
* locations
|
|
* people
|
|
* date
|
|
* tags
|
|
* photo info
|
|
|
|
*/
|
|
|
|
router.get("/", function(req, res/*, next*/) {
|
|
return photoDB.sequelize.query("SELECT path,filename,added FROM photos WHERE path LIKE :path", {
|
|
replacements: {
|
|
path: req.url + "%"
|
|
},
|
|
type: photoDB.Sequelize.QueryTypes.SELECT
|
|
}).then(function(photos) {
|
|
return res.status(200).json(photos);
|
|
});
|
|
});
|
|
|
|
module.exports = router;
|