tango-app-api-infra 3.1.27 → 3.1.28
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
|
@@ -69,6 +69,19 @@ export async function createTicket( req, res ) {
|
|
|
69
69
|
showToClient: req.body.showToClient,
|
|
70
70
|
processType: ( auditInputData?.data?.length && auditOutputData?.data?.length ) ? 'audit' : 'reduction',
|
|
71
71
|
};
|
|
72
|
+
|
|
73
|
+
const reqData = {
|
|
74
|
+
'dateString': dayjs( new Date( req.body.Date ) ).format( 'YYYY-MM-DD' ),
|
|
75
|
+
'storeId': req.body.storeId,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const getFootfall = await postApi( `${JSON.parse( process.env.URL ).oldapidomain}/getFootfall`, reqData );
|
|
80
|
+
|
|
81
|
+
if ( getFootfall?.data?.length ) {
|
|
82
|
+
req.body.dataMismatch['reportedFootfall'] = getFootfall.data[0].footfall_count;
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
req.body.issueDate = new Date( req.body.Date );
|
|
73
86
|
req.body.ticketId = 'TE_DM_' + new Date().valueOf();
|
|
74
87
|
let create = await createTangoTicket( req.body );
|
|
@@ -118,6 +131,25 @@ export async function createTicket( req, res ) {
|
|
|
118
131
|
}
|
|
119
132
|
}
|
|
120
133
|
|
|
134
|
+
async function postApi( url, data ) {
|
|
135
|
+
const requestOptions = {
|
|
136
|
+
method: 'POST',
|
|
137
|
+
headers: {
|
|
138
|
+
'Content-Type': 'application/json',
|
|
139
|
+
'Authorization': 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66',
|
|
140
|
+
},
|
|
141
|
+
body: JSON.stringify( data ),
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
const response = await fetch( url, requestOptions );
|
|
146
|
+
const data = await response.json();
|
|
147
|
+
return data;
|
|
148
|
+
} catch ( error ) {
|
|
149
|
+
logger.error( { error: error, message: data, function: 'postApi' } );
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
121
153
|
export async function updateMat( req, res ) {
|
|
122
154
|
try {
|
|
123
155
|
let updateValue = {};
|