add getChannels api endpoint

This commit is contained in:
Mystikfluu 2022-07-12 14:49:28 +02:00
parent be159babf0
commit ed25dffea3
2 changed files with 10 additions and 0 deletions

View File

@ -26,6 +26,7 @@ CREATE TABLE `posts` (
`post_time` bigint NOT NULL,
`post_special_text` varchar(100) DEFAULT NULL,
`post_receiver_name` varchar(100) DEFAULT NULL,
`post_is_private` tinyint DEFAULT '0',
`post_from_bot` tinyint DEFAULT '0',
`post_reply_id` bigint unsigned DEFAULT NULL,
PRIMARY KEY (`post_id`)

View File

@ -738,6 +738,15 @@ router.get("/api/getPersonalPosts", async function(req,res) {
});
})
router.get("/api/getChannels", async function(req,res) {
res.set("Access-Control-Allow-Origin","*")
let sql = `select post_receiver_name from ipost.posts where post_is_private = false group by post_receiver_name order by post_id desc;`
con.query(sql, [], function (err, result) {
if (err) throw err;
res.json(result)
});
})
router.post("/api/setBio", async function(req,res) {
res.set("Access-Control-Allow-Origin","")
let bio = req.body.Bio