database/index.js
// Inserts a new Poll into the db
Inserts a new Poll into the db
Inserts a new Poll into the db
function createPoll(poll) {
	return new Promise((resolve, reject) => {
		pool.query('INSERT INTO poll (title, options, votes, date_created, multi, dup_check) VALUES ($1, $2, $3, $4, $5, $6) RETURNING *', 
			[poll.title, poll.options, poll.votes, poll.date, poll.multi, poll.dupCheck])
		.then(result => {
			resolve(result.rows[0]);
		})
		.catch(e => reject(e));
	});
}
function createPoll ( poll ) { return new Promise ( ( resolve , reject ) => { pool . query ( 'INSERT INTO poll (title, options, votes, date_created, multi, dup_check) VALUES ($1, $2, $3, $4, $5, $6) RETURNING *' , [ poll . title , poll . options , poll . votes , poll . date , poll . multi , poll . dupCheck ] ) . then ( result => { resolve ( result . rows [ 0 ] ) ; } ) . catch ( e => reject ( e ) ) ; } ) ; }
Inserts a new Poll into the db
Inserts a new Poll into the db