Skip to content

Commit 9850273

Browse files
committed
prettier things
1 parent c053c0d commit 9850273

6 files changed

Lines changed: 52 additions & 41 deletions

File tree

src/plugins/postgrest.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ declare module 'fastify' {
1313
}
1414

1515
async function getPostgrestClient(request: FastifyRequest, jwt: string): Promise<PostgrestClient> {
16-
const {
17-
anonKey,
18-
isMultitenant,
19-
postgrestURL,
20-
postgrestURLSuffix,
21-
xForwardedHostRegExp,
22-
} = getConfig()
16+
const { anonKey, isMultitenant, postgrestURL, postgrestURLSuffix, xForwardedHostRegExp } =
17+
getConfig()
2318
let url = postgrestURL
2419
let apiKey = anonKey
2520
if (isMultitenant && xForwardedHostRegExp) {

src/routes/bucket/createBucket.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export default async function routes(fastify: FastifyInstance) {
6262
.send(createResponse('The key contains invalid characters', '400', 'Invalid key'))
6363
}
6464

65-
const { data: results, error, status } = await request.postgrest
65+
const {
66+
data: results,
67+
error,
68+
status,
69+
} = await request.postgrest
6670
.from<Bucket>('buckets')
6771
.insert(
6872
[

src/routes/bucket/getAllBuckets.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export default async function routes(fastify: FastifyInstance) {
3333
},
3434
async (request, response) => {
3535
// get list of all buckets
36-
const { data: results, error, status } = await request.postgrest
36+
const {
37+
data: results,
38+
error,
39+
status,
40+
} = await request.postgrest
3741
.from<Bucket>('buckets')
3842
.select('id, name, public, owner, created_at, updated_at')
3943

src/routes/object/copyObject.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ export default async function routes(fastify: FastifyInstance) {
105105
owner,
106106
})
107107
request.log.info({ origObject }, 'newObject')
108-
const { data: results, error, status } = await request.postgrest
108+
const {
109+
data: results,
110+
error,
111+
status,
112+
} = await request.postgrest
109113
.from<Obj>('objects')
110114
.insert([newObject], {
111115
returning: 'minimal',

src/routes/object/listObjects.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export default async function routes(fastify: FastifyInstance) {
7272
request.log.info(request.body)
7373
request.log.info(`searching for %s`, prefix)
7474

75-
const { data: results, error, status } = await request.postgrest
75+
const {
76+
data: results,
77+
error,
78+
status,
79+
} = await request.postgrest
7680
.rpc('search', {
7781
prefix,
7882
bucketname: bucketName,

src/server.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getConfig } from './utils/config'
88
import { runMultitenantMigrations, runMigrations } from './utils/migrate'
99
import { cacheTenantConfigsFromDbAndRunMigrations } from './utils/tenant'
1010

11-
let logger = pino({
11+
const logger = pino({
1212
formatters: {
1313
level(label) {
1414
return { level: label }
@@ -19,36 +19,36 @@ let logger = pino({
1919

2020
const exposeDocs = true
2121

22-
; (async () => {
23-
const { isMultitenant } = getConfig()
24-
if (isMultitenant) {
25-
await runMultitenantMigrations()
26-
await cacheTenantConfigsFromDbAndRunMigrations()
27-
28-
const adminApp: FastifyInstance<Server, IncomingMessage, ServerResponse> = buildAdmin({
29-
logger,
30-
})
31-
32-
try {
33-
await adminApp.listen(5001, '0.0.0.0')
34-
} catch (err) {
35-
adminApp.log.error(err)
36-
process.exit(1)
37-
}
38-
} else {
39-
await runMigrations()
40-
}
22+
;(async () => {
23+
const { isMultitenant } = getConfig()
24+
if (isMultitenant) {
25+
await runMultitenantMigrations()
26+
await cacheTenantConfigsFromDbAndRunMigrations()
4127

42-
const app: FastifyInstance<Server, IncomingMessage, ServerResponse> = build({
28+
const adminApp: FastifyInstance<Server, IncomingMessage, ServerResponse> = buildAdmin({
4329
logger,
44-
exposeDocs,
4530
})
4631

47-
app.listen(5000, '0.0.0.0', (err, address) => {
48-
if (err) {
49-
console.error(err)
50-
process.exit(1)
51-
}
52-
console.log(`Server listening at ${address}`)
53-
})
54-
})()
32+
try {
33+
await adminApp.listen(5001, '0.0.0.0')
34+
} catch (err) {
35+
adminApp.log.error(err)
36+
process.exit(1)
37+
}
38+
} else {
39+
await runMigrations()
40+
}
41+
42+
const app: FastifyInstance<Server, IncomingMessage, ServerResponse> = build({
43+
logger,
44+
exposeDocs,
45+
})
46+
47+
app.listen(5000, '0.0.0.0', (err, address) => {
48+
if (err) {
49+
console.error(err)
50+
process.exit(1)
51+
}
52+
console.log(`Server listening at ${address}`)
53+
})
54+
})()

0 commit comments

Comments
 (0)