Add system-wide search endpoints and integrate compare visibility filter:

- Add new search endpoints to OpenAPI schema with cache management functionality.
- Extend invoice distribution functionality with `compareVisibility` filter for result categorization.
- Update unit tests and UI components for compare visibility options.
This commit is contained in:
Jeppe Bundgaard
2026-03-12 20:30:09 +01:00
parent c97d5c09d7
commit d197f7f8cf
4 changed files with 533 additions and 20 deletions
+425
View File
@@ -38,6 +38,8 @@ tags:
description: User and employee authentication endpoints
- name: Users
description: User management and customer operations
- name: Search
description: System-wide search endpoints
- name: Orders
description: Order creation, management, and retrieval
- name: Order Items
@@ -7744,6 +7746,152 @@ paths:
application/json:
schema: {}
/search/system:
get:
tags:
- Search
summary: System-wide search
description: Search across all supported entities with permission-aware filtering and optional intent parsing debug metadata.
operationId: systemWideSearchGet
parameters:
- in: query
name: query
required: true
schema:
type: string
description: Free-text query to search for.
- in: query
name: include_types
required: false
schema:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
style: form
explode: false
description: Comma-separated list of entity types to include. Defaults to all allowed types.
- in: query
name: exclude_types
required: false
schema:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
style: form
explode: false
description: Comma-separated list of entity types to exclude.
- in: query
name: include_associations
required: false
schema:
type: boolean
default: true
description: Include associated objects when matching a primary entity such as a customer.
- in: query
name: debug_intent
required: false
schema:
type: boolean
default: false
description: Include intent parser diagnostics in `meta.intent_parser`.
- in: query
name: limit
required: false
schema:
type: integer
minimum: 1
maximum: 200
default: 50
- in: query
name: offset
required: false
schema:
type: integer
minimum: 0
default: 0
responses:
'200':
description: Search results returned successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SystemSearchResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
post:
tags:
- Search
summary: System-wide search
description: Search across all supported entities using JSON request payload.
operationId: systemWideSearchPost
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SystemSearchRequest'
responses:
'200':
description: Search results returned successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SystemSearchResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
/superuser/search/system/cache:
delete:
tags:
- Search
summary: Clear system search caches
description: Clears both query-result cache and intent-parser cache namespaces for system-wide search.
operationId: clearSystemSearchCache
responses:
'200':
description: Cache cleared successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SystemSearchCacheClearResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
/superuser/search/system/cache/rebuild:
post:
tags:
- Search
summary: Queue system search cache rebuild
description: Queues a cache rebuild request and clears active query/intent cache namespaces immediately.
operationId: rebuildSystemSearchCache
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/SystemSearchCacheRebuildRequest'
responses:
'200':
description: Cache rebuild queued successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SystemSearchCacheRebuildResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
# Configuration Endpoints
/economic/config:
get:
@@ -9006,6 +9154,283 @@ components:
type: integer
description: HTTP status code
SystemSearchEntityType:
type: string
enum:
- objects
- module_config
- orders
- order_items
- customers
- employees
- subusers
- customer_discounts
- customer_fixed_prices
- departments
- permissions
- roles
- invoices
- vehicles
SystemSearchRequest:
type: object
required:
- query
properties:
query:
type: string
description: Free-text query to search for.
include_types:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
description: Limit search to these entity types.
exclude_types:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
description: Exclude these entity types from search.
include_associations:
type: boolean
default: true
description: Include associated records for matched core entities.
debug_intent:
type: boolean
default: false
description: Include parser diagnostics in `meta.intent_parser`.
limit:
type: integer
minimum: 1
maximum: 200
default: 50
offset:
type: integer
minimum: 0
default: 0
SystemSearchResult:
type: object
properties:
entity_type:
$ref: '#/components/schemas/SystemSearchEntityType'
entity_id:
type: string
title:
type: string
description:
type: string
customer_number:
type: integer
nullable: true
department_id:
type: integer
nullable: true
score:
type: integer
association_reason:
type: string
nullable: true
payload:
type: object
additionalProperties: true
required:
- entity_type
- entity_id
- title
- score
SystemSearchIntentParserMeta:
type: object
properties:
invoked:
type: boolean
source:
type: string
enum: [cache, openai, none]
status:
type: string
confidence:
type: number
minimum: 0
maximum: 1
expanded_terms:
type: array
items:
type: string
entity_hints:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
fallback_reason:
type: string
nullable: true
required:
- invoked
- source
- status
- confidence
- expanded_terms
- entity_hints
SystemSearchMeta:
type: object
properties:
query:
type: string
limit:
type: integer
offset:
type: integer
total:
type: integer
allowed_types:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
cache:
type: object
properties:
hit:
type: boolean
required: [hit]
intent_parser:
$ref: '#/components/schemas/SystemSearchIntentParserMeta'
required:
- query
- limit
- offset
- total
- allowed_types
- cache
SystemSearchPayload:
type: object
properties:
results:
type: array
items:
$ref: '#/components/schemas/SystemSearchResult'
grouped_results:
type: object
additionalProperties:
type: array
items:
$ref: '#/components/schemas/SystemSearchResult'
meta:
$ref: '#/components/schemas/SystemSearchMeta'
required:
- results
- grouped_results
- meta
SystemSearchResponse:
type: object
properties:
success:
type: boolean
data:
$ref: '#/components/schemas/SystemSearchPayload'
meta:
type: object
additionalProperties: true
includes:
type: object
additionalProperties: true
required:
- success
- data
- meta
- includes
SystemSearchCacheClearResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
message:
type: string
query_cache_cleared:
type: boolean
intent_cache_cleared:
type: boolean
required:
- message
- query_cache_cleared
- intent_cache_cleared
meta:
type: object
additionalProperties: true
includes:
type: object
additionalProperties: true
required:
- success
- data
- meta
- includes
SystemSearchCacheRebuildRequest:
type: object
properties:
scope:
type: string
enum: [all, types, dirty]
default: all
types:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
SystemSearchCacheRebuildResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
message:
type: string
request:
type: object
properties:
scope:
type: string
enum: [all, types, dirty]
types:
type: array
items:
$ref: '#/components/schemas/SystemSearchEntityType'
requested_at:
type: integer
required:
- scope
- types
- requested_at
query_cache_cleared:
type: boolean
intent_cache_cleared:
type: boolean
required:
- message
- request
- query_cache_cleared
- intent_cache_cleared
meta:
type: object
additionalProperties: true
includes:
type: object
additionalProperties: true
required:
- success
- data
- meta
- includes
ModuleConfigValue:
oneOf:
- type: string