Add admin endpoints for editing and removing punishments and implement frontend dialog for punishment management

This commit is contained in:
2025-10-23 23:52:52 +02:00
parent b71ea7da8b
commit 41dab473b0
11 changed files with 514 additions and 34 deletions
+6
View File
@@ -49,6 +49,12 @@ paths:
$ref: './schemas/bans/bans.yml#/getAllHistoryForUUID'
/api/history/total:
$ref: './schemas/bans/bans.yml#/getTotalPunishments'
/api/history/admin/{type}/{id}/reason:
$ref: './schemas/bans/bans.yml#/updatePunishmentReason'
/api/history/admin/{type}/{id}/until:
$ref: './schemas/bans/bans.yml#/updatePunishmentUntil'
/api/history/admin/{type}/{id}:
$ref: './schemas/bans/bans.yml#/removePunishment'
/api/appeal/update-mail:
$ref: './schemas/forms/appeal/appeal.yml#/UpdateMail'
/api/appeal/minecraft-appeal:
@@ -211,6 +211,73 @@ getAllHistoryForUUID:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistoryList'
updatePunishmentReason:
patch:
tags:
- history
summary: Update punishment reason
description: Updates the reason for a specific punishment history entry
operationId: updatePunishmentReason
parameters:
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/Id'
- $ref: '#/components/parameters/NewPunishmentReason'
responses:
'200':
description: Updated punishment
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
updatePunishmentUntil:
patch:
tags:
- history
summary: Update punishment expiry time
description: Updates the expiry time (until) for a specific punishment history entry (only for ban and mute)
operationId: updatePunishmentUntil
parameters:
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/Id'
- $ref: '#/components/parameters/NewUntil'
responses:
'200':
description: Updated punishment
content:
application/json:
schema:
$ref: '#/components/schemas/PunishmentHistory'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
removePunishment:
delete:
tags:
- history
summary: Remove punishment
description: Removes a punishment from history. For bans and mutes, the punishment is deactivated; for kicks and warnings, the row is deleted.
operationId: removePunishment
parameters:
- $ref: '#/components/parameters/HistoryType'
- $ref: '#/components/parameters/Id'
responses:
'204':
description: Punishment removed
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '../generic/errors.yml#/components/schemas/ApiError'
components:
parameters:
HistoryType:
@@ -250,6 +317,21 @@ components:
schema:
type: integer
description: The id of the punishment that should be retrieved
NewPunishmentReason:
name: reason
in: query
required: true
schema:
type: string
description: The new reason to set for the punishment
NewUntil:
name: until
in: query
required: true
schema:
type: integer
format: int64
description: The new expiry time (epoch millis)
schemas:
SearchResults:
type: integer