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 268a00d026
commit 5ead261db2
8 changed files with 92 additions and 14 deletions

View file

@ -1,6 +1,7 @@
import express from "express";
import {
getPost,
getTags,
getUserPosts,
like,
removeLike,
@ -156,4 +157,29 @@ router.post("/like/:postId", authenticateToken(), like);
*/
router.delete("/removeLike/:postId", authenticateToken(), removeLike);
/**
* @swagger
* /api/posts/tags:
* get:
* summary: Get posttags
* description: Returns posttags
* tags:
* - Posts
* responses:
* 200:
* description: List of tags
* content:
* application/json:
* schema:
* type: object
* properties:
* tags:
* type: array
* items:
* type: string
* 500:
* description: Server error
*/
router.get("/tags", getTags);
export default router;

View file

@ -8,7 +8,7 @@ import {
} from "../controllers/profileController";
const profileRouter = express.Router();
import { upload } from "../middleware/uploadSingle";
import { updateBioSchema } from "../schemas/feedSchemas";
import { updateBioSchema } from "../schemas/profileSchemas";
import { validateData } from "../middleware/validationMiddleware";
/**
* @swagger
@ -97,7 +97,7 @@ profileRouter.get("/getProfilePicture/:username", getProfilePicture);
* 401:
* description: Unauthorized
*/
profileRouter.post(
profileRouter.put(
"/updateBio",
authenticateToken(),
validateData(updateBioSchema),
@ -105,7 +105,7 @@ profileRouter.post(
);
/**
* @swagger
* /api/profile/get/{username}:
* /api/profile/{username}:
* get:
* summary: Get user data
* tags: [Profile]
@ -124,5 +124,5 @@ profileRouter.post(
* 401:
* description: Ungültige Anmeldedaten
*/
profileRouter.get("/get/:username", getProfile);
profileRouter.get("/:username", getProfile);
export default profileRouter;