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:
@ -8,7 +8,7 @@ export class DeleteQueryFactory {
|
||||
const objectNameSingular = capitalize(objectMetadataItem.nameSingular);
|
||||
|
||||
return `
|
||||
mutation Delete${objectNameSingular}($id: ID!) {
|
||||
mutation Delete${objectNameSingular}($id: UUID!) {
|
||||
delete${objectNameSingular}(id: $id) {
|
||||
id
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ export class UpdateQueryFactory {
|
||||
return `
|
||||
mutation Update${capitalize(
|
||||
objectNameSingular,
|
||||
)}($id: ID!, $data: ${capitalize(objectNameSingular)}UpdateInput!) {
|
||||
)}($id: UUID!, $data: ${capitalize(objectNameSingular)}UpdateInput!) {
|
||||
update${capitalize(objectNameSingular)}(id: $id, data: $data) {
|
||||
id
|
||||
${objectMetadata.objectMetadataItem.fields
|
||||
|
||||
@ -181,7 +181,7 @@ export class ApiRestMetadataService {
|
||||
|
||||
return `
|
||||
query FindOne${capitalize(objectNameSingular)}(
|
||||
$id: ID!,
|
||||
$id: UUID!,
|
||||
) {
|
||||
${objectNameSingular}(id: $id) {
|
||||
id
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ID, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
Entity,
|
||||
@ -14,6 +14,7 @@ import { BeforeCreateOne, IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
import { BeforeCreateOneAppToken } from 'src/engine/core-modules/app-token/hooks/before-create-one-app-token.hook';
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
export enum AppTokenType {
|
||||
RefreshToken = 'REFRESH_TOKEN',
|
||||
CodeChallenge = 'CODE_CHALLENGE',
|
||||
@ -24,7 +25,7 @@ export enum AppTokenType {
|
||||
@ObjectType('AppToken')
|
||||
@BeforeCreateOne(BeforeCreateOneAppToken)
|
||||
export class AppToken {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ID, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
Column,
|
||||
@ -15,11 +15,12 @@ import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { BillingSubscriptionItem } from 'src/engine/core-modules/billing/entities/billing-subscription-item.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@Entity({ name: 'billingSubscription', schema: 'core' })
|
||||
@ObjectType('BillingSubscription')
|
||||
export class BillingSubscription {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
import { ObjectType, Field, ID } from '@nestjs/graphql';
|
||||
import { ObjectType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@ObjectType('TimelineCalendarEventParticipant')
|
||||
export class TimelineCalendarEventParticipant {
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
personId: string;
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
workspaceMemberId: string;
|
||||
|
||||
@Field()
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { ObjectType, ID, Field, registerEnumType } from '@nestjs/graphql';
|
||||
import { ObjectType, Field, registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { TimelineCalendarEventParticipant } from 'src/engine/core-modules/calendar/dtos/timeline-calendar-event-participant.dto';
|
||||
|
||||
export enum TimelineCalendarEventVisibility {
|
||||
@ -23,7 +24,7 @@ export class LinkMetadata {
|
||||
|
||||
@ObjectType('TimelineCalendarEvent')
|
||||
export class TimelineCalendarEvent {
|
||||
@Field(() => ID)
|
||||
@Field(() => UUIDScalarType)
|
||||
id: string;
|
||||
|
||||
@Field()
|
||||
|
||||
@ -1,13 +1,5 @@
|
||||
import { UseGuards } from '@nestjs/common';
|
||||
import {
|
||||
Query,
|
||||
Args,
|
||||
ArgsType,
|
||||
Field,
|
||||
ID,
|
||||
Int,
|
||||
Resolver,
|
||||
} from '@nestjs/graphql';
|
||||
import { Query, Args, ArgsType, Field, Int, Resolver } from '@nestjs/graphql';
|
||||
|
||||
import { Max } from 'class-validator';
|
||||
|
||||
@ -21,10 +13,11 @@ import { TimelineCalendarEventService } from 'src/engine/core-modules/calendar/t
|
||||
import { UserService } from 'src/engine/core-modules/user/services/user.service';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { NotFoundError } from 'src/engine/utils/graphql-errors.util';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@ArgsType()
|
||||
class GetTimelineCalendarEventsFromPersonIdArgs {
|
||||
@Field(() => ID)
|
||||
@Field(() => UUIDScalarType)
|
||||
personId: string;
|
||||
|
||||
@Field(() => Int)
|
||||
@ -37,7 +30,7 @@ class GetTimelineCalendarEventsFromPersonIdArgs {
|
||||
|
||||
@ArgsType()
|
||||
class GetTimelineCalendarEventsFromCompanyIdArgs {
|
||||
@Field(() => ID)
|
||||
@Field(() => UUIDScalarType)
|
||||
companyId: string;
|
||||
|
||||
@Field(() => Int)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ID, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
Entity,
|
||||
@ -12,6 +12,7 @@ import {
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
export enum FeatureFlagKeys {
|
||||
IsBlocklistEnabled = 'IS_BLOCKLIST_ENABLED',
|
||||
@ -26,7 +27,7 @@ export enum FeatureFlagKeys {
|
||||
@ObjectType('FeatureFlag')
|
||||
@Unique('IndexOnKeyAndWorkspaceIdUnique', ['key', 'workspaceId'])
|
||||
export class FeatureFlagEntity {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
import { ObjectType, Field, ID } from '@nestjs/graphql';
|
||||
import { ObjectType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@ObjectType('TimelineThreadParticipant')
|
||||
export class TimelineThreadParticipant {
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
personId: string;
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
workspaceMemberId: string;
|
||||
|
||||
@Field()
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
import { ObjectType, Field, ID } from '@nestjs/graphql';
|
||||
import { ObjectType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { TimelineThreadParticipant } from 'src/engine/core-modules/messaging/dtos/timeline-thread-participant.dto';
|
||||
|
||||
@ObjectType('TimelineThread')
|
||||
export class TimelineThread {
|
||||
@Field(() => ID)
|
||||
@Field(() => UUIDScalarType)
|
||||
id: string;
|
||||
|
||||
@Field()
|
||||
|
||||
@ -1,12 +1,4 @@
|
||||
import {
|
||||
Args,
|
||||
Query,
|
||||
Resolver,
|
||||
Int,
|
||||
ArgsType,
|
||||
Field,
|
||||
ID,
|
||||
} from '@nestjs/graphql';
|
||||
import { Args, Query, Resolver, Int, ArgsType, Field } from '@nestjs/graphql';
|
||||
import { UseGuards } from '@nestjs/common';
|
||||
|
||||
import { Max } from 'class-validator';
|
||||
@ -20,10 +12,11 @@ import { TimelineThreadsWithTotal } from 'src/engine/core-modules/messaging/dtos
|
||||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator';
|
||||
import { UserService } from 'src/engine/core-modules/user/services/user.service';
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@ArgsType()
|
||||
class GetTimelineThreadsFromPersonIdArgs {
|
||||
@Field(() => ID)
|
||||
@Field(() => UUIDScalarType)
|
||||
personId: string;
|
||||
|
||||
@Field(() => Int)
|
||||
@ -36,7 +29,7 @@ class GetTimelineThreadsFromPersonIdArgs {
|
||||
|
||||
@ArgsType()
|
||||
class GetTimelineThreadsFromCompanyIdArgs {
|
||||
@Field(() => ID)
|
||||
@Field(() => UUIDScalarType)
|
||||
companyId: string;
|
||||
|
||||
@Field(() => Int)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ID, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
import {
|
||||
@ -14,12 +14,13 @@ import {
|
||||
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@Entity({ name: 'userWorkspace', schema: 'core' })
|
||||
@ObjectType('UserWorkspace')
|
||||
@Unique('IndexOnUserIdAndWorkspaceIdUnique', ['userId', 'workspaceId'])
|
||||
export class UserWorkspace {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ID, Field, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
Entity,
|
||||
@ -15,11 +15,12 @@ import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { WorkspaceMember } from 'src/engine/core-modules/user/dtos/workspace-member.dto';
|
||||
import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@Entity({ name: 'user', schema: 'core' })
|
||||
@ObjectType('User')
|
||||
export class User {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ID, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField, UnPagedRelation } from '@ptc-org/nestjs-query-graphql';
|
||||
import {
|
||||
@ -16,6 +16,7 @@ import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-
|
||||
import { BillingSubscription } from 'src/engine/core-modules/billing/entities/billing-subscription.entity';
|
||||
import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
|
||||
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@Entity({ name: 'workspace', schema: 'core' })
|
||||
@ObjectType('Workspace')
|
||||
@ -24,7 +25,7 @@ import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
||||
nullable: true,
|
||||
})
|
||||
export class Workspace {
|
||||
@IDField(() => ID)
|
||||
@IDField(() => UUIDScalarType)
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
|
||||
@ -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