backend: implement Issues#do_POST

This commit is contained in:
0x1eef 2023-12-20 19:37:59 -03:00
parent ff4471b532
commit 3c14c7f02f

View file

@ -1,4 +1,14 @@
class Twenty::Servlet::Issues < Twenty::Servlet
def do_POST(req, res)
Twenty::Issue.new(
JSON.parse(req.body)
).save!
write res,
{"content-type" => "application/json"},
{"ok": true, errors: []}.to_json
rescue
write res,
{"content-type" => "application/json"},
{"ok": false, errors: [$!.class]}.to_json
end
end