Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
46 lines (37 loc) · 1.15 KB

File metadata and controls

46 lines (37 loc) · 1.15 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
server.get('/active', function(req, res, next) {
// extract query params
var params = req.params || {};
var sql = `
SELECT
users.id AS id,
users.first_name AS first_name,
users.last_name AS last_name,
MD5(users.email) AS email_md5,
users.created_at AS created_at,
users.modified_at AS modified_at,
COUNT(uploads.user_id) as posts,
(SELECT id FROM followers WHERE followers.user_id = ? AND followers.follower_id = users.id) AS following
FROM users
LEFT JOIN
uploads
ON uploads.user_id = users.id
WHERE users.id != ?
GROUP BY uploads.user_id, users.id
HAVING posts > 0 AND following IS NULL
ORDER BY posts DESC
LIMIT 3
`;
db.query(sql, [params.user_id, params.user_id], function(err, result) {
// catch all errors
if (err) {
// use global logger to log to console
log.error(err);
// return error message to client
return next(new restify.InternalError(err.message));
}
// send response to client
res.send(200, result);
return next();
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.