forked from rtanner0150/foodie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects.js
More file actions
174 lines (145 loc) · 3.71 KB
/
Copy pathobjects.js
File metadata and controls
174 lines (145 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
- Blog Post
-- Properties
- Author
- Date Posted
- Title
- Description
- Picture (optional)
- Recipe (optional)
-- Methods
- Create/Add (user, mod)
- Remove (user, mod)
- Edit (user, mod)
- Share (user)
- Comment (user)
- Upvote/Downvote (user)
- Recipe
-- Properties
- Title
- Tags
- Prep/Cook Time
- Ingredients
- Recipe Story
- Recipe Summary
- Substitutions (optional)
- Image (optional)
-- Methods
- Create/Add (user, mod)
- Remove (user, mod)
- Edit (user, mod)
- Share (user)
- Comment (user)
- Rate (user)
- User
-- Properties
- Username
- Password
- Email Address
- Profile
- Pantry Items (ingredients)
-- Methods
- Create (non-user)
- Delete (user)
- Login (non-user)
- Logout (user)
- Profile
*/
class BlogPost {
constructor(title, description, picture = null, recipe = null) {
//title of post
this.title = title;
//contents of post
this.description = description;
//shared image (optional)
this.picture = picture;
//shared recipe (optional)
this.recipe = recipe;
//gets current user for setting author of post
//this.author = getUser();
//gets current date for new posts
this.datePosted = new Date();
}
addPost() {
//adds new blogpost to collection of blogposts
}
removePost() {
//removes from collection
}
editPost() {
//edits data in existing post
}
sharePost() {
//shares post to current user's feed
}
createComment() {
//adds comment by current user
}
upvote() {
//upvote post
}
downvote() {
//downvote post
}
}
class Recipe {
constructor (title, prepTime, ingredients, tags, directions, story = null, substitutions = null, image = null){
//title of recipe
this.title = title;
//prep/cook time
this.prepTime = prepTime;
//ingredients list (collection of Ingredient objects?)
this.ingredients = ingredients;
//tags: categories/cuisines/keywords
this.tags = tags;
//recipe directions
this.directions = directions;
//"story" about recipe (anecdotal info related to recipe) (optional)
this.story = story;
//possible ingredient substitutions (optional)
this.substitutions = substitutions;
//image related to recipe (optional)
this.image = image;
}
createRecipe() {
//adds new recipe to collection of Recipe objects
}
editRecipe() {
//edits data in existing recipe
}
deleteRecipe() {
//removes from collection
}
shareRecipe() {
//shares recipe to current user's feed
}
commentRecipe() {
//adds comment by current user
}
rateRecipe() {
//adds rating to recipe from current user
}
}
class User {
constructor (username, password, email, profile, pantry){
this.username = username;
this.password = password;
this.email = email;
//collection of profile related objects?
this.profile = profile;
//collection of PantryItem or Ingredient objects that a user has
this.pantry = pantry;
}
createUser() {
//adds new user to collection of users
}
deletUser() {
//removes user
}
login() {
//logs in user based on given parameters
}
logout() {
//logs out current user
}
}