Expanded mongo model
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
const Part = require('./Part')
|
||||
|
||||
function capitalize (string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||
}
|
||||
|
||||
module.exports = class Item {
|
||||
constructor (name) {
|
||||
this.name = name
|
||||
this.fullName = capitalize(name) + ' Prime'
|
||||
this.set = new Part(name, 'set')
|
||||
|
||||
this.parts = []
|
||||
|
||||
@@ -3,12 +3,13 @@ const Api = require('../api')
|
||||
module.exports = class Part {
|
||||
constructor (set, part, amount) {
|
||||
this.part = part
|
||||
this.url = `${set}_prime_${part}`
|
||||
this.urlPath = `${set}_prime_${part}`
|
||||
this.url = `https://warframe.market/items/${set}_prime_${part}`
|
||||
this.amount = amount ?? 1
|
||||
}
|
||||
|
||||
async getPrice () {
|
||||
const orders = await Api.getSortedOrders(this.url)
|
||||
const orders = await Api.getSortedOrders(this.urlPath)
|
||||
return Number(orders[0].platinum) * this.amount
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user