37 lines
No EOL
882 B
JavaScript
37 lines
No EOL
882 B
JavaScript
import Route from "../route.js";
|
|
import comment from "./comment.js";
|
|
import initDb from "../db.js";
|
|
|
|
let db = await initDb();
|
|
|
|
let main = new Route([comment], async function (req, res, input) {
|
|
let { id } = req.query;
|
|
let videos = await db.all('SELECT * FROM video WHERE username = ? ORDER BY date DESC', [
|
|
req.query.id
|
|
]);
|
|
|
|
let followers = await db.all('SELECT * FROM follow WHERE target = ?', [
|
|
req.query.id
|
|
]);
|
|
|
|
let following = await db.all('SELECT * FROM follow WHERE username = ?', [
|
|
req.query.id
|
|
]);
|
|
|
|
let user = await db.all('SELECT * FROM user WHERE username = ?', [
|
|
req.query.id
|
|
]);
|
|
|
|
res.render('user', {
|
|
...input,
|
|
id,
|
|
videos,
|
|
followers,
|
|
following,
|
|
user,
|
|
icon: `${process.env.URL}/pfp/${id}.png`
|
|
});
|
|
return true;
|
|
});
|
|
|
|
export default main; |