Skip to content

Commit

Permalink
Merge pull request #126 from rafael-marques/feature/add-delete-user-e…
Browse files Browse the repository at this point in the history
…vent-trigger

Add event trigger to deleteUser resolver
  • Loading branch information
Arthur Bond authored Sep 19, 2023
2 parents 5d8298e + 6c9e80d commit dce3ccd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]


### Added

- Added event trigger on delete a user

## [0.36.1] - 2023-09-19

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"vtex.storefront-permissions": "1.x"
},
"policies": [
{
"name": "colossus-fire-event"
},
{
"name": "update-app-settings"
},
Expand Down
5 changes: 3 additions & 2 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"tslint-config-prettier": "^1.18.0",
"tslint-config-vtex": "^2.1.0",
"typescript": "3.9.7",
"vtex.storefront-permissions": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.storefront-permissions"
"vtex.b2b-organizations-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.b2b-organizations-graphql",
"vtex.storefront-permissions": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.storefront-permissions"
},
"scripts": {
"lint": "tsc --noEmit && tslint -c tslint.json './**/*.ts'",
"test": "jest"
}
}
}
7 changes: 6 additions & 1 deletion node/resolvers/Mutations/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const Users = {
ctx: Context
) => {
const {
clients: { storefrontPermissions: storefrontPermissionsClient },
clients: { events, storefrontPermissions: storefrontPermissionsClient },
vtex: { adminUserAuthToken, logger, sessionData, storefrontPermissions },
} = ctx as Context | any

Expand Down Expand Up @@ -413,6 +413,11 @@ const Users = {
userId,
})
.then((result: any) => {
events.sendEvent('', 'b2b-organizations-graphql.removeUser', {
id,
email,
})

return result.data.deleteUser
})
.catch((error: any) => {
Expand Down
10 changes: 7 additions & 3 deletions node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3909,9 +3909,13 @@ vary@^1.1.2:
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

"vtex.storefront-permissions@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.storefront-permissions":
version "1.35.3"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.storefront-permissions#58d27d180d75da71e43c6d6059f7191002c5f06b"
"vtex.b2b-organizations-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.b2b-organizations-graphql":
version "0.36.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.b2b-organizations-graphql#14adc111841e871d38f888cb1c90ae4dacf1914e"

"vtex.storefront-permissions@http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.storefront-permissions":
version "1.36.0"
resolved "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.storefront-permissions#9b6eca8b176bd2b4a349932a598b6b8691bd6fe9"

w3c-hr-time@^1.0.2:
version "1.0.2"
Expand Down

0 comments on commit dce3ccd

Please sign in to comment.