Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/src/unraid-api/graph/resolvers/api-key/api-key.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class CreateApiKeyInput {
@AtLeastOneOf(['roles', 'permissions'], {
message: 'At least one role or one permission is required to create an API key.',
})
_atLeastOne!: boolean;
_atLeastOne?: boolean;
}

@InputType()
Expand Down Expand Up @@ -149,7 +149,7 @@ export class UpdateApiKeyInput {
@AtLeastOneOf(['roles', 'permissions'], {
message: 'At least one role or one permission is required to update an API key.',
})
_atLeastOne!: boolean;
_atLeastOne?: boolean;
}

@InputType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ describe('ApiKeyMutationsResolver', () => {
description: 'New API Key Description',
roles: [Role.GUEST],
permissions: [],
_atLeastOne: undefined,
};

vi.spyOn(apiKeyService, 'create').mockResolvedValue(mockApiKeyWithSecret);
Expand All @@ -84,7 +83,6 @@ describe('ApiKeyMutationsResolver', () => {
description: 'Should fail',
roles: [Role.GUEST],
permissions: [],
_atLeastOne: undefined,
};
vi.spyOn(apiKeyService, 'create').mockRejectedValue(new Error('Create failed'));
await expect(resolver.create(input)).rejects.toThrow('Create failed');
Expand All @@ -96,7 +94,6 @@ describe('ApiKeyMutationsResolver', () => {
description: 'Should fail sync',
roles: [Role.GUEST],
permissions: [],
_atLeastOne: undefined,
};
vi.spyOn(apiKeyService, 'create').mockResolvedValue(mockApiKeyWithSecret);
vi.spyOn(authService, 'syncApiKeyRoles').mockRejectedValue(new Error('Sync failed'));
Expand All @@ -109,7 +106,6 @@ describe('ApiKeyMutationsResolver', () => {
description: 'No name',
roles: [Role.GUEST],
permissions: [],
_atLeastOne: undefined,
};
await expect(resolver.create(input)).rejects.toThrow();
});
Expand Down
13 changes: 13 additions & 0 deletions api/src/unraid-api/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,22 @@ export async function bootstrapNestServer(): Promise<NestFastifyApplication> {

const server = app.getHttpAdapter().getInstance();

/**------------------------------------------------------------------------
* ! Fastify Type Compatibility
*
* There are known type issues with fastify plugin registration in nestjs.
* These don't affect runtime functionality, but will cause type errors.
*
* See: https://github.com/nestjs/nest/issues/13219
*
* tl;dr different types used by nestjs/platform-fastify and fastify.
*------------------------------------------------------------------------**/

// @ts-expect-error - Known nestjs x fastify type compatibility issue
await server.register(fastifyCookie);

// Minimal Helmet configuration to avoid blocking plugin functionality
// @ts-expect-error - Known nestjs x fastify type compatibility issue
await server.register(fastifyHelmet, {
// Disable restrictive policies
contentSecurityPolicy: false,
Expand Down
Loading