From 9acbc101e1f3a159737faccb661d6564fbad0d96 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Tue, 26 May 2026 22:32:43 +0200 Subject: [PATCH] post processing call from front --- docs/mammon-api.yml | 12 +++++ src/characters/chartacters.ts | 6 ++- src/generated/mammon/api.ts | 89 +++++++++++++++++++++++++++++++++++ src/mammon/mammonService.ts | 10 +++- src/pages/Characters.vue | 8 +++- src/pages/Ledgers.vue | 4 +- 6 files changed, 123 insertions(+), 6 deletions(-) diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index f80336e..a8c89b0 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -64,6 +64,18 @@ paths: '*/*': schema: $ref: "#/components/schemas/CombinedLedgerResponse" + /process-activities: + post: + tags: + - processing-controller + operationId: processNewActivities + responses: + "404": + description: Not Found + "400": + description: Bad Request + "200": + description: OK /ledgers/main: post: tags: diff --git a/src/characters/chartacters.ts b/src/characters/chartacters.ts index 32a5f7b..1c9dba4 100644 --- a/src/characters/chartacters.ts +++ b/src/characters/chartacters.ts @@ -1,4 +1,4 @@ -import {characterControllerApi} from "@/mammon"; +import {activityControllerApi, characterControllerApi} from "@/mammon"; import {defineStore} from "pinia"; import {ref} from "vue"; import {CharacterResponse} from "@/generated/mammon"; @@ -18,9 +18,11 @@ export const useCharactersStore = defineStore('characters', () => { return character; } + const reloadActivities = (characterId: number): Promise => activityControllerApi.fetchNewActivitiesForCharacter(characterId) as Promise; + const refresh = () => characterControllerApi.getCharacters().then(response => characters.value = response.data); refresh(); - return {characters, findById, refresh}; + return {characters, findById, reloadActivities, refresh}; }) \ No newline at end of file diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 57d1cb6..cbf92c6 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -725,6 +725,95 @@ export class LedgerControllerApi extends BaseAPI { +/** + * ProcessingControllerApi - axios parameter creator + */ +export const ProcessingControllerApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + processNewActivities: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/process-activities`; + // 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: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ProcessingControllerApi - functional programming interface + */ +export const ProcessingControllerApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ProcessingControllerApiAxiosParamCreator(configuration) + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async processNewActivities(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.processNewActivities(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ProcessingControllerApi.processNewActivities']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ProcessingControllerApi - factory interface + */ +export const ProcessingControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ProcessingControllerApiFp(configuration) + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + processNewActivities(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.processNewActivities(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ProcessingControllerApi - object-oriented interface + */ +export class ProcessingControllerApi extends BaseAPI { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public processNewActivities(options?: RawAxiosRequestConfig) { + return ProcessingControllerApiFp(this.configuration).processNewActivities(options).then((request) => request(this.axios, this.basePath)); + } +} + + + /** * RuleBookControllerApi - axios parameter creator */ diff --git a/src/mammon/mammonService.ts b/src/mammon/mammonService.ts index 8f527fc..ffb311d 100644 --- a/src/mammon/mammonService.ts +++ b/src/mammon/mammonService.ts @@ -1,6 +1,12 @@ import {logResource} from "@/service"; import axios from "axios"; -import {CharacterControllerApi, LedgerControllerApi, RuleBookControllerApi} from "@/generated/mammon"; +import { + ActivityControllerApi, + CharacterControllerApi, + LedgerControllerApi, + ProcessingControllerApi, + RuleBookControllerApi +} from "@/generated/mammon"; export const mammonUrl = import.meta.env.VITE_MAMMON_URL; export const mammonAddCharacterUrl = mammonUrl + "oauth2/authorization/esi" @@ -17,3 +23,5 @@ logResource(mammonAxiosInstance) export const ledgerControllerApi = new LedgerControllerApi(undefined, mammonUrl, mammonAxiosInstance); export const characterControllerApi = new CharacterControllerApi(undefined, mammonUrl, mammonAxiosInstance); export const ruleBookControllerApi = new RuleBookControllerApi(undefined, mammonUrl, mammonAxiosInstance); +export const activityControllerApi = new ActivityControllerApi(undefined, mammonUrl, mammonAxiosInstance); +export const processingControllerApi = new ProcessingControllerApi(undefined, mammonUrl, mammonAxiosInstance); diff --git a/src/pages/Characters.vue b/src/pages/Characters.vue index 7969c55..adff2be 100644 --- a/src/pages/Characters.vue +++ b/src/pages/Characters.vue @@ -3,8 +3,11 @@ import {mammonAddCharacterUrl} from "@/mammon"; import {storeToRefs} from "pinia"; import {CharacterLabel, useCharactersStore} from "@/characters"; +import {ArrowPathIcon} from '@heroicons/vue/24/outline'; -const {characters} = storeToRefs(useCharactersStore()); +const charactersStore = useCharactersStore() +const {characters} = storeToRefs(charactersStore); +const {reloadActivities} = charactersStore; const addCharacter = () => { window.location.replace(mammonAddCharacterUrl); @@ -17,7 +20,8 @@ const addCharacter = () => {
- + +
\ No newline at end of file diff --git a/src/pages/Ledgers.vue b/src/pages/Ledgers.vue index f3dddaa..a9045c6 100644 --- a/src/pages/Ledgers.vue +++ b/src/pages/Ledgers.vue @@ -2,6 +2,7 @@ import {RouterView} from 'vue-router'; import {CreateLedgerModal} from "@/ledger"; import {ref} from "vue"; +import {processingControllerApi} from "@/mammon"; const createLedgerModal = ref(); @@ -9,7 +10,8 @@ const createLedgerModal = ref();