Fix APIKey typing (#16541)

Following this https://github.com/twentyhq/twenty/pull/16540
Those were not failing (yet) but were wrongly typed and error prone

---------

Co-authored-by: Guillim <guillim@users.noreply.github.com>
This commit is contained in:
Weiko
2025-12-15 17:05:28 +01:00
committed by GitHub
parent fc74a06f53
commit 039a3d99a8
13 changed files with 50 additions and 33 deletions
@@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { msg } from '@lingui/core/macro';
import { PermissionFlagType } from 'twenty-shared/constants';
import { isDefined } from 'twenty-shared/utils';
import { In, Repository } from 'typeorm';
import { PermissionFlagType } from 'twenty-shared/constants';
import { ApiKeyRoleService } from 'src/engine/core-modules/api-key/services/api-key-role.service';
import { TOOL_PERMISSION_FLAGS } from 'src/engine/metadata-modules/permissions/constants/tool-permission-flags';
@@ -132,8 +132,8 @@ export class PermissionsService {
setting: PermissionFlagType;
apiKeyId?: string;
}): Promise<boolean> {
if (apiKeyId) {
const roleId = await this.apiKeyRoleService.getRoleIdForApiKey(
if (isDefined(apiKeyId)) {
const roleId = await this.apiKeyRoleService.getRoleIdForApiKeyId(
apiKeyId,
workspaceId,
);