|
|
|
@ -60,7 +60,7 @@ export class ProductStore {
|
|
|
|
|
try {
|
|
|
|
|
const conn = await client.connect();
|
|
|
|
|
const result = await conn.query(
|
|
|
|
|
'UPDATE products SET name=$1, price=$2 WHERE id=$3 returning *;',
|
|
|
|
|
'UPDATE products SET name=$1, price=$2 WHERE id=$3 RETURNING *;',
|
|
|
|
|
[p.name, p.price, p.id]
|
|
|
|
|
);
|
|
|
|
|
conn.release()
|
|
|
|
@ -72,7 +72,7 @@ export class ProductStore {
|
|
|
|
|
|
|
|
|
|
async delete(id: number): Promise<Product> {
|
|
|
|
|
try {
|
|
|
|
|
const sql = 'DELETE FROM products WHERE id=(1$)'
|
|
|
|
|
const sql = 'DELETE FROM products WHERE id=($1)'
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
const conn = await client.connect()
|
|
|
|
|
|
|
|
|
|