Mercurial Hosting > linkmystyle
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/private/reports/users.json.luan Fri Jul 11 20:57:49 2025 -0600 @@ -0,0 +1,26 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local ipairs = Luan.ipairs or error() +local Parsers = require "luan:Parsers.luan" +local json_string = Parsers.json_string or error() +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local User = require "site:/lib/User.luan" +local Db = require "site:/lib/Db.luan" + + +local function by_links(user1,user2) + return user1.links > user2.links +end + +return function() + local users = User.search("user_registered:*") + local emails = {} + for _, user in ipairs(users) do + if Db.count("link_user_id:"..user.id) > 0 then + emails[#emails+1] = user.email + end + end + Io.stdout = Http.response.text_writer() + %><%= json_string(emails) %><% +end