Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
vhaalmeida committed Sep 29, 2024
2 parents 0ac77f9 + 9f58720 commit c5da41d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 29 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Add new `getOrganizationsByEmailPaginated` query to allow pagination on organizations by email query

## [1.44.7] - 2024-09-25

### Fixed
- Remove unnecessary b2b_users storage on vbase

## [1.44.6] - 2024-09-05

### Fixed
- Add await to requests to properly handle inactive organizations on login

## [1.44.5] - 2024-09-04

### Fixed
- Provide app token on calls to b2b-organizations-graphql app

## [1.44.4] - 2024-09-03

### Fixed
- Add sort to searchDocumentsWithPaginationInfo at getAllUsers

## [1.44.3] - 2024-08-22

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "storefront-permissions",
"vendor": "vtex",
"version": "1.44.3",
"version": "1.44.7",
"title": "Storefront Permissions",
"description": "Manage User's permissions on apps that relates to this app",
"mustUpdateAt": "2022-08-28",
Expand Down
2 changes: 1 addition & 1 deletion node/clients/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Schema } from './schema'
import VtexId from './vtexId'

export const getTokenToHeader = (ctx: IOContext) => {
const adminToken = ctx.adminUserAuthToken ?? ctx.authToken
const adminToken = ctx.authToken
const userToken = ctx.storeUserAuthToken
const { sessionToken, account } = ctx

Expand Down
2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vtex.checkout-ui-custom",
"version": "1.44.3",
"version": "1.44.7",
"dependencies": {
"@vtex/api": "6.47.0",
"atob": "^2.1.2",
Expand Down
30 changes: 6 additions & 24 deletions node/resolvers/Mutations/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const updateUserFields = async ({ masterdata, fields, id }: any) => {
return DocumentId
}

const createPermission = async ({ masterdata, vbase, params }: any) => {
const createPermission = async ({ masterdata, params }: any) => {
const {
roleId,
canImpersonate,
Expand All @@ -129,7 +129,7 @@ const createPermission = async ({ masterdata, vbase, params }: any) => {
id,
} = params

const { DocumentId } = await masterdata
await masterdata
.createOrUpdateEntireDocument({
dataEntity: config.name,
fields: {
Expand Down Expand Up @@ -157,25 +157,11 @@ const createPermission = async ({ masterdata, vbase, params }: any) => {

throw error
})

if (DocumentId) {
await vbase.saveJSON('b2b_users', email, {
canImpersonate,
clId,
costId,
email,
id: DocumentId,
name,
orgId,
roleId,
userId,
})
}
}

export const addUser = async (_: any, params: any, ctx: Context) => {
const {
clients: { masterdata, lm, vbase },
clients: { masterdata, lm },
vtex: { logger },
} = ctx

Expand Down Expand Up @@ -221,7 +207,6 @@ export const addUser = async (_: any, params: any, ctx: Context) => {
...params,
clId: cId,
},
vbase,
})

return { status: 'success', message: '', id: cId }
Expand All @@ -237,7 +222,7 @@ export const addUser = async (_: any, params: any, ctx: Context) => {

export const updateUser = async (_: any, params: any, ctx: Context) => {
const {
clients: { masterdata, lm, vbase },
clients: { masterdata, lm },
vtex: { logger },
} = ctx

Expand All @@ -251,7 +236,6 @@ export const updateUser = async (_: any, params: any, ctx: Context) => {
lm,
masterdata,
params,
vbase,
})

return { status: 'success', message: '', id: params.clId }
Expand Down Expand Up @@ -323,15 +307,13 @@ export const deleteUserProfile = async (_: any, params: any, ctx: Context) => {

export const deleteUser = async (_: any, params: any, ctx: Context) => {
const {
clients: { masterdata, vbase },
clients: { masterdata },
vtex: { logger },
} = ctx

const { id, email } = params
const { id } = params

try {
await vbase.deleteFile('b2b_users', email).catch(() => null)

await masterdata.deleteDocument({
dataEntity: config.name,
id,
Expand Down
1 change: 1 addition & 0 deletions node/resolvers/Queries/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const getAllUsers = async ({
pageSize: PAGINATION.pageSize,
},
schema: config.version,
sort: 'id asc',
...(where ? { where } : {}),
})

Expand Down
3 changes: 1 addition & 2 deletions node/resolvers/Routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ export const Routes = {
if (organizationList) {
organization = (await getOrganization(organizationList.id))?.data
?.getOrganizationById

setActiveUserByOrganization(
await setActiveUserByOrganization(
null,
{
costId: organizationList.costId,
Expand Down

0 comments on commit c5da41d

Please sign in to comment.