Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 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
4c49db0
Merge pull request #12 from MilkyRaven/productroutes
MilkyRaven Nov 5, 2022
2fa52dd
fixed images
MilkyRaven Nov 5, 2022
43a4471
Merge pull request #13 from MilkyRaven/design
MilkyRaven Nov 5, 2022
198574b
logout fixed
Nov 5, 2022
be782e8
Merge pull request #14 from MilkyRaven/userfunction
MilkyRaven Nov 5, 2022
7037b42
added cart hbs
MilkyRaven Nov 6, 2022
69ed9aa
Merge pull request #15 from MilkyRaven/design
MilkyRaven Nov 6, 2022
362a2a0
user shopping cart
Nov 6, 2022
e4268cc
Merge pull request #16 from MilkyRaven/usershopcart
MilkyRaven Nov 6, 2022
8b8af29
added controllers folder
MilkyRaven Nov 6, 2022
9859c16
Merge pull request #17 from MilkyRaven/controllers
MilkyRaven Nov 6, 2022
d6b2b2d
updated first part of main page, added fonts
MilkyRaven Nov 6, 2022
3500cad
sign up page design updated
MilkyRaven Nov 6, 2022
3931c8f
login & sign up design updated
MilkyRaven Nov 6, 2022
2620e88
footer design updated
MilkyRaven Nov 6, 2022
8838efc
improved product style
MilkyRaven Nov 6, 2022
8b07a0c
fixed half of the image database
MilkyRaven Nov 6, 2022
b64fe94
new styles
MilkyRaven Nov 6, 2022
7ca3384
Merge pull request #18 from MilkyRaven/new-styles
MilkyRaven Nov 6, 2022
00ce385
appears product ID & number of clicks
MilkyRaven Nov 6, 2022
03f857d
delete
MilkyRaven Nov 7, 2022
aefaf31
deleted wrong cart
MilkyRaven Nov 7, 2022
260090c
delete wrong cart model
MilkyRaven Nov 7, 2022
d608cf7
Merge pull request #19 from MilkyRaven/cart
MilkyRaven Nov 7, 2022
0c057dd
items updated
MilkyRaven Nov 7, 2022
1f2e77e
user has a new cart
MilkyRaven Nov 7, 2022
4d2a964
carrito
MilkyRaven Nov 7, 2022
af6f23c
Merge pull request #20 from MilkyRaven/cart
MilkyRaven Nov 7, 2022
f999d63
working on carrito!
MilkyRaven Nov 7, 2022
c183699
cart working
MilkyRaven Nov 7, 2022
381ca35
Merge branch 'main' into test-carrrito
MilkyRaven Nov 7, 2022
5072261
Merge pull request #21 from MilkyRaven/test-carrrito
MilkyRaven Nov 7, 2022
6c37bbf
cart is working
MilkyRaven Nov 7, 2022
21ca2b4
path blocked
MilkyRaven Nov 7, 2022
be1a7b5
Merge pull request #22 from MilkyRaven/blocking
MilkyRaven Nov 7, 2022
ca5c19a
cart display works
MilkyRaven Nov 7, 2022
876c05f
Merge pull request #23 from MilkyRaven/cart-display
MilkyRaven Nov 7, 2022
5861a08
cart works
MilkyRaven Nov 7, 2022
b536676
working on cart style
MilkyRaven Nov 7, 2022
203bcd1
Merge pull request #24 from MilkyRaven/cart-display
MilkyRaven Nov 7, 2022
c0533b5
items get deleted from cart
MilkyRaven Nov 7, 2022
e851b3d
when no items, displays empty cart
MilkyRaven Nov 7, 2022
d626a70
Merge pull request #25 from MilkyRaven/cart-display
MilkyRaven Nov 7, 2022
e234fe2
checkout and clean cart
MilkyRaven Nov 7, 2022
694a1b3
Merge pull request #26 from MilkyRaven/cart-display
MilkyRaven Nov 7, 2022
e9eb468
logout button
Nov 8, 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://i.imgur.com/IDVRisS.jpg",
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://i.imgur.com/46d3BBh.jpg",
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://i.imgur.com/TRwqBIx.jpg",
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 #3",
img: "https://i.imgur.com/A8VLIhO.jpg",
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: "Mummitrollet #7",
img: "https://i.imgur.com/1ZJbbu6.jpg",
author: "Tove Jansson",
comicSeries: "Mummintroll",
year: 1998,
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://i.imgur.com/sFXx9ni.jpg",
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://i.imgur.com/4csktko.jpg",
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://i.imgur.com/PhIUrUk.jpg",
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: "https://i.imgur.com/jKe7ZGE.jpg",
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: "Batman #118",
img: "https://i.imgur.com/0UeAVae.jpg",
author: "Sheldon Moldoff",
comicSeries: "Batman",
year: 1940,
condition: "Used",
synopsis: "The Caped Crusaders have the task of saving four escaped felons from the radiation they have become contaminated with before they perish or infect others.",
price: 89.99,
reviewIds: [],
quantity: 9
}
]

// const users = [
// {
// username: "yaron1",
// email: "yaron1@gmail.com",
// password: "1234567",
// },
// {
// username: "carol",
// email: "carol@gmail.com",
// password: "1234567",
// },
// {
// username: "carlas",
// email: "carlas@gmail.com",
// password: "1234567",
// }
// ]
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
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added Project/controllers/index.js
Empty file.
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;
18 changes: 18 additions & 0 deletions Project/models/Items.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { Schema, model } = require("mongoose");
const Cart = require("./ShoppingCart.model");

const itemSchema = new Schema(
{
comicId: {
type: Schema.Types.ObjectId,
ref: 'Comic'
},
cartId: {
type: Schema.Types.ObjectId,
ref: 'Cart'
}
}
);

const Item = model("Item", itemSchema);
module.exports = Item;
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;
13 changes: 13 additions & 0 deletions Project/models/ShoppingCart.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { Schema, model } = require("mongoose");

const cartSchema = new Schema(
{
userId: {type: Schema.Types.ObjectId, ref: 'User'},

itemsIds: [{type: Schema.Types.ObjectId, ref: 'Item'}]
}
);

const Cart = model("Cart", cartSchema);

module.exports = Cart;
5 changes: 4 additions & 1 deletion Project/models/User.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const userSchema = new Schema(
type: String,
required: true,
},
},
cart: {
type: Schema.Types.ObjectId, ref: 'Cart'
}
},
{
// this second object adds extra properties: `createdAt` and `updatedAt`
timestamps: true,
Expand Down
Loading