mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-12 22:18:49 +00:00
installed minIO and added Endpoints for creating posts and retrieving a post with the ID
This commit is contained in:
parent
a199f19ff4
commit
2fc8a70d55
12 changed files with 962 additions and 71 deletions
89
code/backend/src/routes/postRoutes.ts
Normal file
89
code/backend/src/routes/postRoutes.ts
Normal file
|
@ -0,0 +1,89 @@
|
|||
import express from "express";
|
||||
import {
|
||||
getPost,
|
||||
uploadPost as uploadPost,
|
||||
} from "../controllers/postController";
|
||||
import { upload } from "../middleware/fileUpload";
|
||||
import { authenticateToken } from "../middleware/authenticateToken";
|
||||
import { validateData } from "../middleware/validationMiddleware";
|
||||
import { uploadPostSchema } from "../schemas/postSchemas";
|
||||
const router = express.Router();
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/posts/upload:
|
||||
* post:
|
||||
* summary: Upload multiple images with metadata
|
||||
* tags:
|
||||
* - posts
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* multipart/form-data:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - images
|
||||
* - description
|
||||
* - status
|
||||
* properties:
|
||||
* images:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* format: binary
|
||||
* status:
|
||||
* type: string
|
||||
* enum: [HIDDEN, PUBLIC, PRIVATE, ARCHIVED]
|
||||
* description:
|
||||
* type: string
|
||||
* tags:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* encoding:
|
||||
* images:
|
||||
* style: form
|
||||
* explode: true
|
||||
* tags:
|
||||
* style: form
|
||||
* explode: true
|
||||
* status:
|
||||
* style: form
|
||||
* description:
|
||||
* style: form
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Images uploaded successfully
|
||||
*/
|
||||
router.post(
|
||||
"/upload",
|
||||
authenticateToken(),
|
||||
upload,
|
||||
validateData(uploadPostSchema),
|
||||
uploadPost
|
||||
);
|
||||
/**
|
||||
* @swagger
|
||||
* /api/posts/get/{postId}:
|
||||
* get:
|
||||
* summary: Get Post
|
||||
* tags: [posts]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: postId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* description: The post id
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Ok
|
||||
* 401:
|
||||
* description: not authenticated
|
||||
*/
|
||||
router.get("/get/:postId", getPost);
|
||||
|
||||
export default router;
|
Loading…
Add table
Add a link
Reference in a new issue