8000 Productroutes by YaronPeres · Pull Request #13 · carlesespunya/Project2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Productroutes #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
54a19bc
new archives created
MilkyRaven Nov 4, 2022
acd015f
new documents
MilkyRaven Nov 4, 2022
09600a3
new documents
MilkyRaven Nov 4, 2022
563b542
test
MilkyRaven Nov 4, 2022
fca628a
Merge pull request #1 from MilkyRaven/test
MilkyRaven Nov 4, 2022
1d957e7
models created
MilkyRaven Nov 4, 2022
7876da6
Merge pull request #2 from MilkyRaven/models
MilkyRaven Nov 4, 2022
57154ce
first routes
Nov 4, 2022
60a2d9a
Merge pull request #3 from MilkyRaven/routes
MilkyRaven Nov 4, 2022
f9f942b
working on seeds
MilkyRaven Nov 4, 2022
f0a3640
Merge pull request #4 from MilkyRaven/seeds
MilkyRaven Nov 4, 2022
4a96cac
working on the design
MilkyRaven Nov 4, 2022
8482aee
comicsseeds
Nov 4, 2022
acd1f7b
Merge pull request #5 from MilkyRaven/comicsseeds2
MilkyRaven Nov 4, 2022
a07676f
navbar design completed
MilkyRaven Nov 5, 2022
0ab6c9c
reviews seeds, users and comics are commented to not affect the revie…
Nov 5, 2022
947a341
Merge pull request #6 from MilkyRaven/userseed
MilkyRaven Nov 5, 2022
94a0422
Merge branch 'main' of https://github.com/MilkyRaven/Project_VintageC…
MilkyRaven Nov 5, 2022
1eb8720
"Working on design"
MilkyRaven Nov 5, 2022
1d3347d
Merge pull request #7 from MilkyRaven/design
MilkyRaven Nov 5, 2022
8681547
basic structure and css of the pages
MilkyRaven Nov 5, 2022
1984838
working on styles, added logo img
MilkyRaven Nov 5, 2022
37beee2
routed check
Nov 5, 2022
1249df3
Merge pull request #8 from MilkyRaven/design
MilkyRaven Nov 5, 2022
7ecd761
Merge branch 'main' into routesupdate
MilkyRaven Nov 5, 2022
1df3550
Merge pull request #9 from MilkyRaven/routesupdate
MilkyRaven Nov 5, 2022
034ff8d
fixed catalogue route
MilkyRaven Nov 5, 2022
654acf4
Merge branch 'main' into design
MilkyRaven Nov 5, 2022
49f7e01
Merge pull request #10 from MilkyRaven/design
MilkyRaven Nov 5, 2022
a31c115
improved catalogue
MilkyRaven Nov 5, 2022
a4ff549
changes
MilkyRaven Nov 5, 2022
8ffbc63
product details routes
Nov 5, 2022
0dd4217
Merge pull request #11 from MilkyRaven/design
MilkyRaven Nov 5, 2022
8af3fca
Merge branch 'main' into productroutes
MilkyRaven Nov 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added Project/.DS_Store
Binary file not shown.
194 changes: 191 additions & 3 deletions Project/bin/seeds.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,207 @@
const mongoose = require("mongoose")

// Require the models, Example: (-- const Book = require("../models/Book.model") --)
const Comic = require("../models/Comics.model")
const User = require("../models/User.model")
const Review = require("../models/Reviews.model")

const MONGO_URI = "mongodb://localhost:27017/project2"
const MONGO_URI = "mongodb://localhost:27017/vintageComicShop"

const comic = [
{
title: "The Batman Meets Doctor Death",
img: "https://files1.comics.org//img/gcd/covers_by_id/5/w400/5137.jpg?-3164861915678165786",
author: "Book Kane",
comicSeries: "Detective Comics",
year: 1939,
condition: "Used",
synopsis: "Dr. Death plans to use his new invention of a poisonous pollen extract on any wealthy person who refuses to pay him tribute.",
price: 16.99,
reviewIds: [],
quantity: 4
},

{
title: "Les Cigares du Pharaon",
img: "https://files1.comics.org//img/gcd/covers_by_id/1493/w400/1493274.jpg?1117383809191476521",
author: "Hergé",
comicSeries: "Les Aventures de Tintin",
year: 1987,
condition: "Good",
synopsis: "Holidaying on a Mediterranean cruise ship, Tintin and his dog Snowy meet wealthy film producer Rastapopoulos and eccentric Egyptologist Sophocles Sarcophagus",
price: 9.99,
reviewIds: [],
quantity: 6
},

{
title: "Action Comics No. 40",
img: "https://files1.comics.org//img/gcd/covers_by_id/0/w400/565.jpg?-6831418524261450474",
author: "Fred Ray",
comicSeries: "Action Comics",
year: "1938" ,
condition: "Used",
synopsis: "A millionaire agrees to pay $100,000 to charity if Superman helps to straighten out his wayward daughter who spends money as if it were water as various gambling establishments. Only when an emergency arises does the girl see herself in a different vein.",
price: 199.9,
reviewIds: [],
quantity: 2
},
{
title: "Mafalda",
img: "https://files1.comics.org//img/gcd/covers_by_id/1312/w400/1312954.jpg?7950182444208753492",
author: "Quino",
comicSeries: "Mafalda",
year: 1966,
condition: "Good",
synopsis: "Mafalda is a girl who faces reality with the ingenuity and tenderness typical of childhood.",
price: 22.99,
reviewIds: [],
quantity: 2
},
{
title: "Misantropolis",
img: "https://files1.comics.org//img/gcd/covers_by_id/1012/w400/1012879.jpg?3921397601305097350",
author: "Tove Jansson",
comicSeries: "Mummintroll",
year: 1995,
condition: "Very Good",
synopsis: "The main protagonist, the little boy of the family, is interested in and excited about everything he sees and finds, always trying to be good, but sometimes getting into trouble while doing so; he is very brave and always finds a way to make his friends happy.",
price: 14.99,
reviewIds: [],
quantity: 3
},
{
title: "Action Comics No. 27",
img: "https://files1.comics.org//img/gcd/covers_by_id/0/w400/552.jpg?4303249213407754409",
author: "Paul Cassidy",
comicSeries: "Action Comics",
year: 1940,
condition: "Used",
synopsis: "Clark arrives for a date with Lois, who is making a donation to the Brentwood Rehabilitation Home. Clark tells her that the place is more interested in money than their young charges. Lois decides they should visit the home so that she can disprove Clark. After a pleasant visit, Lois and Clark are stopped by a charge, Davey Merrill, who cut his hands climbing the wall just to ask for something to eat. Once they feed him, he tells them all about the horrible conditions at the home",
price: 169.99,
reviewIds: [],
quantity: 1
},
{
title: "Action Comics No. 150",
img: "https://files1.comics.org//img/gcd/covers_by_id/1138/w400/1138923.jpg?7824686344579582815",
author: "Wayne Boring",
comicSeries: "Action Comics",
year: 1950,
condition: "Used",
synopsis: 'Mr. Mxyztplk teams with the Prankster and Lex Luthor to humiliate Superman by making "plastic proxies" (androids) which make it appear as if Lois has jilted Superman for Mxyztplk, make it seem that Superman has falsely accusing Luthor, and make Superman look like the victim of the pranks of the Prankster. But just as the public begins to wonder why they ever admired him, Superman turns the tables on the trio.',
price: 99.9,
reviewIds: [],
quantity: 3
},
{
title: "The Rose of Versailles Vol.1",
img: "https://files1.comics.org//img/gcd/covers_by_id/1379/w400/1379263.jpg?-6745954624512040830",
author: "Riyoko Ikea",
comicSeries: "The Rose of Versailles",
year: 1981,
condition: "Used",
synopsis: "Oscar Francois de Jarjeyes is a young noblewoman raised as a son by her father. As commander of Marie Antoinette's palace guard, Oscar is brought face-to-face with the luxury of King Louis XVI's court at Versailles. Joined by her servant Andre, Oscar is privy to the intrigue and deceit of France's last great royal regime.",
price: 6.99,
reviewIds: [],
quantity: 7
},
{
title: "Nausicaä of the Valley of Wind #1",
img: "Nausicaä of the Valley of Wind #1",
author: "Hayao Miyazaki",
comicSeries: "Nausicaä of the Valley of Wind",
year: 1988,
condition: "Very Good",
synopsis: "Taking place in a post-nuclear futuristic world, the film tells the story of Nausicaä (Shimamoto), the young teenage princess of the Valley of the Wind. She becomes embroiled in a struggle with Tolmekia, a kingdom that tries to use an ancient weapon to eradicate a jungle full of giant mutant insects.",
price: 34.99,
reviewIds: [],
quantity: 1
},
{
title: "Action Comics No. 3",
img: "https://files1.comics.org//img/gcd/covers_by_id/2/w400/2465.jpg?-4414093043624628871",
author: "Bill Finger",
comicSeries: "Batman",
year: 1940,
condition: "Used",
synopsis: "The Caped Crusaders must stop the likes of the Puppet Master, who has set his sights on stealing the Voss Rifle, the Army's newly developed secret gun. But to do it, Batman must overcome the effects of having come under the hypnotic influence of his foe.",
price: 89.99,
reviewIds: [],
quantity: 9
}
]

const users = [
{
username: "yaron1",
email: "yaron1@gmail.com",
password: "1234",
},
{
username: "carol",
email: "carol@gmail.com",
password: "1234",
},
{
username: "carlas",
email: "carlas@gmail.com",
password: "1234",
}
]
const reviews = [
{
title: "Very good service",
userId: "6366346c4ba4c2af26cefabb",
comicId: "6366346c4ba4c2af26cefaab",
content: "Very good service from the store, fast delivery and the comic is in a very good condition as well",
rating: 5
},
{
title: "Nice quality",
userId: "6366346c4ba4c2af26cefabc",
comicId: "6366346c4ba4c2af26cefaad",
content: "The comic arrived in a good quality, service was ok",
rating: 4
},
{
title: "Service is good But the comic is too vintage",
userId: "6366346c4ba4c2af26cefabd",
comicId: "6366346c4ba4c2af26cefaae",
content: "The comic arrived in a bad condition ive expected for better condition",
rating: 3
}
]

const createSeeds = async function () {
try {
const connect = await mongoose.connect(MONGO_URI)
console.log(`Connected to database: ${connect.connections[0].name}`)
//---------------------comics seeds --------------
//const deleteAll = await Comic.deleteMany()
//console.log("Comic Db clean")

//const createAll = await Comic.create(comic)
//console.log("comics created")
//---------------------comics seeds --------------
//---------------------users seeds --------------
//const deleteAllUser = await User.deleteMany()
//console.log("User Db clean")

//const createAllUser = await User.create(users)
//console.log("users created")
//---------------------users seeds --------------
//---------------------review seeds --------------
//const deleteAllreview = await Review.deleteMany()
//console.log("reviews Db clean")

// Clear DB, Example: (-- const deleteAll = await Book.deleteMany() --)
// console.log("Db clean")
//const createAllreview = await Review.create(reviews)
//console.log("reviews created")
//---------------------review seeds --------------

const dbClose = await mongoose.connection.close()

console.log("Seeds created")
} catch (err) {
console.log(`Error creating the seeds: ${err}`)
Expand Down
2 changes: 1 addition & 1 deletion Project/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const mongoose = require("mongoose");
// If no env has been set, we dynamically set it to whatever the folder name was upon the creation of the app

const MONGO_URI =
process.env.MONGODB_URI || "mongodb://localhost:27017/project2";
process.env.MONGODB_URI || "mongodb://localhost:27017/vintageComicShop";

mongoose
.connect(MONGO_URI)
Expand Down
20 changes: 20 additions & 0 deletions Project/models/Comics.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { Schema, model } = require("mongoose");

const comicSchema = new Schema(
{
title: String,
img: String,
author: String,
comicSeries: String,
year: Number,
condition: String,
synopsis: String,
price: Number,
reviewIds: [{ type: Schema.Types.ObjectId, ref: 'Review'}],
quantity: Number
}
);

const Comic = model("Comic", comicSchema);

module.exports = Comic;
15 changes: 15 additions & 0 deletions Project/models/Reviews.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { Schema, model } = require("mongoose");

const reviewSchema = new Schema(
{
title: String,
userId: {type: Schema.Types.ObjectId, ref: 'User'},
comicId: {type: Schema.Types.ObjectId, ref: 'Comic'},
content: String,
rating: Number
}
);

const Review = model("Review", reviewSchema);

module.exports = Review;
15 changes: 15 additions & 0 deletions Project/models/ShoppingCart.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//THIS DOCUMENTS NEEDS TO BE CHECKED, PROBABLY WILL GIVE ERRORS- TEST
const { Schema, model } = require("mongoose");

const shoppingCartSchema = new Schema(
{
userId: {type: Schema.Types.ObjectId, ref: 'User'},
productIds: [{type: Schema.Types.ObjectId, ref: 'Comic'}],
productQuantity: Number,
totalPrice: Number
}
);

const shoppingCart = model("shoppingCart", shoppingCartSchema);

module.exports = shoppingCart;
Loading
0