RAW: Alterado configurações para coleta de dados da API

This commit is contained in:
Rafael Alves Lopes 2025-11-05 15:49:37 -03:00
parent b7f4ef92f2
commit 140212f321
3 changed files with 61 additions and 4 deletions

View File

@ -2,7 +2,7 @@ const ticketService = require('../services/ticketService.js');
const closeTicket = async (req, res) => {
try {
const closingTicket = await ticketService.fechaTicket(req.params.id);
const closingTicket = await ticketService.fechaTicket(req);
res.status(200).json(closingTicket);
} catch (error) {
res.status(500).json({ error: error.message });

View File

@ -3,6 +3,6 @@ const ticketController = require('./controller/ticketController.js');
const router = Router();
router.post('/close-ticket/:id', ticketController.closeTicket);
router.post('/close-ticket', ticketController.closeTicket);
module.exports = router;

View File

@ -1,9 +1,66 @@
const fechaTicket = async (ticketId) => {
const fechaTicket = async (req) => {
// Lógica para fechar o ticket no GLPI
// Exemplo fictício:
return { id: ticketId, status: 'closed' };
// Exemplo JSON que vem na requisição:
// {
// "item": {
// "id": 27779,
// "itemtype": "Ticket",
// "items_id": 34213,
// "content": "<p>Closing Task<\/p>",
// "user": {
// "id": 917,
// "name": "rafael.lopes"
// },
// "user_editor": null
// },
// "event": "new",
// "parent_item": {
// "id": 34213,
// "name": "TESTE",
// "content": "<p>teste<\/p>",
// "is_deleted": false,
// "urgency": 3,
// "impact": 3,
// "priority": 3,
// "actiontime": 0,
// "date_creation": "2025-11-03T16:26:12-03:00",
// "date_mod": "2025-11-05T10:44:03-03:00",
// "date": "2025-11-03T16:26:12-03:00",
// "type": 1,
// "external_id": "",
// "status": {
// "id": 5,
// "name": "Solucionado"
// },
// "category": {
// "id": 5814,
// "name": "HubSoft"
// },
// "location": null,
// "request_type": {
// "id": 1,
// "name": "Helpdesk"
// },
// "entity": {
// "id": 0,
// "name": "Contratos Ativos",
// "completename": "Contratos Ativos"
// },
// "team": []
//     }
// }
// armazenar o body numa const
const bodyRequest = req.body;
return {bodyRequest};
}
module.exports = { fechaTicket };