diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index 2105228..bb34f7c 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -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: diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 7aeb7f3..190e77e 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -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; +} +/** + * @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; @@ -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 => { + // 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>> { + 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> { + 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)); + } +} + + + diff --git a/src/ledger/CreateLedgerModal.vue b/src/ledger/EditLedgerModal.vue similarity index 100% rename from src/ledger/CreateLedgerModal.vue rename to src/ledger/EditLedgerModal.vue diff --git a/src/ledger/index.ts b/src/ledger/index.ts index 10638d5..441a9d3 100644 --- a/src/ledger/index.ts +++ b/src/ledger/index.ts @@ -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'; \ No newline at end of file +export {default as EditLedgerModal} from './EditLedgerModal.vue'; \ No newline at end of file diff --git a/src/pages/Ledgers.vue b/src/pages/Ledgers.vue index f84145d..18f94db 100644 --- a/src/pages/Ledgers.vue +++ b/src/pages/Ledgers.vue @@ -1,19 +1,26 @@ diff --git a/src/pages/ledger/ListLedgers.vue b/src/pages/ledger/ListLedgers.vue index 305b589..cab096a 100644 --- a/src/pages/ledger/ListLedgers.vue +++ b/src/pages/ledger/ListLedgers.vue @@ -1,6 +1,6 @@