Skip to content
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

Sarahxnadeen #25

Open
wants to merge 133 commits into
base: Merna2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
300e5c5
First Commit
LaylaMadany Apr 3, 2017
ab07d2d
rest of the code
LaylaMadany Apr 3, 2017
9a7e3a7
Add files via upload
OmarKhalouk Apr 3, 2017
f6dd3e7
Delete server.js
OmarKhalouk Apr 3, 2017
15473b8
Add files via upload
OmarKhalouk Apr 3, 2017
eac46cc
Search done Except button
LaylaMadany Apr 3, 2017
765ab20
Add files via upload
SarahMohamed96 Apr 3, 2017
c1924ca
Rating Models
KareemAbdelAziz Apr 3, 2017
953d710
Rating Controllers
KareemAbdelAziz Apr 3, 2017
1a0c461
Rating Routes
KareemAbdelAziz Apr 3, 2017
ce1fed9
Merge pull request #2 from SEGUC17/omar
SarahMohamed96 Apr 3, 2017
aad5c6d
FirstAttempt
nadyajdaa Apr 3, 2017
f554037
Add files via upload
nadyajdaa Apr 3, 2017
9dd8069
Add files via upload
nadyajdaa Apr 3, 2017
edbc46e
Add files via upload
nadyajdaa Apr 3, 2017
640a614
Add files via upload
nadyajdaa Apr 3, 2017
100d46b
folders el bykun feha el images
nadyajdaa Apr 3, 2017
9557abc
+ Update and Delete
nadyajdaa Apr 3, 2017
f81a283
Add files via upload
SarahMohamed96 Apr 3, 2017
8a9c4de
Add files via upload
OmarKhalouk Apr 3, 2017
428d3b4
Add files via upload
OmarKhalouk Apr 3, 2017
0b750d9
Add files via upload
OmarKhalouk Apr 3, 2017
80210b0
Timestamp added
LaylaMadany Apr 3, 2017
0b25ec6
Adding node modules
SarahMohamed96 Apr 4, 2017
f3cc4d1
Add files via upload
OmarKhalouk Apr 4, 2017
e5f3564
Search by Offers
LaylaMadany Apr 4, 2017
e02100a
Search by rating
LaylaMadany Apr 4, 2017
c0864a8
Merge pull request #4 from SEGUC17/layla1
nadyajdaa Apr 4, 2017
f01ee41
Updated services
KareemAbdelAziz Apr 4, 2017
c2a5af5
Updated controller
KareemAbdelAziz Apr 4, 2017
2544291
Merge branch 'sarah' into omar
SarahMohamed96 Apr 5, 2017
a4c83e4
Merge pull request #7 from SEGUC17/omar
SarahMohamed96 Apr 5, 2017
b7613d6
Add files via upload
SarahMohamed96 Apr 5, 2017
c4431bd
Delete delete.html
SarahMohamed96 Apr 5, 2017
3c09274
Delete main.js
SarahMohamed96 Apr 5, 2017
4b6e8b7
Add files via upload
SarahMohamed96 Apr 5, 2017
6c1863c
Add files via upload
SarahMohamed96 Apr 5, 2017
afc4445
Add files via upload
SarahMohamed96 Apr 5, 2017
1064253
Delete server.js
SarahMohamed96 Apr 5, 2017
a76a799
Add files via upload
SarahMohamed96 Apr 5, 2017
209a3e0
3rd-msh 3arfa a3mel override :')
nadyajdaa Apr 5, 2017
8c361fc
Latest
KareemAbdelAziz Apr 5, 2017
d7b6282
Promo code Generator
SarahMohamed96 Apr 5, 2017
62c6a14
Search By Keyword
LaylaMadany Apr 5, 2017
b089bcc
Manage Profile Done
LaylaMadany Apr 5, 2017
9f6f38f
2
nadyajdaa Apr 6, 2017
a5d192c
External Friend Request
KareemAbdelAziz Apr 6, 2017
3a02315
Add files via upload
nadyajdaa Apr 6, 2017
bece5cd
Delete routes.js
nadyajdaa Apr 6, 2017
4b351af
Delete imageroutes.js
nadyajdaa Apr 6, 2017
324c847
Delete servicecontroller.js
nadyajdaa Apr 6, 2017
e0851d4
Add files via upload
nadyajdaa Apr 6, 2017
7e6de2b
Delete imageroutes.js
nadyajdaa Apr 6, 2017
a7c0f1f
Delete routes.js
nadyajdaa Apr 6, 2017
fd65ee9
Delete servicecontroller.js
nadyajdaa Apr 6, 2017
d003eb0
Delete category.js
nadyajdaa Apr 6, 2017
10a27e6
Delete image.js
nadyajdaa Apr 6, 2017
7ac957d
Delete location.js
nadyajdaa Apr 6, 2017
c273910
Delete service.js
nadyajdaa Apr 6, 2017
2eb893f
Add files via upload
nadyajdaa Apr 6, 2017
1e637f5
Add files via upload
SarahMohamed96 Apr 6, 2017
41aa719
Delete reservation.js
SarahMohamed96 Apr 6, 2017
fb345cb
Delete main.js
SarahMohamed96 Apr 6, 2017
d46d6fc
Merge pull request #11 from SEGUC17/sarahxnadeen
SarahMohamed96 Apr 6, 2017
97ff01f
Merge pull request #12 from SEGUC17/sarah
SarahMohamed96 Apr 6, 2017
336cc4e
Delete ratingroutes.js
KareemAbdelAziz Apr 6, 2017
dd26c21
Delete rate.js
KareemAbdelAziz Apr 6, 2017
db101a4
Delete rating.js
KareemAbdelAziz Apr 6, 2017
0740ed6
Delete ratingcontroller.js
KareemAbdelAziz Apr 6, 2017
f86bd54
Merge branch 'sarahxnadeen' into nadyajda1
SarahMohamed96 Apr 6, 2017
92c6c82
Merge pull request #13 from SEGUC17/nadyajda1
SarahMohamed96 Apr 6, 2017
4a6ffb9
Add files via upload
SarahMohamed96 Apr 6, 2017
d984a85
Commit
SarahMohamed96 Apr 6, 2017
9887b5a
Merge branch 'sarahxnadeen' of https://github.com/SEGUC17/code-breack…
SarahMohamed96 Apr 6, 2017
917721d
node modules removed
LaylaMadany Apr 6, 2017
67e9f54
Merge branch 'sarahxnadeen' into Layla
SarahMohamed96 Apr 6, 2017
d181675
Merge pull request #15 from SEGUC17/Layla
SarahMohamed96 Apr 6, 2017
6d1220a
Add files via upload
SarahMohamed96 Apr 6, 2017
8f97f24
Add files via upload
KareemAbdelAziz Apr 6, 2017
d33e767
Delete servicecontroller.js
SarahMohamed96 Apr 6, 2017
e678dac
Add files via upload
SarahMohamed96 Apr 6, 2017
121e36e
Merge branch 'sarahxnadeen' into KareemAbdelAziz1
SarahMohamed96 Apr 6, 2017
a423850
Merge pull request #16 from SEGUC17/KareemAbdelAziz1
SarahMohamed96 Apr 6, 2017
8d63654
Revert "Kareem abdel aziz1"
SarahMohamed96 Apr 6, 2017
f28df4c
Merge pull request #17 from SEGUC17/revert-16-KareemAbdelAziz1
SarahMohamed96 Apr 6, 2017
0855065
Add files via upload
KareemAbdelAziz Apr 6, 2017
7f5f5b0
Add files via upload
KareemAbdelAziz Apr 6, 2017
4ca3c7b
Add files via upload
KareemAbdelAziz Apr 6, 2017
4156316
Add files via upload
KareemAbdelAziz Apr 6, 2017
8635ad4
Add files via upload
KareemAbdelAziz Apr 6, 2017
753f5f4
Add files via upload
SarahMohamed96 Apr 6, 2017
9d6dd35
Add files via upload
youssefyehia Apr 6, 2017
f3f9db6
Merge branch 'sarahxnadeen' into KareemAbdelAziz-patch-1
SarahMohamed96 Apr 6, 2017
0d2524f
Merge pull request #18 from SEGUC17/KareemAbdelAziz-patch-1
SarahMohamed96 Apr 6, 2017
d234ad6
Delete serviceController.js
SarahMohamed96 Apr 6, 2017
24c9220
Delete userController.js
SarahMohamed96 Apr 6, 2017
2c2f9fd
Delete category.js
SarahMohamed96 Apr 6, 2017
4af63dc
Delete image.js
SarahMohamed96 Apr 6, 2017
9e43e84
Delete location.js
SarahMohamed96 Apr 6, 2017
55f4e1b
Delete rating.js
SarahMohamed96 Apr 6, 2017
1ce5b48
Delete reservation.js
SarahMohamed96 Apr 6, 2017
de15699
Delete service.js
SarahMohamed96 Apr 6, 2017
3661398
Delete routes.js
SarahMohamed96 Apr 6, 2017
7401746
Delete userController.js
SarahMohamed96 Apr 6, 2017
fb10a7e
Delete serviceController.js
SarahMohamed96 Apr 6, 2017
8b6cccc
Delete category.js
SarahMohamed96 Apr 6, 2017
975ed42
Delete image.js
SarahMohamed96 Apr 6, 2017
19d59ad
Delete location.js
SarahMohamed96 Apr 6, 2017
e1d53ba
Delete rating.js
SarahMohamed96 Apr 6, 2017
5c5019d
Delete reservation.js
SarahMohamed96 Apr 6, 2017
0ce28e9
Delete service.js
SarahMohamed96 Apr 6, 2017
d9503af
Delete routes.js
SarahMohamed96 Apr 6, 2017
c74a576
updated code for sprint1 for merging
youssefyehia Apr 6, 2017
92afec1
Add files via upload
SarahMohamed96 Apr 6, 2017
9da9733
Merge branch 'sarahxnadeen' into youssef1
SarahMohamed96 Apr 6, 2017
f8f93ce
Merge pull request #19 from SEGUC17/youssef1
SarahMohamed96 Apr 6, 2017
958dccb
Delete complaintController.js
SarahMohamed96 Apr 6, 2017
83a9f18
Delete reviewController.js
SarahMohamed96 Apr 6, 2017
cf49f4d
Update package.json
SarahMohamed96 Apr 6, 2017
0713197
updated controllers folder
youssefyehia Apr 6, 2017
2889c99
Merge branch 'sarahxnadeen' into youssef2
SarahMohamed96 Apr 6, 2017
95d1d06
Merge pull request #20 from SEGUC17/youssef2
SarahMohamed96 Apr 6, 2017
ec85f58
Update services.js
SarahMohamed96 Apr 6, 2017
7d336ec
Delete service.js
SarahMohamed96 Apr 6, 2017
d8dfc5b
Update routes.js
SarahMohamed96 Apr 6, 2017
423e4ca
Add files via upload
SarahMohamed96 Apr 6, 2017
3b532df
Add files via upload
AhmedRezkYoussef Apr 6, 2017
a383791
Merge branch 'ahmed' into sarahxnadeen
SarahMohamed96 Apr 6, 2017
d68a101
Update complaintController.js
SarahMohamed96 Apr 6, 2017
d5f3266
Update reviewController.js
SarahMohamed96 Apr 6, 2017
0b16d0c
First Commit
Apr 6, 2017
5be9449
Merge branch 'sarahxnadeen' into Merna3
SarahMohamed96 Apr 6, 2017
d0821ba
Merge pull request #26 from SEGUC17/Merna3
SarahMohamed96 Apr 6, 2017
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 .DS_Store
Binary file not shown.
98 changes: 98 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var index = require('./routes/xyz');
var users = require('./routes/users');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', index);
app.use('/users', users);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});

// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};

// render the error page
res.status(err.status || 500);
res.render('error');
});

var MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://localhost/Ahmed';
MongoClient.connect(url, function(err, db) {
console.log("Connected");
db.close()
});
var MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://localhost/Ahmed';

MongoClient.connect(url, function(err, db) {

db.collection('Services').insertOne({
Serviceid: 1,
ServiceName: "Breakout"
});
});

var MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://localhost/Ahmed';

MongoClient.connect(url, function(err, db) {

var cursor =db.collection('Services').find( );

cursor.each(function(err, doc) {

console.log(doc);

});
});
var express= require('express');

var app=express();
var MongoClient = require('mongodb').MongoClient;

var url = 'mongodb://localhost/Ahmed';

var str="";

app.route('/ServiceName').get(function(req,res)
{
MongoClient.connect(url, function(err, db) {
var cursor =db.collection('Services').find( );

cursor.each(function(err, item) {
if(item != null) {
str = str + "&nbsp;&nbsp;&nbsp;&nbsp;Service Name&nbsp;&nbsp;" + item.ServiceName + "</br>";
}});

res.send(str);
}); });
var server=app.listen(3000,function()
{});
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/controllers/.DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions app/controllers/complaintController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let Complaint = require('../app/models/complaint.js');


let ComplaintController = {
createComplaint: function(req, res){

let complaint = new Complaint(req.body);

complaint.save(function(err, complaint){
if(err){
res.send(err.message)
console.log(err);
}
else{
console.log(complaint);
res.redirect('/');
}
})
},

}

module.exports = ComplaintController;
24 changes: 24 additions & 0 deletions app/controllers/reviewController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
let Review = require('../app/models/review.js');


let ReviewController = {
createReview: function(req, res){

let review = new Review(req.body);

review.save(function(err, complaint){
if(err){
res.send(err.message)
console.log(err);
}
else{
console.log(review);
res.redirect('/');
}
})
},


}

module.exports = ReviewController;
158 changes: 158 additions & 0 deletions app/controllers/serviceController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
let Service = require('../models/service');


let serviceController = {
createService: function(req, res){

let service = new Service(req.body);

service.save(function(err, service){
if(err){
res.send(err.message)
console.log(err);
}
else{
console.log(service);
res.redirect('/');
}
})
},

getServiceByCategory:function(req, res){

var Category = req.body.selectpicker;
console.log(Category.name);


Service.find({category: Category}, function(err, services) {

if(err)
res.send(err.message);
else
res.render('FilteredServices.ejs', {services});

})

},



getServiceByLocation: function(req,res){

var locationn = req.body.selectpicker;
console.log(locationn.name);
Service.find({location: locationn}, function(err, services){

if (err)
res.send(err.message)

else
res.render('FilteredServices.ejs', {services});

console.log(services);

})
},

getServiceByDate: function(req,res){

Service.find(function(err, services){
services.sort(function(a, b) {
a = new Date(a.dateModified);
b = new Date(b.dateModified);
return a>b ? -1 : a<b ? 1 : 0;
});
console.log(services);

if (err)
res.send(err.message)

else
res.render('FilteredServices.ejs', {services});

})},

getServiceByOffer : function(req,res){

Service.find({currentOffers: true}, function(err, services){

if (err)
res.send(err.message)

else
res.render('FilteredServices.ejs', {services});

})},

getServiceByRating: function(req,res){

Service.find(function(err, services){
services.sort(function(a, b) {
a = a.rating;
b = b.rating;
return a>b ? -1 : a<b ? 1 : 0;
});
console.log(services);

if (err)
res.send(err.message)

else
res.render('FilteredServices.ejs', {services});

})}

,

getServiceByKeyword: function (req,res)
{
if(req.query.search) {
const regex = new RegExp(escapeRegex(req.query.search), 'gi');
Service.find({"serviceName": regex}, function(err, services) {
if(err) {
res.send(err.message);
} if(services.length < 1) {
res.render('FilteredServices.ejs', {services}); ///plugs in some flags g is global and i is ignore upper case
} else {
res.render('FilteredServices.ejs', {services});
}
});


}},


getAllServices:function(req, res){

Service.find(function(err, services){

if(err)
res.send(err.message);
else
res.render('index2', {services});

console.log(services);
})
},


getDetails: function(req, res){
Service.find({Service_id:req.body._id},function(err, servicex){

if(err)
res.send(err.message)
else
res.render('sprofile', {servicex});

});
}}


}


function escapeRegex(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); }

module.exports = serviceController;

52 changes: 52 additions & 0 deletions app/controllers/userController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
let User = require('../models/user');



let userController = {

updateUser: function(req, res) {

var username = req.body.email;
var password = req.body.password;
var userId = req.user._id;

User.findById(userId, function (err, userData){
var user = userData;
var oldusername = user.local.username;
var oldpassword = user.local.password;
if (username != "" && password != "")
{
user.local.username = username;
user.local.password = password;
}
else if (username != "" && password == "")
{
user.local.username = username;
user.local.password = oldpassword;

}
else if
(username == "" && password != "")
{
user.local.username = oldusername;
user.local.password = password;
}


user.save(function(err,user){
if (err){
res.send(err.message)
console.log(err);
} else {
console.log("success");
console.log(user);
res.redirect('profile');
}
})
});

},

}

module.exports = userController;
Binary file added app/models/.DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions app/models/category.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var mongoose = require('mongoose');

var categorySchema = mongoose.Schema ({

//db.collection.insert({"category" : ["1", "2","3]})
name:{
type:String,
required:true,
unique:true
}

});

module.exports = mongoose.model("category", categorySchema);
21 changes: 21 additions & 0 deletions app/models/complaint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var ComplaintsSchema = mongoose.Schema({
complaint: {
type: String
},
username: {
type: String
},
servicename: {
type: String
}
});

var Complaint=module.exports = mongoose.model('Complaint', ComplaintsSchema);


module.exports.createComplaint = function(Complaint, callback){
Complaint.save(callback);
}
Loading