summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/53/backend/datamodel.graphql
blob: 85f943945d9a37e96c28419681bdaadefc0583b8 (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
enum Permission {
  ADMIN
  USER
  ITEMCREATE
  ITEMUPDATE
  ITEMDELETE
  PERMISSIONUPDATE
}

type User {
  id: ID! @unique
  name: String!
  email: String! @unique
  password: String!
  resetToken: Float
  resetTokenExpiry: String
  permissions: [Permission]
  cart: [CartItem!]!
}

type Item {
  id: ID! @unique
  title: String!
  description: String!
  image: String
  largeImage: String
  price: Int!
  user: User!
}

type CartItem {
  id: ID! @unique
  quantity: Int! @default(value: 1)
  item: Item # relationship to Item
  user: User! # relationship to User
}

type OrderItem {
  id: ID! @unique
  title: String!
  description: String!
  image: String!
  largeImage: String!
  price: Int!
  quantity: Int! @default(value: 1)
  user: User
}

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