diff --git a/backend/config/db.js b/backend/config/db.js index c87db48..ee1b5f0 100644 --- a/backend/config/db.js +++ b/backend/config/db.js @@ -14,3 +14,5 @@ const database = mongoose.connection; database.on('error', (err) => { console.error(`Database Connection Error: ${err}`); process.exit(2); }); database.on('connected', () => { console.info('Succesfully connected to MongoDB Database'); }); + +console.log(`DB: mongodb://${USER}:${PASSWORD}@${HOSTNAME}:${PORT}/${DATABASE}`); diff --git a/backend/models/Route.js b/backend/models/Route.js index 318b8f1..51426b7 100644 --- a/backend/models/Route.js +++ b/backend/models/Route.js @@ -8,8 +8,8 @@ const RouteSchema = new Schema( title: { type: String, default: '' }, // address: { type: String, required: true }, version: { type: Number, default: 2 }, - route: { type: Array }, - stickers: { type: Array }, + route: { type: Array, default: [] }, + stickers: { type: Array, default: [] }, owner: { type: Schema.Types.ObjectId, ref: 'User' }, logo: { type: String, default: 'DEFAULT' }, distance: { type: Number, default: 0 }, diff --git a/backend/routes/auth/check.js b/backend/routes/auth/check.js index 39ca59e..4053922 100644 --- a/backend/routes/auth/check.js +++ b/backend/routes/auth/check.js @@ -8,7 +8,7 @@ module.exports = async (req, res) => { path: 'routes', options: { limit: 100, - sort: { updated: 1 }, + sort: { updated_at: -1 }, } }); const random_url = await generateRandomUrl(); diff --git a/backend/utils/parse.js b/backend/utils/parse.js index b7df49d..32e884b 100644 --- a/backend/utils/parse.js +++ b/backend/utils/parse.js @@ -9,7 +9,7 @@ module.exports.parseRoute = route => route.filter(el => ( )); module.exports.parseStickers = stickers => stickers.filter(el => ( - Object.keys(el).length === 4 + Object.keys(el).length === 5 && el.latlng && Object.keys(el.latlng).length === 2 && el.latlng.lat diff --git a/src/components/maps/RouteRow.jsx b/src/components/maps/RouteRow.jsx index 245bdcd..3c4c988 100644 --- a/src/components/maps/RouteRow.jsx +++ b/src/components/maps/RouteRow.jsx @@ -30,7 +30,7 @@ export const RouteRow = ({