feat: add get all session endpoint
This commit is contained in:
parent
71c8deeb4a
commit
2b30d5c1b0
4 changed files with 94 additions and 1 deletions
|
|
@ -339,6 +339,30 @@ const requestPairingCode = async (req, res) => {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all sessions.
|
||||
*
|
||||
* @function
|
||||
* @async
|
||||
* @param {Object} req - The HTTP request object.
|
||||
* @param {Object} res - The HTTP response object.
|
||||
* @returns {<Object>}
|
||||
*/
|
||||
const getSessions = async (req, res) => {
|
||||
// #swagger.summary = 'Get all sessions'
|
||||
// #swagger.description = 'Get all sessions.'
|
||||
/* #swagger.responses[200] = {
|
||||
description: "Retrieved all sessions.",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: { "$ref": "#/definitions/GetSessionsResponse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return res.json({ success: true, result: Array.from(sessions.keys()) })
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
startSession,
|
||||
statusSession,
|
||||
|
|
@ -348,5 +372,6 @@ module.exports = {
|
|||
restartSession,
|
||||
terminateSession,
|
||||
terminateInactiveSessions,
|
||||
terminateAllSessions
|
||||
terminateAllSessions,
|
||||
getSessions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ sessionRouter.use(middleware.apikey)
|
|||
sessionRouter.use(middleware.sessionSwagger)
|
||||
routes.use('/session', sessionRouter)
|
||||
|
||||
sessionRouter.get('/getSessions', sessionController.getSessions)
|
||||
sessionRouter.get('/start/:sessionId', middleware.sessionNameValidation, sessionController.startSession)
|
||||
sessionRouter.get('/status/:sessionId', middleware.sessionNameValidation, sessionController.statusSession)
|
||||
sessionRouter.get('/qr/:sessionId', middleware.sessionNameValidation, sessionController.sessionQrCode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue