mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 14:37:21 +01:00
sort recent by created desc
This commit is contained in:
@@ -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