|
@ -38,7 +38,7 @@ class SessionRepo {
|
|
|
static findAll(userId, handler) {
|
|
|
let sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role =0 group by w.session_id";
|
|
|
let sys_session = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = 'system' and participant_role =0 group by w.session_id";
|
|
|
let sessionSQL = "select id, name, type, create_date, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time from "
|
|
|
let sessionSQL = "select id, name, type, create_date, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time,status from "
|
|
|
+ DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.id not in ("+sys_session+")";
|
|
|
ImDb.execQuery({
|
|
|
"sql": sessionSQL,
|
|
@ -197,6 +197,17 @@ class SessionRepo {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
static updateSessionStatus(sessionId,status,handler){
|
|
|
let sql = "update " + DB_TABLES.Sessions + " set status=? where id = ?";
|
|
|
ImDb.execQuery({
|
|
|
"sql": sql,
|
|
|
"args": [status, sessionId],
|
|
|
"handler": handler || function (err, res) {
|
|
|
if(err) log.error(err);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
module.exports = SessionRepo;
|