diff --git a/backend/src/services/jobs/index.ts b/backend/src/services/jobs/index.ts index 662ac310..f604e74a 100644 --- a/backend/src/services/jobs/index.ts +++ b/backend/src/services/jobs/index.ts @@ -25,7 +25,10 @@ import { DataFieldService } from "services/data-field" import { DatabaseService } from "services/database" import axios from "axios" import { SpecService } from "services/spec" -import { aggregateTracesDataHourlyQuery, aggregateTracesDataMinutelyQuery } from "./queries" +import { + aggregateTracesDataHourlyQuery, + aggregateTracesDataMinutelyQuery, +} from "./queries" interface GenerateEndpoint { parameterizedPath: string @@ -68,8 +71,8 @@ export class JobsService { bodySchema = { type: DataType.OBJECT, properties: { - ...bodySchema?.properties - } + ...bodySchema?.properties, + }, } } for (let property in parsedBody) { @@ -91,8 +94,8 @@ export class JobsService { bodySchema = { type: DataType.ARRAY, items: { - ...bodySchema?.items - } + ...bodySchema?.items, + }, } } for (let i = 0; i < l; i++) { @@ -105,7 +108,7 @@ export class JobsService { } else if (dataType === DataType.UNKNOWN) { return { type: dataType, - nullable: true + nullable: true, } } else { return { @@ -121,8 +124,7 @@ export class JobsService { nonNullKey = key || "default" parsedBody = bodyString } else if (parsedBody) { - nonNullKey = - key || "default" + nonNullKey = key || "default" } else { return } @@ -270,7 +272,8 @@ export class JobsService { .from(ApiTrace) .where('"apiEndpointUuid" IS NOT NULL') .andWhere("analyzed = TRUE") - .andWhere('"createdAt" <= :maxTime', { maxTime }).execute() + .andWhere('"createdAt" <= :maxTime', { maxTime }) + .execute() await queryRunner.commitTransaction() } } catch (err) { diff --git a/backend/src/services/jobs/queries.ts b/backend/src/services/jobs/queries.ts index 154ada5d..75d5d216 100644 --- a/backend/src/services/jobs/queries.ts +++ b/backend/src/services/jobs/queries.ts @@ -146,4 +146,4 @@ export const aggregateTracesDataHourlyQuery = ` GROUP BY 1, 2 ON CONFLICT ON CONSTRAINT unique_constraint_hourly DO UPDATE SET "numCalls" = EXCLUDED."numCalls" + aggregate_trace_data_hourly."numCalls" -` \ No newline at end of file +` diff --git a/backend/src/services/spec/queries.ts b/backend/src/services/spec/queries.ts index 5005298a..612bb0de 100644 --- a/backend/src/services/spec/queries.ts +++ b/backend/src/services/spec/queries.ts @@ -87,4 +87,4 @@ export const insertAggregateMinutelyQuery = ` $2 as "apiEndpointUuid" FROM traces_by_minute traces JOIN minute_count_by_status_code status_code_map ON traces.minute = status_code_map.minute -` \ No newline at end of file +` diff --git a/backend/src/services/spec/utils.ts b/backend/src/services/spec/utils.ts index 9829b9ec..fb6004a0 100644 --- a/backend/src/services/spec/utils.ts +++ b/backend/src/services/spec/utils.ts @@ -131,7 +131,11 @@ export const generateAlertMessageFromReqErrors = ( let pathArray = error.instancePath?.split("/")?.slice(2) const message = error.message const defaultErrorMessage = - message[0].toUpperCase() + message.slice(1, message[message.length - 1] === "." ? -1 : message.length) + message[0].toUpperCase() + + message.slice( + 1, + message[message.length - 1] === "." ? -1 : message.length, + ) let errorMessage = `${defaultErrorMessage} in request${ error["location"] ? ` ${error["location"]}` : "" }.` @@ -218,7 +222,11 @@ export const generateAlertMessageFromRespErrors = ( let pathArray = error.instancePath?.split("/")?.slice(2) const message = error.message const defaultErrorMessage = - message[0].toUpperCase() + message.slice(1, message[message.length - 1] === "." ? -1 : message.length) + message[0].toUpperCase() + + message.slice( + 1, + message[message.length - 1] === "." ? -1 : message.length, + ) let errorMessage = `${defaultErrorMessage} in response body.` let path = pathArray?.length > 0 ? pathArray.join(".") : "" let ignoreError = false @@ -309,7 +317,8 @@ export const recursiveTransformSpec = (schema: any) => { const combineKeywords = ["anyOf", "allOf", "oneOf"] for (const keyword of combineKeywords) { if (schema[keyword]) { - if (!schema["unevaluatedProperties"]) schema["unevaluatedProperties"] = false + if (!schema["unevaluatedProperties"]) + schema["unevaluatedProperties"] = false for (let i = 0; i < schema[keyword]?.length; i++) { if (schema[keyword][i]) { const properties = schema[keyword][i]["properties"] @@ -325,7 +334,7 @@ export const recursiveTransformSpec = (schema: any) => { const isPropertyObject = typeof schema["properties"] === "object" const isItemsObject = typeof schema["items"] === "object" if (schema["type"] === "object" || isPropertyObject) { - if(!schema["additionalProperties"]) schema["additionalProperties"] = false + if (!schema["additionalProperties"]) schema["additionalProperties"] = false const properties = schema["properties"] if (properties && isPropertyObject) { for (const property in properties) {