Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce sync roles #121

Merged
merged 3 commits into from
Nov 10, 2023
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Reduce sync roles, remove from checkUserPermissions and listRoles

## [1.37.1] - 2023-11-09

### Fixed
Expand Down
3 changes: 0 additions & 3 deletions node/resolvers/Queries/Roles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { currentRoleNames, currentSchema } from '../../utils'
import { ROLES_VBASE_ID } from '../../utils/constants'
import { syncRoles } from '../Mutations/Roles'
import { getUserByRole } from './Users'

const sorting = (a: any, b: any) => (a.name > b.name ? 1 : -1)
Expand Down Expand Up @@ -106,8 +105,6 @@ export const listRoles = async (_: any, __: any, ctx: Context) => {
} = ctx

try {
await syncRoles(ctx)

return await searchRoles(null, ctx)
} catch (e) {
logger.error({
Expand Down
3 changes: 0 additions & 3 deletions node/resolvers/Queries/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
CUSTOMER_SCHEMA_NAME,
} from '../../utils/constants'
import { getRole } from './Roles'
import { getAppSettings } from './Settings'

const config: any = currentSchema('b2b_users')

Expand Down Expand Up @@ -574,8 +573,6 @@ export const checkUserPermission = async (
params: any,
ctx: Context
) => {
await getAppSettings(null, null, ctx)

const {
vtex: { logger },
} = ctx
Expand Down
5 changes: 2 additions & 3 deletions node/resolvers/Routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { ForbiddenError } from '@vtex/api'
import { json } from 'co-body'

import { getRole } from '../Queries/Roles'
import { getAppSettings, getSessionWatcher } from '../Queries/Settings'
import { getSessionWatcher } from '../Queries/Settings'
import { getActiveUserByEmail, getUserByEmail } from '../Queries/Users'
import { generateClUser, QUERIES } from './utils'
import { setActiveUserByOrganization, getUser } from '../Mutations/Users'
import { getUser, setActiveUserByOrganization } from '../Mutations/Users'

export const Routes = {
PROFILE_DOCUMENT_TYPE: 'cpf',
Expand All @@ -22,7 +22,6 @@ export const Routes = {
} = ctx

ctx.set('Content-Type', 'application/json')
await getAppSettings(null, null, ctx)

const params: any = await json(ctx.req)

Expand Down
Loading