update swagger docs
All checks were successful
Release and Deploy / build (push) Successful in 2m16s
Release and Deploy / deploy (push) Successful in 25s

This commit is contained in:
Fran Jurmanović
2025-08-05 14:32:37 +02:00
parent 56c51e5d02
commit ac61ba5223
8 changed files with 1584 additions and 594 deletions

View File

@@ -11,7 +11,7 @@ const docTemplate = `{
"title": "{{.Title}}",
"contact": {
"name": "ACC Server Manager Support",
"url": "https://github.com/yourusername/acc-server-manager"
"url": "https://github.com/FJurmanovic/acc-server-manager"
},
"license": {
"name": "MIT",
@@ -22,199 +22,7 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/auth/login": {
"post": {
"description": "Authenticate a user and receive a JWT token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Authentication"
],
"summary": "User login",
"parameters": [
{
"description": "Login credentials",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "JWT token",
"schema": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Invalid credentials",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/membership": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a list of all registered users",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "List all users",
"responses": {
"200": {
"description": "List of users",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.User"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a new user account with specified role",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "Create a new user",
"parameters": [
{
"description": "User details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"role": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Created user details",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"409": {
"description": "User already exists",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/server": {
"/v1/api/server": {
"get": {
"security": [
{
@@ -305,6 +113,111 @@ const docTemplate = `{
}
}
},
"/v1/auth/login": {
"post": {
"description": "Authenticate a user and receive a JWT token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Authentication"
],
"summary": "User login",
"parameters": [
{
"description": "Login credentials",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "JWT token",
"schema": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Invalid credentials",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/v1/auth/me": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get details of the currently authenticated user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Authentication"
],
"summary": "Get current user details",
"responses": {
"200": {
"description": "Current user details",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/v1/lookup/car-models": {
"get": {
"security": [
@@ -569,6 +482,361 @@ const docTemplate = `{
}
}
},
"/v1/membership": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a list of all registered users",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "List all users",
"responses": {
"200": {
"description": "List of users",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.User"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a new user account with specified role",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "Create a new user",
"parameters": [
{
"description": "User details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"role": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Created user details",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"409": {
"description": "User already exists",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/v1/membership/roles": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a list of all available user roles",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "Get all roles",
"responses": {
"200": {
"description": "List of roles",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Role"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/v1/membership/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get detailed information about a specific user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "Get user by ID",
"parameters": [
{
"type": "string",
"description": "User ID (UUID format)",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "User details",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "Invalid user ID format",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user details by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "Update user",
"parameters": [
{
"type": "string",
"description": "User ID (UUID format)",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Updated user details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service.UpdateUserRequest"
}
}
],
"responses": {
"200": {
"description": "Updated user details",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "Invalid request body or ID format",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a specific user by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User Management"
],
"summary": "Delete user",
"parameters": [
{
"type": "string",
"description": "User ID (UUID format)",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "User successfully deleted"
},
"400": {
"description": "Invalid user ID format",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/v1/server": {
"get": {
"security": [
@@ -854,6 +1122,71 @@ const docTemplate = `{
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete an existing ACC server",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Server"
],
"summary": "Delete an ACC server",
"parameters": [
{
"type": "string",
"description": "Server ID (UUID format)",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Deleted server details",
"schema": {
"type": "object"
}
},
"400": {
"description": "Invalid server data or ID",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"403": {
"description": "Insufficient permissions",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"404": {
"description": "Server not found",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/error_handler.ErrorResponse"
}
}
}
}
},
"/v1/server/{id}/config": {
@@ -1086,27 +1419,7 @@ const docTemplate = `{
}
}
},
"/v1/service-control": {
"get": {
"description": "Return service control status",
"tags": [
"service-control"
],
"summary": "Return service control status",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"/v1/service-control/restart": {
"/v1/server/{id}/service/restart": {
"post": {
"security": [
{
@@ -1185,7 +1498,7 @@ const docTemplate = `{
}
}
},
"/v1/service-control/start": {
"/v1/server/{id}/service/start": {
"post": {
"security": [
{
@@ -1270,7 +1583,7 @@ const docTemplate = `{
}
}
},
"/v1/service-control/stop": {
"/v1/server/{id}/service/stop": {
"post": {
"security": [
{
@@ -1355,7 +1668,7 @@ const docTemplate = `{
}
}
},
"/v1/service-control/{service}": {
"/v1/server/{id}/service/{service}": {
"get": {
"security": [
{
@@ -1463,6 +1776,26 @@ const docTemplate = `{
}
}
}
},
"/v1/system/health": {
"get": {
"description": "Return service control status",
"tags": [
"system"
],
"summary": "Return service control status",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
@@ -1617,6 +1950,20 @@ const docTemplate = `{
"type": "string"
}
}
},
"service.UpdateUserRequest": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"roleId": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
},
"securityDefinitions": {
@@ -1632,7 +1979,7 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:3000",
Host: "https://acc.jurmanovic.com",
BasePath: "/api/v1",
Schemes: []string{"http", "https"},
Title: "ACC Server Manager API",