-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from minhaufcg/multiMap
Multi map
- Loading branch information
Showing
24 changed files
with
169 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const mongoose = require('mongoose'); | ||
const Campus = require('../models/campi'); | ||
const Coordinations = require('../models/coords'); | ||
const RestHelper = require('../helpers/rest-helper'); | ||
mongoose.Promise = require('bluebird'); | ||
|
||
function getAllCampi (req, res) { | ||
Campus | ||
.find({}).then(function (data) { | ||
console.log(data); | ||
RestHelper.sendJsonResponse(res, 200, data); | ||
}) | ||
} | ||
|
||
function getCampusCoords(req, res) { | ||
if (!req.params || !req.params.campusId) | ||
RestHelper.sendJsonResponse(res, 404, {error : "No campus ID provided"}); | ||
|
||
var campusId = req.params.campusId; | ||
|
||
Coordinations | ||
.getByCampus(campusId).then(function (coords) { | ||
RestHelper.sendJsonResponse(res, 200, coords); | ||
}) | ||
} | ||
|
||
module.exports = { | ||
getAllCampi : getAllCampi, | ||
getCampusCoords : getCampusCoords | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const mongoose = require('mongoose'); | ||
const Schema = mongoose.Schema; | ||
|
||
const campusSchema = Schema({ | ||
name: { | ||
type: String, | ||
required: true | ||
} | ||
}, {collection : 'campi'}); | ||
|
||
module.exports = mongoose.model("Campus", campusSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const mongoose = require('mongoose'); | ||
const Schema = mongoose.Schema; | ||
|
||
const coordsSchema = Schema({ | ||
campus: { | ||
type: Schema.Types.ObjectId, | ||
ref : "Campus", | ||
required: true | ||
}, | ||
center : { | ||
lat : { | ||
type : Number, | ||
required : true | ||
}, | ||
lng : { | ||
type : Number, | ||
required : true | ||
} | ||
}, | ||
coords : { | ||
type : [{ | ||
lat : Number, | ||
lng : Number | ||
}], | ||
required: true | ||
} | ||
}, {collection : 'coords'}); | ||
|
||
coordsSchema.statics.getByCampus = function (campusId) { | ||
return this.findOne({ campus: campusId }).exec(function (coords) { | ||
return coords; | ||
}); | ||
}; | ||
|
||
|
||
module.exports = mongoose.model("Coordinations", coordsSchema); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
angular.module("mufcg").factory('Location', function RequestFactory($http, PROPERTIES) { | ||
return { | ||
getCampi : function () { | ||
return $http.get(PROPERTIES.restBasePath + "/campi"); | ||
}, | ||
|
||
getCampusCoords : function (campusId) { | ||
return $http.get(PROPERTIES.restBasePath + "/campi/" + campusId + "/coords/"); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.