Add API endpoints for search result counts by name and UUID

Introduced new API paths and backend logic to retrieve total punishment counts based on user search queries using names or UUIDs. Updated the frontend to utilize these endpoints and display the total search results dynamically.
This commit is contained in:
2025-04-18 20:43:17 +02:00
parent ee66bdda83
commit ecee377f01
6 changed files with 216 additions and 16 deletions
+4
View File
@@ -22,6 +22,10 @@ paths:
$ref: './schemas/bans/bans.yml#/getHistoryForAll'
/history/{userType}/uuid/{type}/{uuid}/{page}:
$ref: './schemas/bans/bans.yml#/getHistoryForUuid'
/history/{userType}/search-results/uuid/{type}/{uuid}:
$ref: './schemas/bans/bans.yml#/getTotalResultsForUuidSearch'
/history/{userType}/search-results/user/{type}/{user}:
$ref: './schemas/bans/bans.yml#/getTotalResultsForUserSearch'
/history/total:
$ref: './schemas/bans/bans.yml#/getTotalPunishments'
/appeal/update-mail:
@@ -124,6 +124,54 @@ getTotalPunishments:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
getTotalResultsForUserSearch:
get:
tags:
- history
summary: Gets total results for search query
description: Retrieves the total count of punishments for the search query
operationId: getTotalResultsForUserSearch
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/User'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResults'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
getTotalResultsForUuidSearch:
get:
tags:
- history
summary: Gets total results for search query
description: Retrieves the total count of punishments for the search query
operationId: getTotalResultsForUuidSearch
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/Uuid'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/SearchResults'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
components:
parameters:
HistoryType:
@@ -164,6 +212,9 @@ components:
type: integer
description: The page that should be retrieved
schemas:
SearchResults:
type: integer
description: A number representing the total count of results for the search query
PunishmentHistory:
type: array
items: