logger upgraded, session server status upgraded

This commit is contained in:
2023-04-19 21:47:11 +03:00
parent ffa66977c3
commit 4895ca0d09
11 changed files with 135 additions and 80 deletions
+32 -2
View File
@@ -2,12 +2,42 @@ const server_error = require('../../lib/src/http/errors/server_error')
const database = require('../database/database')
const session_closed = async (req, res, next) => {
var remove_result = await database.remove_active_session(req.body.session_id)
const {
session_id,
title,
max_uniq_users,
users_at_close,
time,
unix_timestamp,
time_end,
unix_timestamp_end
} = req.body
let active_session = await database.get_active_session(session_id)
if (active_session) {
await database.add_session_to_history(
session_id,
title,
active_session.server_url,
active_session.websocket_url,
max_uniq_users,
users_at_close,
time,
unix_timestamp,
time_end,
unix_timestamp_end
)
}
let remove_result = await database.remove_active_session(session_id)
if (!remove_result) {
next(new server_error('remove session error'))
return
}
res.json({message:"removed"})
res.json({message:"successfully removed"})
}
module.exports = {