()
| 106 | * @returns {Promise} |
| 107 | */ |
| 108 | const getVotes = async () => { |
| 109 | if (!knex) knex = await connect(); |
| 110 | return knex |
| 111 | .select('candidate', 'time_cast', 'uid') |
| 112 | .from(TABLE) |
| 113 | .orderBy('time_cast', 'desc') |
| 114 | .limit(5); |
| 115 | }; |
| 116 | |
| 117 | /** |
| 118 | * Retrieve the total count of records for a given candidate |