summaryrefslogtreecommitdiffstats
path: root/backend/database/datamodel.graphql
blob: b35f4230fadee69695fa526c61a297a6e888c429 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
type Post {
  id: ID! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
  isPublished: Boolean! @default(value: "false")
  title: String!
  text: String!
  author: User!
}

type User {
  id: ID! @unique
  email: String! @unique
  password: String!
  name: String!
  posts: [Post!]!
  orders: [Order!]!
  website: String
  age: Int
  resetToken: String
  resetTokenExpiry: String
  cart: [CartItem!]!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type CartItem {
  id: ID! @unique
  quantity: Int! @default(value: 1)
  item: Item! # Relationship to an Item
  user: User! # Relationship to a user
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Item {
  id: ID! @unique
  title: String!
  description: String!
  image: String
  largeImage: String
  price: Int!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type OrderItem {
  id: ID! @unique
  title: String!
  description: String!
  image: String
  largeImage: String
  price: Int!
  createdAt: DateTime!
  updatedAt: DateTime!
  quantity: Int! @default(value: 1)
  item: Item! # Relationship to an Item
  user: User! # Relationship to a user
}

type Order {
  id: ID! @unique
  items: [OrderItem!]!
  total: Int!
  user: User!
  createdAt: DateTime!
  updatedAt: DateTime!
  charge: String!
}