Alejandro Sanchez
06/06/2020, 3:01 AMAlejandro Sanchez
06/06/2020, 3:04 AMtype Home {
id: ID! @id
createdAt: DateTime! @createdAt
description: String!
url: String!
name: String!
location: String!
postedBy: User
}
type User {
id: ID! @id
name: String!
email: String! @unique
password: String!
homes: [Home!]!
}
Alejandro Sanchez
06/06/2020, 3:04 AMscalar DateTime
type Query {
info: String!
feed(filter: String, skip: Int, first: Int, orderBy: HomeOrderByInput): Feed!
home(id: ID!): Home
me: User!
}
enum HomeOrderByInput {
description_ASC
description_DESC
url_ASC
url_DESC
createdAt_ASC
createdAt_DESC
}
type Feed {
homes: [Home!]!
count: Int!
}
type Mutation {
post(url: String!, description: String!, name: String!, location: String!): Home!
signup(email: String!, password: String!, name: String!): AuthPayload
login(email: String!, password: String!): AuthPayload
}
type Subscription {
newHome: Home
}
type AuthPayload {
token: String
user: User
}
type User {
id: ID!
name: String!
email: String!
homes: [Home!]!
}
type Home {
id: ID!
createdAt: DateTime!
description: String
url: String
name: String
location: String
postedBy: User
images: [Image!]!
}
type Image {
id: ID!
name: String!
createdAt: DateTime!
description: String!
uploadedBy: User!
home: Home!
}
type ImageList {
images: [Image!]!
count: Int!
}
Alejandro Sanchez
06/06/2020, 3:04 AMAlejandro Sanchez
06/06/2020, 3:06 AMRyan
06/08/2020, 9:27 AMschema.graphql
that you will be exposing to the client via the GraphQL API.
If you do not want to manually create the schema.graphql
you can use Nexus.