gracelungu / todo-app-express

0 stars 0 forks source link

Add pagination to the list items #2

Open gracelungu opened 1 year ago

gracelungu commented 1 year ago

This PR adds pagination support to the list items endpoint.

chatcody[bot] commented 1 year ago

There seems to be a syntax error in the SQL query within the getItemsWithPagination function. The LIMIT and OFFSET values aren't being interpolated correctly. Please revise this to make sure the query is executed correctly. The corrected query would look like this:

const items = await query(`SELECT * FROM items ORDER BY id LIMIT ${limit} OFFSET ${offset}`);

Also, please ensure the use of parameterized queries or prepared statements to prevent SQL injection attacks.