Skip to content

Commit 04ef594

Browse files
committed
style: Format SQL queries
1 parent 9c6afcd commit 04ef594

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

live-demo/app/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
148148
const db = admin.resource('aparts').dataConnector.client;
149149
const days = req.body.days || 7;
150150
const apartsByDays = await db.prepare(
151-
`SELECT
151+
`SELECT
152152
strftime('%Y-%m-%d', created_at) as day,
153153
COUNT(*) as count
154154
FROM apartments
@@ -181,8 +181,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
181181
COUNT(*) as count
182182
FROM apartments
183183
GROUP BY number_of_rooms
184-
ORDER BY number_of_rooms;
185-
`
184+
ORDER BY number_of_rooms;`
186185
).all();
187186

188187
const topCountries = await db.prepare(
@@ -192,15 +191,13 @@ if (import.meta.url === `file://${process.argv[1]}`) {
192191
FROM apartments
193192
GROUP BY country
194193
ORDER BY count DESC
195-
LIMIT 4;
196-
`
194+
LIMIT 4;`
197195
).all();
198196

199197
const totalSquare = await db.prepare(
200198
`SELECT
201199
SUM(square_meter) as totalSquare
202-
FROM apartments;
203-
`
200+
FROM apartments;`
204201
).get();
205202

206203
const listedVsUnlistedPriceByDays = await db.prepare(
@@ -213,7 +210,6 @@ if (import.meta.url === `file://${process.argv[1]}`) {
213210
ORDER BY day ASC
214211
LIMIT ?;`
215212
).all(days);
216-
217213

218214
const totalListedPrice = Math.round(listedVsUnlistedByDays.reduce((
219215
acc: number, { listedPrice }: { listedPrice:number }

0 commit comments

Comments
 (0)