File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- /duct-drone-app /node_modules
2- /duct-drone-app /test /js
3- /duct-drone-app /test /browsertest /js
4- /duct-drone-app /test /fixtures /temp-cache-fixture
5- /duct-drone-app /benchmark /js
6- /benchmark /fixtures
7- /duct-drone-app /examples /** /dist
8- /duct-drone-app /coverage
9- /duct-drone-app /.DS_Store
10- /duct-drone-app /* .log
11- /duct-drone-app /.idea
12- /duct-drone-app /.vscode
13- /duct-drone-app /.eslintcache
14- /duct-drone-app /package-lock.json
15- /Documents /*
16- /duct-drone-app /.vs /
17- duct-drone-app /src /.vs /
18- /.vs /
19- /duct-drone-app /build /
1+ /duct-drone-app /node_modules
2+ /duct-drone-app /test /js
3+ /duct-drone-app /test /browsertest /js
4+ /duct-drone-app /test /fixtures /temp-cache-fixture
5+ /duct-drone-app /benchmark /js
6+ /benchmark /fixtures
7+ /duct-drone-app /examples /** /dist
8+ /duct-drone-app /coverage
9+ /duct-drone-app /.DS_Store
10+ /duct-drone-app /* .log
11+ /duct-drone-app /.idea
12+ /duct-drone-app /.vscode
13+ /duct-drone-app /.eslintcache
14+ /duct-drone-app /package-lock.json
15+ /duct-drone-app /server /mocks.json
16+ /Documents /*
17+ /duct-drone-app /.vs /
18+ duct-drone-app /src /.vs /
19+ /.vs /
20+ /duct-drone-app /build /
Original file line number Diff line number Diff line change 11const Entry = require ( '../daos/entrydao' ) ;
22
33exports . createEntry = function ( req , res , next ) {
4- console . log ( req . body ) ;
54 const entry = {
65 time : req . body . time ,
76 temperature : req . body . temperature ,
Original file line number Diff line number Diff line change 1- const map = require ( '../daos/mapdao' ) ;
1+ const Map = require ( '../daos/mapdao' ) ;
2+
3+ exports . createMap = function ( req , res , next ) {
4+ console . log ( req . body ) ;
5+ const map = {
6+ name : req . body . name ,
7+ map_link : req . body . map_link ,
8+ date : req . body . date ,
9+ sensorData : req . body . sensorData ,
10+ } ;
11+ Map . create ( map , ( err , map ) => {
12+ if ( err ) {
13+ res . json ( {
14+ error : err ,
15+ } ) ;
16+ }
17+ res . json ( {
18+ message : 'Map created successfully' ,
19+ } ) ;
20+ } ) ;
21+ } ;
222
323exports . getMaps = function ( req , res , next ) {
4- map . get ( { } , ( err , map ) => {
24+ Map . get ( { } , ( err , map ) => {
525 if ( err ) {
626 res . json ( {
727 error : err ,
Original file line number Diff line number Diff line change @@ -6,11 +6,9 @@ entrySchema.statics = {
66 create ( data , cb ) {
77 const entry = new this ( data ) ;
88 entry . save ( cb ) ;
9- console . log ( 'cheese' ) ;
109 } ,
1110 get ( query , cb ) {
1211 this . find ( query , cb ) ;
13- console . log ( 'its' ) ;
1412 } ,
1513} ;
1614
Original file line number Diff line number Diff line change 11const mongoose = require ( 'mongoose' ) ;
2+ const entrySchema = require ( './entrymodel' ) ;
23
34const { Schema } = mongoose ;
45
56const mapSchema = new Schema ( {
67 name : String ,
78 map_link : String ,
89 date : Date ,
9- sensorData : [ { type : Schema . Types . ObjectId , ref : 'Entry' } ] ,
10+ sensorData : [ entrySchema ] ,
1011} ) ;
1112
1213module . exports = mapSchema ;
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ const Map = require('../controllers/mapController');
22
33module . exports = function ( router ) {
44 router . get ( '/get/maps' , Map . getMaps ) ;
5+ router . post ( '/create/map' , Map . createMap ) ;
56} ;
You can’t perform that action at this time.
0 commit comments