From d21736d52c3e7cc93eb965f338b6a6dfb42471c1 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Thu, 17 Jul 2025 09:59:50 -0400 Subject: [PATCH] docs: Update Swagger documentation for Post endpoints Updated the Swagger documentation for various Post endpoints to accurately reflect their return types, including arrays of Post objects and detailed schemas for specific responses. --- routes/post.js | 202 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) diff --git a/routes/post.js b/routes/post.js index 2168d11..eb9bec5 100644 --- a/routes/post.js +++ b/routes/post.js @@ -86,6 +86,58 @@ DB.getDB.then((DB) => { /** * @swagger + * components: + * schemas: + * Post: + * type: object + * properties: + * profileid: + * type: string + * description: The ID of the profile that created the post. + * content: + * type: string + * description: The content of the post. + * createdAt: + * type: string + * format: date-time + * description: The timestamp when the post was created. + * reactions: + * type: object + * description: An object containing reactions to the post, keyed by profile ID. + * comments: + * type: array + * items: + * type: object + * description: An array of comments on the post. + * bookmarks: + * type: array + * items: + * type: string + * description: An array of profile IDs that bookmarked the post. + * nonOrganicType: + * type: string + * description: Type of non-organic content (e.g., "News", "PopularUsers", "PopularGroups"). + * contentHistory: + * type: array + * items: + * type: string + * description: A history of content edits. + * toProfile: + * type: string + * description: The ID of the profile this post is directed to (e.g., a group). + * lastUpdated: + * type: string + * format: date-time + * description: The timestamp when the post was last updated. + * tags: + * type: array + * items: + * type: string + * description: An array of tags associated with the post. + * chatSenderId: + * type: string + * description: The ID of the chat sender, if applicable. + * * /post/organic: * get: * summary: Get the organic feed for the current user @@ -95,6 +147,12 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/organic", async (req, res) => { const profileid = getProfileId(req); @@ -116,6 +174,12 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/", async (req, res) => { const profileid = getProfileId(req); @@ -143,6 +207,12 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: array + * items: + * $ref: '#/components/schemas/Post' * 400: * description: Tag is required */ @@ -177,6 +247,12 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/usr/:id", async (req, res) => { const profileId = req.params.id; @@ -210,6 +286,17 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * posts: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/usr/:id/images", async (req, res) => { const profileid = req.params.id; @@ -238,6 +325,17 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * posts: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/usr/:id/embedded", async (req, res) => { const profileid = req.params.id; @@ -266,6 +364,17 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * posts: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/usr/:id/media", async (req, res) => { const profileid = req.params.id; @@ -609,6 +718,17 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * posts: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/images", async (req, res) => { const profileid = getProfileId(req); @@ -630,6 +750,17 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * posts: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/embedded", async (req, res) => { const profileid = getProfileId(req); @@ -651,6 +782,17 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * posts: + * type: array + * items: + * $ref: '#/components/schemas/Post' */ router.get("/media", async (req, res) => { const profileid = getProfileId(req); @@ -672,6 +814,62 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * recentMedia: + * type: object + * additionalProperties: + * type: array + * items: + * type: object + * properties: + * watchRecord: + * type: object + * _id: + * type: string + * profileid: + * type: string + * content: + * type: string + * createdAt: + * type: string + * format: date-time + * reactions: + * type: object + * comments: + * type: array + * items: + * type: object + * bookmarks: + * type: array + * items: + * type: string + * nonOrganicType: + * type: string + * contentHistory: + * type: array + * items: + * type: string + * toProfile: + * type: string + * lastUpdated: + * type: string + * format: date-time + * tags: + * type: array + * items: + * type: string + * chatSenderId: + * type: string + * mediaProfileMap: + * type: object + * additionalProperties: + * type: object */ router.get("/course/recent", async (req, res) => { const profileid = getProfileId(req); @@ -737,6 +935,10 @@ DB.getDB.then((DB) => { * responses: * 200: * description: OK + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/Post' */ router.get("/:id", async (req, res) => { const postId = req.params.id;