Fix likes display, add avatar system (presets+upload), improve desktop layout, fix profile viewing
This commit is contained in:
@@ -35,7 +35,7 @@ router.get('/', (req: AuthRequest, res: Response) => {
|
||||
|
||||
const cats = queryAll(
|
||||
`SELECT c.id, c.image_url, c.caption, c.created_at, c.user_id,
|
||||
u.username, u.points AS user_points,
|
||||
u.username, u.points AS user_points, u.avatar_url AS user_avatar_url,
|
||||
(SELECT COUNT(*) FROM likes WHERE cat_id = c.id) AS likes_count,
|
||||
(SELECT COUNT(*) FROM comments WHERE cat_id = c.id) AS comments_count
|
||||
FROM cats c
|
||||
@@ -55,7 +55,7 @@ router.get('/user/:userId', (req: AuthRequest, res: Response) => {
|
||||
const userId = parseInt(req.params.userId);
|
||||
const cats = queryAll(
|
||||
`SELECT c.id, c.image_url, c.caption, c.created_at, c.user_id,
|
||||
u.username, u.points AS user_points,
|
||||
u.username, u.points AS user_points, u.avatar_url AS user_avatar_url,
|
||||
(SELECT COUNT(*) FROM likes WHERE cat_id = c.id) AS likes_count,
|
||||
(SELECT COUNT(*) FROM comments WHERE cat_id = c.id) AS comments_count
|
||||
FROM cats c
|
||||
@@ -71,7 +71,7 @@ router.get('/user/:userId', (req: AuthRequest, res: Response) => {
|
||||
router.get('/:id', (req: AuthRequest, res: Response) => {
|
||||
const cat = queryOne(
|
||||
`SELECT c.id, c.image_url, c.caption, c.created_at, c.user_id,
|
||||
u.username, u.points AS user_points,
|
||||
u.username, u.points AS user_points, u.avatar_url AS user_avatar_url,
|
||||
(SELECT COUNT(*) FROM likes WHERE cat_id = c.id) AS likes_count,
|
||||
(SELECT COUNT(*) FROM comments WHERE cat_id = c.id) AS comments_count
|
||||
FROM cats c
|
||||
@@ -106,7 +106,7 @@ router.post('/', authMiddleware, upload.single('image'), (req: AuthRequest, res:
|
||||
|
||||
const cat = queryOne(
|
||||
`SELECT c.id, c.image_url, c.caption, c.created_at, c.user_id,
|
||||
u.username, u.points AS user_points,
|
||||
u.username, u.points AS user_points, u.avatar_url AS user_avatar_url,
|
||||
0 AS likes_count,
|
||||
0 AS comments_count
|
||||
FROM cats c
|
||||
|
||||
Reference in New Issue
Block a user