[POC] add graphql query runner (#6747)

## Context
The goal is to replace pg_graphql with our own ORM wrapper (TwentyORM).
This PR tries to add some parsing logic to convert graphql requests to
send to the ORM to replace pg_graphql implementation.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Weiko
2024-08-27 17:06:39 +02:00
committed by GitHub
parent ef4f2e43b0
commit f6fd92adcb
51 changed files with 1397 additions and 249 deletions

View File

@ -0,0 +1,34 @@
import { Logger } from '@nestjs/common';
/**
* A decorator function that logs the execution time of the decorated method.
*
* @param target The target class of the decorated method.
* @param propertyKey The name of the decorated method.
* @param descriptor The property descriptor of the decorated method.
* @returns The modified property descriptor with the execution time logging functionality.
*/
export function LogExecutionTime() {
return function (
target: any,
propertyKey: string,
descriptor: PropertyDescriptor,
) {
const originalMethod = descriptor.value;
const logger = new Logger(`${target.constructor.name}:${propertyKey}`);
descriptor.value = async function (...args: any[]) {
const start = performance.now();
const result = await originalMethod.apply(this, args);
const end = performance.now();
const executionTime = end - start;
logger.log(`Execution time: ${executionTime.toFixed(2)}ms`);
return result;
};
return descriptor;
};
}