-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathop_read_badge_members.js
32 lines (27 loc) · 1.24 KB
/
op_read_badge_members.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var model_group_member= require('./model_group_member');
var model_user_badge = require('./model_user_badge');
var app_ajax = require('./app_ajax');
var logger = require('./logger');
exports.handle = function (uid, data, res) {
console.log('op_read_members_by_group input = ' + JSON.stringify(data));
var group = { gid: data.gid };
var badge = { bid: data.bid };
model_group_member.getMemberIdsByGroupId(group, function(uids) {
if (uids instanceof Error) {
logger.error(__filename + ' : model_group_member.getMemberIdsByGroupId : ' + uids.message);
return app_ajax.error(res);
}
console.log('group_member is read = ' + JSON.stringify(uids));
var members = uids.map(function(uid) {return {uid: uid};});
console.log('members = ' + JSON.stringify(members));
//model_user_badge.getUserIdsbyBadgeId(badge, function(uids){
// if (uids instanceof Error) {
// logger.error(__filename + ' : model_user_badge.getUserIdsByBadgeId : ' + uids.message);
// return app_ajax.error(res);
// }
// console.log('user_badge is read = ' + JSON.stringify(uids));
//members = uids.map(function(uid) {return {uid: uid};});
//});
return app_ajax.data(res, members);
});
};