const {pool, sql} = require('./config/sql.js'); async function init() { const sqlQuery = `SELECT A.ConfigValue AS supported_file_ext, B.ConfigValue AS protected_file_ext FROM (SELECT * FROM TB_AIP_CONFIG WHERE ConfigKey = 'SupportedFileExt' AND AipServerId = 0) A, (SELECT * FROM TB_AIP_CONFIG WHERE ConfigKey = 'ProtectedFileExt' AND AipServerId = 0) B`; try { const query = await pool; const result = await query.request().query(sqlQuery); if (result && result.recordset.length) { return result.recordset[0]; } else { return []; } } catch(error) { console.log(error); return []; } } module.exports ={ init : init, }