diff options
author | mat <github@matdoes.dev> | 2022-07-02 15:06:02 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-07-02 15:06:02 -0500 |
commit | aff11215ac2587d36f92b80c26a5f5d56f9c9b5e (patch) | |
tree | 8e9a7ac5eb081769470b2c8041c21d9d4d1c9a1d /src/database.ts | |
parent | ea9753474a8f3e02079782a2dd6502b297ff541d (diff) | |
download | skyblock-api-aff11215ac2587d36f92b80c26a5f5d56f9c9b5e.tar.gz skyblock-api-aff11215ac2587d36f92b80c26a5f5d56f9c9b5e.tar.bz2 skyblock-api-aff11215ac2587d36f92b80c26a5f5d56f9c9b5e.zip |
Minor database optimization for bin
Diffstat (limited to 'src/database.ts')
-rw-r--r-- | src/database.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/database.ts b/src/database.ts index e3affc4..e7a7bad 100644 --- a/src/database.ts +++ b/src/database.ts @@ -128,7 +128,8 @@ export interface SimpleAuctionSchemaBson { ts: number /** Whether the auction was successfully bought or simply expired. */ s: boolean - bin: boolean + /** If this is missing, it's false. */ + bin?: true } export interface SimpleAuctionSchema { /** The UUID of the auction so we can look it up later. */ @@ -1124,6 +1125,7 @@ function toItemAuctionsSchema(i: ItemAuctionsSchemaBson): ItemAuctionsSchema { return { ...a, id: a.id.toString('hex'), + bin: a.bin ?? false } }), } @@ -1136,7 +1138,8 @@ function toItemAuctionsSchemaBson(i: ItemAuctionsSchema): ItemAuctionsSchemaBson auctions: i.auctions.map(a => { return { ...a, - id: createUuid(a.id) + id: createUuid(a.id), + bin: a.bin ? true : undefined } }), // we sort by oldestDate to get the volume sold, but we don't want brand new items with like no data having a high frequency |