Coder Social home page Coder Social logo

truckpad-test's Introduction

truck traffic tracking

Tech Test for truck pad

API Docs

1. Truck arriving registration

  • Endpoint: POST /api/register-entrance/
  • Request Data Specification:
{
  "truck_number": "DHF3388", // truck's card numebr
  "truck_type": 1, // Truck's type number
  "cpf_no": "23725897841", // driver's cpf number for unique idenfication
  "name": "Liang", // driver's name
  "age": 30, // driver's age
  "gender": 1, // driver's gender: 0-secret, 1-male, 2-female
  "drive_license_type": "A/B", // driver's drive license type
  "has_truck": true, // if driver has truck or no
  "is_loaded": false, // if truck is loaded
  "user_from_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809", // driver's source terminal id
  "user_to_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d",// driver's destination terminal id
  "to_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809", // current exit terminal's id 
  "from_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d" // current arrived terminal's id 
}
  • Response Data Sepcification:
{
  "object_id": "080dc891-bcb4-44b1-8ef6-b194899eacbb", // registration id
  "created_at": 1545008709, // registration time's timestamp value
  "updated_at": 1545008709, // comm update time's timestamp value
  
  "driver": { 
    "object_id": "59f3e8bf-74f6-4b95-b1c9-6f0e6b86ce53",
    "created_at": 1545005672,
    "updated_at": 1545008709,
    "cpf_no": "23725897840",
    "name": "Liang",
    "age": 30,
    "gender": 1,
    "drive_license_type": "A/B",
    "has_truck": true,
    "from_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809",
    "to_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d"
  },
  "truck": {
    "object_id": "d3068505-a413-4de6-bf93-949f8da2b3ac",
    "created_at": 1545005101,
    "updated_at": 1545005101,
    "number": "DSZ3381",
    "truck_type": 1
  },
  "from_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d",
  "to_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809",
  "is_loaded": false,
  "status": 0
}

2. Query each driver's source and destination

  • Endpoint: GET /api/query-driver-location/
  • Request Data specification:
{
  "cpf_no": "23725898830" // **required**
}
  • Response data specification:
{
  "status": 0,
  "cpf_no": "23725897840",
  "name": "Liang",
  "origin_terminal": {
    "name": "Taubaté",
    "latitude": 13.456,
    "longitude": 13.567
  },
  "destination_terminal": {
    "name": "Tietê",
    "latitude": 12.345,
    "longitude": 12.456
  }
}

3. Query Empty Return drivers

  • Endpoint: GET /api/query-empty-return-drivers/
  • Request data specification: None
  • Response data specification:
{
  "status": 0,
  "data": [
    {
      "object_id": "59f3e8bf-74f6-4b95-b1c9-6f0e6b86ce53",
      "created_at": 1545005672,
      "updated_at": 1545008709,
      "cpf_no": "23725897840",
      "name": "Liang",
      "age": 30,
      "gender": 1,
      "drive_license_type": "A/B",
      "has_truck": true,
      "from_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809",
      "to_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d"
    }
  ]
}

4. Query self-own truck drivers count

  • Endpoint: GET /api/query-own-truck-drivers/
  • Request data specification: None
  • Response data specification:
{
  "status": 0,
  "driver_count": 1
}

5. Query Loaded Trucks during one day, one week or one month

  • Endpoint: GET /api/query-terminal-loaded-traffic/
  • Request data specification:
{
  "start_date": "2018-12-01", // **optional**, query period date, default is today
  "end_date": "2018-12-05", // **optional**, query period end, default is tomorrow
  "terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d"// **optional**, specify which terminal should query,default query data on all terminal
}
  • Response data specification:
{
  "status": 0,
  "data": {
    "traffic_count": 1
  }
}

2. Query Truck traffic history group by truck type

  • Endpoint: GET /api/query-truck-type-traffics/
  • Request data specification: None
  • Response data specification:
{
  "status": 0,
  "data": [
    {
      "Truck Type": "Caminhão 3/4",
      "Origin Terminal": "Taubaté",
      "Destination Terminal": "Tietê"
    },
    {
      "Truck Type": "Caminhão 3/4",
      "Origin Terminal": "Tietê",
      "Destination Terminal": "Taubaté"
    }
  ]
}

7. Update driver register information

  • Endpoint: PUT /api/update-driver-info/
  • Request data specification:
{
  "cpf_no": "23725897840",// **required**, identify driver
  "name": "Liang", // **optional**
  "age": 30, // **optional**
  "gender": 1, // **optional**
  "drive_license_type": "A/B", // **optional**
  "has_truck": true, // **optional**
  "is_loaded": false, // **optional**
  "from_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809", // **optional**
  "to_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d" // **optional**
}
  • Response data specification:
{
  "status": 0,
  "data": {
    "object_id": "59f3e8bf-74f6-4b95-b1c9-6f0e6b86ce53",
    "created_at": 1545005672,
    "updated_at": 1545009878,
    "cpf_no": "23725897840",
    "name": "Liang",
    "age": 30,
    "gender": 1,
    "drive_license_type": "A/B",
    "has_truck": true,
    "from_terminal": "35ff14e0-664d-43c6-abad-e68ac8b61809",
    "to_terminal": "4c91204e-f63b-4359-bdb9-76c166a2603d"
  }
}

truckpad-test's People

Contributors

theo-l avatar liangguisheng avatar

Watchers

 avatar

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.