const { event, sequence } = require('../../../../lib/db');
const { transform } = require('../../../../lib/sse');

const seis = async function (req, res, next) {
	try {
		const events = await event.list(req.params.project, req.query);
		const sequences = await sequence.list(req.params.project, req.query);
		const response = transform(events, sequences, {projectId: req.params.project});
		res.status(200).send(response);
		next();
	} catch (err) {
		next(err);
	}
};

module.exports = seis;
