Last active
November 26, 2018 19:36
-
-
Save benjaminadk/cf4d5836a9240f026704646d22c0ab02 to your computer and use it in GitHub Desktop.
chingu-7-data-model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const categories = ['react', 'jquery', 'angular', 'vue'] | |
const subCategories = ['documentation', 'tutorial', 'book'] | |
const user = { | |
id: String, // generated by db | |
username: String, // unique | |
password: String, // if we use text password | |
email: String, // unique | |
oauthId: String, // if we use oauth | |
_items: [String], // array of itemIds mongo ref to 'item' --> items that user created | |
_votes: [String], // array of voteIds mongo ref to 'vote' --> votes user has cast | |
createdAt: Date // timestamp | |
} | |
const item = { | |
id: String, | |
category: Int, // from enum of predefined categories we set --> react=0, jquery=1, etc | |
subCategory: Int, // from enum --> tutorial=0, docs=1, etc | |
title: String, // main text displayed to represent item --> 'Wes Bos Advanced React/Apollo Course' | |
summary: String, // more detail about item | |
creator: String, // original content creator ie. not the User | |
href: String, // link to website of item | |
image: String, // url of screenshot/logo/something represents item | |
votes: Int, // could be mongo ref but not needed if we use user _votes to handle business logic | |
createdAt: Date | |
} | |
const vote = { | |
id: String, | |
_itemId: String, // mongo ref to item --> make sure user only gets one vote per category+subcategory?? | |
_userId: String, // mongo ref to user who cast vote | |
createdAt: Date | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment