call mammon for single scan

This commit is contained in:
Sirttas
2026-06-13 12:31:01 +02:00
parent 3348b9f668
commit cc3bdccd9a
4 changed files with 453 additions and 128 deletions
+16 -2
View File
@@ -2,7 +2,8 @@
import {ClipboardButton} from '@/components';
import {getMarketType, MarketType, MarketTypeInput, useApraisalStore, useMarketTaxStore} from "@/market";
import {AcquisitionResultTable, BuyModal, useAcquiredTypesStore} from '@/market/acquisition';
import {buildScanResult, ScanResultTable} from '@/market/scan';
import {ScanResultTable, toScanResult} from '@/market/scan';
import {marketApi} from "@/mammon";
import {ShoppingCartIcon} from '@heroicons/vue/24/outline';
import log from "loglevel";
import {computed, ref, watch} from "vue";
@@ -21,7 +22,20 @@ const apraisalStore = useApraisalStore();
const marketTaxStore = useMarketTaxStore();
const days = useStorage('market-scan-days', 365);
const price = computedAsync(() => item.value ? apraisalStore.getPrice(item.value) : undefined);
const result = computedAsync(async () => price.value ? await buildScanResult(price.value, days.value, marketTaxStore.calculateProfit) : undefined);
const result = computedAsync(async () => {
if (!item.value) {
return undefined;
}
const { data } = await marketApi.scanMarketType(
String(item.value.id),
days.value,
marketTaxStore.brokerFee / 100,
marketTaxStore.scc / 100
);
return toScanResult(data, item.value);
});
const acquiredTypesStore = useAcquiredTypesStore();
const acquisitions = computed(() => {