added endpoint for getting postTags and fixed follow bug

This commit is contained in:
Kai Ritthaler 2025-06-27 09:57:08 +02:00 committed by mrProm3theus
parent f035635df2
commit b868bdb599
8 changed files with 92 additions and 14 deletions

View file

@ -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" }],