Lint all the things
This commit is contained in:
@@ -9,7 +9,7 @@ const calculateStatusDuration = (transitions, statuses) => {
|
||||
let totalCurrentStatusDuration = null;
|
||||
let summations = [];
|
||||
|
||||
transitions.forEach((transition, index) => {
|
||||
transitions.forEach((transition) => {
|
||||
let duration = transition.duration;
|
||||
totalDuration += duration;
|
||||
if (transition.start && !transition.end) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @param logger
|
||||
* @returns {{getBodyshopRoom: (function(*): string), getBodyshopConversationRoom: (function({bodyshopId: *, conversationId: *}): string)}}
|
||||
*/
|
||||
const applyIOHelpers = ({ app, api, io, logger }) => {
|
||||
const applyIOHelpers = ({ app }) => {
|
||||
// Global Bodyshop Room
|
||||
const getBodyshopRoom = (bodyshopId) => `bodyshop-broadcast-room:${bodyshopId}`;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ const getHostNameOrIP = require("./getHostNameOrIP");
|
||||
const client = require("../graphql-client/graphql-client").client;
|
||||
const queries = require("../graphql-client/queries");
|
||||
|
||||
|
||||
const LOG_LEVELS = {
|
||||
error: { level: 0, name: "error" },
|
||||
warn: { level: 1, name: "warn" },
|
||||
@@ -38,7 +37,7 @@ const region = InstanceRegion();
|
||||
const estimateLogSize = (logEntry) => {
|
||||
let estimatedSize = 0;
|
||||
for (const key in logEntry) {
|
||||
if (logEntry.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(logEntry, key)) {
|
||||
const value = logEntry[key];
|
||||
if (value === undefined || value === null) {
|
||||
estimatedSize += key.length; // Only count the key length if value is undefined or null
|
||||
@@ -102,11 +101,13 @@ const createLogger = () => {
|
||||
const labelColor = "\x1b[33m"; // Yellow
|
||||
const separatorColor = "\x1b[35m|\x1b[0m"; // Magenta for separators
|
||||
|
||||
return `${timestampColor} [${hostnameColor}] [${level}]: ${message} ${user ? `${separatorColor} ${labelColor}user:\x1b[0m ${JSON.stringify(user)}` : ""
|
||||
} ${record ? `${separatorColor} ${labelColor}record:\x1b[0m ${JSON.stringify(record)}` : ""}${meta
|
||||
return `${timestampColor} [${hostnameColor}] [${level}]: ${message} ${
|
||||
user ? `${separatorColor} ${labelColor}user:\x1b[0m ${JSON.stringify(user)}` : ""
|
||||
} ${record ? `${separatorColor} ${labelColor}record:\x1b[0m ${JSON.stringify(record)}` : ""}${
|
||||
meta
|
||||
? `\n${separatorColor} ${labelColor}meta:\x1b[0m ${JSON.stringify(meta, null, 2)} ${separatorColor}`
|
||||
: ""
|
||||
}`;
|
||||
}`;
|
||||
})
|
||||
)
|
||||
})
|
||||
@@ -195,9 +196,19 @@ const createLogger = () => {
|
||||
winstonLogger.log(logEntry);
|
||||
};
|
||||
|
||||
const LogIntegrationCall = async ({ platform, method, name, jobid, paymentid, billid, status, bodyshopid, email }) => {
|
||||
const LogIntegrationCall = async ({
|
||||
platform,
|
||||
method,
|
||||
name,
|
||||
jobid,
|
||||
paymentid,
|
||||
billid,
|
||||
status,
|
||||
bodyshopid,
|
||||
email
|
||||
}) => {
|
||||
try {
|
||||
//Insert the record.
|
||||
//Insert the record.
|
||||
await client.request(queries.INSERT_INTEGRATION_LOG, {
|
||||
log: {
|
||||
platform,
|
||||
@@ -211,7 +222,6 @@ const createLogger = () => {
|
||||
email
|
||||
}
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.trace("Stack", error?.stack);
|
||||
log("integration-log-error", "ERROR", email, null, {
|
||||
|
||||
Reference in New Issue
Block a user