Skip to content

Commit

Permalink
Enable Archived Prices
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzmatazzz committed Dec 15, 2024
1 parent 1677543 commit e30c409
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
6 changes: 3 additions & 3 deletions datasources/historical-prices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions resolvers/itemResolver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
26 changes: 3 additions & 23 deletions schema-static.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -234,6 +212,8 @@ type HideoutStationLevel {
type historicalPricePoint {
price: Int
priceMin: Int
offerCount: Int
offerCountMin: Int
timestamp: String
}
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit e30c409

Please sign in to comment.