From faaeeee6f243ecc49de492db3ad6a52279729763 Mon Sep 17 00:00:00 2001 From: Abdul Rahman <81605929+abdulrahmancodes@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:49:24 +0530 Subject: [PATCH] refactor(server): remove nestjs-query from key-value-pair module (#22575) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary First step toward removing `@ptc-org/nestjs-query` from the codebase (follow-up to the `indexFieldMetadatas` DI bug [discussion](https://github.com/twentyhq/twenty/pull/22439#issuecomment-4864265452)). The `key-value-pair` module wrapped its entity in `NestjsQueryGraphQLModule.forFeature`, but registered **no resolvers** — the `KeyValuePair` type is exposed in no GraphQL schema, and `KeyValuePairService` only uses a plain TypeORM repository. The nestjs-query layer was doing nothing except registering that repository as a side effect. ## Changes - Replace the empty `NestjsQueryGraphQLModule.forFeature({...})` wrapper with a plain `TypeOrmModule.forFeature([KeyValuePairEntity])` - Swap the entity's `@IDField` (nestjs-query) for the standard `@Field` from `@nestjs/graphql` `nestjs-query` is no longer referenced anywhere under `key-value-pair/`. Review in cubic --- .../key-value-pair/key-value-pair.entity.ts | 3 +-- .../key-value-pair/key-value-pair.module.ts | 17 ++++------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.entity.ts b/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.entity.ts index 8b87b4600f..3da1740df9 100644 --- a/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.entity.ts +++ b/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.entity.ts @@ -1,6 +1,5 @@ import { Field, ObjectType } from '@nestjs/graphql'; -import { IDField } from '@ptc-org/nestjs-query-graphql'; import { Column, CreateDateColumn, @@ -56,7 +55,7 @@ export enum KeyValuePairType { }, ) export class KeyValuePairEntity { - @IDField(() => UUIDScalarType) + @Field(() => UUIDScalarType) @PrimaryGeneratedColumn('uuid') id: string; diff --git a/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.module.ts b/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.module.ts index e7b97a335b..fb26235a7d 100644 --- a/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.module.ts +++ b/packages/twenty-server/src/engine/core-modules/key-value-pair/key-value-pair.module.ts @@ -1,21 +1,12 @@ import { Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; -import { NestjsQueryGraphQLModule } from '@ptc-org/nestjs-query-graphql'; -import { NestjsQueryTypeOrmModule } from '@ptc-org/nestjs-query-typeorm'; - -import { KeyValuePairService } from 'src/engine/core-modules/key-value-pair/key-value-pair.service'; -import { KeyValuePairEntity } from 'src/engine/core-modules/key-value-pair/key-value-pair.entity'; import { TypeORMModule } from 'src/database/typeorm/typeorm.module'; +import { KeyValuePairEntity } from 'src/engine/core-modules/key-value-pair/key-value-pair.entity'; +import { KeyValuePairService } from 'src/engine/core-modules/key-value-pair/key-value-pair.service'; @Module({ - imports: [ - NestjsQueryGraphQLModule.forFeature({ - imports: [ - NestjsQueryTypeOrmModule.forFeature([KeyValuePairEntity]), - TypeORMModule, - ], - }), - ], + imports: [TypeOrmModule.forFeature([KeyValuePairEntity]), TypeORMModule], exports: [KeyValuePairService], providers: [KeyValuePairService], })