mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
* Test profile settings * NPM Version change * Use console log * Use console log for client * Use console log for client.sbx * Use console log for client.ddata * Use console log for client again * revert * Added multi-profile reporting capabilities Co-authored-by: VIS TFS Admin <liveid@visualsolution.co.uk>
This commit is contained in:
co-authored by
VIS TFS Admin
parent
500de79b5d
commit
802d98684f
@@ -16,6 +16,31 @@ function configure (app, wares, ctx) {
|
||||
api.use(wares.bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
api.use(ctx.authorization.isPermitted('api:profile:read'));
|
||||
|
||||
|
||||
/**
|
||||
* @function query_models
|
||||
* Perform the standard query logic, translating API parameters into mongo
|
||||
* db queries in a fairly regimented manner.
|
||||
* This middleware executes the query, returning the results as JSON
|
||||
*/
|
||||
function query_models (req, res, next) {
|
||||
var query = req.query;
|
||||
|
||||
// If "?count=" is present, use that number to decide how many to return.
|
||||
if (!query.count) {
|
||||
query.count = consts.ENTRIES_DEFAULT_COUNT;
|
||||
}
|
||||
|
||||
// perform the query
|
||||
ctx.profile.list_query(query, function payload(err, profiles) {
|
||||
return res.json(profiles);
|
||||
});
|
||||
}
|
||||
|
||||
// List profiles available
|
||||
api.get('/profiles/', query_models);
|
||||
|
||||
// List profiles available
|
||||
api.get('/profile/', function(req, res) {
|
||||
ctx.profile.list(function (err, attribute) {
|
||||
|
||||
Reference in New Issue
Block a user