style: Prettier format

This commit is contained in:
April Hall 2025-01-13 08:36:41 -05:00
parent d3b8653c88
commit 12ad2431d8
No known key found for this signature in database
GPG Key ID: A49AC35CB186266C
2 changed files with 7 additions and 6 deletions

View File

@ -4,8 +4,7 @@ function reverseArray(array: cassandra.types.Row[]) {
let left = null; let left = null;
let right = null; let right = null;
const length = array.length; const length = array.length;
for (left = 0, right = length - 1; left < right; left += 1, right -= 1) for (left = 0, right = length - 1; left < right; left += 1, right -= 1) {
{
const temporary = array[left]; const temporary = array[left];
array[left] = array[right]; array[left] = array[right];
array[right] = temporary; array[right] = temporary;
@ -43,8 +42,10 @@ async function storeMessage(client: cassandra.Client, channelName: string, conte
async function getMessages(client: cassandra.Client, channelName: string, limit: number) { async function getMessages(client: cassandra.Client, channelName: string, limit: number) {
try { try {
const res = await client.execute(`SELECT * FROM channels.channel_${channelName} WHERE channel_name = '${channelName}' ORDER BY timestamp DESC LIMIT ${limit}`); const res = await client.execute(
return reverseArray(res.rows) `SELECT * FROM channels.channel_${channelName} WHERE channel_name = '${channelName}' ORDER BY timestamp DESC LIMIT ${limit}`,
);
return reverseArray(res.rows);
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me // @ts-expect-error I don't like this thing yelling at me
console.log(`Error fetching messages: ${e.message}`); console.log(`Error fetching messages: ${e.message}`);