You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
681 B
JavaScript
26 lines
681 B
JavaScript
'use strict';
|
|
|
|
const db = require('../config').database;
|
|
const { domain, name } = require('../config').server;
|
|
const { objectMapper, pick, isEmpty } = require('../utils/commons.util');
|
|
const initModels = require('../models/init-models');
|
|
|
|
const Sequelize = db.sequelize;
|
|
const models = initModels(Sequelize);
|
|
|
|
const AgentSessionsModelModel = models.agent_sessions;
|
|
|
|
const getAgentSession = async where => {
|
|
const r = await AgentSessionsModelModel.findOne({
|
|
where,
|
|
});
|
|
return r?.toJSON() || {};
|
|
};
|
|
|
|
const createAgentSession = async data => {
|
|
const r = await AgentSessionsModelModel.create(data);
|
|
return r;
|
|
};
|
|
|
|
module.exports = { getAgentSession, createAgentSession };
|