From 55aa837bde3138977273f898d77ad2fad56491df Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 7 Sep 2018 08:50:17 +0200 Subject: [PATCH] Known Improvements list added --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index daef7293d..2d8579e81 100644 --- a/README.md +++ b/README.md @@ -1 +1,26 @@ # ModuleUsers + + +# Known Improvements + +1. Remove the relationship to users, since it is not needed. + +const RoleType = new GraphQLObjectType({ + name: 'Role', + fields: () => ({ + id: { type: GraphQLID}, + name: {type: GraphQLString}, + users: { + type: new GraphQLList(UserType), + resolve(parent, args) { + return User.find({roleId: parent.id}); + } + } + }) +}); + +2. Roles should be an Enum Type. + +Since roles just have a name field, I think we should use the ENUM type... https://graphql.org/learn/schema/#enumeration-types +They would just be resolved in Mongoose/MongoDB as strings and we would validate specifcially to those strings. +Unless there's going to be many types of roles in the future.