From a7af78a6cb49e4027d0a15de88321398be5c9632 Mon Sep 17 00:00:00 2001 From: idoctnef Date: Wed, 14 Sep 2016 19:59:05 +0200 Subject: [PATCH] arrayObjectIndexOf, and some details --- README.md | 166 ++++++++++++++------------------ controllers/travelController.js | 6 +- models/commentModel.js | 3 +- models/joinModel.js | 3 +- 4 files changed, 80 insertions(+), 98 deletions(-) diff --git a/README.md b/README.md index 2b111cd..da2d106 100644 --- a/README.md +++ b/README.md @@ -9,121 +9,99 @@ frontend app code: https://github.com/idoctnef/collectivecarApp Angularjs + Ionic + MaterialDesign -##Project Structure: -``` -collectivecar/ - server/ - controllers/ - userController.js - travelController.js - carController.js - askfortravelController.js - models/ - userModel.js - travelModel.js - carModel.js - needtravelModel.js - node_modules/ - config.js - server.js - package.js - README.md -``` ##To Do List: -**Backend:** +**Backend and Frontend:** ``` --signup user --> done --loggin user --> done --update user profile --> done --create new travel --> done --update travel --> done --delete travel --> done --create offeringCar +-signup user --> done +-loggin user --> done +-update user profile --> done +-create new travel --> done +-update travel --> done +-delete travel --> done +-create offeringCar --> done -update offeringCar -delete offeringCar --create askingForTravel (needtravel) +-create askingForTravel (needtravel) --> done -update askingForTravel -delete askgingForTravel --user joins a car --user joins travel +-create askingPackage (need transport package) --> done +-update askingPackage +-delete askgingPackage +-user joins a car --> done +-user offer car to a travel --> done +-user offer car to a askingpackage --> done +-user unjoins a car +-user unoffer car to a travel +-user unoffer car to a askingpackage +-comment publication(car, travel, package) --> done + +-web page (webapp) ``` -**Frontend:** -``` --signup user --loggin user --update user profile --create new travel --update travel --delete travel --create offeringCar --update offeringCar --delete offeringCar --create askingForTravel --update askingForTravel --delete askgingForTravel -``` + -------------------- ####**PARA LA BASE DE DATOS** [para definir como queremos q esté estructurado, pensando en las funcionalidades que queremos tener]: -**user**: --username --password --description --icon/avatar --mail --phone - -**travel**: (seria cuando un user publica un nuevo trayecto que va a hacer) --title --description --owner (user q ha publicado el viaje) --from --to --date --description --generateddate (cuando el user genera el aviso) --seats (plazas de coche disponibles) - -**car**: (cuando un user tiene un coche disponible para hacer viajes que se necesiten) --title --description --owner (user q ha publicado el viaje) --zone (la zona por la que está) --available (cuando el user esta disponible, marca que esta disponible, si unos dias no podrá, lo desactiva) --generateddate --seats (plazas de coche disponibles) - -**needtravel**: (cuando un user no dispone de coche y necesita hacer un travel) --title --description --owner (user q ha publicado el asking travel) --from --to --date (las fechas para cuando se necesita el viaje) --generateddate (cuando el user genera el aviso) --seats (plazas de coche necesarias) - -**collectivizedCar**: (los coches/furgos colectivos) --> quizás esto no hace falta, solo usar 'offeringCar' normal con un añadido para notificar que es un coche colectivizado --owner (user q publica el coche) --title --seats (plazas de coche disponibles) +``` +var userSchema = new Schema({ + username: { type: String }, + password: { type: String }, + description: { type: String }, + avatar: { type: String }, + mail: { type: String }, + phone: { type: String }, + telegram: { type: String } +}) +var travelSchema = new Schema({ + title: { type: String }, + description: { type: String }, + owner: { type: String }, + from: { type: String }, + to: { type: String }, + date: { type: Date }, + periodic: { type: Boolean }, + generateddate: { type: Date }, + seats: { type: Number }, + package: { type: Boolean }, + icon: { type: String }, + phone: { type: Number }, + telegram: { type: String }, + collectivized: { type: Boolean }, + modality: { type: String } //if is an offering travel or asking for travel +}) +var joinSchema = new Schema({ + travelId: { type: String }, + joinedUserId: { type: String }, + joinedUsername: { type: String }, + acceptedUserId: { type: String }, + joinedAvatar: { type: String } + +}); +var commentSchema = new Schema({ + travelId: { type: String }, + commentUserId: { type: String }, + commentUsername: { type: String }, + comment: { type: String }, + commentAvatar: { type: String } + +}); +``` -------------------- +####**RESOURCES using**: + +car icons [http://www.flaticon.com/packs/transportation-7](http://www.flaticon.com/packs/transportation-7) -####**OTRAS COSAS**: -lo de poner o no un mapa, de entrada no destinaria esfuerzos en eso. Para la primera versión de la aplicación no hace falta, solo añade confort visual, para ver el recorrido, pero de entrada para una app q pone en contacto personas para compartir coche, no es algo imprescindible quizás +css para la app: matterializeCSS [http://materializecss.com/](http://materializecss.com/) +avatars users: [http://www.flaticon.com/packs/animal-icon-collection](http://www.flaticon.com/packs/animal-icon-collection) -####**RESOURCES to use**: -car icons [http://www.flaticon.com/packs/transportation-7](http://www.flaticon.com/packs/transportation-7) -css para la app: matterializeCSS [http://materializecss.com/](http://materializecss.com/) -avatars users: [http://www.flaticon.com/packs/animal-icon-collection](http://www.flaticon.com/packs/animal-icon-collection) +mirar per fer hash de passwords https://www.npmjs.com/package/bcrypt-nodejs diff --git a/controllers/travelController.js b/controllers/travelController.js index c005a16..8d803eb 100644 --- a/controllers/travelController.js +++ b/controllers/travelController.js @@ -111,7 +111,8 @@ exports.addJoin = function(req, res) { travelId: req.params.travelId, joinedUserId: req.body.joinedUserId, joinedUsername: req.body.joinedUsername, - acceptedUserId: req.body.acceptedUserId + acceptedUserId: req.body.acceptedUserId, + joinedAvatar: req.body.joinedAvatar }); join.save(function(err, join) { @@ -145,7 +146,8 @@ exports.addComment = function(req, res) { travelId: req.params.travelId, commentUserId: req.body.commentUserId, commentUsername: req.body.commentUsername, - comment: req.body.comment + comment: req.body.comment, + commentAvatar: req.body.commentAvatar }); comment.save(function(err, comment) { diff --git a/models/commentModel.js b/models/commentModel.js index 37650cc..de44312 100644 --- a/models/commentModel.js +++ b/models/commentModel.js @@ -6,7 +6,8 @@ var commentSchema = new Schema({ travelId: { type: String }, commentUserId: { type: String }, commentUsername: { type: String }, - comment: { type: String } + comment: { type: String }, + commentAvatar: { type: String } }); module.exports = mongoose.model('commentModel', commentSchema); diff --git a/models/joinModel.js b/models/joinModel.js index 1b26d64..9d5dcaa 100644 --- a/models/joinModel.js +++ b/models/joinModel.js @@ -6,7 +6,8 @@ var joinSchema = new Schema({ travelId: { type: String }, joinedUserId: { type: String }, joinedUsername: { type: String }, - acceptedUserId: { type: String } + acceptedUserId: { type: String }, + joinedAvatar: { type: String } }); module.exports = mongoose.model('joinModel', joinSchema);