Skip to content

Commit

Permalink
feat: code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
giurigaud authored and ataideverton committed Dec 3, 2024
1 parent ba1285f commit 5214c99
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ type Query {
getActiveOrganizationsByEmail(email: String): [B2BOrganization]
@checkUserAccess
@cacheControl(scope: PRIVATE)
@validateStoreUserAccess

checkOrganizationIsActive(id: String): Boolean
@cacheControl(scope: PRIVATE)
Expand Down
17 changes: 5 additions & 12 deletions node/resolvers/Queries/Organizations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-await-in-loop */
import {
ORGANIZATION_DATA_ENTITY,
ORGANIZATION_FIELDS,
Expand All @@ -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 = []

Expand Down Expand Up @@ -320,7 +313,7 @@ const Organizations = {
} catch (error) {
logger.error({
error,
message: 'getOrganizationsByEmail-error',
message: 'getActiveOrganizationsByEmail-error',
})
throw new GraphQLError(getErrorMessage(error))
}
Expand Down
8 changes: 8 additions & 0 deletions node/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5214c99

Please sign in to comment.