Skip to content

Instantly share code, notes, and snippets.

@benjaminadk
Last active November 28, 2018 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminadk/df675b4a79042123df8ca79990cc9d61 to your computer and use it in GitHub Desktop.
Save benjaminadk/df675b4a79042123df8ca79990cc9d61 to your computer and use it in GitHub Desktop.
chingu7 graphql data model
type User {
id: ID! @unique
name: String!
email: String! @unique
image: String
password: String # tradition email/password login
oauthId: String # if oauth login is used
posts: [Post]
reviews: [Review]
createdAt: DateTime!
}
type Post {
id: ID! @unique
langauge: Language!
library: Library!
contentType: ContentType!
difficulty: Difficulty!
title: String! # main ui piece the title
description: String! # details about the post
author: String # company/person who created the content on the web
href: String! # link to the actual content
image: String # brand logo or image associated with content
price: Int! # free would be 0, could use enum here too
reviews: [Review] # review about this post, calcuate rating with this
user: User! # user who create the post on the site
createdAt: DateTime!
}
type Review {
id: ID! @unique
rating: Int! # 0 to 5 stars
text: String # comment
user: User! # use who create review
post: Post! # post that is reviewed
createdAt: DateTime!
}
# various programming languages
enum Language {
JAVASCRIPT
PYTHON
CPLUSPLUS
}
# important libraries for included languages
enum Library {
NATIVE # built into the language
REACT
SCRAPY
ON_POSIX
}
# general categories of content
enum ContentType {
DOCUMENTATION
TUTORIAL
BOOK
ARTICLE
}
# difficulty level of content
enum Difficulty {
EASY
INTERMEDIATE
HARD
EXPERT
}
@benjaminadk
Copy link
Author

Model assumes user generated content. There are lots of ways to organize/categorize this data. This is just one way that made sense at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment