mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
sort recent by created desc
This commit is contained in:
5
server/package-lock.json
generated
5
server/package-lock.json
generated
@@ -1867,6 +1867,11 @@
|
||||
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.sortby": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
||||
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg="
|
||||
},
|
||||
"lowercase-keys": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"express": "^4.14.1",
|
||||
"glob": "^7.1.2",
|
||||
"json-fs-store": "^1.0.1",
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"uuid": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
const storeDir = process.env.JSON_STORE || '/tmp/pdfer-store/';
|
||||
|
||||
console.log(`using json-store at ${storeDir}`);
|
||||
|
||||
const store = require('json-fs-store')(storeDir);
|
||||
const { promisify } = require('util');
|
||||
|
||||
const store = require('json-fs-store')(storeDir);
|
||||
const sortBy = require('lodash.sortby');
|
||||
|
||||
const list = promisify(store.list);
|
||||
const load = promisify(store.load);
|
||||
const add = promisify(store.add);
|
||||
|
||||
module.exports = {
|
||||
list: () => list(),
|
||||
list: () => list()
|
||||
.then(result => sortBy(result, 'created').reverse()),
|
||||
load: id => load(id),
|
||||
add: item => add(item),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user