Fix ID type being used in place of UUID in graphql and metadata queries (#4905)
We have recently discovered that we were using ID type in place of UUID type in many place in the code. We have merged #4895 but this introduced bugs as we forgot to replace it everywhere
This commit is contained in:
@ -1,9 +1,13 @@
|
||||
import { InputType, ID } from '@nestjs/graphql';
|
||||
import { InputType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@InputType()
|
||||
export class DeleteOneFieldInput {
|
||||
@IDField(() => ID, { description: 'The id of the field to delete.' })
|
||||
@IDField(() => UUIDScalarType, {
|
||||
description: 'The id of the field to delete.',
|
||||
})
|
||||
id!: string;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import {
|
||||
Field,
|
||||
HideField,
|
||||
ID,
|
||||
ObjectType,
|
||||
registerEnumType,
|
||||
} from '@nestjs/graphql';
|
||||
@ -33,6 +32,7 @@ import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/fi
|
||||
import { IsFieldMetadataDefaultValue } from 'src/engine/metadata-modules/field-metadata/validators/is-field-metadata-default-value.validator';
|
||||
import { IsFieldMetadataOptions } from 'src/engine/metadata-modules/field-metadata/validators/is-field-metadata-options.validator';
|
||||
import { IsValidMetadataName } from 'src/engine/decorators/metadata/is-valid-metadata-name.decorator';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
registerEnumType(FieldMetadataType, {
|
||||
name: 'FieldMetadataType',
|
||||
@ -61,7 +61,7 @@ export class FieldMetadataDTO<
|
||||
> {
|
||||
@IsUUID()
|
||||
@IsNotEmpty()
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
id: string;
|
||||
|
||||
@IsEnum(FieldMetadataType)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import {
|
||||
Field,
|
||||
HideField,
|
||||
ID,
|
||||
InputType,
|
||||
OmitType,
|
||||
PartialType,
|
||||
@ -10,6 +9,7 @@ import {
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsNotEmpty, IsUUID, ValidateNested } from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { FieldMetadataDTO } from 'src/engine/metadata-modules/field-metadata/dtos/field-metadata.dto';
|
||||
|
||||
@InputType()
|
||||
@ -28,7 +28,9 @@ export class UpdateFieldInput extends OmitType(
|
||||
export class UpdateOneFieldMetadataInput {
|
||||
@IsUUID()
|
||||
@IsNotEmpty()
|
||||
@Field(() => ID, { description: 'The id of the record to update' })
|
||||
@Field(() => UUIDScalarType, {
|
||||
description: 'The id of the record to update',
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@Type(() => UpdateFieldInput)
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
import { ID, InputType } from '@nestjs/graphql';
|
||||
import { InputType } from '@nestjs/graphql';
|
||||
|
||||
import { BeforeDeleteOne, IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { BeforeDeleteOneObject } from 'src/engine/metadata-modules/object-metadata/hooks/before-delete-one-object.hook';
|
||||
|
||||
@InputType()
|
||||
@BeforeDeleteOne(BeforeDeleteOneObject)
|
||||
export class DeleteOneObjectInput {
|
||||
@IDField(() => ID, { description: 'The id of the record to delete.' })
|
||||
@IDField(() => UUIDScalarType, {
|
||||
description: 'The id of the record to delete.',
|
||||
})
|
||||
id!: string;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, ID, Field, HideField } from '@nestjs/graphql';
|
||||
import { ObjectType, Field, HideField } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
Authorize,
|
||||
@ -9,6 +9,7 @@ import {
|
||||
QueryOptions,
|
||||
} from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { FieldMetadataDTO } from 'src/engine/metadata-modules/field-metadata/dtos/field-metadata.dto';
|
||||
import { BeforeDeleteOneObject } from 'src/engine/metadata-modules/object-metadata/hooks/before-delete-one-object.hook';
|
||||
|
||||
@ -26,7 +27,7 @@ import { BeforeDeleteOneObject } from 'src/engine/metadata-modules/object-metada
|
||||
@BeforeDeleteOne(BeforeDeleteOneObject)
|
||||
@CursorConnection('fields', () => FieldMetadataDTO)
|
||||
export class ObjectMetadataDTO {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
id: string;
|
||||
|
||||
@Field()
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import {
|
||||
ObjectType,
|
||||
ID,
|
||||
Field,
|
||||
HideField,
|
||||
registerEnumType,
|
||||
@ -18,6 +17,7 @@ import {
|
||||
import { ObjectMetadataDTO } from 'src/engine/metadata-modules/object-metadata/dtos/object-metadata.dto';
|
||||
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
import { BeforeDeleteOneRelation } from 'src/engine/metadata-modules/relation-metadata/hooks/before-delete-one-relation.hook';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
registerEnumType(RelationMetadataType, {
|
||||
name: 'RelationMetadataType',
|
||||
@ -40,7 +40,7 @@ registerEnumType(RelationMetadataType, {
|
||||
@Relation('fromObjectMetadata', () => ObjectMetadataDTO)
|
||||
@Relation('toObjectMetadata', () => ObjectMetadataDTO)
|
||||
export class RelationMetadataDTO {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
id: string;
|
||||
|
||||
@Field(() => RelationMetadataType)
|
||||
|
||||
Reference in New Issue
Block a user