Mercurial Hosting > linkmystyle
comparison src/private/reports/users.json.luan @ 0:8f4df159f06b
start public repo
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 11 Jul 2025 20:57:49 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8f4df159f06b |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local ipairs = Luan.ipairs or error() | |
4 local Parsers = require "luan:Parsers.luan" | |
5 local json_string = Parsers.json_string or error() | |
6 local Io = require "luan:Io.luan" | |
7 local Http = require "luan:http/Http.luan" | |
8 local User = require "site:/lib/User.luan" | |
9 local Db = require "site:/lib/Db.luan" | |
10 | |
11 | |
12 local function by_links(user1,user2) | |
13 return user1.links > user2.links | |
14 end | |
15 | |
16 return function() | |
17 local users = User.search("user_registered:*") | |
18 local emails = {} | |
19 for _, user in ipairs(users) do | |
20 if Db.count("link_user_id:"..user.id) > 0 then | |
21 emails[#emails+1] = user.email | |
22 end | |
23 end | |
24 Io.stdout = Http.response.text_writer() | |
25 %><%= json_string(emails) %><% | |
26 end |