docs: Update Swagger documentation for Profile endpoints
Updated the Swagger documentation for various Profile endpoints to accurately reflect their return types, including arrays of Profile objects and detailed schemas for specific responses.
This commit is contained in:
@@ -21,29 +21,93 @@ DB.getDB.then((DB) => {
|
|||||||
* description: User profile management
|
* description: User profile management
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /user/mine:
|
* components:
|
||||||
* get:
|
* schemas:
|
||||||
* summary: Get all profiles for the logged-in user
|
* Profile:
|
||||||
* tags: [Profiles]
|
* type: object
|
||||||
* security:
|
* properties:
|
||||||
* - cookieAuth: []
|
* userid:
|
||||||
* responses:
|
* type: string
|
||||||
* 200:
|
* description: The ID of the user associated with the profile.
|
||||||
* description: OK
|
* profile:
|
||||||
* content:
|
* type: object
|
||||||
* application/json:
|
* properties:
|
||||||
* schema:
|
* firstName:
|
||||||
* type: object
|
* type: string
|
||||||
* properties:
|
* lastName:
|
||||||
* status:
|
* type: string
|
||||||
* type: string
|
* photo:
|
||||||
* profiles:
|
* type: string
|
||||||
* type: array
|
* location:
|
||||||
* items:
|
* type: string
|
||||||
* type: object
|
* language:
|
||||||
*/
|
* type: string
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* description:
|
||||||
|
* type: string
|
||||||
|
* data:
|
||||||
|
* type: object
|
||||||
|
* description: Additional custom data for the profile.
|
||||||
|
* username:
|
||||||
|
* type: string
|
||||||
|
* following:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: string
|
||||||
|
* description: List of profile IDs this profile is following.
|
||||||
|
* lastUpdate:
|
||||||
|
* type: string
|
||||||
|
* format: date-time
|
||||||
|
* newsFeedCache:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* notifications:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* isGroup:
|
||||||
|
* type: boolean
|
||||||
|
* isCourse:
|
||||||
|
* type: boolean
|
||||||
|
* isPrivate:
|
||||||
|
* type: boolean
|
||||||
|
* isChat:
|
||||||
|
* type: boolean
|
||||||
|
* subscribed:
|
||||||
|
* type: object
|
||||||
|
* description: Users subscribed to this group (if isGroup is true).
|
||||||
|
* pending:
|
||||||
|
* type: object
|
||||||
|
* description: Pending subscription requests for private groups.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /user/mine:
|
||||||
|
* get:
|
||||||
|
* summary: Get all profiles for the logged-in user
|
||||||
|
* tags: [Profiles]
|
||||||
|
* security:
|
||||||
|
* - cookieAuth: []
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* profiles:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
|
*/
|
||||||
router.get("/mine", async (req, res) => {
|
router.get("/mine", async (req, res) => {
|
||||||
let userid = getUserId(req);
|
let userid = getUserId(req);
|
||||||
let profiles = await DB.getUserProfiles(userid);
|
let profiles = await DB.getUserProfiles(userid);
|
||||||
@@ -67,9 +131,14 @@ DB.getDB.then((DB) => {
|
|||||||
* required: true
|
* required: true
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* type: object
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/new", async (req, res) => { //Deprecated please use route post("/")
|
router.get("/new", async (req, res) => { //Deprecated please use route post("/")
|
||||||
let profile = {
|
let profile = {
|
||||||
@@ -97,13 +166,14 @@ DB.getDB.then((DB) => {
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: '#/components/schemas/Profile'
|
||||||
* properties:
|
|
||||||
* content:
|
|
||||||
* type: object
|
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.post("/", async (req, res) => {
|
router.post("/", async (req, res) => {
|
||||||
let profile = {
|
let profile = {
|
||||||
@@ -126,32 +196,32 @@ DB.getDB.then((DB) => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /user/invite:
|
* /user/invite:
|
||||||
* post:
|
* post:
|
||||||
* summary: Invite a new user by email
|
* summary: Invite a new user by email
|
||||||
* tags: [Profiles]
|
* tags: [Profiles]
|
||||||
* security:
|
* security:
|
||||||
* - cookieAuth: []
|
* - cookieAuth: []
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* type: object
|
||||||
* properties:
|
* properties:
|
||||||
* name:
|
* name:
|
||||||
* type: string
|
* type: string
|
||||||
* email:
|
* email:
|
||||||
* type: string
|
* type: string
|
||||||
* format: email
|
* format: email
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
* 400:
|
* 400:
|
||||||
* description: Bad request
|
* description: Bad request
|
||||||
*/
|
*/
|
||||||
router.post("/invite", async (req, res) => {
|
router.post("/invite", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const userid = getUserId(req);
|
const userid = getUserId(req);
|
||||||
@@ -207,7 +277,17 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
*/
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* invitation:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
|
*
|
||||||
|
*/
|
||||||
router.get("/invite/:email", async (req, res) => {
|
router.get("/invite/:email", async (req, res) => {
|
||||||
const userid = getUserId(req);
|
const userid = getUserId(req);
|
||||||
const email = req.params.email;
|
const email = req.params.email;
|
||||||
@@ -231,6 +311,17 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* groups:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/groups", async (req, res) => {
|
router.get("/groups", async (req, res) => {
|
||||||
let groups = await DB.getGroups();
|
let groups = await DB.getGroups();
|
||||||
@@ -251,6 +342,17 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* groups:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/groups/following", async (req, res) => {
|
router.get("/groups/following", async (req, res) => {
|
||||||
const profileId = getProfileId(req);
|
const profileId = getProfileId(req);
|
||||||
@@ -274,10 +376,14 @@ DB.getDB.then((DB) => {
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: '#/components/schemas/Profile'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.post("/groups", async (req, res) => {
|
router.post("/groups", async (req, res) => {
|
||||||
let profile = {
|
let profile = {
|
||||||
@@ -304,6 +410,17 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* groups:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/courses", async (req, res) => {
|
router.get("/courses", async (req, res) => {
|
||||||
let groups = await DB.getCourses();
|
let groups = await DB.getCourses();
|
||||||
@@ -418,6 +535,17 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* groups:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/groups/search", async (req, res) => {
|
router.get("/groups/search", async (req, res) => {
|
||||||
let query = req.query.query;
|
let query = req.query.query;
|
||||||
@@ -446,6 +574,15 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* groups:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/groups/:id", async (req, res) => {
|
router.get("/groups/:id", async (req, res) => {
|
||||||
const groupid = req.params.id;
|
const groupid = req.params.id;
|
||||||
@@ -531,6 +668,17 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
|
* profiles:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/search", async (req, res) => {
|
router.get("/search", async (req, res) => {
|
||||||
let query = req.query.query;
|
let query = req.query.query;
|
||||||
@@ -563,6 +711,13 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
*/
|
*/
|
||||||
router.post("/setData", (req, res) => {
|
router.post("/setData", (req, res) => {
|
||||||
const key = req.body.key;
|
const key = req.body.key;
|
||||||
@@ -590,12 +745,19 @@ DB.getDB.then((DB) => {
|
|||||||
* type: object
|
* type: object
|
||||||
* properties:
|
* properties:
|
||||||
* profile:
|
* profile:
|
||||||
* type: object
|
* $ref: '#/components/schemas/Profile'
|
||||||
* data:
|
* data:
|
||||||
* type: object
|
* type: object
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
*/
|
*/
|
||||||
router.post("/myProfile", async (req, res) => {
|
router.post("/myProfile", async (req, res) => {
|
||||||
let profile = {
|
let profile = {
|
||||||
@@ -627,6 +789,10 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/Profile'
|
||||||
*/
|
*/
|
||||||
router.get("/:id", async (req, res) => {
|
router.get("/:id", async (req, res) => {
|
||||||
let profileId = req.params.id;
|
let profileId = req.params.id;
|
||||||
@@ -654,6 +820,13 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
*/
|
*/
|
||||||
router.delete("/:id", async (req, res) => {
|
router.delete("/:id", async (req, res) => {
|
||||||
const profileId = req.params.id;
|
const profileId = req.params.id;
|
||||||
@@ -685,6 +858,13 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
*/
|
*/
|
||||||
router.get("/:id/follow", async (req, res) => {
|
router.get("/:id/follow", async (req, res) => {
|
||||||
let followProfileId = req.params.id;
|
let followProfileId = req.params.id;
|
||||||
@@ -713,6 +893,13 @@ DB.getDB.then((DB) => {
|
|||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* status:
|
||||||
|
* type: string
|
||||||
*/
|
*/
|
||||||
router.get("/:id/unfollow", async (req, res) => {
|
router.get("/:id/unfollow", async (req, res) => {
|
||||||
let followProfileId = req.params.id;
|
let followProfileId = req.params.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user