reactioncommerce / api-plugin-accounts Goto Github PK
View Code? Open in Web Editor NEWAccounts plugin for the Reaction API
License: GNU General Public License v3.0
Accounts plugin for the Reaction API
License: GNU General Public License v3.0
When calling createAccount
directly in GraphiQL
(or another interface), the account is not created as expected - null
is returned, and no account is seen in the collection. This is / was an existing issue when this package was internal in reaction (src/core-services/account
), so we are going ahead with publishing this package, and will revisit.
This plugin needs an invitation
query to list all staff member invites, with paginated results and only allowed to admins.
The inviteShopMember
mutation allows a groupId
to be specified, but it would be even better to allow multiple groups with a groupIds
array.
This plugin needs a customers
query, with paginated results and only allowed to admins.
When a group is created(every time you create a shop or directly from graphQL), the console always displays this error
Error in "afterAccountGroupCreate" consumer TypeError: Cannot read property '_id' of null
or you can use the mutation updateAccountGroup directly
Get userId
from the context here instead of user
, and replace it in the event
1.4.4
Even though the tests pass, the following error is thrown after almost every test:
Error in "afterShopCreate" consumer TypeError: Cannot read property '_id' of null
at /home/circleci/reaction/node_modules/@reactioncommerce/api-plugin-accounts/src/startup/afterShopCreate.js:26:26
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at synchronousPromiseLoop (/home/circleci/reaction/node_modules/@reactioncommerce/api-core/src/util/appEvents.js:24:5)
at synchronousPromiseLoop (/home/circleci/reaction/node_modules/@reactioncommerce/api-core/src/util/appEvents.js:30:5)
at AppEvents.emit (/home/circleci/reaction/node_modules/@reactioncommerce/api-core/src/util/appEvents.js:53:5)
at insertPrimaryShop (/home/circleci/reaction/node_modules/@reactioncommerce/api-utils/lib/tests/insertPrimaryShop.js:123:3)
at Object.<anonymous> (/home/circleci/reaction/tests/integration/api/mutations/updateSimpleInventory/updateSimpleInventory.test.js:106:3)
npm run test
in reaction.This plugin uses the Address
, and AddressInput
types in GraphQL, which live in the address-validation plugin.
When work is done to move this plugin, we need to be sure to install api-plugin-address-validation
as a peerDependency
.
The default for customers is to not belong to a group anymore.
In createAccount
, groups default to an empty set, which is then passed to:
updateGroupsForAccounts
as empty array:
In updateGroupsForAccounts
, the Groups collection is searched for docs matching _id: { $in: [] }
which will return no elements.
Next, as the length of matching elements is 0, an error will be thrown:
So the implications of this are:
This error is only present in the latest trunk
branch, as in 1.3 there was no updateGroupsForAccounts
and instead createAccount
would execute addAccountToGroup
for each element in groups
, therefore just executing 0 times.
I only followed along the code and stumbled on this by accident so far and didn't actually test.
Check in createAccount
if there are actually groups to add, and decide wether to call updateGroupsForAccounts
.
Optionally, make updateGroupsForAccounts
fail gracefully with just some warning if it was called with groupIds.length < 1
.
trunk
Introduced here: 7c993f0#diff-8da12d48810df3c6da9a60f2945ee716R116
I'm re-writing the Accounts page in reaction-admin
and I will need a way to bulk-edit the groups
field on accounts. Something that can assign/de-assign multiple groups at once to/from multiple accounts at once. Current mutations would need to be ran multiple times if multiple groups are (de-)selected by the user.
Create an updateGroupsForAccounts
mutation, taking a groupIds
array instead of a groupId
string and an accountIds
array instead of an accountId
string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.