Refactor history APIs and integrate LiteBans database support

Redesigned history-related APIs to streamline handling of user and UUID punishments, moving from POST to GET endpoints. Added support for LiteBans database with mappers for retrieving punishment records by name and UUID, and implemented global exception handling for better error reporting. Updated schema paths and added enums (UserType, HistoryType) and a new Gradle dependency.
This commit is contained in:
2025-04-11 01:12:46 +02:00
parent 43a5dafd82
commit 0f9761da3a
12 changed files with 475 additions and 65 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ paths:
$ref: './schemas/team/team.yml#/getTeam'
/history/{userType}/search/{type}:
$ref: './schemas/bans/bans.yml#/getUserNames'
/history/{userType}/{type}/{user}:
/history/{userType}/name/{type}/{user}:
$ref: './schemas/bans/bans.yml#/getHistoryForUsers'
/history/{userType}/{type}/{uuid}:
/history/{userType}/uuid/{type}/{uuid}:
$ref: './schemas/bans/bans.yml#/getHistoryForUuid'
@@ -1,31 +1,31 @@
getUserNames:
post:
get:
tags:
- history
summary: Get user names
description: Get all user names with punishment history of the specified type
operationId: getUserNames
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
type: string
description: A list of users
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
parameters:
- $ref: '#/components/parameters/UserType'
- $ref: '#/components/parameters/HistoryType'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
type: string
description: A list of users
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForUsers:
post:
get:
tags:
- history
summary: Get history for users
@@ -33,25 +33,25 @@ getHistoryForUsers:
Get all users with punishment history of the specified type,
where the user name starts with the search query
operationId: getHistoryForUsers
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/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
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/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForUuid:
post:
get:
tags:
- history
summary: Get user
@@ -59,23 +59,23 @@ getHistoryForUuid:
Get all users with punishment history of the specified type,
where the user uuid matches
operationId: getHistoryForUuid
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/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
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/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../generic/errors.yml#/components/schemas/ApiError"
components:
parameters:
HistoryType: