From 9915189d6ead89400ec8463533a45b3db25cff0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sophie-Ga=C3=ABlle=20CALLOCH?= Date: Fri, 14 Aug 2026 11:23:33 +0200 Subject: [PATCH 1/3] feat: Consumption persistence --- src/market/acquisition/acquisition.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/market/acquisition/acquisition.ts b/src/market/acquisition/acquisition.ts index d9cf198..8bb9b3f 100644 --- a/src/market/acquisition/acquisition.ts +++ b/src/market/acquisition/acquisition.ts @@ -1,7 +1,7 @@ import {defineStore} from "pinia"; import {computed, ref} from "vue"; import {acquisitionApi, activityApi} from "@/mammon"; -import {AcquisitionResponse, ActivitySourceResponse} from "@/generated/mammon"; +import {AcquisitionResponse} from "@/generated/mammon"; import {onActivitiesProcessed} from "@/activity"; export type RawAcquiredType = { @@ -12,7 +12,6 @@ export type RawAcquiredType = { remaining: number; price: number; date: Date; - source: ActivitySourceResponse; } export const toAcquiredType = (a: AcquisitionResponse): RawAcquiredType => ({ @@ -23,7 +22,6 @@ export const toAcquiredType = (a: AcquisitionResponse): RawAcquiredType => ({ remaining: a.remaining, price: a.unitCost, date: new Date(a.datetime), - source: a.source, }); export const useAcquiredTypesStore = defineStore('market-acquisition', () => { From 62c0e1aab228176f975a6067957d05a4943a029b Mon Sep 17 00:00:00 2001 From: Sirttas Date: Fri, 14 Aug 2026 22:51:15 +0200 Subject: [PATCH 2/3] fix: rerun open api gen --- docs/mammon-api.yml | 19 +-- src/generated/mammon/api.ts | 309 ++++++++++++++++++++---------------- 2 files changed, 176 insertions(+), 152 deletions(-) diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index f8171cb..46f123b 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -959,7 +959,7 @@ paths: /ledgers/{ledgerId}/profit: get: tags: - - transaction + - profit summary: Get the daily profit series for a single ledger operationId: profitPerDayInLedger parameters: @@ -987,8 +987,8 @@ paths: /ledgers/{ledgerId}/margin: get: tags: - - transaction - summary: Get the daily FIFO-realized profit series for a single ledger + - profit + summary: Get the daily FIFO-realized margin series for a single ledger operationId: marginPerDayInLedger parameters: - name: ledgerId @@ -1000,10 +1000,10 @@ paths: format: uuid responses: "200": - description: "Daily FIFO-realized profit for the ledger, ascending by date,\ - \ only for days with a sale. iskIn is the sum of that day's profitable\ - \ trades, iskOut is the sum of that day's losing trades (as a positive\ - \ deficit); profit is iskIn minus iskOut." + description: "Daily FIFO-realized margin for the ledger, ascending by date,\ + \ only for days with a consumption. iskIn is the sum of that day's profitable\ + \ consumptions, iskOut is the sum of that day's losing consumptions (as\ + \ a positive deficit); profit is iskIn minus iskOut." content: '*/*': schema: @@ -2310,10 +2310,6 @@ components: format: uuid description: Ledger the acquisition is held in. example: 3fa85f64-5717-4562-b3fc-2c963f66afa6 - source: - $ref: "#/components/schemas/ActivitySourceResponse" - description: "Where the acquisition came from: a character, a corporation,\ - \ or nothing." marketTypeId: type: integer format: int64 @@ -2345,5 +2341,4 @@ components: - marketTypeId - quantity - remaining - - source - unitCost diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 49ffa98..a79de42 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -35,10 +35,6 @@ export interface AcquisitionResponse { * Ledger the acquisition is held in. */ 'ledgerId': string; - /** - * Where the acquisition came from: a character, a corporation, or nothing. - */ - 'source': ActivitySourceResponse; /** * EVE market type (item) id that was acquired. */ @@ -3636,6 +3632,175 @@ export class MarketHistoryAdminControllerApi extends BaseAPI { +/** + * ProfitApi - axios parameter creator + */ +export const ProfitApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the daily FIFO-realized margin series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + marginPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'ledgerId' is not null or undefined + assertParamExists('marginPerDayInLedger', 'ledgerId', ledgerId) + const localVarPath = `/ledgers/{ledgerId}/margin` + .replace('{ledgerId}', encodeURIComponent(String(ledgerId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Accept'] = '*/*'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the daily profit series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + profitPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'ledgerId' is not null or undefined + assertParamExists('profitPerDayInLedger', 'ledgerId', ledgerId) + const localVarPath = `/ledgers/{ledgerId}/profit` + .replace('{ledgerId}', encodeURIComponent(String(ledgerId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Accept'] = '*/*'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ProfitApi - functional programming interface + */ +export const ProfitApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ProfitApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Get the daily FIFO-realized margin series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.marginPerDayInLedger(ledgerId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ProfitApi.marginPerDayInLedger']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary Get the daily profit series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.profitPerDayInLedger(ledgerId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ProfitApi.profitPerDayInLedger']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ProfitApi - factory interface + */ +export const ProfitApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ProfitApiFp(configuration) + return { + /** + * + * @summary Get the daily FIFO-realized margin series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.marginPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Get the daily profit series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.profitPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ProfitApi - object-oriented interface + */ +export class ProfitApi extends BaseAPI { + /** + * + * @summary Get the daily FIFO-realized margin series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) { + return ProfitApiFp(this.configuration).marginPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Get the daily profit series for a single ledger + * @param {string} ledgerId Id of the ledger + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) { + return ProfitApiFp(this.configuration).profitPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath)); + } +} + + + /** * ReprocessingApi - axios parameter creator */ @@ -4192,74 +4357,6 @@ export const TransactionApiAxiosParamCreator = function (configuration?: Configu let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the daily FIFO-realized profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - marginPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'ledgerId' is not null or undefined - assertParamExists('marginPerDayInLedger', 'ledgerId', ledgerId) - const localVarPath = `/ledgers/{ledgerId}/margin` - .replace('{ledgerId}', encodeURIComponent(String(ledgerId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the daily profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - profitPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'ledgerId' is not null or undefined - assertParamExists('profitPerDayInLedger', 'ledgerId', ledgerId) - const localVarPath = `/ledgers/{ledgerId}/profit` - .replace('{ledgerId}', encodeURIComponent(String(ledgerId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -4287,32 +4384,6 @@ export const TransactionApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['TransactionApi.finAllTransactionsInLedger']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, - /** - * - * @summary Get the daily FIFO-realized profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.marginPerDayInLedger(ledgerId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['TransactionApi.marginPerDayInLedger']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Get the daily profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.profitPerDayInLedger(ledgerId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['TransactionApi.profitPerDayInLedger']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, } }; @@ -4332,26 +4403,6 @@ export const TransactionApiFactory = function (configuration?: Configuration, ba finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.finAllTransactionsInLedger(ledgerId, options).then((request) => request(axios, basePath)); }, - /** - * - * @summary Get the daily FIFO-realized profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise> { - return localVarFp.marginPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Get the daily profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise> { - return localVarFp.profitPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath)); - }, }; }; @@ -4369,28 +4420,6 @@ export class TransactionApi extends BaseAPI { public finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig) { return TransactionApiFp(this.configuration).finAllTransactionsInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath)); } - - /** - * - * @summary Get the daily FIFO-realized profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) { - return TransactionApiFp(this.configuration).marginPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Get the daily profit series for a single ledger - * @param {string} ledgerId Id of the ledger - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) { - return TransactionApiFp(this.configuration).profitPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath)); - } } From 206e6b3fa4408e23dc2496e7167370286fbdd394 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Fri, 14 Aug 2026 22:53:36 +0200 Subject: [PATCH 3/3] fix: rewire profit from api --- src/mammon/mammonService.ts | 2 ++ src/pages/ledger/ViewLedgerStatistics.vue | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mammon/mammonService.ts b/src/mammon/mammonService.ts index 750464d..30b1ea2 100644 --- a/src/mammon/mammonService.ts +++ b/src/mammon/mammonService.ts @@ -12,6 +12,7 @@ import { LocationApi, MarketApi, MeResponse, + ProfitApi, ReprocessingApi, RuleBookApi, RuleScriptApi, @@ -108,6 +109,7 @@ export const postLogout = (): Promise => export const ledgerApi = new LedgerApi(undefined, mammonUrl, mammonAxiosInstance); export const transactionApi = new TransactionApi(undefined, mammonUrl, mammonAxiosInstance); +export const profitApi = new ProfitApi(undefined, mammonUrl, mammonAxiosInstance); export const characterApi = new CharacterApi(undefined, mammonUrl, mammonAxiosInstance); export const corporationApi = new CorporationApi(undefined, mammonUrl, mammonAxiosInstance); export const ruleBookApi = new RuleBookApi(undefined, mammonUrl, mammonAxiosInstance); diff --git a/src/pages/ledger/ViewLedgerStatistics.vue b/src/pages/ledger/ViewLedgerStatistics.vue index 3a3040b..7c1bb23 100644 --- a/src/pages/ledger/ViewLedgerStatistics.vue +++ b/src/pages/ledger/ViewLedgerStatistics.vue @@ -18,7 +18,7 @@ import { } from "chart.js"; import {Chart} from "vue-chartjs"; import {useLedgerParam} from "@/ledger"; -import {transactionApi} from "@/mammon"; +import {profitApi} from "@/mammon"; import {useProcessedResource} from "@/activity"; import {DailyProfitResponse} from "@/generated/mammon"; import {IskLabel} from "@/market"; @@ -48,8 +48,8 @@ const profits = useProcessedResource(async () => { } const {data} = mode.value === ProfitModes.Margin - ? await transactionApi.marginPerDayInLedger(ledgerId.value) - : await transactionApi.profitPerDayInLedger(ledgerId.value); + ? await profitApi.marginPerDayInLedger(ledgerId.value) + : await profitApi.profitPerDayInLedger(ledgerId.value); return data; }, []);