rule book ui
This commit is contained in:
+94
-57
@@ -108,6 +108,57 @@ paths:
|
|||||||
'*/*':
|
'*/*':
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/CombinedLedgerResponse"
|
$ref: "#/components/schemas/CombinedLedgerResponse"
|
||||||
|
/characters/{characterId}/rule-book:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- rule-book-controller
|
||||||
|
operationId: findByCharacterId
|
||||||
|
parameters:
|
||||||
|
- name: characterId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/RuleBookResponse"
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- rule-book-controller
|
||||||
|
operationId: setCharacterRuleBook
|
||||||
|
parameters:
|
||||||
|
- name: characterId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/SetCharacterRuleBookRequest"
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
"404":
|
||||||
|
description: Not Found
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/RuleBookResponse"
|
||||||
/activity/fetch/{characterId}:
|
/activity/fetch/{characterId}:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -190,29 +241,6 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/CharacterResponse"
|
$ref: "#/components/schemas/CharacterResponse"
|
||||||
/characters/{characterId}/rule-book:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- rule-book-controller
|
|
||||||
operationId: findByCharacterId
|
|
||||||
parameters:
|
|
||||||
- name: characterId
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
responses:
|
|
||||||
"404":
|
|
||||||
description: Not Found
|
|
||||||
"400":
|
|
||||||
description: Bad Request
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
content:
|
|
||||||
'*/*':
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/RuleBookResponse"
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
UpdateMainLedgerRequest:
|
UpdateMainLedgerRequest:
|
||||||
@@ -301,40 +329,6 @@ components:
|
|||||||
required:
|
required:
|
||||||
- memberLedgerIds
|
- memberLedgerIds
|
||||||
- name
|
- name
|
||||||
LedgerResponse:
|
|
||||||
type: object
|
|
||||||
discriminator:
|
|
||||||
propertyName: type
|
|
||||||
properties:
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- MAIN
|
|
||||||
- COMBINED
|
|
||||||
CharacterResponse:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
characterId:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- characterId
|
|
||||||
- name
|
|
||||||
RuleBookResponse:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
characterId:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
ruleSets:
|
|
||||||
type: object
|
|
||||||
additionalProperties:
|
|
||||||
$ref: "#/components/schemas/RuleSetResponse"
|
|
||||||
required:
|
|
||||||
- characterId
|
|
||||||
- ruleSets
|
|
||||||
RuleResponse:
|
RuleResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@@ -363,3 +357,46 @@ components:
|
|||||||
$ref: "#/components/schemas/RuleResponse"
|
$ref: "#/components/schemas/RuleResponse"
|
||||||
required:
|
required:
|
||||||
- rules
|
- rules
|
||||||
|
SetCharacterRuleBookRequest:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
ruleSets:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
$ref: "#/components/schemas/RuleSetResponse"
|
||||||
|
required:
|
||||||
|
- ruleSets
|
||||||
|
RuleBookResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
characterId:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
ruleSets:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
$ref: "#/components/schemas/RuleSetResponse"
|
||||||
|
required:
|
||||||
|
- characterId
|
||||||
|
- ruleSets
|
||||||
|
LedgerResponse:
|
||||||
|
type: object
|
||||||
|
discriminator:
|
||||||
|
propertyName: type
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- MAIN
|
||||||
|
- COMBINED
|
||||||
|
CharacterResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
characterId:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- characterId
|
||||||
|
- name
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ export type RuleResponseRateEnum = typeof RuleResponseRateEnum[keyof typeof Rule
|
|||||||
export interface RuleSetResponse {
|
export interface RuleSetResponse {
|
||||||
'rules': Array<RuleResponse>;
|
'rules': Array<RuleResponse>;
|
||||||
}
|
}
|
||||||
|
export interface SetCharacterRuleBookRequest {
|
||||||
|
'ruleSets': { [key: string]: RuleSetResponse; };
|
||||||
|
}
|
||||||
export interface UpdateCombinedLedgerRequest {
|
export interface UpdateCombinedLedgerRequest {
|
||||||
'name': string;
|
'name': string;
|
||||||
'memberLedgerIds': Array<string>;
|
'memberLedgerIds': Array<string>;
|
||||||
@@ -755,6 +758,44 @@ export const RuleBookControllerApiAxiosParamCreator = function (configuration?:
|
|||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: toPathString(localVarUrlObj),
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {number} characterId
|
||||||
|
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
setCharacterRuleBook: async (characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'characterId' is not null or undefined
|
||||||
|
assertParamExists('setCharacterRuleBook', 'characterId', characterId)
|
||||||
|
// verify required parameter 'setCharacterRuleBookRequest' is not null or undefined
|
||||||
|
assertParamExists('setCharacterRuleBook', 'setCharacterRuleBookRequest', setCharacterRuleBookRequest)
|
||||||
|
const localVarPath = `/characters/{characterId}/rule-book`
|
||||||
|
.replace('{characterId}', encodeURIComponent(String(characterId)));
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
localVarHeaderParameter['Accept'] = '*/*';
|
||||||
|
|
||||||
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
localVarRequestOptions.data = serializeDataIfNeeded(setCharacterRuleBookRequest, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: toPathString(localVarUrlObj),
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
@@ -781,6 +822,19 @@ export const RuleBookControllerApiFp = function(configuration?: Configuration) {
|
|||||||
const localVarOperationServerBasePath = operationServerMap['RuleBookControllerApi.findByCharacterId']?.[localVarOperationServerIndex]?.url;
|
const localVarOperationServerBasePath = operationServerMap['RuleBookControllerApi.findByCharacterId']?.[localVarOperationServerIndex]?.url;
|
||||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {number} characterId
|
||||||
|
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async setCharacterRuleBook(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RuleBookResponse>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.setCharacterRuleBook(characterId, setCharacterRuleBookRequest, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['RuleBookControllerApi.setCharacterRuleBook']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -799,6 +853,16 @@ export const RuleBookControllerApiFactory = function (configuration?: Configurat
|
|||||||
findByCharacterId(characterId: number, options?: RawAxiosRequestConfig): AxiosPromise<RuleBookResponse> {
|
findByCharacterId(characterId: number, options?: RawAxiosRequestConfig): AxiosPromise<RuleBookResponse> {
|
||||||
return localVarFp.findByCharacterId(characterId, options).then((request) => request(axios, basePath));
|
return localVarFp.findByCharacterId(characterId, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {number} characterId
|
||||||
|
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
setCharacterRuleBook(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig): AxiosPromise<RuleBookResponse> {
|
||||||
|
return localVarFp.setCharacterRuleBook(characterId, setCharacterRuleBookRequest, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -815,6 +879,17 @@ export class RuleBookControllerApi extends BaseAPI {
|
|||||||
public findByCharacterId(characterId: number, options?: RawAxiosRequestConfig) {
|
public findByCharacterId(characterId: number, options?: RawAxiosRequestConfig) {
|
||||||
return RuleBookControllerApiFp(this.configuration).findByCharacterId(characterId, options).then((request) => request(this.axios, this.basePath));
|
return RuleBookControllerApiFp(this.configuration).findByCharacterId(characterId, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {number} characterId
|
||||||
|
* @param {SetCharacterRuleBookRequest} setCharacterRuleBookRequest
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
public setCharacterRuleBook(characterId: number, setCharacterRuleBookRequest: SetCharacterRuleBookRequest, options?: RawAxiosRequestConfig) {
|
||||||
|
return RuleBookControllerApiFp(this.configuration).setCharacterRuleBook(characterId, setCharacterRuleBookRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ watchEffect(async () => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@reference "tailwindcss";
|
@reference "tailwindcss";
|
||||||
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
@apply ms-auto;
|
@apply ms-auto;
|
||||||
>:deep(div.header) {
|
>:deep(div.header) {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ClipboardButton} from '@/components';
|
import {ClipboardButton} from '@/components';
|
||||||
import { MarketType, MarketTypeInput, getMarketType, useApraisalStore } from "@/market";
|
import {getMarketType, MarketType, MarketTypeInput, useApraisalStore} from "@/market";
|
||||||
import {AcquisitionResultTable, BuyModal, useAcquiredTypesStore} from '@/market/acquisition';
|
import {AcquisitionResultTable, BuyModal, useAcquiredTypesStore} from '@/market/acquisition';
|
||||||
import { TrackingResultTable, createResult, useMarketTrackingStore } from '@/market/tracking';
|
import {createResult, TrackingResultTable, useMarketTrackingStore} from '@/market/tracking';
|
||||||
import {BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon} from '@heroicons/vue/24/outline';
|
import {BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon} from '@heroicons/vue/24/outline';
|
||||||
import { computedAsync } from '@vueuse/core/index.cjs';
|
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import {computed, ref, watch} from "vue";
|
import {computed, ref, watch} from "vue";
|
||||||
import {useRoute, useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
|
import {computedAsync} from "@vueuse/core";
|
||||||
|
|
||||||
const buyModal = ref<typeof BuyModal>();
|
const buyModal = ref<typeof BuyModal>();
|
||||||
|
|
||||||
@@ -115,6 +115,7 @@ watch(useRoute(), async route => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@reference "tailwindcss";
|
@reference "tailwindcss";
|
||||||
|
|
||||||
img.type-image {
|
img.type-image {
|
||||||
width: 64px;
|
width: 64px;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {Character, CharacterLabel, useCharactersStore} from "@/characters";
|
|||||||
import {useRoute} from "vue-router";
|
import {useRoute} from "vue-router";
|
||||||
import {ref, watch, watchEffect} from "vue";
|
import {ref, watch, watchEffect} from "vue";
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import {activityTypes, findByCharacterId, RuleBook, RuleSetInput} from "@/rules";
|
import {activityTypes, findByCharacterId, RuleBook, RuleSetInput, setCharacterRuleBook} from "@/rules";
|
||||||
|
|
||||||
const {findById: findCharacterById} = useCharactersStore();
|
const {findById: findCharacterById} = useCharactersStore();
|
||||||
const character = ref<Character>();
|
const character = ref<Character>();
|
||||||
@@ -18,6 +18,14 @@ watchEffect(async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
const characterId = character.value?.characterId;
|
||||||
|
|
||||||
|
if (characterId && ruleBook.value) {
|
||||||
|
setCharacterRuleBook(characterId, ruleBook.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(useRoute(), async route => {
|
watch(useRoute(), async route => {
|
||||||
if (route.params.characterId) {
|
if (route.params.characterId) {
|
||||||
const id = parseInt(typeof route.params.characterId === 'string' ? route.params.characterId : route.params.characterId[0]);
|
const id = parseInt(typeof route.params.characterId === 'string' ? route.params.characterId : route.params.characterId[0]);
|
||||||
@@ -35,6 +43,9 @@ watch(useRoute(), async route => {
|
|||||||
<div v-if="character" class="grid mb-2 mt-4">
|
<div v-if="character" class="grid mb-2 mt-4">
|
||||||
<div class="mb-2 border-b-1 flex">
|
<div class="mb-2 border-b-1 flex">
|
||||||
<CharacterLabel class="flex grow mb-2" :character="character" :size="64" />
|
<CharacterLabel class="flex grow mb-2" :character="character" :size="64" />
|
||||||
|
<div>
|
||||||
|
<button @click="save">Save</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="ruleBook" class="flex-col">
|
<div v-if="ruleBook" class="flex-col">
|
||||||
<div class="flex-col grow border-b-1" v-for="activityType in activityTypes" :key="activityType">
|
<div class="flex-col grow border-b-1" v-for="activityType in activityTypes" :key="activityType">
|
||||||
|
|||||||
@@ -14,3 +14,6 @@ export type RuleBook = RuleBookResponse & { ruleSets: { [key: ActivityType]: Rul
|
|||||||
export const findByCharacterId = (characterId: number): Promise<RuleBook> => ruleBookControllerApi.findByCharacterId(characterId)
|
export const findByCharacterId = (characterId: number): Promise<RuleBook> => ruleBookControllerApi.findByCharacterId(characterId)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
.catch(() => ({characterId, ruleSets: {}}));
|
.catch(() => ({characterId, ruleSets: {}}));
|
||||||
|
|
||||||
|
export const setCharacterRuleBook = (characterId: number, ruleBook: RuleBook): Promise<RuleBook> => ruleBookControllerApi.setCharacterRuleBook(characterId, ruleBook)
|
||||||
|
.then(response => response.data);
|
||||||
Reference in New Issue
Block a user