-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature: design graphql user schema #90
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tuanthanh2067/seeksi/7dYhZLzv13yihHoSFfNAdPKqmUFM |
There's 4 new types I just added, can you guys please check to see if I need to change anything to nullable or non-nullabel @oliver-pham @minhhang107 |
I can't anticipate any problem with allowing all the fields in |
How about User type? @oliver-pham |
Apart from the change in the resolver's response, I think it's good to be merged, @tuanthanh2067. |
dob: String! | ||
sex: String! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can create scalar types for dob
and sex
(e.g. Date
and Sex
). I'm not sure if we have time for this, but just writing it down for future enhancement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, go head. For now, we can just use string.
@@ -1,6 +1,6 @@ | |||
const queries = { | |||
userByEmail: async (_, args, { dataSources }) => { | |||
return await dataSources.userAPI.findUser(args.email); | |||
return await dataSources.userAPI.findUserByEmail(args.email); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to change the response in this resolver.
A response should have these fields:
code
(status code of the response like 200, 404),success
:true
/false
message
(optional): the response error message if it fails- any data (e.g. user)
Related issue
Fixes #36
Type of Change
Note
I bring the note up here because we have something to discuss here! For the fields, they can be nullable and non-nullable. For example: String! and [String!]! are non-nullable. [String!]! will always have to return an empty array or array of strings. I'm not sure about which fields should be nullable and which ones should be non-nullable.
For reference here
Description
This PR is to add user schema in GraphQL and add missing type in database as well. I also added a query to get user by email so we can test it out using our local database.
Screenshot