post processing call from front
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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<void> => activityControllerApi.fetchNewActivitiesForCharacter(characterId) as Promise<void>;
|
||||
|
||||
const refresh = () => characterControllerApi.getCharacters().then(response => characters.value = response.data);
|
||||
|
||||
refresh();
|
||||
|
||||
return {characters, findById, refresh};
|
||||
return {characters, findById, reloadActivities, refresh};
|
||||
})
|
||||
@@ -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<RequestArgs> => {
|
||||
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<void>> {
|
||||
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<void> {
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = () => {
|
||||
<button class="mb-2" @click="addCharacter">Add chacarcter</button>
|
||||
</div>
|
||||
<div v-for="character in characters" :key="character.characterId" class="flex items-center mb-2">
|
||||
<CharacterLabel :character="character" />
|
||||
<CharacterLabel class="grow" :character="character" />
|
||||
<button class="btn-icon" @click="reloadActivities(character.characterId)"><ArrowPathIcon /></button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,6 +2,7 @@
|
||||
import {RouterView} from 'vue-router';
|
||||
import {CreateLedgerModal} from "@/ledger";
|
||||
import {ref} from "vue";
|
||||
import {processingControllerApi} from "@/mammon";
|
||||
|
||||
const createLedgerModal = ref<typeof CreateLedgerModal>();
|
||||
</script>
|
||||
@@ -9,7 +10,8 @@ const createLedgerModal = ref<typeof CreateLedgerModal>();
|
||||
<template>
|
||||
<div class="mt-4">
|
||||
<div class="mb-4 border-b-1 flex justify-end">
|
||||
<button class="mb-2" @click="createLedgerModal?.open()">New Ledger</button>
|
||||
<button class="mb-2 ms-2" @click="processingControllerApi.processNewActivities()">Process Activities</button>
|
||||
<button class="mb-2 ms-2" @click="createLedgerModal?.open()">New Ledger</button>
|
||||
</div>
|
||||
<CreateLedgerModal ref="createLedgerModal" />
|
||||
<RouterView />
|
||||
|
||||
Reference in New Issue
Block a user