Code Monkey home page Code Monkey logo

taxi-website's People

Contributors

kpatticha avatar

Watchers

 avatar

taxi-website's Issues

Define validations for booking's model

var BookingSchema = new mongoose.Schema({
  user: { type : Schema.ObjectId, ref : 'User' },
  drivers: [{
    driver: { type : Schema.ObjectId, ref : 'Driver' }
  }],
  uui: Number,
  message: String,
  flightNo: String,
  passengers: Number,
  oneWay: Boolean,
  departure: String,
  arrival: String,
  departureTimestamp: { type: Date },
  arrivalTimestamp: { type: Date },
  returnTimestamp: { type: Date },
  duration: Number,
  distance: Number,
  confirmationToken: String,
  confirmedAt: { type: Date },
  confirmationSentAt: { type: Date },
  createdAt: { type: Date },
  updatedAt: { type: Date, default: Date.now },
});

authorise user to access only his booking

The user cannot

  1. access booking which is not hers
  2. access location endpoint
  3. access price endpoint
  4. access users endpoint

ACTUALLY

all he can is to access his profile, and his bookings NOTHING else

Location model: latitude and longitude should be generated

The admin will add only the address name.
Those values should be generated automatically in the backend based on the address either in the front the admin will have a integrated map to point the location and send those values though the form.

Having the map will help the admin visualise and verify the location.
The address names are not unique

Define validations for user's model

var mongoose = require('mongoose');

var UserSchema = new mongoose.Schema({
  uui: Number,
  admin: { type: Boolean, default: false },
  firstName: String,
  lastName: String,
  email: String,
  encryptedPassword: String,
  resetPasswordToken: String,
  resetPasswordSentAt: String,
  phone: Number,
  countryCode: Number,
  confirmationToken: String,
  confirmedAt: { type: Date },
  confirmationSentAt: { type: Date },
  createdAt: { type: Date },
  updatedAt: { type: Date, default: Date.now },
  lastSignInAt: { type: Date },
});

module.exports = mongoose.model('User', UserSchema);

Create endpoint for users

Get all users

GET /users

Get specific user

GET /users/:id

Create a user

POST /users

validations

  1. email
  2. country code
  3. require fields

Update a specific user

PUT /users/:id

TODO: define which params

Create endpoint for locations

Get all location

GET /locations

Get specific location

GET /locations/:id

Create a location

POST /locations

validations

Update a specific location

PUT /locations/:id

TODO: define which params

Setup database: User schema

review halkidiki tranfer database schema, evaluate the current one and decide to go with the same or another one

Create endpooint for Booking

Get all location

GET /bookings

Get specific booking

GET /bookings/:id

Create a booking

POST /booking
params:

  1. user id
  2. departure
    3 arrival
  3. timestamp
  4. return

validations

Update a specific booking

PUT /booking/:id

Investigate extention for mongoose models

User model and Driver models have a lot of similarities.

we have duplicate code, mongoose might support extend or populate.

explore this option or something else

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.