feat(#7): Rework rule-book UI for one-rule-book-per-user model

This commit is contained in:
Sirttas
2026-07-02 19:28:37 +02:00
parent e66fe9b40e
commit 052a0a5d03
10 changed files with 539 additions and 1288 deletions
+166 -310
View File
@@ -6,44 +6,28 @@ servers:
- url: http://localhost:8080
description: Generated server url
paths:
/rule-books/{ruleBookId}:
/rule-book:
get:
tags:
- rule-book
summary: Find a rule book by its id
operationId: findRuleBookById
parameters:
- name: ruleBookId
in: path
description: Id of the rule book
required: true
schema:
type: string
format: uuid
summary: Find the caller's rule book
operationId: findRuleBook
responses:
"200":
description: The rule book
description: The caller's rule book
content:
'*/*':
schema:
$ref: "#/components/schemas/RuleBookResponse"
"404":
description: No rule book with this id
description: The caller has no rule book
put:
tags:
- rule-book
summary: Update a rule book
summary: Update the caller's rule book
operationId: updateRuleBook
parameters:
- name: ruleBookId
in: path
description: Id of the rule book
required: true
schema:
type: string
format: uuid
requestBody:
description: New state of the rule book
description: New state of the caller's rule book
content:
application/json:
schema:
@@ -59,29 +43,8 @@ paths:
"400":
description: |-
Returned when:
- the request is invalid (e.g. blank name)
- the rule book is the default rule book, which cannot be modified
delete:
tags:
- rule-book
summary: Delete a rule book
operationId: deleteRuleBook
parameters:
- name: ruleBookId
in: path
description: Id of the rule book
required: true
schema:
type: string
format: uuid
responses:
"204":
description: The rule book was deleted
"400":
description: |-
Returned when:
- the rule book is associated to a character
- the rule book is the default rule book, which cannot be deleted
- a binding references a ledger the caller does not own
- a binding references a ledger that is not a main ledger
/ledgers/main/{ledgerId}:
put:
tags:
@@ -152,108 +115,6 @@ paths:
- the request is invalid
"404":
description: No ledger with this id
/characters/{characterId}/rule-book:
get:
tags:
- character-rule-book
summary: Find the rule book assigned to a character
operationId: findCharacterRuleBookByCharacterId
parameters:
- name: characterId
in: path
description: Id of the character
required: true
schema:
type: integer
format: int64
responses:
"200":
description: The rule book assignment of the character
content:
'*/*':
schema:
$ref: "#/components/schemas/CharacterRuleBookResponse"
"400":
description: Invalid character id
"404":
description: No rule book assigned to this character
put:
tags:
- character-rule-book
summary: Assign a rule book to a character
operationId: setCharacterRuleBookForCharacter
parameters:
- name: characterId
in: path
description: Id of the character
required: true
schema:
type: integer
format: int64
requestBody:
description: Rule book and ledger bindings to assign
content:
application/json:
schema:
$ref: "#/components/schemas/SetCharacterRuleBookRequest"
required: true
responses:
"200":
description: The rule book assignment of the character
content:
'*/*':
schema:
$ref: "#/components/schemas/CharacterRuleBookResponse"
"400":
description: |-
Returned when:
- the referenced rule book does not exist
- a bound ledger does not exist
- a bound ledger is not a main or system ledger
- a required ledger binding is missing
/rule-books:
get:
tags:
- rule-book
summary: Find all rule books
operationId: findAllRuleBooks
responses:
"200":
description: All rule books
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/RuleBookResponse"
post:
tags:
- rule-book
summary: Create a rule book
operationId: createRuleBook
requestBody:
description: Rule book to create
content:
application/json:
schema:
$ref: "#/components/schemas/CreateRuleBookRequest"
required: true
responses:
"201":
description: The created rule book
headers:
Location:
description: URL of the created rule book
style: simple
schema:
type: string
format: uri
content:
'*/*':
schema:
$ref: "#/components/schemas/RuleBookResponse"
"400":
description: Invalid request (e.g. blank name)
/reprocessing:
post:
tags:
@@ -456,7 +317,8 @@ paths:
post:
tags:
- activity
summary: Fetch all new activities for all characters from the EVE API
summary: Fetch new activities for the authenticated user's characters from the
EVE API
operationId: fetchAllNewActivities
responses:
"200":
@@ -484,15 +346,15 @@ paths:
post:
tags:
- activity
summary: Process new activities for all characters with a usable token
summary: Process new activities for the authenticated user's characters
operationId: processNewActivities
responses:
"200":
description: New activities processed
/rule-books/script-definitions:
/rule-scripts/definitions:
get:
tags:
- rule-book
- rule-script
summary: Download the TypeScript definitions for the rule script runtime
operationId: getScriptDefinitions
responses:
@@ -829,15 +691,31 @@ paths:
- the types parameter is missing
- a types value is not a numeric id
- the days parameter is not greater than 0
/market-orders:
get:
tags:
- market-order
summary: List the open market orders across all characters owned by the authenticated
user
operationId: findAllMarketOrders
responses:
"200":
description: The authenticated user's open market orders
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/MarketOrderResponse"
/ledgers:
get:
tags:
- ledger
summary: Find all ledgers
summary: Find all ledgers owned by the authenticated user
operationId: findAllLedgers
responses:
"200":
description: All ledgers
description: The authenticated user's ledgers
content:
'*/*':
schema:
@@ -921,32 +799,17 @@ paths:
get:
tags:
- character
summary: Find all characters with a usable token
summary: Find the characters owned by the authenticated user
operationId: findAllCharacters
responses:
"200":
description: All characters with a usable token
description: The authenticated user's characters
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/CharacterResponse"
/characters/rule-books:
get:
tags:
- character-rule-book
summary: Find the rule books of all characters that have a token
operationId: findAllCharacterRuleBooks
responses:
"200":
description: Rule book assignments of all characters with a token
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/CharacterRuleBookResponse"
/acquisitions:
get:
tags:
@@ -982,69 +845,58 @@ components:
schemas:
UpdateRuleBookRequest:
type: object
description: Request to update an existing rule book; replaces its mutable fields.
description: Request to update the caller's rule book; replaces its mutable
fields.
properties:
name:
type: string
description: Rule book name.
example: Trading rules
usedForAcquisitions:
type: boolean
description: Whether this rule book is used to derive acquisitions.
example: true
ledgerRefs:
type: array
description: Symbolic ledger references the script writes to; each must
be bound to a ledger per character.
items:
bindings:
type: object
additionalProperties:
type: string
example: sales
pattern: "[a-z][a-zA-Z0-9]*"
format: uuid
description: "Ledger references the script writes to, each bound to one\
\ of the user's ledgers."
script:
type: string
description: The classification script source.
example: transfer.to('sales')
required:
- ledgerRefs
- name
- bindings
- script
- usedForAcquisitions
RuleBookResponse:
type: object
description: "A rule book: a named script that classifies transactions, together\
\ with the ledger references it expects."
description: "The caller's rule book: a script that classifies transactions,\
\ together with its ledger bindings."
properties:
ruleBookId:
userId:
type: string
format: uuid
description: Unique rule book identifier.
description: Owning user identifier.
example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
name:
type: string
description: Rule book name.
example: Trading rules
usedForAcquisitions:
type: boolean
description: Whether this rule book is used to derive acquisitions.
example: true
ledgerRefs:
type: array
description: Symbolic ledger references the script writes to; each must
be bound to a ledger per character.
items:
bindings:
type: object
additionalProperties:
type: string
example: sales
pattern: "[a-z][a-zA-Z0-9]*"
format: uuid
description: "Ledger references the script writes to, each bound to one\
\ of the user's ledgers."
script:
type: string
description: The classification script source.
example: transfer.to('sales')
required:
- ledgerRefs
- name
- ruleBookId
- bindings
- script
- usedForAcquisitions
- userId
UpdateMainLedgerRequest:
type: object
description: Request to update an existing main ledger.
@@ -1127,113 +979,6 @@ components:
- ledgerId
- memberLedgerIds
- name
SetCharacterRuleBookRequest:
type: object
description: "Request to assign a rule book to a character, binding each of\
\ its ledger references to a concrete ledger."
properties:
ruleBookId:
type: string
format: uuid
description: Id of the rule book to assign.
example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
bindings:
type: object
additionalProperties:
type: string
format: uuid
description: Bindings from each ledger reference name to the ledger id it
resolves to for this character.
example:
sales: 5c1e6f2a-1234-4562-b3fc-2c963f66afa6
required:
- bindings
- ruleBookId
CharacterResponse:
type: object
description: An EVE Online character.
properties:
characterId:
type: integer
format: int64
description: EVE character id.
example: 2112625428
name:
type: string
description: Character name.
example: CCP Falcon
required:
- characterId
- name
CharacterRuleBookResponse:
type: object
description: "A rule book assigned to a character, with the ledger bindings\
\ that resolve its references."
properties:
character:
$ref: "#/components/schemas/CharacterResponse"
description: The character the rule book is assigned to.
ruleBook:
$ref: "#/components/schemas/RuleBookSummaryResponse"
description: Summary of the assigned rule book.
bindings:
type: object
additionalProperties:
type: string
format: uuid
description: Bindings from each ledger reference name to the ledger id it
resolves to for this character.
example:
sales: 5c1e6f2a-1234-4562-b3fc-2c963f66afa6
required:
- bindings
- character
- ruleBook
RuleBookSummaryResponse:
type: object
description: "Lightweight reference to a rule book: its id and name only."
properties:
ruleBookId:
type: string
format: uuid
description: Unique rule book identifier.
example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
name:
type: string
description: Rule book name.
example: Trading rules
required:
- name
- ruleBookId
CreateRuleBookRequest:
type: object
description: Request to create a new rule book.
properties:
name:
type: string
description: Rule book name.
example: Trading rules
usedForAcquisitions:
type: boolean
description: Whether this rule book is used to derive acquisitions.
example: true
ledgerRefs:
type: array
description: Symbolic ledger references the script writes to; each must
be bound to a ledger per character.
items:
type: string
example: sales
pattern: "[a-z][a-zA-Z0-9]*"
script:
type: string
description: The classification script source.
example: transfer.to('sales')
required:
- ledgerRefs
- name
- script
- usedForAcquisitions
MarketTypeStackRequest:
type: object
description: A quantity of a single market type to reprocess.
@@ -1373,6 +1118,22 @@ components:
required:
- memberLedgerIds
- name
CharacterResponse:
type: object
description: An EVE Online character.
properties:
characterId:
type: integer
format: int64
description: EVE character id.
example: 2112625428
name:
type: string
description: Character name.
example: CCP Falcon
required:
- characterId
- name
MeResponse:
type: object
description: The authenticated user and the characters they own.
@@ -1627,6 +1388,101 @@ components:
- marketTypeId
- orderCount
- sell
MarketOrderResponse:
type: object
description: An open market order placed by one of the authenticated user's
characters.
properties:
orderId:
type: integer
format: int64
description: EVE market order id.
example: 5266893063
characterId:
type: integer
format: int64
description: EVE character id that owns the order.
example: 2112625428
characterName:
type: string
description: Name of the character that owns the order.
example: CCP Falcon
marketTypeId:
type: integer
format: int64
description: EVE market type (item) id being traded.
example: 34
locationId:
type: integer
format: int64
description: Location id (station or structure) the order is placed at.
example: 60003760
regionId:
type: integer
format: int64
description: Region id the order resides in.
example: 10000002
direction:
type: string
description: Trade direction of the order.
enum:
- BUY
- SELL
example: SELL
price:
type: number
description: "Price per unit, in ISK."
example: 5.42
volumeTotal:
type: integer
format: int64
description: Total volume the order was created with.
example: 1000000
volumeRemain:
type: integer
format: int64
description: Volume still remaining on the order.
example: 750000
minVolume:
type: integer
format: int32
description: Minimum volume that must be bought or sold in a single transaction.
example: 1
range:
type: string
description: "Order range. For buy orders the matching range, for sell orders\
\ always 'region'."
example: region
duration:
type: integer
format: int32
description: "Duration of the order, in days."
example: 90
issued:
type: string
format: date-time
description: When the order was issued.
example: 2026-06-22T05:12:25Z
escrow:
type: number
description: ISK held in escrow for a buy order; null for sell orders.
example: 4065000.0
required:
- characterId
- characterName
- direction
- duration
- escrow
- issued
- locationId
- marketTypeId
- minVolume
- orderId
- price
- range
- regionId
- volumeRemain
- volumeTotal
LedgerResponse:
description: "A ledger, either a standalone main ledger or a combined ledger\
\ aggregating others."