Skip to content

Commit d8fefba

Browse files
committed
chore: cleanup sql formatting sample
1 parent c2298b9 commit d8fefba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

services/proposals.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@ import { Proposal, PendingProposal } from '../types/proposal';
55
async function index() {
66
const pool = await getPool();
77
return await pool.connect(async (connection) => {
8-
const rows = await connection.any(sql.type(Proposal)`SELECT * FROM proposals;`)
8+
const rows = await connection.any(
9+
sql.type(Proposal)`
10+
SELECT * FROM proposals;`)
11+
912
return rows;
1013
});
1114
}
1215

1316
async function store(data: PendingProposal) {
1417
const pool = await getPool();
1518
return await pool.connect(async (connection) => {
16-
const proposal = await connection.one(sql.type(Proposal)`INSERT INTO proposals (title, summary, description, type) VALUES (${data.title}, ${data.summary}, ${data.description}, ${data.type}) RETURNING *;`)
19+
const proposal = await connection.one(sql.type(Proposal)`
20+
INSERT INTO proposals (title, summary, description, type)
21+
VALUES (${data.title}, ${data.summary}, ${data.description}, ${data.type})
22+
RETURNING *;`)
1723
});
1824
}
1925

0 commit comments

Comments
 (0)