corporation transactions + cleanup

This commit is contained in:
Sirttas
2026-06-06 23:44:09 +02:00
parent cd1965acc4
commit 7e0ea10d68
6 changed files with 150 additions and 153 deletions
+75 -50
View File
@@ -309,9 +309,7 @@ paths:
schema: schema:
type: array type: array
items: items:
oneOf: $ref: "#/components/schemas/LedgerResponse"
- $ref: "#/components/schemas/CombinedLedgerResponse"
- $ref: "#/components/schemas/MainLedgerResponse"
/ledgers/{ledgerId}: /ledgers/{ledgerId}:
get: get:
tags: tags:
@@ -332,9 +330,7 @@ paths:
content: content:
'*/*': '*/*':
schema: schema:
oneOf: $ref: "#/components/schemas/LedgerResponse"
- $ref: "#/components/schemas/CombinedLedgerResponse"
- $ref: "#/components/schemas/MainLedgerResponse"
"400": "400":
description: The ledger cannot be exposed (system ledger) description: The ledger cannot be exposed (system ledger)
"404": "404":
@@ -419,27 +415,57 @@ paths:
$ref: "#/components/schemas/AcquisitionResponse" $ref: "#/components/schemas/AcquisitionResponse"
components: components:
schemas: schemas:
RuleClauseResponse: IskRuleClauseResponse:
type: object allOf:
properties: - $ref: "#/components/schemas/RuleClauseResponse"
rate: - type: object
type: string properties:
enum: fromLedgerRef:
- NONE type: string
- VALUE pattern: "[a-z]+(-[a-z]+)*"
- JITA_BUY toLedgerRef:
- JITA_SELL type: string
- EVE_ESTIMATE pattern: "[a-z]+(-[a-z]+)*"
fromLedgerRef: required:
type: string - fromLedgerRef
pattern: "[a-z]+(-[a-z]+)*" - toLedgerRef
toLedgerRef: ItemExchangeRuleClauseResponse:
type: string allOf:
pattern: "[a-z]+(-[a-z]+)*" - $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: required:
- fromLedgerRef - fromLedgerRef
- rate - rate
- toLedgerRef - 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: RuleResponse:
type: object type: object
properties: properties:
@@ -454,6 +480,8 @@ components:
properties: properties:
name: name:
type: string type: string
usedForAcquisitions:
type: boolean
ledgerRefs: ledgerRefs:
type: array type: array
items: items:
@@ -467,6 +495,7 @@ components:
- ledgerRefs - ledgerRefs
- name - name
- rules - rules
- usedForAcquisitions
RuleBookResponse: RuleBookResponse:
type: object type: object
properties: properties:
@@ -475,6 +504,8 @@ components:
format: uuid format: uuid
name: name:
type: string type: string
usedForAcquisitions:
type: boolean
ledgerRefs: ledgerRefs:
type: array type: array
items: items:
@@ -489,6 +520,7 @@ components:
- name - name
- ruleBookId - ruleBookId
- rules - rules
- usedForAcquisitions
UpdateMainLedgerRequest: UpdateMainLedgerRequest:
type: object type: object
properties: properties:
@@ -508,10 +540,6 @@ components:
type: string type: string
balance: balance:
type: number type: number
type:
type: string
enum:
- MAIN
required: required:
- balance - balance
- ledgerId - ledgerId
@@ -546,10 +574,6 @@ components:
items: items:
type: string type: string
format: uuid format: uuid
type:
type: string
enum:
- COMBINED
required: required:
- balance - balance
- ledgerId - ledgerId
@@ -592,6 +616,8 @@ components:
properties: properties:
name: name:
type: string type: string
usedForAcquisitions:
type: boolean
ledgerRefs: ledgerRefs:
type: array type: array
items: items:
@@ -605,6 +631,7 @@ components:
- ledgerRefs - ledgerRefs
- name - name
- rules - rules
- usedForAcquisitions
CreateMainLedgerRequest: CreateMainLedgerRequest:
type: object type: object
properties: properties:
@@ -626,15 +653,19 @@ components:
- memberLedgerIds - memberLedgerIds
- name - name
LedgerResponse: LedgerResponse:
type: object
discriminator: discriminator:
propertyName: type propertyName: type
mapping:
MAIN: "#/components/schemas/MainLedgerResponse"
COMBINED: "#/components/schemas/CombinedLedgerResponse"
oneOf:
- $ref: "#/components/schemas/MainLedgerResponse"
- $ref: "#/components/schemas/CombinedLedgerResponse"
properties: properties:
type: type:
type: string type: string
enum: required:
- MAIN - type
- COMBINED
IskTransferResponse: IskTransferResponse:
allOf: allOf:
- $ref: "#/components/schemas/TransferResponse" - $ref: "#/components/schemas/TransferResponse"
@@ -648,10 +679,6 @@ components:
format: uuid format: uuid
amount: amount:
type: number type: number
type:
type: string
enum:
- ISK
required: required:
- amount - amount
- fromLedgerId - fromLedgerId
@@ -673,10 +700,6 @@ components:
quantity: quantity:
type: integer type: integer
format: int64 format: int64
type:
type: string
enum:
- ITEM
required: required:
- fromLedgerId - fromLedgerId
- marketTypeId - marketTypeId
@@ -699,9 +722,7 @@ components:
transfers: transfers:
type: array type: array
items: items:
oneOf: $ref: "#/components/schemas/TransferResponse"
- $ref: "#/components/schemas/IskTransferResponse"
- $ref: "#/components/schemas/ItemTransferResponse"
required: required:
- characterId - characterId
- datetime - datetime
@@ -709,15 +730,19 @@ components:
- transactionId - transactionId
- transfers - transfers
TransferResponse: TransferResponse:
type: object
discriminator: discriminator:
propertyName: type propertyName: type
mapping:
ISK: "#/components/schemas/IskTransferResponse"
ITEM: "#/components/schemas/ItemTransferResponse"
oneOf:
- $ref: "#/components/schemas/IskTransferResponse"
- $ref: "#/components/schemas/ItemTransferResponse"
properties: properties:
type: type:
type: string type: string
enum: required:
- ISK - type
- ITEM
BalanceResponse: BalanceResponse:
type: object type: object
properties: properties:
+46 -86
View File
@@ -59,15 +59,7 @@ export interface CombinedLedgerResponse extends LedgerResponse {
'name': string; 'name': string;
'balance': number; 'balance': number;
'memberLedgerIds': Array<string>; 'memberLedgerIds': Array<string>;
'type'?: CombinedLedgerResponseTypeEnum;
} }
export const CombinedLedgerResponseTypeEnum = {
Combined: 'COMBINED',
} as const;
export type CombinedLedgerResponseTypeEnum = typeof CombinedLedgerResponseTypeEnum[keyof typeof CombinedLedgerResponseTypeEnum];
export interface CreateCombinedLedgerRequest { export interface CreateCombinedLedgerRequest {
'name': string; 'name': string;
'memberLedgerIds': Array<string>; 'memberLedgerIds': Array<string>;
@@ -77,82 +69,32 @@ export interface CreateMainLedgerRequest {
} }
export interface CreateRuleBookRequest { export interface CreateRuleBookRequest {
'name': string; 'name': string;
'usedForAcquisitions': boolean;
'ledgerRefs': Array<string>; 'ledgerRefs': Array<string>;
'rules': { [key: string]: RuleResponse; }; 'rules': { [key: string]: RuleResponse; };
} }
/** export interface IskRuleClauseResponse extends RuleClauseResponse {
* @type FindAllLedgers200ResponseInner 'fromLedgerRef': string;
*/ 'toLedgerRef': string;
export type FindAllLedgers200ResponseInner = CombinedLedgerResponse | MainLedgerResponse; }
export interface IskTransferResponse extends TransferResponse { export interface IskTransferResponse extends TransferResponse {
'fromLedgerId': string; 'fromLedgerId': string;
'toLedgerId': string; 'toLedgerId': string;
'amount': number; 'amount': number;
'type'?: IskTransferResponseTypeEnum;
} }
export const IskTransferResponseTypeEnum = {
Isk: 'ISK',
} as const;
export type IskTransferResponseTypeEnum = typeof IskTransferResponseTypeEnum[keyof typeof IskTransferResponseTypeEnum];
export interface ItemBalanceResponse { export interface ItemBalanceResponse {
'typeId': number; 'typeId': number;
'quantity': number; 'quantity': number;
} }
export interface ItemTransferResponse extends TransferResponse { export interface ItemExchangeRuleClauseResponse extends RuleClauseResponse {
'fromLedgerId': string; 'rate': ItemExchangeRuleClauseResponseRateEnum;
'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<string>;
'rules': { [key: string]: RuleResponse; };
}
export interface RuleClauseResponse {
'rate': RuleClauseResponseRateEnum;
'fromLedgerRef': string; 'fromLedgerRef': string;
'toLedgerRef': string; 'toLedgerRef': string;
} }
export const RuleClauseResponseRateEnum = { export const ItemExchangeRuleClauseResponseRateEnum = {
None: 'NONE', None: 'NONE',
Value: 'VALUE', Value: 'VALUE',
JitaBuy: 'JITA_BUY', JitaBuy: 'JITA_BUY',
@@ -160,7 +102,35 @@ export const RuleClauseResponseRateEnum = {
EveEstimate: 'EVE_ESTIMATE', EveEstimate: 'EVE_ESTIMATE',
} as const; } 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<string>;
'rules': { [key: string]: RuleResponse; };
}
/**
* @type RuleClauseResponse
*/
export type RuleClauseResponse = { type: 'ISK' } & IskRuleClauseResponse | { type: 'ITEM_EXCHANGE' } & ItemExchangeRuleClauseResponse;
export interface RuleResponse { export interface RuleResponse {
'clauses': Array<RuleClauseResponse>; 'clauses': Array<RuleClauseResponse>;
@@ -174,23 +144,12 @@ export interface TransactionResponse {
'characterId': number; 'characterId': number;
'datetime': string; 'datetime': string;
'description': string; 'description': string;
'transfers': Array<TransactionResponseTransfersInner>; 'transfers': Array<TransferResponse>;
} }
/** /**
* @type TransactionResponseTransfersInner * @type TransferResponse
*/ */
export type TransactionResponseTransfersInner = IskTransferResponse | ItemTransferResponse; export type TransferResponse = { type: 'ISK' } & IskTransferResponse | { type: 'ITEM' } & 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 { export interface UpdateCombinedLedgerRequest {
'name': string; 'name': string;
@@ -201,6 +160,7 @@ export interface UpdateMainLedgerRequest {
} }
export interface UpdateRuleBookRequest { export interface UpdateRuleBookRequest {
'name': string; 'name': string;
'usedForAcquisitions': boolean;
'ledgerRefs': Array<string>; 'ledgerRefs': Array<string>;
'rules': { [key: string]: RuleResponse; }; 'rules': { [key: string]: RuleResponse; };
} }
@@ -1022,7 +982,7 @@ export const LedgerApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async findAllLedgers(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<FindAllLedgers200ResponseInner>>> { async findAllLedgers(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<LedgerResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.findAllLedgers(options); const localVarAxiosArgs = await localVarAxiosParamCreator.findAllLedgers(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LedgerApi.findAllLedgers']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['LedgerApi.findAllLedgers']?.[localVarOperationServerIndex]?.url;
@@ -1048,7 +1008,7 @@ export const LedgerApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FindAllLedgers200ResponseInner>> { async findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<LedgerResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.findLedgerById(ledgerId, options); const localVarAxiosArgs = await localVarAxiosParamCreator.findLedgerById(ledgerId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LedgerApi.findLedgerById']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['LedgerApi.findLedgerById']?.[localVarOperationServerIndex]?.url;
@@ -1117,7 +1077,7 @@ export const LedgerApiFactory = function (configuration?: Configuration, basePat
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
findAllLedgers(options?: RawAxiosRequestConfig): AxiosPromise<Array<FindAllLedgers200ResponseInner>> { findAllLedgers(options?: RawAxiosRequestConfig): AxiosPromise<Array<LedgerResponse>> {
return localVarFp.findAllLedgers(options).then((request) => request(axios, basePath)); 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. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<FindAllLedgers200ResponseInner> { findLedgerById(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<LedgerResponse> {
return localVarFp.findLedgerById(ledgerId, options).then((request) => request(axios, basePath)); return localVarFp.findLedgerById(ledgerId, options).then((request) => request(axios, basePath));
}, },
/** /**
+1 -1
View File
@@ -94,7 +94,7 @@ watch(useRoute(), async route => {
<template #button> <template #button>
<span>{{ activityType.name }}</span> <span>{{ activityType.name }}</span>
</template> </template>
<RuleInput :ledgerRefs="ledgerRefs" v-model="rules[activityType.key]" /> <RuleInput :ledgerRefs="ledgerRefs" :activityType="activityType.key" v-model="rules[activityType.key]" />
</Dropdown> </Dropdown>
</div> </div>
+13 -6
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import {RuleClauseResponse} from "@/generated/mammon"; import {ItemExchangeRuleClauseResponse, ItemExchangeRuleClauseResponseRateEnum, RuleClauseResponse} from "@/generated/mammon";
import {computed, watch} from "vue"; import {computed, watch} from "vue";
import {systemLedgerRef} from "@/ledger"; import {systemLedgerRef} from "@/ledger";
import {ratesTypes} from "@/rules/rules.ts"; import {ratesTypes} from "@/rules/rules.ts";
@@ -8,16 +8,21 @@ import LedgerRefSelect from "./LedgerRefSelect.vue";
interface Props { interface Props {
ledgerRefs: string[]; ledgerRefs: string[];
hasRate: boolean;
} }
const props = defineProps<Props>() const props = defineProps<Props>()
const rule = defineModel<RuleClauseResponse>({ default: { const rule = defineModel<RuleClauseResponse>({ default: {
rate: ratesTypes.None, type: 'ITEM_EXCHANGE',
rate: ItemExchangeRuleClauseResponseRateEnum.None,
fromLedgerRef: systemLedgerRef, fromLedgerRef: systemLedgerRef,
toLedgerRef: systemLedgerRef, toLedgerRef: systemLedgerRef,
}}); }});
// Only item-exchange clauses carry a rate; narrow for the rate <select>.
const itemRule = computed(() => rule.value as ItemExchangeRuleClauseResponse)
const ledgerRefsWithSystem = computed<string[]>(() => [systemLedgerRef, ...props.ledgerRefs]) const ledgerRefsWithSystem = computed<string[]>(() => [systemLedgerRef, ...props.ledgerRefs])
watch(ledgerRefsWithSystem, (newVal, oldVal) => { watch(ledgerRefsWithSystem, (newVal, oldVal) => {
@@ -39,8 +44,10 @@ watch(ledgerRefsWithSystem, (newVal, oldVal) => {
<LedgerRefSelect class="me-2 grow" v-model="rule.fromLedgerRef" :ledger-refs="ledgerRefsWithSystem"/> <LedgerRefSelect class="me-2 grow" v-model="rule.fromLedgerRef" :ledger-refs="ledgerRefsWithSystem"/>
To: To:
<LedgerRefSelect class="me-2 grow" v-model="rule.toLedgerRef" :ledger-refs="ledgerRefsWithSystem"/> <LedgerRefSelect class="me-2 grow" v-model="rule.toLedgerRef" :ledger-refs="ledgerRefsWithSystem"/>
At: <template v-if="hasRate">
<select class="me-2 grow" v-model="rule.rate"> At:
<option v-for="rateType in ratesTypes" :key="rateType.key" :value="rateType.key">{{ rateType.name }}</option> <select class="me-2 grow" v-model="itemRule.rate">
</select> <option v-for="rateType in ratesTypes" :key="rateType.key" :value="rateType.key">{{ rateType.name }}</option>
</select>
</template>
</template> </template>
+10 -7
View File
@@ -1,18 +1,22 @@
<script setup lang="ts"> <script setup lang="ts">
import {RuleClauseResponse, RuleClauseResponseRateEnum, RuleResponse} from "@/generated/mammon"; import {ItemExchangeRuleClauseResponseRateEnum, RuleClauseResponse, RuleResponse} from "@/generated/mammon";
import RuleClauseInput from "@/rules/RuleClauseInput.vue"; import RuleClauseInput from "@/rules/RuleClauseInput.vue";
import {computed, useTemplateRef} from "vue"; import {computed, useTemplateRef} from "vue";
import {Bars4Icon, PlusIcon, TrashIcon} from '@heroicons/vue/24/outline'; import {Bars4Icon, PlusIcon, TrashIcon} from '@heroicons/vue/24/outline';
import {useSortable} from "@vueuse/integrations/useSortable"; import {useSortable} from "@vueuse/integrations/useSortable";
import {systemLedgerRef} from "@/ledger"; import {systemLedgerRef} from "@/ledger";
import {ActivityType, activityTypeHasRate} from "@/rules/rules.ts";
interface Props { interface Props {
ledgerRefs: string[]; ledgerRefs: string[];
activityType: ActivityType;
} }
const props = defineProps<Props>() const props = defineProps<Props>()
const hasRate = computed<boolean>(() => activityTypeHasRate(props.activityType));
const rule = defineModel<RuleResponse>({default: {clauses:[]}}); const rule = defineModel<RuleResponse>({default: {clauses:[]}});
const clauses = computed<RuleClauseResponse[]>({ const clauses = computed<RuleClauseResponse[]>({
get: () => rule.value && rule.value.clauses ? rule.value.clauses : [], get: () => rule.value && rule.value.clauses ? rule.value.clauses : [],
@@ -20,11 +24,10 @@ const clauses = computed<RuleClauseResponse[]>({
}) })
const addClause = () => { const addClause = () => {
clauses.value = [...clauses.value, { const clause: RuleClauseResponse = hasRate.value
rate: RuleClauseResponseRateEnum.None, ? {type: 'ITEM_EXCHANGE', rate: ItemExchangeRuleClauseResponseRateEnum.None, fromLedgerRef: systemLedgerRef, toLedgerRef: systemLedgerRef}
fromLedgerRef: systemLedgerRef, : {type: 'ISK', fromLedgerRef: systemLedgerRef, toLedgerRef: systemLedgerRef};
toLedgerRef: systemLedgerRef clauses.value = [...clauses.value, clause]
}]
} }
const setClause = (index: number, clause?: RuleClauseResponse) => { const setClause = (index: number, clause?: RuleClauseResponse) => {
@@ -49,7 +52,7 @@ useSortable(sortableContainer, clauses, { handle: '.sortable-handle'});
<span class="sortable-handle flex"> <span class="sortable-handle flex">
<Bars4Icon class="w-6"/> <Bars4Icon class="w-6"/>
</span> </span>
<RuleClauseInput :ledgerRefs="ledgerRefs" :modelValue="clause" @update:modelValue="v => setClause(index, v)" /> <RuleClauseInput :ledgerRefs="ledgerRefs" :hasRate="hasRate" :modelValue="clause" @update:modelValue="v => setClause(index, v)" />
<button class="btn-icon" @click="removeClause(index)"><TrashIcon /></button> <button class="btn-icon" @click="removeClause(index)"><TrashIcon /></button>
</div> </div>
</div> </div>
+4 -2
View File
@@ -2,8 +2,8 @@ import {characterRuleBookApi, ruleBookApi} from "@/mammon";
import { import {
CharacterRuleBookResponse, CharacterRuleBookResponse,
CreateRuleBookRequest, CreateRuleBookRequest,
ItemExchangeRuleClauseResponseRateEnum,
RuleBookResponse, RuleBookResponse,
RuleClauseResponseRateEnum,
RuleResponse, RuleResponse,
SetCharacterRuleBookRequest SetCharacterRuleBookRequest
} from "@/generated/mammon"; } from "@/generated/mammon";
@@ -24,6 +24,8 @@ export type ActivityType = typeof activityTypes[keyof typeof activityTypes]['key
export type Rules = { [key: ActivityType]: RuleResponse; }; export type Rules = { [key: ActivityType]: RuleResponse; };
export type RuleBook = RuleBookResponse & { rules: Rules } export type RuleBook = RuleBookResponse & { rules: Rules }
export const activityTypeHasRate = (key: ActivityType): boolean => key !== activityTypes.bountyEarned.key;
export const ratesTypes = { export const ratesTypes = {
None: {key: "NONE", name: "0 ISK"}, None: {key: "NONE", name: "0 ISK"},
Value: {key: "VALUE", name: "Value"}, Value: {key: "VALUE", name: "Value"},
@@ -32,7 +34,7 @@ export const ratesTypes = {
EveEstimate: {key: "EVE_ESTIMATE", name: "Eve Estimate"}, EveEstimate: {key: "EVE_ESTIMATE", name: "Eve Estimate"},
} as const; } as const;
export type Rate = { key: RuleClauseResponseRateEnum, name: string } export type Rate = { key: ItemExchangeRuleClauseResponseRateEnum, name: string }
export const useRuleBooksStore = defineStore('rule-books', () => { export const useRuleBooksStore = defineStore('rule-books', () => {
const ruleBooks = ref<RuleBook[]>([]); const ruleBooks = ref<RuleBook[]>([]);