summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/53/backend/datamodel.graphql
diff options
context:
space:
mode:
Diffstat (limited to 'stepped-solutions/53/backend/datamodel.graphql')
-rwxr-xr-xstepped-solutions/53/backend/datamodel.graphql57
1 files changed, 57 insertions, 0 deletions
diff --git a/stepped-solutions/53/backend/datamodel.graphql b/stepped-solutions/53/backend/datamodel.graphql
new file mode 100755
index 0000000..ce9ae38
--- /dev/null
+++ b/stepped-solutions/53/backend/datamodel.graphql
@@ -0,0 +1,57 @@
+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!
+ createdAt: DateTime!
+ updatedAt: DateTime!
+}