summaryrefslogtreecommitdiffstats
path: root/backend/src/schema.graphql
blob: b30b0962a5dd7a25b53bcf0fa62c3ca4c8498541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# import CartItem, ItemWhereInput, ItemOrderByInput, allItems, Post, Item, ItemCreateInput, ItemOrderByInput, ItemWhereInput from './generated/prisma.graphql'

type Query {
  feed: [Post!]!
  drafts: [Post!]!
  post(id: ID!): Post!
  me: User
  itemsConnection(
    where: ItemWhereInput
    orderBy: ItemOrderByInput
    skip: Int
    after: String
    before: String
    first: Int
    last: Int
  ): ItemConnection!
  items(
    where: ItemWhereInput
    orderBy: ItemOrderByInput
    skip: Int
    first: Int
  ): [Item]!
}

# import Mutation from './generated/prisma.graphql'

type Mutation {
  signup(email: String!, password: String!, name: String!): AuthPayload!
  signin(email: String!, password: String!): AuthPayload!
  requestReset(email: String!): User
  resetPassword(resetToken: String!, password: String!, confirmPassword: String!): AuthPayload!
  createDraft(title: String!, text: String!): Post!
  publish(id: ID!): Post!
  deletePost(id: ID!): Post!
  updatePost(id: ID!, title: String, text: String): Post!
  createItem(title: String, description: String, price: Int): Item!
  deleteItem(id: ID!): Item!
  updateItem(id: ID!, title: String, description: String, price: Int): Item!
  addToCart(id: ID!): CartItem
  removeFromCart(id: ID!): CartItem
}

type AuthPayload {
  token: String!
  user: User!
}

type User {
  id: ID!
  email: String!
  website: String
  name: String!
  posts: [Post!]!
  age: Int
  cart: [CartItem!]!
}