const { setSurvey } = require('../connection');

async function list (projectId, opts = {}) {
	const client = await setSurvey(projectId);

// 	const sortFields = [ "line", "length", "azimuth", "fsp", "lsp", "num_points", "incr", "remarks" ];
// 	const sortKey = opts.sortBy && sortFields.includes(opts.sortBy) && opts.sortBy || "line";
// 	const sortDir = opts.sortDesc == "true" ? "DESC" : "ASC";
// 	const offset = Math.abs((opts.page-1)*opts.itemsPerPage) || 0;
// 	const limit = Math.abs(Number(opts.itemsPerPage)) || null;

	const text = `
		SELECT *
		FROM planned_lines_summary
		ORDER BY sequence ASC;
	`;

	const res = await client.query(text);
	client.release();
	return res.rows;
}

module.exports = list;
