transaction list api

This commit is contained in:
Sirttas
2026-05-31 21:54:56 +02:00
parent 457d2a5161
commit 47ee14319d
6 changed files with 266 additions and 9 deletions
+104
View File
@@ -325,6 +325,31 @@ paths:
oneOf:
- $ref: "#/components/schemas/CombinedLedgerResponse"
- $ref: "#/components/schemas/MainLedgerResponse"
/ledgers/{ledgerId}/transactions:
get:
tags:
- transaction
operationId: finAllTransactionsInLedger
parameters:
- name: ledgerId
in: path
required: true
schema:
type: string
format: uuid
responses:
"404":
description: Not Found
"400":
description: Bad Request
"200":
description: OK
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/TransactionResponse"
/characters:
get:
tags:
@@ -556,6 +581,85 @@ components:
enum:
- MAIN
- COMBINED
IskTransferResponse:
allOf:
- $ref: "#/components/schemas/TransferResponse"
- type: object
properties:
fromLedgerId:
type: string
format: uuid
toLedgerId:
type: string
format: uuid
amount:
type: number
type:
type: string
enum:
- ISK
required:
- amount
- fromLedgerId
- toLedgerId
ItemTransferResponse:
allOf:
- $ref: "#/components/schemas/TransferResponse"
- type: object
properties:
fromLedgerId:
type: string
format: uuid
toLedgerId:
type: string
format: uuid
marketTypeId:
type: integer
format: int64
quantity:
type: integer
format: int64
type:
type: string
enum:
- ITEM
required:
- fromLedgerId
- marketTypeId
- quantity
- toLedgerId
TransactionResponse:
type: object
properties:
transactionId:
type: string
format: uuid
datetime:
type: string
format: date-time
description:
type: string
transfers:
type: array
items:
oneOf:
- $ref: "#/components/schemas/IskTransferResponse"
- $ref: "#/components/schemas/ItemTransferResponse"
required:
- datetime
- description
- transactionId
- transfers
TransferResponse:
type: object
discriminator:
propertyName: type
properties:
type:
type: string
enum:
- ISK
- ITEM
CharacterResponse:
type: object
properties:
+146
View File
@@ -63,6 +63,33 @@ export interface CreateRuleBookRequest {
*/
export type FindAllLedgers200ResponseInner = CombinedLedgerResponse | MainLedgerResponse;
export interface IskTransferResponse extends TransferResponse {
'fromLedgerId': string;
'toLedgerId': string;
'amount': number;
'type'?: IskTransferResponseTypeEnum;
}
export const IskTransferResponseTypeEnum = {
Isk: 'ISK',
} as const;
export type IskTransferResponseTypeEnum = typeof IskTransferResponseTypeEnum[keyof typeof IskTransferResponseTypeEnum];
export interface ItemTransferResponse extends TransferResponse {
'fromLedgerId': string;
'toLedgerId': string;
'marketTypeId': number;
'quantity': number;
'type'?: ItemTransferResponseTypeEnum;
}
export const ItemTransferResponseTypeEnum = {
Item: 'ITEM',
} as const;
export type ItemTransferResponseTypeEnum = typeof ItemTransferResponseTypeEnum[keyof typeof ItemTransferResponseTypeEnum];
export interface LedgerResponse {
'type'?: LedgerResponseTypeEnum;
}
@@ -116,6 +143,28 @@ export interface SetCharacterRuleBookRequest {
'ruleBookId': string;
'bindings': { [key: string]: string; };
}
export interface TransactionResponse {
'transactionId': string;
'datetime': string;
'description': string;
'transfers': Array<TransactionResponseTransfersInner>;
}
/**
* @type TransactionResponseTransfersInner
*/
export type TransactionResponseTransfersInner = IskTransferResponse | ItemTransferResponse;
export interface TransferResponse {
'type'?: TransferResponseTypeEnum;
}
export const TransferResponseTypeEnum = {
Isk: 'ISK',
Item: 'ITEM',
} as const;
export type TransferResponseTypeEnum = typeof TransferResponseTypeEnum[keyof typeof TransferResponseTypeEnum];
export interface UpdateCombinedLedgerRequest {
'name': string;
'memberLedgerIds': Array<string>;
@@ -1292,3 +1341,100 @@ export class RuleBookApi extends BaseAPI {
/**
* TransactionApi - axios parameter creator
*/
export const TransactionApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {string} ledgerId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
finAllTransactionsInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'ledgerId' is not null or undefined
assertParamExists('finAllTransactionsInLedger', 'ledgerId', ledgerId)
const localVarPath = `/ledgers/{ledgerId}/transactions`
.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,
};
},
}
};
/**
* TransactionApi - functional programming interface
*/
export const TransactionApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = TransactionApiAxiosParamCreator(configuration)
return {
/**
*
* @param {string} ledgerId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<TransactionResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.finAllTransactionsInLedger(ledgerId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['TransactionApi.finAllTransactionsInLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* TransactionApi - factory interface
*/
export const TransactionApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = TransactionApiFp(configuration)
return {
/**
*
* @param {string} ledgerId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<TransactionResponse>> {
return localVarFp.finAllTransactionsInLedger(ledgerId, options).then((request) => request(axios, basePath));
},
};
};
/**
* TransactionApi - object-oriented interface
*/
export class TransactionApi extends BaseAPI {
/**
*
* @param {string} ledgerId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig) {
return TransactionApiFp(this.configuration).finAllTransactionsInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath));
}
}
+1 -1
View File
@@ -2,4 +2,4 @@ export * from './ledger';
export {default as LedgerLabel} from './LedgerLabel.vue';
export {default as LedgerSelect} from './LedgerSelect.vue';
export {default as CreateLedgerModal} from './CreateLedgerModal.vue';
export {default as EditLedgerModal} from './EditLedgerModal.vue';
+12 -5
View File
@@ -1,19 +1,26 @@
<script setup lang="ts">
import {RouterView} from 'vue-router';
import {CreateLedgerModal} from "@/ledger";
import {EditLedgerModal, useLedgersStore} from "@/ledger";
import {ref} from "vue";
import {processingApi} from "@/mammon";
const createLedgerModal = ref<typeof CreateLedgerModal>();
const {refresh} = useLedgersStore();
const editLedgerModal = ref<typeof EditLedgerModal>();
const processActivities = async () => {
await processingApi.processNewActivities();
await refresh();
}
</script>
<template>
<div class="mt-4">
<div class="mb-4 border-b-1 flex justify-end">
<button class="mb-2 ms-2" @click="processingApi.processNewActivities()">Process Activities</button>
<button class="mb-2 ms-2" @click="createLedgerModal?.open()">New Ledger</button>
<button class="mb-2 ms-2" @click="processActivities">Process Activities</button>
<button class="mb-2 ms-2" @click="editLedgerModal?.open()">New Ledger</button>
</div>
<CreateLedgerModal ref="createLedgerModal" />
<EditLedgerModal ref="editLedgerModal" />
<RouterView />
</div>
</template>
+3 -3
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import {CreateLedgerModal, LedgerLabel, useLedgersStore} from "@/ledger";
import {EditLedgerModal, LedgerLabel, useLedgersStore} from "@/ledger";
import {storeToRefs} from "pinia";
import {nextTick, ref} from "vue";
import {PencilSquareIcon} from "@heroicons/vue/24/outline";
@@ -8,7 +8,7 @@ import {formatIsk} from "@/formaters.ts";
const {ledgers} = storeToRefs(useLedgersStore());
const editModal = ref<typeof CreateLedgerModal>();
const editModal = ref<typeof EditLedgerModal>();
const editingLedgerId = ref("");
const openEdit = async (ledgerId: string) => {
@@ -29,5 +29,5 @@ const openEdit = async (ledgerId: string) => {
<button class="btn-icon ms-2" @click="openEdit(ledger.ledgerId)"><PencilSquareIcon /></button>
</div>
</div>
<CreateLedgerModal ref="editModal" :ledger-id="editingLedgerId" />
<EditLedgerModal ref="editModal" :ledger-id="editingLedgerId" />
</template>