summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/51/backend/datamodel.graphql
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-08-22 16:47:49 -0400
committerWes Bos <wesbos@gmail.com>2018-08-22 16:47:49 -0400
commit9876e7dfca6fa2bbf6ac383eeb8e2c82e05c2164 (patch)
tree3307dbf546a8e3ad027074c11069f8658dc36340 /stepped-solutions/51/backend/datamodel.graphql
parent5d4fca10187c8ffff19161ec2b3b02814789a3b2 (diff)
orders
Diffstat (limited to 'stepped-solutions/51/backend/datamodel.graphql')
-rwxr-xr-xstepped-solutions/51/backend/datamodel.graphql55
1 files changed, 55 insertions, 0 deletions
diff --git a/stepped-solutions/51/backend/datamodel.graphql b/stepped-solutions/51/backend/datamodel.graphql
new file mode 100755
index 0000000..b556d36
--- /dev/null
+++ b/stepped-solutions/51/backend/datamodel.graphql
@@ -0,0 +1,55 @@
+enum Permission {
+ ADMIN
+ USER
+ ITEMCREATE
+ ITEMUPDATE
+ ITEMDELETE
+ PERMISSIONUPDATE
+}
+
+type User {
+ id: ID! @unique
+ name: String!
+ email: String! @unique
+ password: String!
+ resetToken: String
+ 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!
+}