post processing call from front
This commit is contained in:
@@ -64,6 +64,18 @@ paths:
|
|||||||
'*/*':
|
'*/*':
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/CombinedLedgerResponse"
|
$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:
|
/ledgers/main:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {characterControllerApi} from "@/mammon";
|
import {activityControllerApi, characterControllerApi} from "@/mammon";
|
||||||
import {defineStore} from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import {CharacterResponse} from "@/generated/mammon";
|
import {CharacterResponse} from "@/generated/mammon";
|
||||||
@@ -18,9 +18,11 @@ export const useCharactersStore = defineStore('characters', () => {
|
|||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reloadActivities = (characterId: number): Promise<void> => activityControllerApi.fetchNewActivitiesForCharacter(characterId) as Promise<void>;
|
||||||
|
|
||||||
const refresh = () => characterControllerApi.getCharacters().then(response => characters.value = response.data);
|
const refresh = () => characterControllerApi.getCharacters().then(response => characters.value = response.data);
|
||||||
|
|
||||||
refresh();
|
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
|
* RuleBookControllerApi - axios parameter creator
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import {logResource} from "@/service";
|
import {logResource} from "@/service";
|
||||||
import axios from "axios";
|
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 mammonUrl = import.meta.env.VITE_MAMMON_URL;
|
||||||
export const mammonAddCharacterUrl = mammonUrl + "oauth2/authorization/esi"
|
export const mammonAddCharacterUrl = mammonUrl + "oauth2/authorization/esi"
|
||||||
@@ -17,3 +23,5 @@ logResource(mammonAxiosInstance)
|
|||||||
export const ledgerControllerApi = new LedgerControllerApi(undefined, mammonUrl, mammonAxiosInstance);
|
export const ledgerControllerApi = new LedgerControllerApi(undefined, mammonUrl, mammonAxiosInstance);
|
||||||
export const characterControllerApi = new CharacterControllerApi(undefined, mammonUrl, mammonAxiosInstance);
|
export const characterControllerApi = new CharacterControllerApi(undefined, mammonUrl, mammonAxiosInstance);
|
||||||
export const ruleBookControllerApi = new RuleBookControllerApi(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 {mammonAddCharacterUrl} from "@/mammon";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {CharacterLabel, useCharactersStore} from "@/characters";
|
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 = () => {
|
const addCharacter = () => {
|
||||||
window.location.replace(mammonAddCharacterUrl);
|
window.location.replace(mammonAddCharacterUrl);
|
||||||
@@ -17,7 +20,8 @@ const addCharacter = () => {
|
|||||||
<button class="mb-2" @click="addCharacter">Add chacarcter</button>
|
<button class="mb-2" @click="addCharacter">Add chacarcter</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="character in characters" :key="character.characterId" class="flex items-center mb-2">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import {RouterView} from 'vue-router';
|
import {RouterView} from 'vue-router';
|
||||||
import {CreateLedgerModal} from "@/ledger";
|
import {CreateLedgerModal} from "@/ledger";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
|
import {processingControllerApi} from "@/mammon";
|
||||||
|
|
||||||
const createLedgerModal = ref<typeof CreateLedgerModal>();
|
const createLedgerModal = ref<typeof CreateLedgerModal>();
|
||||||
</script>
|
</script>
|
||||||
@@ -9,7 +10,8 @@ const createLedgerModal = ref<typeof CreateLedgerModal>();
|
|||||||
<template>
|
<template>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<div class="mb-4 border-b-1 flex justify-end">
|
<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>
|
</div>
|
||||||
<CreateLedgerModal ref="createLedgerModal" />
|
<CreateLedgerModal ref="createLedgerModal" />
|
||||||
<RouterView />
|
<RouterView />
|
||||||
|
|||||||
Reference in New Issue
Block a user