mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-08 13:38:47 +00:00
added endpoint for getting postTags and fixed follow bug
This commit is contained in:
parent
f035635df2
commit
b868bdb599
8 changed files with 92 additions and 14 deletions
|
@ -3,6 +3,7 @@ import express, { Request, Response } from "express";
|
|||
import { JwtPayload } from "jsonwebtoken";
|
||||
import { PrismaClient, Follow } from "../../prisma/app/generated/prisma/client";
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export const followUser = async (req: Request, res: Response) => {
|
||||
const username: string = req.params.username;
|
||||
const followingUser: JwtPayload = req.user!;
|
||||
|
@ -27,7 +28,7 @@ export const followUser = async (req: Request, res: Response) => {
|
|||
});
|
||||
return;
|
||||
}
|
||||
if (user.username == username) {
|
||||
if (user.id == followingUser.sub) {
|
||||
res.status(StatusCodes.BAD_REQUEST).json({
|
||||
error: "Bad Request",
|
||||
details: [{ message: "You can`t follow yourself" }],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue