From 093c172d16732ba8d01faa313e0af99d26902205 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Fri, 7 Sep 2018 12:15:53 -0400 Subject: getting there --- stepped-solutions/53/backend/datamodel.graphql | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 stepped-solutions/53/backend/datamodel.graphql (limited to 'stepped-solutions/53/backend/datamodel.graphql') 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! +} -- cgit v1.3