RAW: Alterado configurações para coleta de dados da API
This commit is contained in:
parent
b7f4ef92f2
commit
140212f321
@ -2,7 +2,7 @@ const ticketService = require('../services/ticketService.js');
|
|||||||
|
|
||||||
const closeTicket = async (req, res) => {
|
const closeTicket = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const closingTicket = await ticketService.fechaTicket(req.params.id);
|
const closingTicket = await ticketService.fechaTicket(req);
|
||||||
res.status(200).json(closingTicket);
|
res.status(200).json(closingTicket);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: error.message });
|
res.status(500).json({ error: error.message });
|
||||||
|
|||||||
@ -3,6 +3,6 @@ const ticketController = require('./controller/ticketController.js');
|
|||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.post('/close-ticket/:id', ticketController.closeTicket);
|
router.post('/close-ticket', ticketController.closeTicket);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
@ -1,9 +1,66 @@
|
|||||||
|
|
||||||
|
|
||||||
const fechaTicket = async (ticketId) => {
|
const fechaTicket = async (req) => {
|
||||||
// Lógica para fechar o ticket no GLPI
|
// Lógica para fechar o ticket no GLPI
|
||||||
// Exemplo fictício:
|
// 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 };
|
module.exports = { fechaTicket };
|
||||||
Loading…
Reference in New Issue
Block a user