Skip to content

Commit 11779de

Browse files
profile edits
2 parents 268486e + b03f069 commit 11779de

File tree

12 files changed

+57
-313
lines changed

12 files changed

+57
-313
lines changed

data/SeedData.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
{
22
"PostSeedData": [
33
{
4-
"title": "title1",
4+
"title": "Living at Breadloaf",
55
"posterID": 1,
6-
"content": "content1",
6+
"content": "I went into summer housing draw and am now forced to live in Breadoaf for the fall semester. As I do not have a car, this will be incredibly inconvient for me and I expect my grades to fall. Does anyone else think Middlebury needs to focus more on supporting its current students rather than prioritizing incoming first years?",
77
"category": "school",
88
"num_votes": 10,
99
"id": 1,
1010
"created_at": "2023-04-17T18:07:54.472Z"
1111
},
1212
{
13-
"title": "title2",
13+
"title": "No Nutella??",
1414
"posterID": 2,
15-
"content": "content2",
15+
"content": "Recently there has been no Nutella in the dining halls. I know it is a small thing, but it seems like something small that really makes students happier? Does anyone agree?",
1616
"category": "food",
1717
"num_votes": 2,
1818
"id": 2,
1919
"created_at": "2023-04-17T13:46:11.125Z"
2020
},
2121
{
22-
"title": "title3",
22+
"title": "O for Registration",
2323
"posterID": 3,
24-
"content": "content3",
24+
"content": "I got 0/4 courses for fall course registration. It is outrageous that as a junior I cannot get classes to fuffil my major!",
2525
"category": "school",
2626
"num_votes": 8,
2727
"id": 3,
2828
"created_at": "2023-04-17T12:54:00.364Z"
2929
},
3030
{
31-
"title": "title4",
31+
"title": "Library Hours",
3232
"posterID": 1,
33-
"content": "content4",
33+
"content": "I'm very frustrated that Davis and Armstrong close at 5pm on Friday and Saturday. It seems that this is the sort of thing that Midd does so they do not need to pay students to keep the library open. I'm sure there are students would would be willing to work in the evenings (like me!). ",
3434
"category": "school",
3535
"num_votes": 6,
3636
"id": 4,
@@ -97,21 +97,21 @@
9797
"id": 1,
9898
"commenterID": 1,
9999
"postID": 1,
100-
"content": "commentContent1",
100+
"content": "Absolutely insane.",
101101
"likes": 2
102102
},
103103
{
104104
"id": 2,
105105
"commenterID": 1,
106106
"postID": 1,
107-
"content": "commentContent1",
107+
"content": "Please Midd, stop letting as many people into the school.",
108108
"likes": 0
109109
},
110110
{
111111
"id": 3,
112112
"commenterID": 2,
113113
"postID": 2,
114-
"content": "commentContent2",
114+
"content": "Really missing the Nutella. Please bring it back Midd",
115115
"likes": 3
116116
}
117117
]

ellen.db

-4 KB
Binary file not shown.

knex/seeds/comments.js

+9-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1-
/**
2-
* @param { import("knex").Knex } knex
3-
* @returns { Promise<void> }
4-
*/
1+
const fs = require("fs");
2+
const contents = fs.readFileSync("./data/SeedData.json");
3+
const data = JSON.parse(contents);
4+
55
exports.seed = async function (knex) {
6-
// Deletes ALL existing entries
6+
const commentData = data.CommentSeedData.map((entry) => {
7+
return { ...entry, created_at: new Date().toISOString() };
8+
});
9+
710
await knex("comments").del();
8-
await knex("comments").insert([
9-
{
10-
id: 1,
11-
commenterID: 1,
12-
postID: 1,
13-
content: "content_1",
14-
likes: 0,
15-
created_at: new Date().toISOString(),
16-
},
17-
{
18-
id: 2,
19-
commenterID: 2,
20-
postID: 2,
21-
content: "content_2",
22-
likes: 0,
23-
created_at: new Date().toISOString(),
24-
},
25-
]);
11+
await knex("comments").insert(commentData);
2612
};

knex/seeds/posts.js

+9-19
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,15 @@
22
* @param { import("knex").Knex } knex
33
* @returns { Promise<void> }
44
*/
5+
const fs = require("fs");
6+
const contents = fs.readFileSync("./data/SeedData.json");
7+
const data = JSON.parse(contents);
8+
59
exports.seed = async function (knex) {
6-
// Deletes ALL existing entries
10+
const postData = data.PostSeedData.map((entry) => {
11+
return { ...entry, created_at: new Date().toISOString() };
12+
});
13+
714
await knex("posts").del();
8-
await knex("posts").insert([
9-
{
10-
title: "title1",
11-
posterID: 1,
12-
content: "content1",
13-
num_votes: 0,
14-
category: "school",
15-
created_at: new Date().toISOString(),
16-
},
17-
{
18-
title: "title2",
19-
posterID: 2,
20-
content: "content2",
21-
num_votes: 10,
22-
category: "food",
23-
created_at: new Date().toISOString(),
24-
},
25-
]);
15+
await knex("posts").insert(postData);
2616
};

public/components/filterBar.js

-45
This file was deleted.

public/components/filterBar.test.js

-36
This file was deleted.

public/components/post.js

-36
This file was deleted.

public/components/postsList.js

-43
This file was deleted.

public/components/postsList.test.js

-71
This file was deleted.

0 commit comments

Comments
 (0)