Skip to content

Commit

Permalink
limit recent messages to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 28, 2024
1 parent 8b41dcc commit 6367512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/utils/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function addMessage(user: string, message: string) {
db.sql`INSERT INTO messages (user, message) VALUES (${user}, ${message})`;
}

export async function getMessages(count = 10) {
export async function getMessages(count = 5) {
const db = useDatabase();
const { rows } = await db.sql`SELECT * FROM messages ORDER BY created_at ASC LIMIT ${count}`
return rows as { id: number, user: string, message: string, created_at: string }[];
Expand Down

0 comments on commit 6367512

Please sign in to comment.