Skip to content
Open

Css #24

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
44b98b3
views
Nov 7, 2022
99068b7
done
Nov 7, 2022
1cadc45
Merge pull request #1 from GMILLA92/models
GMILLA92 Nov 7, 2022
254e472
Merge pull request #2 from GMILLA92/views
agusmarcote Nov 7, 2022
3612e00
update spot
Nov 8, 2022
a7c04cd
Merge pull request #3 from GMILLA92/views2
agusmarcote Nov 8, 2022
21f4c6f
done2
Nov 8, 2022
f273a1b
Merge pull request #4 from GMILLA92/models2
GMILLA92 Nov 8, 2022
c76d3ff
done routes
Nov 8, 2022
5155a56
Merge pull request #5 from GMILLA92/routes
GMILLA92 Nov 8, 2022
357fcf7
Merge pull request #6 from GMILLA92/routes3
GMILLA92 Nov 8, 2022
bf04462
done
Nov 8, 2022
e44db85
spot routes
Nov 8, 2022
0d6a44d
Merge branch 'main' into routespot
GMILLA92 Nov 8, 2022
45374ba
Merge pull request #8 from GMILLA92/routespot
GMILLA92 Nov 8, 2022
fcddae1
done
Nov 8, 2022
a044230
Merge pull request #7 from GMILLA92/seeds2
GMILLA92 Nov 8, 2022
27e59c9
populate
Nov 8, 2022
ad3fc02
Merge pull request #9 from GMILLA92/everything
agusmarcote Nov 8, 2022
007a86f
spots add
Nov 9, 2022
90d8ca8
Merge pull request #10 from GMILLA92/everything
agusmarcote Nov 9, 2022
3713bde
new routes
Nov 9, 2022
c6d991f
new routes2
Nov 9, 2022
8aea075
Merge pull request #11 from GMILLA92/routes5
GMILLA92 Nov 9, 2022
1f9fc6d
addSpots
Nov 9, 2022
2833bf0
Merge pull request #12 from GMILLA92/everything1
agusmarcote Nov 9, 2022
137ba3f
Merge branch 'main' into risk
GMILLA92 Nov 9, 2022
a988b95
Merge pull request #13 from GMILLA92/risk
GMILLA92 Nov 9, 2022
e7cb666
wednesday
Nov 9, 2022
f7fdf2d
map
Nov 9, 2022
ea12467
Merge branch 'main' into map
GMILLA92 Nov 9, 2022
b42c606
Merge pull request #14 from GMILLA92/map
GMILLA92 Nov 9, 2022
35350ec
Merge pull request #15 from GMILLA92/risk
GMILLA92 Nov 9, 2022
184bfe4
doneeee
Nov 9, 2022
b9b31e7
Merge branch 'main' into risk
GMILLA92 Nov 9, 2022
75edaa7
update
Nov 9, 2022
d6a3e0c
Merge pull request #16 from GMILLA92/all
agusmarcote Nov 9, 2022
909a60e
done
Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added Project/.DS_Store
Binary file not shown.
7 changes: 4 additions & 3 deletions Project/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ const app = express();
require("./config")(app);

const capitalize = require("./utils/capitalize");
const projectName = "project2";
const projectName = "AIRBNVAN";

app.locals.appTitle = `${capitalize(projectName)} created with IronLauncher`;
app.locals.appTitle = `${(projectName)}`;

// 👇 Start handling routes here
const indexRoutes = require("./routes/index.routes");
app.use("/", indexRoutes);

const authRoutes = require("./routes/auth.routes");
app.use("/auth", authRoutes);
app.use("/", authRoutes);


// ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes
require("./error-handling")(app);
Expand Down
23 changes: 0 additions & 23 deletions Project/bin/seeds.js

This file was deleted.

22 changes: 22 additions & 0 deletions Project/config/cloudinary.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const cloudinary = require('cloudinary').v2;
const { CloudinaryStorage } = require('multer-storage-cloudinary');
const multer = require('multer');

cloudinary.config({
cloud_name: process.env.CLOUDINARY_NAME,
api_key: process.env.CLOUDINARY_KEY,
api_secret: process.env.CLOUDINARY_SECRET
});

const storage = new CloudinaryStorage({
// cloudinary: cloudinary,
cloudinary,
params: {
allowed_formats: ['jpg', 'png'],
folder: 'AIRBnvan' // The name of the folder in cloudinary
// resource_type: 'raw' => this is in case you want to upload other type of files, not just images
}
});

// storage: storage
module.exports = multer({ storage });
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/Project_park4night";

mongoose
.connect(MONGO_URI)
Expand Down
4 changes: 1 addition & 3 deletions Project/middleware/isLoggedIn.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module.exports = (req, res, next) => {
// checks if the user is logged in when trying to access a specific page
if (!req.session.currentUser) {
return res.redirect("/auth/login");
}
if (!req.session.currentUser) return res.redirect("/login")

next();
};
21 changes: 21 additions & 0 deletions Project/models/Comment.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { Schema, model } = require("mongoose");
const commentSchema = new Schema(
{
description: {
type: String,
required: true,
trim: true,
},
author:{ type: Schema.Types.ObjectId, ref: 'User' },
commentLike: [{ type: Schema.Types.ObjectId, ref: 'CommentLike' }],
spot:{ type: Schema.Types.ObjectId, ref: 'Spot' },
},
{
timestamps: true,
}
);

const Comment = model("Comment", commentSchema);

module.exports = Comment;

15 changes: 15 additions & 0 deletions Project/models/CommentLike.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { Schema, model } = require("mongoose");
const commentLikeSchema = new Schema(
{
comment: { type: Schema.Types.ObjectId, ref: 'Comment' },
user: { type: Schema.Types.ObjectId, ref: 'User' },
},
{
timestamps: true,
}
);

const CommentLike = model("CommentLike", commentLikeSchema);

module.exports = CommentLike;

68 changes: 68 additions & 0 deletions Project/models/Spot.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const { Schema, model } = require("mongoose");
const spotSchema = new Schema(
{
name: {
type: String,
// required: true,
unique: true,
trim: true,
},
coordinates: {
type: String,
// required: true,
unique: true,
trim: true,
},
address: {
type: String,
required: false,
trim: true,
},
province: {
type: String,
required: false,
},
rating: {
type: Number, min: 0, max: 10,
// required: true,
},
amenities: {
type: Object,
required: false,
Toilet : {type: Boolean},
BBQ : {type: Boolean},
Electricity : {type: Boolean},
Drinking_water: {type: Boolean},
Trash_can: {type:Boolean},
Shower: {type:Boolean},
},
webpage: {
type: String,
},
UserSpot: { type: Schema.Types.ObjectId, ref: 'UserSpot' },
comments: [{ type: Schema.Types.ObjectId, ref: 'Comment' }],
description: {
type: String,
// required: true,
},
price : {
type: Number,
required: false,
},
images: {
imagesUrl: [String],
},
Number_parking_spots: {
type: Number,
required: false,
}
},
{
timestamps: true,
}
);

const Spot = model("Spot", spotSchema);

module.exports = Spot;

14 changes: 10 additions & 4 deletions Project/models/User.model.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const { Schema, model } = require("mongoose");

// TODO: Please make sure you edit the User model to whatever makes sense in this case
const userSchema = new Schema(
{
fullName: {
type: String,
required: true,
trim:true,
},
username: {
type: String,
required: false,
required: true,
unique: true,
trim: true,
},
Expand All @@ -20,9 +24,11 @@ const userSchema = new Schema(
type: String,
required: true,
},
UserSpot: [{ type: Schema.Types.ObjectId, ref: 'UserSpot' }],
comments: [{ type: Schema.Types.ObjectId, ref: 'Comment' }],
commentLike: [{ type: Schema.Types.ObjectId, ref: 'CommentLike' }]
},
{
// this second object adds extra properties: `createdAt` and `updatedAt`
{
timestamps: true,
}
);
Expand Down
14 changes: 14 additions & 0 deletions Project/models/UserSpot.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { Schema, model } = require("mongoose");
const UserSpotSchema = new Schema(
{
spot: { type: Schema.Types.ObjectId, ref: 'Spot' },
user: { type: Schema.Types.ObjectId, ref: 'User' },
},
{
timestamps: true,
}
);

const UserSpot = model("UserSpot", UserSpotSchema);

module.exports = UserSpot;
Loading