From 1e268b9f8e942b24f778d0b27d73d431e66d565d Mon Sep 17 00:00:00 2001 From: giurigaud Date: Tue, 29 Oct 2024 09:56:00 -0300 Subject: [PATCH] feat: code review comments --- graphql/schema.graphql | 1 + node/resolvers/Queries/Organizations.ts | 17 +++++------------ node/typings.d.ts | 8 ++++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/graphql/schema.graphql b/graphql/schema.graphql index ced55741..08a869cc 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -96,6 +96,7 @@ type Query { getActiveOrganizationsByEmail(email: String): [B2BOrganization] @checkUserAccess @cacheControl(scope: PRIVATE) + @validateStoreUserAccess checkOrganizationIsActive(id: String): Boolean @cacheControl(scope: PRIVATE) diff --git a/node/resolvers/Queries/Organizations.ts b/node/resolvers/Queries/Organizations.ts index cc86b57a..1dc3f98b 100644 --- a/node/resolvers/Queries/Organizations.ts +++ b/node/resolvers/Queries/Organizations.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-await-in-loop */ import { ORGANIZATION_DATA_ENTITY, ORGANIZATION_FIELDS, @@ -7,20 +6,14 @@ import { ORGANIZATION_REQUEST_SCHEMA_VERSION, ORGANIZATION_SCHEMA_VERSION, } from '../../mdSchema' -import type { Organization } from '../../typings' +import type { + GetOrganizationsByEmailWithStatus, + Organization, +} from '../../typings' import GraphQLError, { getErrorMessage } from '../../utils/GraphQLError' import checkConfig from '../config' import { organizationStatus } from '../fieldResolvers' -export interface GetOrganizationsByEmailWithStatus { - costId: string - orgId: string - roleId: string - id: string - clId: string - status: string -} - const getWhereByStatus = ({ status }: { status: string[] }) => { const whereArray = [] @@ -315,7 +308,7 @@ const Organizations = { } catch (error) { logger.error({ error, - message: 'getOrganizationsByEmail-error', + message: 'getActiveOrganizationsByEmail-error', }) throw new GraphQLError(getErrorMessage(error)) } diff --git a/node/typings.d.ts b/node/typings.d.ts index 29113e57..a2fce388 100644 --- a/node/typings.d.ts +++ b/node/typings.d.ts @@ -167,6 +167,14 @@ interface Collection { id: string name: string } +interface GetOrganizationsByEmailWithStatus { + costId: string + orgId: string + roleId: string + id: string + clId: string + status: string +} interface CostCenter { id: string