apraisal endpoint

This commit is contained in:
Sirttas
2026-06-12 21:20:44 +02:00
parent 2ab3f01d89
commit d0c198118d
6 changed files with 144 additions and 67 deletions
+20
View File
@@ -0,0 +1,20 @@
import {marketApi} from '@/mammon/mammonService';
import {MarketTypePrice, PriceGetter} from './MarketTypePrice';
export const getMammonPrices: PriceGetter = async types => {
if (types.length === 0) {
return [];
}
const typesById = new Map(types.map(t => [t.id, t]));
const response = await marketApi.currentPrices(types.map(t => t.id));
return response.data.reduce<MarketTypePrice[]>((prices, p) => {
const type = typesById.get(p.marketTypeId);
if (type) {
prices.push({ type, buy: p.buy, sell: p.sell, orderCount: p.orderCount });
}
return prices;
}, []);
};