tango-app-api-infra 3.0.75-dev → 3.0.76-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { findOneTangoTicket, createTangoTicket, updateOneTangoTicket, aggregateTangoTicket, countDocumentsTangoTicket } from '../services/tangoTicket.service.js';
|
|
3
|
-
import { logger, getUTC, appConfig, fileUpload, signedUrl } from 'tango-app-api-middleware';
|
|
3
|
+
import { logger, getUTC, appConfig, fileUpload, signedUrl, sendMessageToQueue } from 'tango-app-api-middleware';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
|
|
4
6
|
export async function createTicket( req, res ) {
|
|
5
7
|
try {
|
|
6
8
|
let ticketExist = await findOneTangoTicket( { 'issueType': req.body.issueType, 'issueDate': ( new Date( req.body.Date ) ), 'basicDetails.storeId': req.body.storeId } );
|
|
@@ -49,6 +51,17 @@ export async function createTicket( req, res ) {
|
|
|
49
51
|
attachments: [ getObject ],
|
|
50
52
|
} ];
|
|
51
53
|
await updateOneTangoTicket( { ticketId: create.ticketId }, { ticketActivity: req.body.ticketActivity } );
|
|
54
|
+
|
|
55
|
+
const ticket = await findOneTangoTicket( { ticketId: req.body.ticketId }, { 'issueDate': 1, 'basicDetails': 1, 'issueType': 1, 'dataMismatch.contactEmail': 1, '_id': 0 } );
|
|
56
|
+
|
|
57
|
+
const obj = {
|
|
58
|
+
storeId: ticket.basicDetails.storeId,
|
|
59
|
+
issueDate: dayjs( ticket.issueDate ).format( 'DD-MM-YYYY' ),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if ( req.body.issueType === 'highcount' ) {
|
|
63
|
+
await sendMessageToQueue( `${appConfig.cloud.aws.sqs.url}${appConfig.cloud.aws.sqs.highcountTopic}`, JSON.stringify( obj ) );
|
|
64
|
+
}
|
|
52
65
|
if ( create ) {
|
|
53
66
|
res.sendSuccess( 'Ticket Created Successfully' );
|
|
54
67
|
}
|