diff --git a/src/config.ts b/src/config.ts index 4ee0fd0e..9bfc4083 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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) }) diff --git a/src/indexApi.ts b/src/indexApi.ts index 460b69c5..21ea9b25 100644 --- a/src/indexApi.ts +++ b/src/indexApi.ts @@ -81,7 +81,7 @@ async function main(): Promise { }, limit: 1000000 } - console.log(config) + const rawApps = await reportsApps.find(query) const apps = asApps(rawApps.docs) diff --git a/src/initDbs.ts b/src/initDbs.ts index f1ba30c9..93f8d1cc 100644 --- a/src/initDbs.ts +++ b/src/initDbs.ts @@ -5,7 +5,7 @@ import { datelog } from './util' const nanoDb = nano(config.couchDbFullpath) -const INDEXES: string[][] = [ +const transactionIndexFields: string[][] = [ ['isoDate'], ['status'], ['status', 'depositCurrency', 'isoDate'], @@ -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', @@ -62,7 +63,7 @@ const DB_NAMES = [ { name: 'reports_transactions', options, - indexes + indexes: transactionIndexes }, { name: 'reports_progresscache', options }, {