Mercurial Hosting > lang
diff src/new_chat.red.luan @ 18:820136c5ee33
add new_chat.red
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 30 Jul 2025 15:11:24 -0600 |
parents | |
children | 0c17c233c45a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/new_chat.red.luan Wed Jul 30 15:11:24 2025 -0600 @@ -0,0 +1,18 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local Http = require "luan:http/Http.luan" +local User = require "site:/lib/User.luan" +local current_user = User.current or error() +local Chat = require "site:/lib/Chat.luan" + + +return function() + local user = current_user() or error() + local chat = Chat.new{ + user_id = user.id + name = "whatever" + language = "jp" + } + chat.save() + Http.response.send_redirect("chat.html?chat="..chat.id) +end