From d8fefba365e7bf161639ad467b91dfcf3e365b8d Mon Sep 17 00:00:00 2001 From: zenlex Date: Tue, 9 Apr 2024 18:59:38 -0500 Subject: [PATCH] chore: cleanup sql formatting sample --- services/proposals.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/proposals.ts b/services/proposals.ts index 8eeda3d..9d36762 100644 --- a/services/proposals.ts +++ b/services/proposals.ts @@ -5,7 +5,10 @@ import { Proposal, PendingProposal } from '../types/proposal'; async function index() { const pool = await getPool(); return await pool.connect(async (connection) => { - const rows = await connection.any(sql.type(Proposal)`SELECT * FROM proposals;`) + const rows = await connection.any( + sql.type(Proposal)` + SELECT * FROM proposals;`) + return rows; }); } @@ -13,7 +16,10 @@ async function index() { async function store(data: PendingProposal) { const pool = await getPool(); return await pool.connect(async (connection) => { - 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 *;`) + 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 *;`) }); }