sjy-ecos/model/sjy_eco_v1.js

22 lines
653 B
JavaScript
Raw Normal View History

2018-01-29 07:29:19 +00:00
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')
};
2018-01-30 04:26:04 +00:00
exports.login = function(username) {
return db.oneOrNone('select id, username, password, usertype, email, realname from users where username = $1', [username])
};
2018-01-29 07:45:42 +00:00