@openinc/parse-server-opendash 2.4.83 → 2.4.84
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.
|
@@ -13,6 +13,9 @@ async function handleRequest(request) {
|
|
|
13
13
|
}
|
|
14
14
|
console.log("Handling request with", request.params);
|
|
15
15
|
try {
|
|
16
|
+
const time = new Date().getTime();
|
|
17
|
+
//Log the time taken to fetch the data in seconds
|
|
18
|
+
console.log(`Function openinc-openservice-ticket-data runs for: ${(new Date().getTime() - time) / 1000}s. Next: Constructing queries`);
|
|
16
19
|
const queries = [];
|
|
17
20
|
for await (const config of request.params.config) {
|
|
18
21
|
let ticketQuery = new Parse.Query(types_1.Maintenance_Ticket).equalTo("enabled", true);
|
|
@@ -42,8 +45,12 @@ async function handleRequest(request) {
|
|
|
42
45
|
.find({ useMasterKey: true });
|
|
43
46
|
// get total count of tickets before applying pagination
|
|
44
47
|
const totalCount = tickets.length;
|
|
48
|
+
//Log the time taken to fetch the data in seconds
|
|
49
|
+
console.log(`Function openinc-openservice-ticket-data runs for: ${(new Date().getTime() - time) / 1000}s. Next: Fetch ticket data`);
|
|
45
50
|
// fetch ticket data for those tickets
|
|
46
51
|
const ticketData = await getTicketData(tickets);
|
|
52
|
+
//Log the time taken to fetch the data in seconds
|
|
53
|
+
console.log(`Function openinc-openservice-ticket-data runs for: ${(new Date().getTime() - time) / 1000}s. Next: Sorting and Pagination`);
|
|
47
54
|
// apply sorting
|
|
48
55
|
if (request.params.config[0].sortBy && request.params.config[0].order) {
|
|
49
56
|
ticketData.sort((a, b) => {
|
|
@@ -61,6 +68,8 @@ async function handleRequest(request) {
|
|
|
61
68
|
request.params.config[0].limit !== undefined) {
|
|
62
69
|
ticketDataPaginated = ticketData.slice(request.params.config[0].skip, request.params.config[0].skip + request.params.config[0].limit);
|
|
63
70
|
}
|
|
71
|
+
//Log the time taken to fetch the data in seconds
|
|
72
|
+
console.log(`Total time taken to execute function openinc-openservice-ticket-data: ${(new Date().getTime() - time) / 1000}s`);
|
|
64
73
|
return {
|
|
65
74
|
success: true,
|
|
66
75
|
data: ticketDataPaginated,
|