
const { sequence } = require('../../../../../lib/db');

module.exports = async function (req, res, next) {

	try {
		const feature = await sequence.point.get(req.params.project, req.params.sequence, req.params.point, req.query);

		if (feature) {

			const geojson = {
				type: "Feature",
				geometry: feature.geometry,
				properties: {...feature}
			};
			delete geojson.properties.geometry;

			res.status(200).send(geojson);
		} else {
			res.status(404).send();
		}
		next();
	} catch (err) {
		next(err);
	}


};
