diff --git a/src/lib/server/db/index.ts b/src/lib/server/db/index.ts index a355a15..089130a 100644 --- a/src/lib/server/db/index.ts +++ b/src/lib/server/db/index.ts @@ -7,18 +7,13 @@ async function createChannel(client: cassandra.Client, channelName: string) { message_content TEXT, timestamp TIMESTAMP, sender UUID - );`) + );`); } -async function storeMessage( - client: cassandra.Client, - channelName: string, - content: string, - sender: string, - id: string) { +async function storeMessage(client: cassandra.Client, channelName: string, content: string, sender: string, id: string) { const now = new Date(); await client.execute(`INSERT INTO channels.channel_${channelName} (id, message_content, timestamp, sender) - VALUES (${id}, '${content}', ${now.getTime()}, ${sender})`) + VALUES (${id}, '${content}', ${now.getTime()}, ${sender})`); } const client = new cassandra.Client({ @@ -32,4 +27,4 @@ await client.connect(); await client.execute(`CREATE KEYSPACE IF NOT EXISTS users WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};`); await client.execute(`CREATE KEYSPACE IF NOT EXISTS channels WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};`); -export { client, createChannel, storeMessage }; \ No newline at end of file +export { client, createChannel, storeMessage };