Now that you've created your Apollo Server instance, you need to create your GraphQL types. In this case, we will create some types, queries, and mutations for users.
The first thing you need to do is define your scalar types at /backend/src/graphql/types/Scalar.graphql:
scalar UUID
scalar Datetime
scalar JSON
Now, let's create our User.graphql file with our initial User type:
type User {
id: UUID!
username: String!
password: String!
email: String!
privilege: String!
active: Boolean!
createdAt: Datetime!
updatedAt: Datetime!
}
As you can see, we are using some scalar types such as UUID and Datetime to define some fields in our User type. In this case, when you define a type in GraphQL, you need to do so with the type keyword, followed by the type's name capitalized. Then, you can define your fields inside the curly braces, {}.
There are some primitive data types in GraphQL such as String, Boolean, Float, and Int. You...