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

async function unaccept (projectId, payload) {
	const client = await setSurvey(projectId);

	const text = `
		UPDATE event_log_full
		SET
			labels = array_remove(labels, 'QCAccepted')
		WHERE
			validity @> current_timestamp
			AND id = ANY($1);
	`;

	const values = [ payload ];

	await client.query(text, values);
	client.release();
	return;
}

module.exports = unaccept;
