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

/**
 * Delete an event from the database.
 */
async function del (projectId, eventId) {

	if (!projectId || !eventId) {
		throw {status: 400, message: "Invalid request" };
		return;
	}

	const client = await setSurvey(projectId);
	try {

		const text = `
			DELETE
			FROM event_log
			WHERE id = $1;
		`;

		await client.query(text, [eventId]);
	} catch (err) {
		throw err;
	} finally {
		client.release();
	}

	return;
}

module.exports = del;
