logger upgraded, session server status upgraded
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user