51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
module.exports = function (app) {
|
|
const router = require('express').Router(),
|
|
locationCtl = require('../controllers/location');
|
|
|
|
/**
|
|
* @api {post} /location/nearMe Get list of other team members
|
|
* @apiVersion 1.2.1
|
|
* @apiName PostLocationNearMe
|
|
* @apiGroup Locations
|
|
* @apiDescription Get list of other team members (mostly loading trucks working on the ground).
|
|
* @apiParam {Number[]} coors Current user (API caller) coordinate in [latitude, longitude]
|
|
* @apiSuccess {Object[]} items team members list
|
|
* @apiSuccess {Number[]} items.coors Last known coordinates [latitude, longitude].
|
|
* @apiSuccess {String} items.name User's name.
|
|
* @apiSuccess {Date} items.createdAt Created date, when the user first started sending the location.
|
|
* @apiSuccess {Date} items.updatedAt Last updated date.
|
|
* @apiParamExample {json} Request-Example:
|
|
* {
|
|
* "coors": [44.329988, -79.683370]
|
|
* }
|
|
* @apiSuccessExample {json} Success-Example
|
|
* HTTP/1.1 200 OK
|
|
* [
|
|
* {
|
|
* "name": "agservice",
|
|
* "coors": [
|
|
* 44.3546,
|
|
* -79.6889
|
|
* ],
|
|
* "createdAt": "2019-09-11T14:51:52.211Z",
|
|
* "updatedAt": "2019-09-11T14:51:52.211Z"
|
|
* },
|
|
* {
|
|
* "name": "loadtruck_01",
|
|
* "coors": [
|
|
* 44.35462,
|
|
* -79.6888
|
|
* ],
|
|
* "createdAt": "2019-09-11T11:51:52.211Z",
|
|
* "updatedAt": "2019-09-11T14:51:52.211Z"
|
|
* },
|
|
* ]
|
|
*/
|
|
router.post('/nearMe', locationCtl.nearMe_post);
|
|
|
|
// Record a new user location for tracking
|
|
router.post('/addpos', locationCtl.addpos_post);
|
|
|
|
app.use('/api/location/', router);
|
|
}
|