Ethermap collaborative map tool inspired by etherpad.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
604 B

import MapModel from '../db/models/map.js'
const getAllMaps = async (req, res) => {
const maps = await MapModel.query()
res.json({ maps })
}
const getMapByName = async (req, res) => {
const name = req.params.mapName
try {
let map = await MapModel.query().where({ name }).withGraphFetched('map_points').first()
if (!map) {
const created = await MapModel.query().insert({ name })
map = await MapModel.query().findById(created.id).withGraphFetched('map_points')
}
res.json(map)
} catch (error) {
console.error(error)
}
}
export { getMapByName, getAllMaps }