fix: standardize GraphQL schema UUID field types (#13550)
Closes [#1264](https://github.com/twentyhq/core-team-issues/issues/1264)
This commit is contained in:
@@ -36,7 +36,7 @@ export class ApiKey {
|
||||
@Column({ type: 'timestamptz', nullable: true })
|
||||
revokedAt?: Date | null;
|
||||
|
||||
@Field()
|
||||
@Field(() => UUIDScalarType)
|
||||
@Column('uuid')
|
||||
workspaceId: string;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
Resolver,
|
||||
} from '@nestjs/graphql';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import {
|
||||
ApiKeyException,
|
||||
ApiKeyExceptionCode,
|
||||
@@ -108,8 +109,8 @@ export class ApiKeyResolver {
|
||||
@Mutation(() => Boolean)
|
||||
async assignRoleToApiKey(
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
@Args('apiKeyId') apiKeyId: string,
|
||||
@Args('roleId') roleId: string,
|
||||
@Args('apiKeyId', { type: () => UUIDScalarType }) apiKeyId: string,
|
||||
@Args('roleId', { type: () => UUIDScalarType }) roleId: string,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
await this.apiKeyRoleService.assignRoleToApiKey({
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@InputType()
|
||||
export class CreateApiKeyDTO {
|
||||
@Field()
|
||||
@@ -24,7 +26,7 @@ export class CreateApiKeyDTO {
|
||||
@IsDateString()
|
||||
revokedAt?: string;
|
||||
|
||||
@Field()
|
||||
@Field(() => UUIDScalarType)
|
||||
@IsNotEmpty()
|
||||
@IsUUID()
|
||||
roleId: string;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
|
||||
import { IsNotEmpty, IsString } from 'class-validator';
|
||||
import { IsNotEmpty, IsUUID } from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@InputType()
|
||||
export class GetApiKeyDTO {
|
||||
@Field()
|
||||
@Field(() => UUIDScalarType)
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@IsUUID()
|
||||
id: string;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
|
||||
import { IsNotEmpty, IsString } from 'class-validator';
|
||||
import { IsNotEmpty, IsUUID } from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@InputType()
|
||||
export class RevokeApiKeyDTO {
|
||||
@Field()
|
||||
@Field(() => UUIDScalarType)
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@IsUUID()
|
||||
id: string;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,16 @@ import {
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
} from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
@InputType()
|
||||
export class UpdateApiKeyDTO {
|
||||
@Field()
|
||||
@Field(() => UUIDScalarType)
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@IsUUID()
|
||||
id: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
|
||||
Reference in New Issue
Block a user