Add punishment details and history retrieval functionality

This commit introduces a new `DetailsComponent` for displaying detailed punishment data and establishes a route to view punishment history by ID and type. It also updates the API to support fetching individual punishment records and refines database mappings for improved data handling.
This commit is contained in:
2025-04-19 04:02:51 +02:00
parent a1912b96d8
commit 3babde5513
22 changed files with 547 additions and 165 deletions
+2
View File
@@ -26,6 +26,8 @@ paths:
$ref: './schemas/bans/bans.yml#/getTotalResultsForUuidSearch'
/history/{userType}/search-results/user/{type}/{user}:
$ref: './schemas/bans/bans.yml#/getTotalResultsForUserSearch'
/history/single/{type}/{id}:
$ref: './schemas/bans/bans.yml#/getHistoryById'
/history/total:
$ref: './schemas/bans/bans.yml#/getTotalPunishments'
/appeal/update-mail:
@@ -44,7 +44,7 @@ getHistoryForUsers:
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
$ref: '#/components/schemas/PunishmentHistoryList'
default:
description: Unexpected error
content:
@@ -70,7 +70,7 @@ getHistoryForAll:
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
$ref: '#/components/schemas/PunishmentHistoryList'
default:
description: Unexpected error
content:
@@ -97,7 +97,7 @@ getHistoryForUuid:
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
$ref: '#/components/schemas/PunishmentHistoryList'
default:
description: Unexpected error
content:
@@ -172,6 +172,29 @@ getTotalResultsForUuidSearch:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
getHistoryById:
get:
tags:
- history
summary: Gets history for specified id
description: Retrieves a specific history record
operationId: getHistoryById
parameters:
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/Id'
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:
@@ -211,57 +234,70 @@ components:
schema:
type: integer
description: The page that should be retrieved
Id:
name: id
in: path
required: true
schema:
type: integer
description: The id of the punishment that should be retrieved
schemas:
SearchResults:
type: integer
description: A number representing the total count of results for the search query
PunishmentHistory:
PunishmentHistoryList:
type: array
items:
type: object
required:
- username
- uuid
- reason
- type
- punishmentTime
- expiryTime
- punishedBy
- punishedByUuid
properties:
username:
type: string
description: The username of the user
uuid:
type: string
description: The UUID of the user
reason:
type: string
description: The reason for the punishment
type:
type: string
description: The type of punishment
enum: [ ban, mute, kick, warn ]
punishmentTime:
type: integer
format: int64
description: The time when the punishment was given
expiryTime:
type: integer
format: int64
description: The time when the punishment expires
punishedBy:
type: string
description: The username of the punishment issuer
punishedByUuid:
type: string
description: The UUID of the punishment issuer
removedBy:
type: string
description: The name of the staff member who removed the punishment
removedReason:
type: string
description: The reason why the punishment was removed
$ref: '#/components/schemas/PunishmentHistory'
PunishmentHistory:
type: object
required:
- username
- uuid
- reason
- type
- punishmentTime
- expiryTime
- punishedBy
- punishedByUuid
- id
properties:
username:
type: string
description: The username of the user
uuid:
type: string
description: The UUID of the user
reason:
type: string
description: The reason for the punishment
type:
type: string
description: The type of punishment
enum: [ ban, mute, kick, warn ]
punishmentTime:
type: integer
format: int64
description: The time when the punishment was given
expiryTime:
type: integer
format: int64
description: The time when the punishment expires
punishedBy:
type: string
description: The username of the punishment issuer
punishedByUuid:
type: string
description: The UUID of the punishment issuer
removedBy:
type: string
description: The name of the staff member who removed the punishment
removedReason:
type: string
description: The reason why the punishment was removed
id:
type: integer
description: Id of the punishment
Player:
type: object
properties: