From 7e0ea10d68e2b5a8b8e7dd79951a1ced631a0779 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Sat, 6 Jun 2026 23:44:09 +0200 Subject: [PATCH] corporation transactions + cleanup --- docs/mammon-api.yml | 125 +++++++++++++++++------------ src/generated/mammon/api.ts | 132 +++++++++++-------------------- src/pages/rules/EditRuleBook.vue | 2 +- src/rules/RuleClauseInput.vue | 21 +++-- src/rules/RuleInput.vue | 17 ++-- src/rules/rules.ts | 6 +- 6 files changed, 150 insertions(+), 153 deletions(-) diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index c53b9f5..e6e6fd8 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -309,9 +309,7 @@ paths: schema: type: array items: - oneOf: - - $ref: "#/components/schemas/CombinedLedgerResponse" - - $ref: "#/components/schemas/MainLedgerResponse" + $ref: "#/components/schemas/LedgerResponse" /ledgers/{ledgerId}: get: tags: @@ -332,9 +330,7 @@ paths: content: '*/*': schema: - oneOf: - - $ref: "#/components/schemas/CombinedLedgerResponse" - - $ref: "#/components/schemas/MainLedgerResponse" + $ref: "#/components/schemas/LedgerResponse" "400": description: The ledger cannot be exposed (system ledger) "404": @@ -419,27 +415,57 @@ paths: $ref: "#/components/schemas/AcquisitionResponse" components: schemas: - RuleClauseResponse: - type: object - properties: - rate: - type: string - enum: - - NONE - - VALUE - - JITA_BUY - - JITA_SELL - - EVE_ESTIMATE - fromLedgerRef: - type: string - pattern: "[a-z]+(-[a-z]+)*" - toLedgerRef: - type: string - pattern: "[a-z]+(-[a-z]+)*" + IskRuleClauseResponse: + allOf: + - $ref: "#/components/schemas/RuleClauseResponse" + - type: object + properties: + fromLedgerRef: + type: string + pattern: "[a-z]+(-[a-z]+)*" + toLedgerRef: + type: string + pattern: "[a-z]+(-[a-z]+)*" + required: + - fromLedgerRef + - toLedgerRef + ItemExchangeRuleClauseResponse: + allOf: + - $ref: "#/components/schemas/RuleClauseResponse" + - type: object + properties: + rate: + type: string + enum: + - NONE + - VALUE + - JITA_BUY + - JITA_SELL + - EVE_ESTIMATE + fromLedgerRef: + type: string + pattern: "[a-z]+(-[a-z]+)*" + toLedgerRef: + type: string + pattern: "[a-z]+(-[a-z]+)*" required: - fromLedgerRef - rate - toLedgerRef + RuleClauseResponse: + discriminator: + propertyName: type + mapping: + ISK: "#/components/schemas/IskRuleClauseResponse" + ITEM_EXCHANGE: "#/components/schemas/ItemExchangeRuleClauseResponse" + oneOf: + - $ref: "#/components/schemas/IskRuleClauseResponse" + - $ref: "#/components/schemas/ItemExchangeRuleClauseResponse" + properties: + type: + type: string + required: + - type RuleResponse: type: object properties: @@ -454,6 +480,8 @@ components: properties: name: type: string + usedForAcquisitions: + type: boolean ledgerRefs: type: array items: @@ -467,6 +495,7 @@ components: - ledgerRefs - name - rules + - usedForAcquisitions RuleBookResponse: type: object properties: @@ -475,6 +504,8 @@ components: format: uuid name: type: string + usedForAcquisitions: + type: boolean ledgerRefs: type: array items: @@ -489,6 +520,7 @@ components: - name - ruleBookId - rules + - usedForAcquisitions UpdateMainLedgerRequest: type: object properties: @@ -508,10 +540,6 @@ components: type: string balance: type: number - type: - type: string - enum: - - MAIN required: - balance - ledgerId @@ -546,10 +574,6 @@ components: items: type: string format: uuid - type: - type: string - enum: - - COMBINED required: - balance - ledgerId @@ -592,6 +616,8 @@ components: properties: name: type: string + usedForAcquisitions: + type: boolean ledgerRefs: type: array items: @@ -605,6 +631,7 @@ components: - ledgerRefs - name - rules + - usedForAcquisitions CreateMainLedgerRequest: type: object properties: @@ -626,15 +653,19 @@ components: - memberLedgerIds - name LedgerResponse: - type: object discriminator: propertyName: type + mapping: + MAIN: "#/components/schemas/MainLedgerResponse" + COMBINED: "#/components/schemas/CombinedLedgerResponse" + oneOf: + - $ref: "#/components/schemas/MainLedgerResponse" + - $ref: "#/components/schemas/CombinedLedgerResponse" properties: type: type: string - enum: - - MAIN - - COMBINED + required: + - type IskTransferResponse: allOf: - $ref: "#/components/schemas/TransferResponse" @@ -648,10 +679,6 @@ components: format: uuid amount: type: number - type: - type: string - enum: - - ISK required: - amount - fromLedgerId @@ -673,10 +700,6 @@ components: quantity: type: integer format: int64 - type: - type: string - enum: - - ITEM required: - fromLedgerId - marketTypeId @@ -699,9 +722,7 @@ components: transfers: type: array items: - oneOf: - - $ref: "#/components/schemas/IskTransferResponse" - - $ref: "#/components/schemas/ItemTransferResponse" + $ref: "#/components/schemas/TransferResponse" required: - characterId - datetime @@ -709,15 +730,19 @@ components: - transactionId - transfers TransferResponse: - type: object discriminator: propertyName: type + mapping: + ISK: "#/components/schemas/IskTransferResponse" + ITEM: "#/components/schemas/ItemTransferResponse" + oneOf: + - $ref: "#/components/schemas/IskTransferResponse" + - $ref: "#/components/schemas/ItemTransferResponse" properties: type: type: string - enum: - - ISK - - ITEM + required: + - type BalanceResponse: type: object properties: diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 6e404f2..0ea3c2e 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -59,15 +59,7 @@ export interface CombinedLedgerResponse extends LedgerResponse { 'name': string; 'balance': number; 'memberLedgerIds': Array; - 'type'?: CombinedLedgerResponseTypeEnum; } - -export const CombinedLedgerResponseTypeEnum = { - Combined: 'COMBINED', -} as const; - -export type CombinedLedgerResponseTypeEnum = typeof CombinedLedgerResponseTypeEnum[keyof typeof CombinedLedgerResponseTypeEnum]; - export interface CreateCombinedLedgerRequest { 'name': string; 'memberLedgerIds': Array; @@ -77,82 +69,32 @@ export interface CreateMainLedgerRequest { } export interface CreateRuleBookRequest { 'name': string; + 'usedForAcquisitions': boolean; 'ledgerRefs': Array; 'rules': { [key: string]: RuleResponse; }; } -/** - * @type FindAllLedgers200ResponseInner - */ -export type FindAllLedgers200ResponseInner = CombinedLedgerResponse | MainLedgerResponse; +export interface IskRuleClauseResponse extends RuleClauseResponse { + 'fromLedgerRef': string; + 'toLedgerRef': string; +} + 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 ItemBalanceResponse { 'typeId': number; 'quantity': number; } -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; -} - -export const LedgerResponseTypeEnum = { - Main: 'MAIN', - Combined: 'COMBINED', -} as const; - -export type LedgerResponseTypeEnum = typeof LedgerResponseTypeEnum[keyof typeof LedgerResponseTypeEnum]; - -export interface MainLedgerResponse extends LedgerResponse { - 'ledgerId': string; - 'name': string; - 'balance': number; - 'type'?: MainLedgerResponseTypeEnum; -} - -export const MainLedgerResponseTypeEnum = { - Main: 'MAIN', -} as const; - -export type MainLedgerResponseTypeEnum = typeof MainLedgerResponseTypeEnum[keyof typeof MainLedgerResponseTypeEnum]; - -export interface RuleBookResponse { - 'ruleBookId': string; - 'name': string; - 'ledgerRefs': Array; - 'rules': { [key: string]: RuleResponse; }; -} -export interface RuleClauseResponse { - 'rate': RuleClauseResponseRateEnum; +export interface ItemExchangeRuleClauseResponse extends RuleClauseResponse { + 'rate': ItemExchangeRuleClauseResponseRateEnum; 'fromLedgerRef': string; 'toLedgerRef': string; } -export const RuleClauseResponseRateEnum = { +export const ItemExchangeRuleClauseResponseRateEnum = { None: 'NONE', Value: 'VALUE', JitaBuy: 'JITA_BUY', @@ -160,7 +102,35 @@ export const RuleClauseResponseRateEnum = { EveEstimate: 'EVE_ESTIMATE', } as const; -export type RuleClauseResponseRateEnum = typeof RuleClauseResponseRateEnum[keyof typeof RuleClauseResponseRateEnum]; +export type ItemExchangeRuleClauseResponseRateEnum = typeof ItemExchangeRuleClauseResponseRateEnum[keyof typeof ItemExchangeRuleClauseResponseRateEnum]; + +export interface ItemTransferResponse extends TransferResponse { + 'fromLedgerId': string; + 'toLedgerId': string; + 'marketTypeId': number; + 'quantity': number; +} +/** + * @type LedgerResponse + */ +export type LedgerResponse = { type: 'COMBINED' } & CombinedLedgerResponse | { type: 'MAIN' } & MainLedgerResponse; + +export interface MainLedgerResponse extends LedgerResponse { + 'ledgerId': string; + 'name': string; + 'balance': number; +} +export interface RuleBookResponse { + 'ruleBookId': string; + 'name': string; + 'usedForAcquisitions': boolean; + 'ledgerRefs': Array; + 'rules': { [key: string]: RuleResponse; }; +} +/** + * @type RuleClauseResponse + */ +export type RuleClauseResponse = { type: 'ISK' } & IskRuleClauseResponse | { type: 'ITEM_EXCHANGE' } & ItemExchangeRuleClauseResponse; export interface RuleResponse { 'clauses': Array; @@ -174,23 +144,12 @@ export interface TransactionResponse { 'characterId': number; 'datetime': string; 'description': string; - 'transfers': Array; + 'transfers': Array; } /** - * @type TransactionResponseTransfersInner + * @type TransferResponse */ -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 type TransferResponse = { type: 'ISK' } & IskTransferResponse | { type: 'ITEM' } & ItemTransferResponse; export interface UpdateCombinedLedgerRequest { 'name': string; @@ -201,6 +160,7 @@ export interface UpdateMainLedgerRequest { } export interface UpdateRuleBookRequest { 'name': string; + 'usedForAcquisitions': boolean; 'ledgerRefs': Array; 'rules': { [key: string]: RuleResponse; }; } @@ -1022,7 +982,7 @@ export const LedgerApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async findAllLedgers(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + async findAllLedgers(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.findAllLedgers(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['LedgerApi.findAllLedgers']?.[localVarOperationServerIndex]?.url; @@ -1048,7 +1008,7 @@ export const LedgerApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.findLedgerById(ledgerId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['LedgerApi.findLedgerById']?.[localVarOperationServerIndex]?.url; @@ -1117,7 +1077,7 @@ export const LedgerApiFactory = function (configuration?: Configuration, basePat * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findAllLedgers(options?: RawAxiosRequestConfig): AxiosPromise> { + findAllLedgers(options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.findAllLedgers(options).then((request) => request(axios, basePath)); }, /** @@ -1137,7 +1097,7 @@ export const LedgerApiFactory = function (configuration?: Configuration, basePat * @param {*} [options] Override http request option. * @throws {RequiredError} */ - findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise { + findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.findLedgerById(ledgerId, options).then((request) => request(axios, basePath)); }, /** diff --git a/src/pages/rules/EditRuleBook.vue b/src/pages/rules/EditRuleBook.vue index ae07db3..11d7285 100644 --- a/src/pages/rules/EditRuleBook.vue +++ b/src/pages/rules/EditRuleBook.vue @@ -94,7 +94,7 @@ watch(useRoute(), async route => { - + diff --git a/src/rules/RuleClauseInput.vue b/src/rules/RuleClauseInput.vue index e367d96..cfdd399 100644 --- a/src/rules/RuleClauseInput.vue +++ b/src/rules/RuleClauseInput.vue @@ -1,6 +1,6 @@