From bce06cd76c0f3d00304d1f671621c4862a7311d9 Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Mon, 3 Mar 2025 14:54:01 -0500 Subject: [PATCH] fix(api): type imports from generated graphql types (#1215) ## Summary by CodeRabbit - Enhanced internal type handling by updating import statements to use type-only syntax, ensuring clearer and more consistent type-checking across modules. - No changes to application behavior or user-facing functionality have been introduced. --- api/src/unraid-api/auth/api-key.service.ts | 2 +- api/src/unraid-api/cli/apikey/add-api-key.questions.ts | 3 ++- api/src/unraid-api/cli/apikey/api-key.command.ts | 3 ++- api/src/unraid-api/graph/services/services.resolver.ts | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/src/unraid-api/auth/api-key.service.ts b/api/src/unraid-api/auth/api-key.service.ts index ecd46b6e3..a1285586d 100644 --- a/api/src/unraid-api/auth/api-key.service.ts +++ b/api/src/unraid-api/auth/api-key.service.ts @@ -10,13 +10,13 @@ import { AuthActionVerb } from 'nest-authz'; import { v4 as uuidv4 } from 'uuid'; import { ZodError } from 'zod'; +import type { Permission } from '@app/graphql/generated/api/types.js'; import { environment } from '@app/environment.js'; import { ApiKeySchema, ApiKeyWithSecretSchema } from '@app/graphql/generated/api/operations.js'; import { AddPermissionInput, ApiKey, ApiKeyWithSecret, - Permission, Resource, Role, } from '@app/graphql/generated/api/types.js'; diff --git a/api/src/unraid-api/cli/apikey/add-api-key.questions.ts b/api/src/unraid-api/cli/apikey/add-api-key.questions.ts index 34eaf0640..79508b8c5 100644 --- a/api/src/unraid-api/cli/apikey/add-api-key.questions.ts +++ b/api/src/unraid-api/cli/apikey/add-api-key.questions.ts @@ -1,6 +1,7 @@ import { ChoicesFor, Question, QuestionSet, WhenFor } from 'nest-commander'; -import { Permission, Role } from '@app/graphql/generated/api/types.js'; +import type { Permission } from '@app/graphql/generated/api/types.js'; +import { Role } from '@app/graphql/generated/api/types.js'; import { ApiKeyService } from '@app/unraid-api/auth/api-key.service.js'; import { LogService } from '@app/unraid-api/cli/log.service.js'; diff --git a/api/src/unraid-api/cli/apikey/api-key.command.ts b/api/src/unraid-api/cli/apikey/api-key.command.ts index acf4b0ebf..4d900f280 100644 --- a/api/src/unraid-api/cli/apikey/api-key.command.ts +++ b/api/src/unraid-api/cli/apikey/api-key.command.ts @@ -1,7 +1,8 @@ import { AuthActionVerb } from 'nest-authz'; import { Command, CommandRunner, InquirerService, Option } from 'nest-commander'; -import { Permission, Resource, Role } from '@app/graphql/generated/api/types.js'; +import type { Permission } from '@app/graphql/generated/api/types.js'; +import { Resource, Role } from '@app/graphql/generated/api/types.js'; import { ApiKeyService } from '@app/unraid-api/auth/api-key.service.js'; import { AddApiKeyQuestionSet } from '@app/unraid-api/cli/apikey/add-api-key.questions.js'; import { LogService } from '@app/unraid-api/cli/log.service.js'; diff --git a/api/src/unraid-api/graph/services/services.resolver.ts b/api/src/unraid-api/graph/services/services.resolver.ts index e87fa449c..8ff91a3a0 100644 --- a/api/src/unraid-api/graph/services/services.resolver.ts +++ b/api/src/unraid-api/graph/services/services.resolver.ts @@ -2,9 +2,10 @@ import { Query, Resolver } from '@nestjs/graphql'; import { AuthActionVerb, AuthPossession, UsePermissions } from 'nest-authz'; +import type { Service } from '@app/graphql/generated/api/types.js'; import { bootTimestamp } from '@app/common/dashboard/boot-timestamp.js'; import { API_VERSION } from '@app/environment.js'; -import { DynamicRemoteAccessType, Resource, Service } from '@app/graphql/generated/api/types.js'; +import { DynamicRemoteAccessType, Resource } from '@app/graphql/generated/api/types.js'; import { store } from '@app/store/index.js'; @Resolver('Services')