diff --git a/node/resolvers/Queries/Users.ts b/node/resolvers/Queries/Users.ts index 21198d6..b0385a9 100644 --- a/node/resolvers/Queries/Users.ts +++ b/node/resolvers/Queries/Users.ts @@ -21,29 +21,24 @@ export const isUserPartOfBuyerOrg = async (email: string, ctx: Context) => { clients: { masterdata }, } = ctx - try { - const where = `email=${email}` - const resp = await masterdata.searchDocumentsWithPaginationInfo({ - dataEntity: config.name, - fields: ['id'], // we don't need to fetch all fields, only if there is an entry or not - pagination: { - page: 1, - pageSize: 1, // we only need to know if there is at least one user entry - }, - schema: config.version, - ...(where ? { where } : {}), - }) + const where = `email=${email}` + const resp = await masterdata.searchDocumentsWithPaginationInfo({ + dataEntity: config.name, + fields: ['id'], // we don't need to fetch all fields, only if there is an entry or not + pagination: { + page: 1, + pageSize: 1, // we only need to know if there is at least one user entry + }, + schema: config.version, + ...(where ? { where } : {}), + }) - const { data } = resp as unknown as { - data: any - } + const { data } = resp as unknown as { + data: any + } - if (data.length > 0) { - return true - } - } catch (error) { - // if it fails at somepoint, we treat it like no user was found - // on any buyer org, so we just let the function return false + if (data.length > 0) { + return true } return false diff --git a/node/utils/LicenseManager.ts b/node/utils/LicenseManager.ts index 5eea5e2..b91bdf4 100644 --- a/node/utils/LicenseManager.ts +++ b/node/utils/LicenseManager.ts @@ -74,13 +74,11 @@ export class LMClient extends ExternalClient { } public getUserAdminPermissions = async (account: string, userId: string) => { - return this.get(this.routes.getUserAdminPermissions(account, userId)) - .then((res: any) => { + return this.get(this.routes.getUserAdminPermissions(account, userId)).then( + (res: any) => { return res - }) - .catch(() => { - return false - }) + } + ) } protected get = (url: string) => {