22 lines
653 B
JavaScript
22 lines
653 B
JavaScript
var promise = require('bluebird');
|
|
var options = {
|
|
promiseLib: promise
|
|
};
|
|
var pgp = require('pg-promise')(options);
|
|
var connection = Connections.pg_sjy_metadata;
|
|
var db = pgp(connection);
|
|
|
|
|
|
exports.getTop10Metadata = function () {
|
|
return db.any('select id, uuid, title, description, ts_created from metadata limit 10')
|
|
};
|
|
|
|
exports.getLast10Metadata = function () {
|
|
return db.any('select id, uuid, title, description, ts_created from metadata order by ts_created desc limit 10')
|
|
};
|
|
|
|
exports.login = function(username) {
|
|
return db.oneOrNone('select id, username, password, usertype, email, realname from users where username = $1', [username])
|
|
};
|
|
|