Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Feb 10, 2024
1 parent f874765 commit 3bf568c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const asConfig = asObject({
),
httpPort: asOptional(asNumber, 8008),
bog: asOptional(asObject({ apiKey: asString }), { apiKey: '' }),
soloAppIds: asOptional(asArray(asString), undefined),
soloPartnerIds: asOptional(asArray(asString), undefined),
soloAppIds: asOptional(asArray(asString), null),
soloPartnerIds: asOptional(asArray(asString), null),
timeoutOverrideMins: asOptional(asNumber, 1200),
cacheLookbackMonths: asOptional(asNumber, 24)
})
Expand Down
2 changes: 1 addition & 1 deletion src/indexApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function main(): Promise<void> {
},
limit: 1000000
}
console.log(config)

const rawApps = await reportsApps.find(query)
const apps = asApps(rawApps.docs)

Expand Down
25 changes: 13 additions & 12 deletions src/initDbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { datelog } from './util'

const nanoDb = nano(config.couchDbFullpath)

const INDEXES: string[][] = [
const transactionIndexFields: string[][] = [
['isoDate'],
['status'],
['status', 'depositCurrency', 'isoDate'],
Expand All @@ -26,25 +26,26 @@ interface Index {
partitioned: boolean
}

const indexes: Index[] = []
const transactionIndexes: Index[] = []

INDEXES.forEach(index => {
transactionIndexFields.forEach(index => {
const indexLower = index.map(i => i.toLowerCase())
const out = {
const out: Index = {
index: { fields: index },
ddoc: indexLower.join('-'),
name: indexLower.join('-'),
type: 'json' as 'json',
type: 'json',
partitioned: false
}
indexes.push(out)
out.ddoc += '-p'
out.name += '-p'
out.partitioned = true
indexes.push(out)
transactionIndexes.push(out)
const out2 = { ...out }
out2.ddoc += '-p'
out2.name += '-p'
out2.partitioned = true
transactionIndexes.push(out2)
})

const cacheIndexes = [
const cacheIndexes: Index[] = [
{
index: { fields: ['timestamp'] },
ddoc: 'timestamp-p',
Expand All @@ -62,7 +63,7 @@ const DB_NAMES = [
{
name: 'reports_transactions',
options,
indexes
indexes: transactionIndexes
},
{ name: 'reports_progresscache', options },
{
Expand Down

0 comments on commit 3bf568c

Please sign in to comment.