Refactor API structure and endpoints for history and team.

Updated API definitions and endpoints to better support punishment history and team queries. Introduced new parameters, schemas, and operations to improve functionality, and reorganized related controllers into appropriate packages.
This commit is contained in:
Teriuihi 2025-04-10 22:46:30 +02:00
parent 2137459e9b
commit 1585011143
5 changed files with 201 additions and 77 deletions

View File

@ -0,0 +1,21 @@
package com.alttd.altitudeweb.controllers.history;
import com.alttd.altitudeweb.api.HistoryApi;
import org.springframework.http.ResponseEntity;
public class HistoryApiController implements HistoryApi {
@Override
public ResponseEntity<Void> getHistoryForUsers(String userType, String type, String user) throws Exception {
return null;
}
@Override
public ResponseEntity<Void> getHistoryForUuid(String userType, String type, String uuid) throws Exception {
return null;
}
@Override
public ResponseEntity<Void> getUserNames(String userType, String type) throws Exception {
return null;
}
}

View File

@ -1,4 +1,4 @@
package com.alttd.altitudeweb.controllers; package com.alttd.altitudeweb.controllers.team;
import com.alttd.altitudeweb.api.TeamApi; import com.alttd.altitudeweb.api.TeamApi;
import com.alttd.altitudeweb.database.Connection; import com.alttd.altitudeweb.database.Connection;

View File

@ -7,10 +7,16 @@ info:
servers: servers:
- url: https://alttd.com/api/v3 - url: https://alttd.com/api/v3
tags: tags:
- name: player - name: history
description: Retrieve player information description: Retrieves punishment history
- name: team
description: Retrieves information about the staff team
paths: paths:
/team: /team/{team}:
$ref: './sub_api/team/team.yml' $ref: './sub_api/team/team.yml#/getTeam'
/history: /history/{userType}/search/{type}:
$ref: './sub_api/bans/bans.yml' $ref: './sub_api/bans/bans.yml#/getUserNames'
/history/{userType}/{type}/{user}:
$ref: './sub_api/bans/bans.yml#/getHistoryForUsers'
/history/{userType}/{type}/{uuid}:
$ref: './sub_api/bans/bans.yml#/getHistoryForUuid'

View File

@ -1,47 +1,145 @@
paths: getUserNames:
/history: post:
post: tags:
tags: - history
- user summary: Get user names
summary: Get player history description: Get all user names with punishment history of the specified type
description: Retrieves all types of player history about the player operationId: getUserNames
operationId: getPlayerHistory parameters:
requestBody: - $ref: '#/components/parameters/UserType'
description: The player history - $ref: '#/components/parameters/HistoryType'
content: responses:
application/json: '200':
schema: description: Successful operation
$ref: '#/components/schemas/Player' content:
responses: application/json:
'200': schema:
description: successful operation type: array
content: items:
application/json: type: string
schema: description: A list of users
$ref: '#/components/schemas/PlayerHistory' default:
default: description: Unexpected error
description: Unexpected error content:
content: application/json:
application/json: schema:
schema: $ref: "../generic/errors.yml#/components/schemas/Error"
$ref: "../generic/errors.yml#/components/schemas/Error" getHistoryForUsers:
post:
tags:
- history
summary: Get history for users
description: >
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/Error"
getHistoryForUuid:
post:
tags:
- history
summary: Get user
description: >
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/Error"
components: components:
parameters:
HistoryType:
name: type
in: path
required: true
schema:
type: string
enum: [ all, bans, mutes, kicks ]
description: The type of history to retrieve
User:
name: user
in: path
required: true
schema:
type: string
description: The (partial) username to search for
Uuid:
name: uuid
in: path
required: true
schema:
type: string
description: The uuid of the desired user
UserType:
name: userType
in: path
required: true
schema:
type: string
enum: [ player, staff ]
description: Indicates if this is a staff history or a player history look up
schemas: schemas:
PlayerHistory: PunishmentHistory:
type: object type: array
properties: items:
punishmentType: type: object
type: string properties:
punishment: username:
type: string type: string
active: description: The username of the user
type: boolean uuid:
start: type: string
type: integer description: The UUID of the user
format: int64 reason:
duration: type: string
type: integer description: The reason for the punishment
format: int64 type:
type: string
description: The type of punishment
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
punishmentUser:
type: string
description: The username of the punishment issuer
punishmentUserUuid:
type: string
description: The UUID of the punishment issuer
Player: Player:
type: object type: object
properties: properties:

View File

@ -1,31 +1,30 @@
paths: getTeam:
/{group}: get:
get: tags:
tags: - team
- team summary: Get team members
summary: Get team members description: Retrieve players who are part of the specified team
description: Retrieve players who are part of the specified team operationId: getTeamMembers
operationId: getTeamMembers parameters:
parameters: - name: group
- name: group in: path
in: path required: true
required: true description: The group name of the team
description: The group name of the team schema:
schema: type: string
type: string responses:
responses: '200':
'200': description: successful operation
description: successful operation content:
content: application/json:
application/json: schema:
schema: $ref: '#/components/schemas/TeamMembers'
$ref: '#/components/schemas/TeamMembers' default:
default: description: Unexpected error
description: Unexpected error content:
content: application/json:
application/json: schema:
schema: $ref: "../generic/errors.yml#/components/schemas/Error"
$ref: "../generic/errors.yml#/components/schemas/Error"
components: components:
schemas: schemas:
TeamMembers: TeamMembers: