diff options
Diffstat (limited to 'finished-application/backend/prisma/datamodel.graphql')
| -rw-r--r-- | finished-application/backend/prisma/datamodel.graphql | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/finished-application/backend/prisma/datamodel.graphql b/finished-application/backend/prisma/datamodel.graphql new file mode 100644 index 0000000..cb8afcb --- /dev/null +++ b/finished-application/backend/prisma/datamodel.graphql @@ -0,0 +1,65 @@ +enum Permission { + ADMIN + USER + ITEMCREATE + ITEMUPDATE + ITEMDELETE + PERMISSIONUPDATE +} + +type User { + id: ID! @unique + email: String! @unique + password: String! + name: String! + orders: [Order!]! + resetToken: String + resetTokenExpiry: String + cart: [CartItem!]! + createdAt: DateTime! + updatedAt: DateTime! + permissions: [Permission!]! +} + +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! + user: User! # Relationship to a user +} + +type OrderItem { + id: ID! @unique + title: String! + description: String! + image: String + largeImage: String + price: Int! + createdAt: DateTime! + updatedAt: DateTime! + quantity: Int! @default(value: 1) +} + +type Order { + id: ID! @unique + items: [OrderItem!]! + total: Int! + user: User! + createdAt: DateTime! + updatedAt: DateTime! + charge: String! +} |
