From e30c409814f74f8e5229ce57c04326511d269393 Mon Sep 17 00:00:00 2001 From: Razzmatazz Date: Sun, 15 Dec 2024 09:01:20 -0600 Subject: [PATCH] Enable Archived Prices --- datasources/historical-prices.mjs | 6 +++--- resolvers/itemResolver.mjs | 4 ++-- schema-static.mjs | 26 +++----------------------- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/datasources/historical-prices.mjs b/datasources/historical-prices.mjs index f5ab7a2c..99caff59 100644 --- a/datasources/historical-prices.mjs +++ b/datasources/historical-prices.mjs @@ -5,7 +5,7 @@ class historicalPricesAPI extends WorkerKVSplit { super('historical_price_data', dataSource); this.addGameMode('pve'); this.defaultDays = 7; - this.maxDays = 7; + this.maxDays = 30; this.itemLimitDays = 2; } @@ -27,9 +27,9 @@ class historicalPricesAPI extends WorkerKVSplit { if (!prices) { return []; } - /*if (days === this.maxDays) { + if (days === this.maxDays) { return prices; - }*/ + } const cutoffTimestamp = new Date().setDate(new Date().getDate() - days); let dayFiltered = prices.filter(hp => hp.timestamp >= cutoffTimestamp); if (halfResults) { diff --git a/resolvers/itemResolver.mjs b/resolvers/itemResolver.mjs index 5401a1a0..dcc6c900 100644 --- a/resolvers/itemResolver.mjs +++ b/resolvers/itemResolver.mjs @@ -76,9 +76,9 @@ export default { historicalItemPrices(obj, args, context, info) { return context.util.paginate(context.data.worker.historicalPrice.getByItemId(context, info, args.id, args.days), args); }, - /*archivedItemPrices(obj, args, context, info) { + archivedItemPrices(obj, args, context, info) { return context.util.paginate(context.data.worker.archivedPrice.getByItemId(context, info, args.id), args); - },*/ + }, armorMaterials(obj, args, context, info) { return context.data.worker.item.getArmorMaterials(context, info); }, diff --git a/schema-static.mjs b/schema-static.mjs index cffb6cf8..ba3e4def 100644 --- a/schema-static.mjs +++ b/schema-static.mjs @@ -39,28 +39,6 @@ type Ammo { #attributes: AttributeCollection! } -#type AttributeCollection { -# int: [AttributeInt]! -# float: [AttributeFloat]! -# string: [ItemAttribute]! -# boolean: [AttributeBoolean]! -#} - -#type AttributeBoolean { -# name: String! -# value: Boolean! -#} - -#type AttributeFloat { -# name: String! -# value: Float! -#} - -#type AttributeInt { -# name: String! -# value: Int! -#} - type ArmorMaterial { id: String name: String @@ -234,6 +212,8 @@ type HideoutStationLevel { type historicalPricePoint { price: Int priceMin: Int + offerCount: Int + offerCountMin: Int timestamp: String } @@ -1395,7 +1375,7 @@ interface Vendor { type Query { achievements(lang: LanguageCode, limit: Int, offset: Int): [Achievement]! ammo(lang: LanguageCode, gameMode: GameMode, limit: Int, offset: Int): [Ammo] - #archivedItemPrices(id: ID!, limit: Int, offset: Int): [historicalPricePoint]! + archivedItemPrices(id: ID!, limit: Int, offset: Int): [historicalPricePoint]! barters(lang: LanguageCode, gameMode: GameMode, limit: Int, offset: Int): [Barter] bosses(lang: LanguageCode, gameMode: GameMode, name: [String!], limit: Int, offset: Int): [MobInfo] crafts(lang: LanguageCode, gameMode: GameMode, limit: Int, offset: Int): [Craft]