40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
|
const axios = require('axios');
|
||
|
module.exports = Self => {
|
||
|
Self.remoteMethodCtx('closeTicket', {
|
||
|
description: 'Close tickets without response from the user',
|
||
|
accessType: 'READ',
|
||
|
returns: {
|
||
|
type: 'Object',
|
||
|
root: true
|
||
|
},
|
||
|
http: {
|
||
|
path: `/closeTicket`,
|
||
|
verb: 'GET'
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Self.closeTicket = async ctx => {
|
||
|
const models = Self.app.models;
|
||
|
// const tickets = await models.OsTicket.rawSql(`
|
||
|
// SELECT t.ticket_id AS id, t.number, ua.username, td.subject
|
||
|
// FROM ost_ticket t
|
||
|
// JOIN ost_user_account ua ON t.user_id = ua.user_id
|
||
|
// JOIN ost_ticket__cdata td ON t.ticket_id = td.ticket_id
|
||
|
// JOIN ost_ticket_priority tp ON td.priority = tp.priority_id
|
||
|
// LEFT JOIN ost_department dept ON dept.id = t.dept_id
|
||
|
// WHERE tp.priority = 'emergency'
|
||
|
// AND (t.staff_id = 0 AND t.team_id = 0)
|
||
|
// AND dept.code = 'IT'
|
||
|
// `);
|
||
|
console.log('Llega');
|
||
|
// await requestToken();
|
||
|
|
||
|
// async function requestToken() {
|
||
|
// const ostUri = 'https://cau.verdnatura.es/scp/login.php';
|
||
|
// const {data} = await axios.get(ostUri);
|
||
|
|
||
|
// console.log(data.data);
|
||
|
// }
|
||
|
};
|
||
|
};
|