# О системе

Система для соревнований по программированию

{% hint style="danger" %}
Эта документация для версии v2. Данная версия больше не поддерживается, как и документация к ней\
\
См [Codebattles V3](https://docs.codebattles.ru/ru_v3)
{% endhint %}

## Для кого подходит эта система

Изначально система разрабатывалась для школ и учителей, которые хотят проводить уроки в более интересном и интерактивном формате. Но также Вы можете организовывать свои соревнования, например, среди своих друзей.

## Навигация&#x20;

Для Вашего удобства, вся документация разделена на разделы. Перейти в них можно в меню слева

{% hint style="info" %}
Если вы нашли ответ на свой вопрос здесь, можете написать в [Telegram](https://doctorixx.t.me/)
{% endhint %}


# Интерфейс участника

<figure><img src="/files/w9J5AiuMxFaWcGY7uEbX" alt=""><figcaption><p>Страница входа</p></figcaption></figure>

<figure><img src="/files/49TbkRFaLkiBJHYgjQK6" alt=""><figcaption><p>Задачи</p></figcaption></figure>

<figure><img src="/files/iGhrp2vP798YPGQGj376" alt=""><figcaption><p>Отправить решение</p></figcaption></figure>

<figure><img src="/files/8fQXKLqxQM6XWv2AbJoJ" alt=""><figcaption><p>Ошибка подключения</p></figcaption></figure>

<figure><img src="/files/YmQwfhGIyqvtJQhSfdwr" alt=""><figcaption><p>Обзор задачи</p></figcaption></figure>

<figure><img src="/files/emPgtXAtXQGHVvTlhDi7" alt=""><figcaption><p>Положение</p></figcaption></figure>

<figure><img src="/files/3PrzFKsLAm866kNcuzx2" alt=""><figcaption><p>Просмотр посылок</p></figcaption></figure>

<figure><img src="/files/u4DcqlLKut8WCApTABFD" alt=""><figcaption><p>Статусы выполнения</p></figcaption></figure>


# Интерфейс учителя

(тут должна быть картинка)

<figure><img src="/files/mzk3zZ7CKPOqa6VC3kj7" alt=""><figcaption><p>Вход</p></figcaption></figure>

<figure><img src="/files/rMgnXtVnaNb3gslYr0i0" alt=""><figcaption><p>Соревнования</p></figcaption></figure>

<figure><img src="/files/poq8IAW6IUu5llqbllY1" alt=""><figcaption><p>Настройки соревнований</p></figcaption></figure>

<figure><img src="/files/T98Gtwx6Dm6Jj2GL5K3X" alt=""><figcaption><p>Таблица пользователей</p></figcaption></figure>

<figure><img src="/files/QayErbcUurMVgSa0WoKQ" alt=""><figcaption><p>Таблица пользователей с режимом печати</p></figcaption></figure>

<figure><img src="/files/1hREFVH3AGUJPT7iQ2uT" alt=""><figcaption><p>Окно печати</p></figcaption></figure>

<figure><img src="/files/p5ZsRR81QsNpsuSIFcRe" alt=""><figcaption><p>Настройки доступа соревнования</p></figcaption></figure>

<figure><img src="/files/xtgLV322pe3uZDc4alAx" alt=""><figcaption><p>Рейтинг с просмотром посылок</p></figcaption></figure>


# Установка

## Docker

{% hint style="warning" %}
Если до этого у вас не был установлен Docker, пожалуйста, установите. Без этого ничего работать не будет [\[Ссылка на гайд по установке\]](https://docs.docker.com/engine/install/)
{% endhint %}

### Выберете вашу архитектуру

{% tabs %}
{% tab title="x64" %}
Для установки потребуется скачать репозиторий и развернуть Docker compose Container

скачивание образов из репозитория:

```bash
docker compose pull
```

запуск:

```sh
docker compose up
```

{% endtab %}

{% tab title="другие" %}
Для установки потребуется скачать репозиторий и развернуть Docker compose Container

сборка образов:

```bash
docker compose build
```

запуск:

```sh
docker compose up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Для запуска контейнеров в фоновом режиме используйте флаг *<mark style="color:blue;">**-d**</mark>*

Пример:

{% code fullWidth="false" %}

```bash
docker compose up -d
```

{% endcode %}
{% endhint %}

После этого, пожалуйста, настройке языки программирования. Это описано на следующей странице


# Значения по умолчанию

### Стандартные данные

{% hint style="info" %}
Для входа в систему учителя введите данные

\
Логин: admin\
Пароль: admin
{% endhint %}

{% hint style="danger" %}
СМЕНИТЕ ПАРОЛЬ СРАЗУ ПОСЛЕ НАСТРОЙКИ
{% endhint %}

### Стандартные языки программирования

Они доступны сразу после установки системы

* [x] Python
* [x] Java
* [ ] Остальное вы можете добавить сами

### Cтандартные задания для соревнований

#### Задание 1:  <mark style="color:orange;">Футбол</mark>

{% code overflow="wrap" %}

```
Петя и Вася играют в футбол. Петя забил А голов, а Вася - В голов.Ваша задача посчитать, сколько всего голов было забито в данной игре :)
```

{% endcode %}

{% code overflow="wrap" %}

```
На ввод подаются два числа на разных строках. A - число головзабитых Петей. B - Васей.

0 ≤ А ≤ 10^9
0 ≤ B ≤ 10^9

Выведите общее количество голов в игре
```

{% endcode %}

#### Задание 2: <mark style="color:orange;">Четность числа</mark> &#x20;

{% code overflow="wrap" %}

```
Маша и Даша спорят, кто больше разбирается в математике. При этом, Даша не знает почти ничего. Помогите ей выиграть спор. Ваша задача написать программу, определяющую четность числа
```

{% endcode %}

{% code overflow="wrap" %}

```
-10^6 <= N <= 10^6

Вывести "YES", если число четное. "NO" - если нечетное. (Вывод выполняется без ковычек)
```

{% endcode %}


# Как зайти

<figure><img src="/files/5lgB0uAxwX7OJaF5ebqA" alt=""><figcaption></figcaption></figure>

Для доступа к странице необходимо перейти на <mark style="color:red;">gateway</mark>, порт <mark style="color:red;">2500</mark>\
Если система запускается локально, то <http://localhost:2500>

Тестировать фронтенды, интерфейсы пользователей напрямую, без использования порта gateway, невозможно.

{% hint style="warning" %}
**Почему так?**\
\
Это происходит из-за того, что фронтенды настроены ходить на тот же порт. При открытии фронтенда без gateway, приложение пытается обратиться к АПИ, но из-за другого порта этого не получится
{% endhint %}

Базы данных, API будут прекрасно работать


# Настройка языков программирования

## Добавление чекера языка программирования в базу данных

1. Запустить систему
2. Подключиться к базе данных ***cb***(порт 25565)
3. Выбрать схему ***public***
4. Выбрать таблицу ***servers***
5. Внести данные (Добавить новый чекер)

<figure><img src="/files/X8D0QGlhVxYka83nEyLx" alt=""><figcaption></figcaption></figure>

6. Сохранить и закрыть.

{% hint style="info" %}
Для данных действий я использовал программу [*pgAdmin 4*](https://www.pgadmin.org/)
{% endhint %}

## Добавление других языков программирования в систему

Список подготовленных образов для языков программирования Вы можете найти [здесь](/ru/ustanovka/obrazy-chekerov).

* Скачайте *<mark style="color:purple;">**NAME**</mark>*.Dockefile (Где *<mark style="color:purple;">**NAME**</mark>* - имя файла)
* В `docker-compose.yml` напишите новый сервис.\
  Пример нового `docker-compose.yml`<br>

<...> - сокращенный код

{% code title="docker-compose.yml" lineNumbers="true" %}

```yaml
version: "3.9"
services:
  frontend:
    build: FRONTEND/.
    ports:
      - "80:80"
    restart: unless-stopped
  <...>
  checker-goland:
    build:
      dockerfile: ./NAME.Dockerfile
    restart: unless-stopped

```

{% endcode %}

Более подробное описание файла:\
\
*Строчка 3* - системный сервис, где <mark style="color:red;">frontend</mark> - его название. Его трогать не нужно\
\
*Строчка 9* - наш новый чекер для языка программирования. Мы можем дать ему любое название, но я дам <mark style="color:red;">checker-goland</mark>\
\
*Строка 10*: относительный путь до образа чекера\
(Кидать файл можно только в корень, путь - <mark style="color:red;">./</mark><mark style="color:purple;">NAME</mark><mark style="color:red;">.Dockerfile</mark><br>

{% hint style="danger" %}
Внимание! В yml файлах отступы играют большую роль, поэтому копируйте, не забывая отступы
{% endhint %}


# Образы чекеров

## Таблица чекеров

| Название языка | Ссылка                                                                                                         |
| -------------- | -------------------------------------------------------------------------------------------------------------- |
| Python         | [Python.Dockerfile](https://github.com/doctorixx/CodeBattles-GitBook/blob/main/.dockerfiles/Python.Dockerfile) |
| Java           | [Java.Dockerfile](https://github.com/doctorixx/CodeBattles-GitBook/blob/main/.dockerfiles/Java.Dockerfile)     |

## Как скачать?

<figure><img src="/files/W8kl5dY4oKzVbkftYUOU" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Для скачивания нажать на кнопку, которая выделена <mark style="color:red;">красным</mark> цветом на фото
{% endhint %}


# Архитектура

<figure><img src="/files/UVGihg1Rkih49cZVSUEV" alt=""><figcaption></figcaption></figure>

*<mark style="color:red;">**Redis**</mark>* - кеш для сложных запросов (...)

*<mark style="color:purple;">**Gateway**</mark>* - Nginx для разделения запросов на несколько серверов

*<mark style="color:green;">**Init Configurer**</mark>* - исполнение sql при первой загрузке приложения и инициализации стандартного состояния (Python)

*<mark style="color:blue;">**PostgeSQL**</mark>* - база данных (...)

*<mark style="color:purple;">Frontend</mark>* -Для интерфейса учителя  Nginx (JS, React)&#x20;

*<mark style="color:purple;">Frontend\_2</mark>* -Для интерфейса участника Nginx (JS, React)

*<mark style="color:orange;">Backend</mark>* - api (Python, Flask)

*<mark style="color:blue;">**\*\*\*\* cheker**</mark>* - сервис для проверки задач на нужном языке (Java, Javalin)


# Production Архитектура

<figure><img src="/files/XkaCqRRyEfF6ZFrwgvor" alt=""><figcaption></figcaption></figure>

Для анализа логов мы возьмем ELK стек.

Также сделаем доступ через https для защиты данных.

Для защиты от DDOS мы возьмем прокси cloudflare.&#x20;

Примерно в такой архитектуре будет работать система в нашей школе после всех тестов


# Подготовка задач

### Для этого есть 2 подхода:

{% content-ref url="/spaces/9dbIa69nTWIA6cXFJbio/pages/4fGMEFtLMz9vGsYdRwPg" %}
[Создание своей задачи](/ru/svoe-sorevnovanie/podgotovka-zadach/sozdanie-svoei-zadachi)
{% endcontent-ref %}

{% content-ref url="/spaces/9dbIa69nTWIA6cXFJbio/pages/1kyr5wn5J175XEu7lB6K" %}
[Импорт готовой задачи](/ru/svoe-sorevnovanie/podgotovka-zadach/import-gotovoi-zadachi)
{% endcontent-ref %}


# Создание своей задачи

## Генерация шаблона задачи

Для удобной работы с задачами есть [TestsGeneratorFramework](https://github.com/doctorixx/TestsGeneratorFramework)\
Скачиваем его и заходим в основную папку, где есть ***manager.py***

Для генерации задачи вводим в консоль ({NAME} - имя задачки)

```css
python manager.py create {NAME} -f -e 
```

На Linux, возможно, потребуется запустить через команду ***python3***

```css
python3 manager.py create {NAME} -f -e
```

После этого в папке programms появилась наша папка( В примере {NAME} = test}

<figure><img src="/files/sthetUcO5zthUksofcNe" alt=""><figcaption></figcaption></figure>

| Имя файла       | Предназначение         |
| --------------- | ---------------------- |
| description.txt | Описание задачи        |
| in\_data.txt    | Входные данные задачи  |
| name.txt        | Имя задачи             |
| out\_data.txt   | Выходные данные задачи |

| Имя файла | Предназначение                                                                  |
| --------- | ------------------------------------------------------------------------------- |
| build.py  | Файл для сборки задачи.(Рассмотрим позже)                                       |
| main.py   | Эталонная программа для данной задачи (Благодаря ей будут генерироваться тесты) |
|           |                                                                                 |

Теперь давайте рассмотрим содержимое файла build.py.

<mark style="color:green;">examples</mark> - словарь, где ключ - входные данные, значение - выходные\ <mark style="color:green;">input\_data</mark> - список с входными значениями, с которыми сгенерируются тесты

Для большего понимания рассмотрим страницу с задачей, что именно куда подставляется. И попробуем сделать такую же задачу

## Свои тесты для программы

Примеры напишем сами, а вот входные данные сгенерируем с помощью программы. \
Изменяем build.py и эталон программы

{% code title="main.py" lineNumbers="true" %}

```python
n = int(input())
if n % 2 == 0:
    print("YES"
else:
    print("NO")

```

{% endcode %}

{% code title="build.py" lineNumbers="true" fullWidth="false" %}

```python
from core.runner import Runner
from random import randint

runner = Runner()

examples = {
    "2": "YES",
    "3": "NO",
}

input_data = []

for i in range(30):
    input_data.append(randint(0, 100))

out = runner.run_many(input_data)
runner.save_tests(out, input_data)
runner.save_examples(examples)
runner.build(indent=2)
print("[+] Done")

```

{% endcode %}

## Изменяем описание

{% hint style="info" %}
Система может воспринимать формат текста ***Markdown***.  [\[Примеры формата\]](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
{% endhint %}

Также изменяем описание, входные и выходные данные. Показывать не буду, т.к будет много текста. Просто напишу везде *test*

<details>

<summary>Все файлы</summary>

{% code title="name.txt" %}

```
test
```

{% endcode %}

{% code title="description.txt" %}

```
test
```

{% endcode %}

{% code title="in\_data.txt" %}

```
test
```

{% endcode %}

{% code title="out\_data.txt" %}

```
test
```

{% endcode %}

</details>

## Генерация задачи

После всех шагов, запускаем ***build.py***

<details>

<summary>Вывод</summary>

```
[/] Tests are running 
30/30 
[+] Tests was built
[/] Building export 
[+] Export was built 
[+] Done
```

</details>

***

У нас появился файл build.json . Это и есть наша сгенерированная задача. Ее мы будет загружать на платформу

Этот файл содержит все данные, тесты, примеры.

<details>

<summary>build.json</summary>

```json5
{
  "name": "test",
  "description": "test",
  "in": "test",
  "out": "test",
  "examples": [
    ["2", "YES"],
    ["3", "NO"]
  ],
  "tests": [
    [
      "87",
      "NO"
    ],
    [
      "11",
      "NO"
    ],
    [
      "73",
      "NO"
    ],
    [
      "40",
      "YES"
    ],
    [
      "97",
      "NO"
    ],
    [
      "51",
      "NO"
    ],
    [
      "9",
      "NO"
    ],
    [
      "80",
      "YES"
    ],
    [
      "70",
      "YES"
    ],
    [
      "75",
      "NO"
    ],
    [
      "7",
      "NO"
    ],
    [
      "56",
      "YES"
    ],
    [
      "62",
      "YES"
    ],
    [
      "14",
      "YES"
    ],
    [
      "32",
      "YES"
    ],
    [
      "53",
      "NO"
    ],
    [
      "25",
      "NO"
    ],
    [
      "0",
      "YES"
    ],
    [
      "23",
      "NO"
    ],
    [
      "74",
      "YES"
    ],
    [
      "82",
      "YES"
    ],
    [
      "19",
      "NO"
    ],
    [
      "99",
      "NO"
    ],
    [
      "56",
      "YES"
    ],
    [
      "41",
      "NO"
    ],
    [
      "43",
      "NO"
    ],
    [
      "54",
      "YES"
    ],
    [
      "57",
      "NO"
    ],
    [
      "14",
      "YES"
    ],
    [
      "57",
      "NO"
    ]
  ]
}
```

</details>

<mark style="color:green;">**Готово!**</mark>


# Импорт готовой задачи

Вы можете найти готовые задачи на нашем репозитории задач

Он находится по этой [ссылке](https://github.com/CodeBattles-nn/problems-repo)

***

Выберете задачу, которую хотите использовать

<figure><img src="/files/BoiqeHP0tF9BNo5mI03J" alt=""><figcaption></figcaption></figure>

Перейдите в выбранную папку

<figure><img src="/files/1r1qHl1UTZU7xdPUoHTr" alt=""><figcaption></figcaption></figure>

Скопируйте содержимое файла `build.json`

<figure><img src="/files/Ckmgvv3h3E7TRSo6GpS0" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Этот файл нужно использовать для добавления в соревнование
{% endhint %}


# Создание соревнования

### Вход в панель учителя

* Войдите в аккаунт учителя

<figure><img src="/files/MyPctPSeWtvSGzjj0ZiK" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Для входа в систему учителя введите данные

\
Логин: admin\
Пароль: admin
{% endhint %}

{% hint style="danger" %}
СМЕНИТЕ ПАРОЛЬ СРАЗУ ПОСЛЕ НАСТРОЙКИ
{% endhint %}

### Создание соревнования

<figure><img src="/files/GxdkaZCpoQY170udoRRR" alt=""><figcaption><p>Нажмите на кнопку добавить</p></figcaption></figure>

Перейдите в настройки созданного соревнования

<figure><img src="/files/yX2gAOuBQCDoQExvtMWr" alt=""><figcaption></figcaption></figure>

### Добавление пользователей

Перейдите во вкладку `управление пользователями` -> `Добавить`

<figure><img src="/files/gUvqrtXwKuLZLg7uROpB" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Обратите внимание, что каждый пользователь на новой строке
{% endhint %}

<figure><img src="/files/rZxnvMGDeopRuMgrm4Yc" alt=""><figcaption></figcaption></figure>

После добавление пользователей их будет видно в разделе управление пользователями, их фамилии, логины и пароли.

<figure><img src="/files/AqqsCALHaMhpb5AmxOM8" alt=""><figcaption></figcaption></figure>

### Добавление задач

> Вернитесь к разделу настройки соревнования

<figure><img src="/files/0u0LMqitEiWB4CAhBgOM" alt=""><figcaption></figcaption></figure>

Нажмите на  <mark style="background-color:blue;">посмотреть все задачи</mark>

<figure><img src="/files/r3WYKPDObe0BKSEyOcXq" alt=""><figcaption></figcaption></figure>

При клике на название можно открыть предпросмотр задачи

<figure><img src="/files/Fceoy8TClr8SZxKElFG5" alt=""><figcaption></figcaption></figure>

Чтобы добавить задачу в соревнование, введите ее ID и Букву, которая будет присвоена в соревновании

{% hint style="danger" %}
Для корректной работы системы добавляйте все буквы задачам.

Пример:

* <mark style="color:green;">А, B, C -> Можно</mark>
* <mark style="color:red;">A, D, E -> Нельзя</mark>
  {% endhint %}

<figure><img src="/files/sHqOMNADlkhpezwhWSiE" alt=""><figcaption></figcaption></figure>

**Задачи добавлены!**


# About the system

System for programming competitions

{% hint style="danger" %}
This documentation is for version v2. This version and its documentation are no longer supported.\
\
See [Codebattles V3](https://docs.codebattles.ru/ru_v3)
{% endhint %}

## Who This System is Suitable For

Initially, the system was developed for schools and teachers who want to conduct lessons in a more interesting and interactive format. However, you can also organize your own competitions, for example, among your friends.

## Navigation

For your convenience, all documentation is divided into sections. You can access them from the menu on the left.

{% hint style="info" %}
If you found an answer to your question here, you can write to [Telegram](https://doctorixx.t.me/)
{% endhint %}


# Participant interface

<figure><img src="/files/w9J5AiuMxFaWcGY7uEbX" alt=""><figcaption><p>Login Page</p></figcaption></figure>

<figure><img src="/files/49TbkRFaLkiBJHYgjQK6" alt=""><figcaption><p>Problems</p></figcaption></figure>

<figure><img src="/files/iGhrp2vP798YPGQGj376" alt=""><figcaption><p>Submit Solution</p></figcaption></figure>

<figure><img src="/files/1JtnALUpBOLoeSyUN7Ei" alt=""><figcaption><p>Connection Error</p></figcaption></figure>

<figure><img src="/files/u3DvuwNoppQxPUPHC2d0" alt=""><figcaption><p>Problem Overview</p></figcaption></figure>

<figure><img src="/files/kRPdPfNy6dgUL8NWo4dJ" alt=""><figcaption><p>Standings</p></figcaption></figure>

<figure><img src="/files/mhOKAhqTPnhGTJCyrPrZ" alt=""><figcaption><p>View Submissions</p></figcaption></figure>

<figure><img src="/files/MXIK149j6pihbqZRPsav" alt=""><figcaption><p>Completion Statuses</p></figcaption></figure>


# Teacher interface

**Teacher Interface**

<figure><img src="/files/nMERzzumCdeN5MKiFq51" alt=""><figcaption><p>Login</p></figcaption></figure>

<figure><img src="/files/SagWhOsNhB1YI1saLRyK" alt=""><figcaption><p>Competitions</p></figcaption></figure>

<figure><img src="/files/Y56uXXq3COLyyPMhFCa1" alt=""><figcaption><p>Competition Settings</p></figcaption></figure>

<figure><img src="/files/FrHkscn3DsM38SDPojSx" alt=""><figcaption><p>User Table</p></figcaption></figure>

<figure><img src="/files/1LwmrUZoW3fZp5G9Xs1X" alt=""><figcaption><p>User Table with Print Mode</p></figcaption></figure>

<figure><img src="/files/sPBjHgw2mkXCeOACqTeO" alt=""><figcaption><p>Print Window</p></figcaption></figure>

<figure><img src="/files/00GGiYxrxNYsDXGE14CB" alt=""><figcaption><p>Competition Access Settings</p></figcaption></figure>

<figure><img src="/files/aQFTLjXkM2gbSjExuJ8m" alt=""><figcaption><p>Rating with Submission View</p></figcaption></figure>


# Installation

## Docker

{% hint style="warning" %}
If you haven't installed Docker before, please install it. Nothing will work without it [\[Installation Guide Link\]](https://docs.docker.com/engine/install/)
{% endhint %}

### Choose your architecture

{% tabs %}
{% tab title="x64" %}
To install, you need to download the repository and deploy the Docker Compose Container

downloading images from the repository:

```bash
docker compose pull
```

start:

```sh
docker compose up
```

{% endtab %}

{% tab title="other" %}
To install, you need to download the repository and deploy the Docker Compose Container

building images:

```bash
docker compose build
```

start:

```sh
docker compose up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
To run containers in the background, use the *<mark style="color:blue;">**-d**</mark>* flag

Example:

{% code fullWidth="false" %}

```bash
docker compose up -d
```

{% endcode %}
{% endhint %}

After this, please configure the programming languages. This is described on the next page


# Default values

### Standard Data

{% hint style="info" %}
To log into the teacher's system, enter the following data

\
Login: admin\
Password: admin
{% endhint %}

{% hint style="danger" %}
CHANGE THE PASSWORD IMMEDIATELY AFTER SETUP
{% endhint %}

### Standard Programming Languages

They are available immediately after system installation

* [x] Python
* [x] Java
* [ ] You can add the rest yourself

### Standard Competition Tasks

#### Task 1: <mark style="color:orange;">Football</mark>

{% code overflow="wrap" %}

```
Petya and Vasya are playing football. Petya scored A goals, and Vasya scored B goals. Your task is to calculate the total number of goals scored in the game :)
```

{% endcode %}

{% code overflow="wrap" %}

```
Two numbers are given on separate lines. A - the number of goals scored by Petya. B - by Vasya.

0 ≤ A ≤ 10^9
0 ≤ B ≤ 10^9

Output the total number of goals in the game
```

{% endcode %}

#### Task 2: <mark style="color:orange;">Even Number</mark>

{% code overflow="wrap" %}

```
Masha and Dasha are arguing about who knows more about mathematics. Meanwhile, Dasha knows almost nothing. Help her win the argument. Your task is to write a program that determines the evenness of a number.
```

{% endcode %}

{% code overflow="wrap" %}

```
-10^6 <= N <= 10^6

Output "YES" if the number is even. "NO" if it is odd. (Output without quotes)
```

{% endcode %}


# How to log in

<figure><img src="/files/ure9kzytovxyjR2uo7vs" alt=""><figcaption></figcaption></figure>

To access the page, you need to go to the <mark style="color:red;">gateway</mark>, port <mark style="color:red;">2500</mark>\
If the system is running locally, then <http://localhost:2500>

It is impossible to test frontends, user interfaces directly without using the gateway port.

{% hint style="warning" %}
**Why is this?**\
\
This occurs because the frontends are configured to go to the same port. When opening the frontend without the gateway, the application tries to access the API, but this will not work due to the different port
{% endhint %}

Databases and APIs will work fine


# Programming language setup

### Setting up programming languages

### Adding a programming language checker to the database

1. Start the system
2. Connect to the ***cb*** database (port 25565)
3. Select the ***public*** schema
4. Select the ***servers*** table
5. Enter data (Add a new checker)

<figure><img src="/files/SKlv3y2H6jJRHU9bjGMp" alt=""><figcaption></figcaption></figure>

6. Save and close.

{% hint style="info" %}
For these actions, I used the program [*pgAdmin 4*](https://www.pgadmin.org/)
{% endhint %}

### Adding other programming languages to the system

You can find the list of prepared images for programming languages [here](/en/installation/obrazy-chekerov).

* Download *<mark style="color:purple;">**NAME**</mark>*.Dockerfile (Where *<mark style="color:purple;">**NAME**</mark>* is the file name)
* In `docker-compose.yml`, write a new service. Example of a new `docker-compose.yml`

<...> - abbreviated code

{% code title="docker-compose.yml" lineNumbers="true" %}

```yaml
version: "3.9"
services:
  frontend:
    build: FRONTEND/.
    ports:
      - "80:80"
    restart: unless-stopped
  <...>
  checker-goland:
    build:
      dockerfile: ./NAME.Dockerfile
    restart: unless-stopped

```

{% endcode %}

More detailed description of the file:

\&#xNAN;*Line 3* - system service, where <mark style="color:red;">frontend</mark> is its name. Do not change it

\&#xNAN;*Line 9* - our new checker for the programming language. We can give it any name, but I will give it <mark style="color:red;">checker-goland</mark>

\&#xNAN;*Line 10*: relative path to the checker image (You can only place the file in the root, the path is <mark style="color:red;">./</mark><mark style="color:purple;">NAME</mark><mark style="color:red;">.Dockerfile</mark>

{% hint style="danger" %}
Attention! Indentation plays a significant role in yml files, so copy without forgetting the indentation
{% endhint %}


# Checker images

## Table of Checkers

| Language Name | Link                                                                                                           |
| ------------- | -------------------------------------------------------------------------------------------------------------- |
| Python        | [Python.Dockerfile](https://github.com/doctorixx/CodeBattles-GitBook/blob/main/.dockerfiles/Python.Dockerfile) |
| Java          | [Java.Dockerfile](https://github.com/doctorixx/CodeBattles-GitBook/blob/main/.dockerfiles/Java.Dockerfile)     |

## How to Download?

<figure><img src="/files/O83j6pcgItFsKalJvOed" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
To download, click the button highlighted in <mark style="color:red;">red</mark> on the photo
{% endhint %}


# Architecture

<figure><img src="/files/aly7bIvUg1boE5SyvJbJ" alt=""><figcaption></figcaption></figure>

*<mark style="color:red;">**Redis**</mark>* - cache for complex queries (...)

*<mark style="color:purple;">**Gateway**</mark>* - Nginx for distributing requests to multiple servers

*<mark style="color:green;">**Init Configurer**</mark>* - executing SQL on the first application load and initializing the standard state (Python)

*<mark style="color:blue;">**PostgreSQL**</mark>* - database (...)

*<mark style="color:purple;">Frontend</mark>* - For the teacher interface Nginx (JS, React)

*<mark style="color:purple;">Frontend\_2</mark>* - For the participant interface Nginx (JS, React)

*<mark style="color:orange;">Backend</mark>* - api (Python, Flask)

*<mark style="color:blue;">\*\*\*\* cheker\*\*</mark>* - service for checking tasks in the desired language (Java, Javalin)


# Production Architecture

<figure><img src="/files/X8Pyt7jU2Ygx8OQMGhNN" alt=""><figcaption></figcaption></figure>

For log analysis, we will use the ELK stack.

We will also provide access via https for data protection.

For DDoS protection, we will use Cloudflare proxy.

The system will operate in approximately this architecture at our school after all tests.


# Preparing tasks

## There are 2 approaches for this:

{% content-ref url="/pages/6wgHzb60ETdRgxPOSnLm" %}
[Creating your own task](/en/your-own-competition/podgotovka-zadach/sozdanie-svoei-zadachi)
{% endcontent-ref %}

{% content-ref url="/pages/do77vSHmEwrgB00v6O6U" %}
[Importing a ready-made task](/en/your-own-competition/podgotovka-zadach/import-gotovoi-zadachi)
{% endcontent-ref %}


# Creating your own task

## Task Template Generation

For convenient work with tasks, there is [TestsGeneratorFramework](https://github.com/doctorixx/TestsGeneratorFramework) Download it and go to the main folder where there is ***manager.py***

To generate a task, enter the following in the console ({NAME} is the task name)

```css
python manager.py create {NAME} -f -e
```

On Linux, you may need to run it using the ***python3*** command

```css
python3 manager.py create {NAME} -f -e
```

After that, our folder appears in the programms folder (In the example {NAME} = test)

<figure><img src="/files/7srMJ7JacqoX9DHLMtGY" alt=""><figcaption></figcaption></figure>

| File Name       | Purpose                  |
| --------------- | ------------------------ |
| description.txt | Task Description         |
| in\_data.txt    | Input Data for the Task  |
| name.txt        | Task Name                |
| out\_data.txt   | Output Data for the Task |

| File Name | Purpose                                                                |
| --------- | ---------------------------------------------------------------------- |
| build.py  | File for task assembly. (We will discuss it later)                     |
| main.py   | Reference program for the task (Tests will be generated based on this) |

Now let's look at the contents of the build.py file.

<mark style="color:green;">examples</mark> - dictionary where the key is input data, and the value is output data <mark style="color:green;">input\_data</mark> - list with input values for which tests will be generated

To better understand, let's look at the task page and see what exactly is substituted where. And let's try to create a similar task.

## Your Own Tests for the Program

We will write the examples ourselves, but the input data will be generated using the program. Modify build.py and the reference program

{% code title="main.py" lineNumbers="true" %}

```python
n = int(input())
if n % 2 == 0:
    print("YES")
else:
    print("NO")

```

{% endcode %}

{% code title="build.py" lineNumbers="true" fullWidth="false" %}

```python
from core.runner import Runner
from random import randint

runner = Runner()

examples = {
    "2": "YES",
    "3": "NO",
}

input_data = []

for i in range(30):
    input_data.append(randint(0, 100))

out = runner.run_many(input_data)
runner.save_tests(out, input_data)
runner.save_examples(examples)
runner.build(indent=2)
print("[+] Done")

```

{% endcode %}

## Modifying the Description

{% hint style="info" %}
The system can accept text in ***Markdown*** format. [\[Markdown Examples\]](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
{% endhint %}

We also modify the description, input, and output data. I won't show it because there will be a lot of text. I'll just write *test* everywhere.

<details>

<summary>All Files</summary>

{% code title="name.txt" %}

```
test
```

{% endcode %}

{% code title="description.txt" %}

```
test
```

{% endcode %}

{% code title="in\_data.txt" %}

```
test
```

{% endcode %}

{% code title="out\_data.txt" %}

```
test
```

{% endcode %}

</details>

## Task Generation

After all the steps, run ***build.py***

<details>

<summary>Output</summary>

```
[/] Tests are running
30/30
[+] Tests was built
[/] Building export
[+] Export was built
[+] Done
```

</details>

***

We now have a build.json file. This is our generated task. We will upload it to the platform.

This file contains all data, tests, and examples.

<details>

<summary>build.json</summary>

```json5
{
  "name": "test",
  "description": "test",
  "in": "test",
  "out": "test",
  "examples": [
    ["2", "YES"],
    ["3", "NO"]
  ],
  "tests": [
    [
      "87",
      "NO"
    ],
    [
      "11",
      "NO"
    ],
    [
      "73",
      "NO"
    ],
    [
      "40",
      "YES"
    ],
    [
      "97",
      "NO"
    ],
    [
      "51",
      "NO"
    ],
    [
      "9",
      "NO"
    ],
    [
      "80",
      "YES"
    ],
    [
      "70",
      "YES"
    ],
    [
      "75",
      "NO"
    ],
    [
      "7",
      "NO"
    ],
    [
      "56",
      "YES"
    ],
    [
      "62",
      "YES"
    ],
    [
      "14",
      "YES"
    ],
    [
      "32",
      "YES"
    ],
    [
      "53",
      "NO"
    ],
    [
      "25",
      "NO"
    ],
    [
      "0",
      "YES"
    ],
    [
      "23",
      "NO"
    ],
    [
      "74",
      "YES"
    ],
    [
      "82",
      "YES"
    ],
    [
      "19",
      "NO"
    ],
    [
      "99",
      "NO"
    ],
    [
      "56",
      "YES"
    ],
    [
      "41",
      "NO"
    ],
    [
      "43",
      "NO"
    ],
    [
      "54",
      "YES"
    ],
    [
      "57",
      "NO"
    ],
    [
      "14",
      "YES"
    ],
    [
      "57",
      "NO"
    ]
  ]
}
```

</details>

<mark style="color:green;">**Done!**</mark>


# Importing a ready-made task

You can find prepared tasks in our task repository.

It is located at this [link](https://github.com/CodeBattles-nn/problems-repo)

***

Choose the task you want to use

<figure><img src="/files/QR8MiS0geTXEiiR8OEtq" alt=""><figcaption></figcaption></figure>

Navigate to the selected folder

<figure><img src="/files/H6h4g3M4yLVPwTvagPRM" alt=""><figcaption></figcaption></figure>

Copy the contents of the `build.json` file

<figure><img src="/files/QanlrGMIND5uhD88Cexx" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This file should be used for adding to the competition
{% endhint %}


# Creating a competition

### Teacher Panel Login

* Log in to the teacher's account

<figure><img src="/files/sthetUcO5zthUksofcNe" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
To log into the teacher system, enter the following details

\
Login: admin\
Password: admin
{% endhint %}

{% hint style="danger" %}
CHANGE THE PASSWORD IMMEDIATELY AFTER SETUP
{% endhint %}

### Creating a Competition

<figure><img src="/files/rbatgZE8FAf1TMvVUcnF" alt=""><figcaption><p>Click the add button</p></figcaption></figure>

Go to the settings of the created competition

<figure><img src="/files/X8D0QGlhVxYka83nEyLx" alt=""><figcaption></figcaption></figure>

### Adding Users

Go to the `user management` tab -> `Add`

<figure><img src="/files/V0mgCtBmnAmXYF1yRury" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Note that each user should be on a new line
{% endhint %}

<figure><img src="/files/8fQXKLqxQM6XWv2AbJoJ" alt=""><figcaption></figcaption></figure>

After adding users, they will be visible in the user management section, including their last names, logins, and passwords.

<figure><img src="/files/BHZc8l9AwzZ3lXz34wrP" alt=""><figcaption></figcaption></figure>

### Adding Tasks

> Return to the competition settings section

<figure><img src="/files/3PrzFKsLAm866kNcuzx2" alt=""><figcaption></figcaption></figure>

Click on <mark style="background-color:blue;">view all tasks</mark>

<figure><img src="/files/emPgtXAtXQGHVvTlhDi7" alt=""><figcaption></figcaption></figure>

Clicking on the title opens a preview of the task

<figure><img src="/files/u4DcqlLKut8WCApTABFD" alt=""><figcaption></figcaption></figure>

To add a task to the competition, enter its ID and the Letter that will be assigned in the competition

{% hint style="danger" %}
For the system to work correctly, assign all letters to tasks.

Example:

* <mark style="color:green;">A, B, C -> Allowed</mark>
* <mark style="color:red;">A, D, E -> Not Allowed</mark>
  {% endhint %}

<figure><img src="/files/jYczvmqselpN5PTa74uv" alt=""><figcaption></figcaption></figure>

**Tasks Added!**


# О системе V3

Система для соревнований по программированию

{% hint style="success" %}
Эта документация для версии v3, которая активно развивается и поддерживается
{% endhint %}

## Для кого подходит эта система

Изначально система разрабатывалась для школ и учителей, которые хотят проводить уроки в более интересном и интерактивном формате. Но также Вы можете организовывать свои соревнования, например, среди своих друзей.

## Навигация&#x20;

Для Вашего удобства, вся документация разделена на разделы. Перейти в них можно в меню слева

## Для разработчиков

Если вы разработчик и хотите писать свои инструменты, описание API находится в разделе API

[Backend API ](/api/backend)- основной API&#x20;

[Checker API](/api/checker-api) - апи для чекеров, которые проверяют решение

{% hint style="info" %}
Если вы нашли ответ на свой вопрос здесь, можете написать в [Telegram](https://doctorixx.t.me/)
{% endhint %}


# Contribution Guidelines

Если вы хотите помочь проекту и дополнять его, вы можете создавать Pool Request\`ы

Краткий обзор по актуальным существующим репозиториям системы Codebattls:

### Landing

<figure><img src="/files/CuLJipJKpyFUSnZdZr0d" alt=""><figcaption></figcaption></figure>

Репозиторий главного сайта([codebattles.ru](https://codebattles.ru)). На текущий момент находится в репозитории пользователя из-за ограничений Vercel

### Codebattles

<figure><img src="/files/ZidsP6ZZy8qK4pB1ncIF" alt=""><figcaption></figcaption></figure>

Основная система. Подробнее можно прочитать в этой документации

### docs\_RU\_V3

<figure><img src="/files/prp8YqXhGh6IBE6PeEGk" alt=""><figcaption></figcaption></figure>

Репозиторий текущей документации


# Интерфейс участника

<figure><img src="/files/cHG592t8y2rU6P6fU41U" alt=""><figcaption><p>Страница входа</p></figcaption></figure>

<figure><img src="/files/KIkWPZbgXzTeNhoikCey" alt=""><figcaption><p>Страница профиля</p></figcaption></figure>

<figure><img src="/files/9P5yrvmZBSK6841jDSPd" alt=""><figcaption><p>Соревнования участника</p></figcaption></figure>

<figure><img src="/files/BJPqHjGEgjB24H918luc" alt=""><figcaption><p>Задачи сореванования</p></figcaption></figure>

<figure><img src="/files/niXGWum5UF9yCJ3HO9SL" alt=""><figcaption><p>Просмотр задачи 1</p></figcaption></figure>

<figure><img src="/files/BvH7JGClUKg2LQ6jgZGX" alt=""><figcaption><p>Просмотр задачи 2</p></figcaption></figure>

<figure><img src="/files/LaD5wC2KnhjyPQHhCzkJ" alt=""><figcaption><p>Посылки участника</p></figcaption></figure>

<figure><img src="/files/HLudO3FvsPKLnObSQN79" alt=""><figcaption><p>Рейтинг соревнования</p></figcaption></figure>

<figure><img src="/files/QOF461RyBsteEjwCZa8R" alt=""><figcaption><p>Статусы выполнения тестов</p></figcaption></figure>


# Интерфейс администратора

(тут должна быть картинка)

<figure><img src="/files/RYco1IpR8PuOFxDUvbYq" alt=""><figcaption></figcaption></figure>


# Задачи

<figure><img src="/files/P7LGd9JDkJOEQFm6Qldm" alt=""><figcaption><p>Просмотр всех задач</p></figcaption></figure>

<figure><img src="/files/DkmVUtKVedeeWC6iqvhw" alt=""><figcaption><p>Создать задачу</p></figcaption></figure>

<figure><img src="/files/FFbcrbNMBvwzjrKXxOji" alt=""><figcaption><p>Редактировать задачу</p></figcaption></figure>


# Пользователи

<figure><img src="/files/wxwnqJLpC5YeaF21E3Um" alt=""><figcaption><p>Просмотр пользователей</p></figcaption></figure>

<figure><img src="/files/Ut9hGMKII3ssKFevlNhF" alt=""><figcaption><p>Создание пользователя</p></figcaption></figure>

<figure><img src="/files/uMsfp7WBTV4fLIBQtVI3" alt=""><figcaption><p>Генерация пароля при создании пользователя</p></figcaption></figure>


# Чекеры

<figure><img src="/files/yQrnFwJEwP1zOfxx6VCM" alt=""><figcaption><p>Просмотр чекеров</p></figcaption></figure>

<figure><img src="/files/Oy1r08D6ZBUmwE7Wda60" alt=""><figcaption><p>Добавить чекер</p></figcaption></figure>

<figure><img src="/files/EJ5vA3fNInVqsmyRD2qV" alt=""><figcaption><p>Редактировать чекер</p></figcaption></figure>


# Соревнования

<figure><img src="/files/Y4OfQgOUbMhxgYKSUabM" alt=""><figcaption><p>Все соревнования</p></figcaption></figure>

<figure><img src="/files/p6p9j8miE2Ms40GExauQ" alt=""><figcaption><p>Сздание соревнования</p></figcaption></figure>

<figure><img src="/files/iQv5oHtUT6lPZYL6Npab" alt=""><figcaption><p>Настройки соревнования</p></figcaption></figure>

<figure><img src="/files/LarjntmOAPzieXznQsol" alt=""><figcaption><p>Редактирование задач соревнования</p></figcaption></figure>

<figure><img src="/files/F5O8H6kbUCmVg8EzKbYa" alt=""><figcaption><p>Редактирование настроек задачи соревнования</p></figcaption></figure>

<figure><img src="/files/GgS7OuCr0T4ZP4n5trpX" alt=""><figcaption><p>Добавление задачи в соревнования</p></figcaption></figure>

<figure><img src="/files/LLb85sOx7xlVaChXbZn7" alt=""><figcaption><p>Добавление чекеров в соревнования</p></figcaption></figure>

<figure><img src="/files/qOZ2RqdSI6VwCSFg0O3h" alt=""><figcaption><p>Добавление участников в соренования</p></figcaption></figure>

<figure><img src="/files/N1mHV8GnFb4xQ0xy3qPY" alt=""><figcaption><p>Рейтинг соревнования</p></figcaption></figure>


# Установка

**После установки интерфейс будет доступен на порте&#x20;**<mark style="color:red;">**2500**</mark>


# Локальная установка

{% hint style="danger" %}
На настоящих соревнованиях используйте [Production режим](/nastroika-i-ustanovka-sistemy/ustanovka/production-ustanovka). \
Он отличается более строгими политиками безопасности и не содержит инструментов для разработки
{% endhint %}

## Docker

{% hint style="warning" %}
Если до этого у вас не был установлен Docker, пожалуйста, установите. Без этого ничего работать не будет [\[Ссылка на гайд по установке\]](https://docs.docker.com/engine/install/)
{% endhint %}

### Выберете вашу архитектуру

{% tabs %}
{% tab title="x64" %}
Для установки потребуется скачать репозиторий и развернуть Docker compose Container

скачивание образов из репозитория:

```bash
docker compose pull
```

запуск:

```sh
docker compose up
```

{% endtab %}

{% tab title="другие" %}
Для установки потребуется скачать репозиторий и развернуть Docker compose Container

сборка образов:

```bash
docker compose build
```

запуск:

```sh
docker compose up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Для запуска контейнеров в фоновом режиме используйте флаг *<mark style="color:blue;">**-d**</mark>*

Пример:

{% code fullWidth="false" %}

```bash
docker compose up -d
```

{% endcode %}
{% endhint %}

После этого, пожалуйста, настройке языки программирования. Это описано на следующей странице


# Production установка

## Docker

{% hint style="warning" %}
Если до этого у вас не был установлен Docker, пожалуйста, установите. Без этого ничего работать не будет [\[Ссылка на гайд по установке\]](https://docs.docker.com/engine/install/)
{% endhint %}

### Настройте переменные окружения

Пример: <https://github.com/CodeBattles-nn/codebattles/blob/new_backend/.env.example><br>

{% code title=".env.example" lineNumbers="true" %}

```properties
DB_USER=dfvdsdfvsdswvdfvdsvdfvdf
DB_PASSWORD=dvnsevhjeiwurowuqvhjevfvuodfb
DB_NAME=cb

```

{% endcode %}

{% stepper %}
{% step %}

### Создайте файл .env

Структура назодится в .env.example
{% endstep %}

{% step %}

### Задать сложные настройки

В файле .env
{% endstep %}
{% endstepper %}

### Выберете вашу архитектуру

{% tabs %}
{% tab title="x64" %}
Для установки потребуется скачать репозиторий и развернуть Docker compose Container

скачивание образов из репозитория:

```bash
docker compose -f prod-docker-compose.yml pull
```

запуск:

```sh
docker compose -f prod-docker-compose.ymlup
```

{% endtab %}

{% tab title="другие" %}
Для установки потребуется скачать репозиторий и развернуть Docker compose Container

сборка образов:

```bash
docker compose -f prod-docker-compose.yml build
```

запуск:

```sh
docker compose -f prod-docker-compose.yml up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Для запуска контейнеров в фоновом режиме используйте флаг *<mark style="color:blue;">**-d**</mark>*

Пример:

{% code fullWidth="false" %}

```bash
docker compose up -f prod-docker-compose.yml -d
```

{% endcode %}
{% endhint %}

После этого, пожалуйста, настройке языки программирования. Это описано на следующей странице


# Создать соревнование

{% stepper %}
{% step %}

### [Создайте соревнование](/instrukcii/sorevnovanie/sozdanie-sorevnovaniya)

{% endstep %}

{% step %}

### [Добавьте задачи](/instrukcii/zadachi/dobavit-zadachu)

{% endstep %}

{% step %}

### [Добавьте задачи к соревнованию](/instrukcii/sorevnovanie/redaktirovanie-zadach-sorevnovaniya)

{% endstep %}

{% step %}

### [Добавьте чекеры](/instrukcii/sorevnovanie/redaktirovanie-zadach-sorevnovaniya)

{% endstep %}

{% step %}

### [Добавьте участников](/instrukcii/sorevnovanie/redaktirovanie-polzovatelei-sorevnovaniya)

{% endstep %}
{% endstepper %}


# Смена языка

Вкладка смены языка располагается слева сверху<br>

<figure><img src="/files/W0wpsoDdiriD1gygSVtw" alt=""><figcaption></figcaption></figure>

При нажатии на нее открывается меню с выбором языка

<figure><img src="/files/liXxj5TcnTU2t55DvuV4" alt=""><figcaption></figcaption></figure>


# Соревнование


# Создание соревнования

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/WA7VdQxgFFvWBaws4722" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Создайте соревнование

<figure><img src="/files/d51BgCDXWijMj2i3t7gh" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Редактирование чекеров соревнования

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/WA7VdQxgFFvWBaws4722" alt=""><figcaption></figcaption></figure>

Нажмите на кнопку <mark style="color:yellow;">**Управлять**</mark>
{% endstep %}

{% step %}

### Пролистайте вниз страницы и найдите кнопку редактирования чекеров

<figure><img src="/files/bUYD0xvBPsi7s9BY9jIl" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Измените чекеры

<figure><img src="/files/6jgOqzlPD9kHIFeyJIRi" alt=""><figcaption></figcaption></figure>

Если у вас нет чекера, который вам хотелось бы добавить, [создайте новый чекер](/instrukcii/chekery/sozdanie-chekera)

{% endstep %}
{% endstepper %}


# Редактирование пользователей соревнования

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/WA7VdQxgFFvWBaws4722" alt=""><figcaption></figcaption></figure>

Нажмите на кнопку <mark style="color:yellow;">**Управлять**</mark>
{% endstep %}

{% step %}

### Нажмите на <mark style="color:yellow;">пользователи</mark>

<figure><img src="/files/ZIXy1vp6HQZiwmIZmTeD" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Измените пользователей

<figure><img src="/files/pMXIsvk6Ko3ZKHf4CJPW" alt=""><figcaption></figcaption></figure>

Если вы ходите добавить нового пользователя в систему, смотрите раздел [регистрация пользователей](/instrukcii/polzovateli/registraciya-polzovatelei)

{% endstep %}
{% endstepper %}


# Редактирование задач соревнования

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/WA7VdQxgFFvWBaws4722" alt=""><figcaption></figcaption></figure>

Нажмите на кнопку <mark style="color:yellow;">**Управлять**</mark>
{% endstep %}

{% step %}

### Нажмите на задания

<figure><img src="/files/JcVYcSCIzdSZj4dj7xxW" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Далее нажмите кнопку создать

<figure><img src="/files/mZ1zpobIrxhblnXe2vxz" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Введите нужные данные&#x20;

<figure><img src="/files/Fh3wVamXPIQB1HvIcrXR" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Задачи


# Добавить задачу

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/8xDPpBXF5QrjldLfJVt0" alt=""><figcaption></figcaption></figure>

Нажмите на кнопку <mark style="color:yellow;">**Задачи**</mark>
{% endstep %}

{% step %}

### Нажмите на <mark style="color:yellow;">создать</mark>

<figure><img src="/files/dzUVLS1Ckj242dRMfBcq" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Создайте задачу

<figure><img src="/files/mgmG8W3AWVdjCawfFvRK" alt=""><figcaption></figcaption></figure>

{% endstep %}
{% endstepper %}


# Изменить задачу

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/8xDPpBXF5QrjldLfJVt0" alt=""><figcaption></figcaption></figure>

Нажмите на кнопку <mark style="color:yellow;">**Задачи**</mark>
{% endstep %}

{% step %}

### Нажмите на <mark style="color:yellow;">управлять</mark>

<figure><img src="/files/8aIzATSqpBdVQGtXK6fr" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Отредактируйте задачу

<figure><img src="/files/Jbrf66wyjFLpilZINrvX" alt=""><figcaption></figcaption></figure>

{% endstep %}
{% endstepper %}


# Удалить задачу

{% hint style="info" %}
Функционал еще в разработке
{% endhint %}


# Импорт из системы Polygon

{% stepper %}
{% step %}

### Перейдите в систему Polygon и выберите задачу&#x20;

<figure><img src="/files/yhCNH61qIEHM7dFoeNHc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### В раздел Packages

<figure><img src="/files/h77pkqcKAV2sb4eiU8Ms" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Экспортируйте как для Linux

<figure><img src="/files/6yomuDKDip2whUNt1egX" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Перейдите на платформу Codebattles

<figure><img src="/files/Ege2w6jg91zbs9ktE0Ra" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}

### Загрузите архив и добавьте задачу на платформу

<figure><img src="/files/PHcAugQ0ahFZ0kFrEVnH" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Пользователи


# Регистрация пользователей

{% stepper %}
{% step %}

### Перейтите в панель администратора

<figure><img src="/files/qoAFaxwRhynISxi5Hayl" alt=""><figcaption></figcaption></figure>

Нажмите на кнопку <mark style="color:yellow;">**Пользователи**</mark>
{% endstep %}

{% step %}

### Нажмите на <mark style="color:yellow;">Добавить</mark>

<figure><img src="/files/yLUjUajMAHQvI7kwmfrS" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Создайте пользователя

<figure><img src="/files/fdW7SWc8l6x387U8kJcg" alt=""><figcaption></figcaption></figure>

> По кнопке "Генерировать будет доступен  генератор паролей"
>
> ![](/files/2dQ4l2FHdZ251XXbp9Am)
> {% endstep %}
> {% endstepper %}


# Чекеры


# Создание чекера

{% stepper %}
{% step %}

### Перейдите во вкладку с чекерами

<figure><img src="/files/WETkoGAJkuGeNgzvstZw" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Нажмите на кнопку создать

<figure><img src="/files/XX6Bo0gi9loLyjml3HI4" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Создайте нужный чекер

<figure><img src="/files/MLgM9Gx1MPLkB5EzhXth" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

| Параметр  | Описани                                                                                                                                                                           |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Имя       | Просто имя                                                                                                                                                                        |
| Имя языка | Используется для подсветки. Просто имя языка в нижнем регистре                                                                                                                    |
| Адрес     | <p>Адрес чекера, который реализует апи.<br><br>Для всех стандарных чекеров адрес<br><br><em>http\://<mark style="color:yellow;">\<checker\_name></mark>:7070/api/v1/test</em></p> |


# Изменение чекера

{% stepper %}
{% step %}

### Перейдите во вкладку с чекерами

<figure><img src="/files/WETkoGAJkuGeNgzvstZw" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Выберете чекер и нажмите кнопку редактировать

<figure><img src="/files/XX6Bo0gi9loLyjml3HI4" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Отредактируйте значения

<figure><img src="/files/bBvTfuwauxJq7hV8VFzk" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

| Параметр  | Описани                                                                                                                                                                           |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Имя       | Просто имя                                                                                                                                                                        |
| Имя языка | Используется для подсветки. Просто имя языка в нижнем регистре                                                                                                                    |
| Адрес     | <p>Адрес чекера, который реализует апи.<br><br>Для всех стандарных чекеров адрес<br><br><em>http\://<mark style="color:yellow;">\<checker\_name></mark>:7070/api/v1/test</em></p> |


# Удаление чекера

{% hint style="info" %}
**Функционал пока в разработке**
{% endhint %}


# Архитектура

<div data-full-width="false"><figure><img src="/files/D8sctOnodcfXKmSfhSRz" alt=""><figcaption></figcaption></figure></div>

*<mark style="color:purple;">**Gateway**</mark>* - Nginx для разделения запросов на несколько серверов

*<mark style="color:blue;">**PostgeSQL**</mark>* - база данных (...)

*<mark style="color:purple;">Frontend</mark>* -Для интерфейса Nginx (JS, React)&#x20;

*<mark style="color:orange;">Backend</mark>* - API (Kotlin, Spring)

*<mark style="color:blue;">**\*\*\*\* cheker**</mark>* - сервис для проверки задач на нужном языке (Java, Javalin)


# Безопасность

<figure><img src="/files/lvzSKzIBXMNtgSH1Fw7o" alt=""><figcaption></figcaption></figure>

Платформа Codebattles обеспечивает безопасность исполняемых программ несколькими инструментами.

### Docker

[**Docker** ](https://www.docker.com)-  приложение для контейнеризации.

Приложение чекера запускается в изолированном контейнере. Сеть контейнеров чекеров запускается в изолированной от общей подсети.

### Bubblewrap

[**Bubblewrap** ](https://github.com/containers/bubblewrap)-  песочница для приложений. Используется, например, в [Flatpak](https://flatpak.org/)

Внутри докера используется песочница с изоляцией сети, файловой системы.

***

Используя вышеперечисленные методы защиты от злоумышленника, можно быть спокойным в безопасности системы


# Метрики строк кода

## 📊 Отчёт по анализу кода

> **Создано с помощью cloc v1.96** | ⚡ **Производительность**: 0.27с | 🚀 **Скорость**: 1,063.8 файлов/с, 72,135.7 строк/с

***

### 📈 Обзор проекта

#### 🎯 **Ключевые метрики**

* **Всего файлов**: 287
* **Всего строк**: 17,010
* **Пустые строки**: 2,113
* **Строки комментариев**: 339
* **Строки кода**: 17,010

***

### 🗂️ Распределение по языкам

| 🏷️ **Язык**      | 📁 **Файлы** | ⬜ **Пустые** | 💬 **Комментарии** | 💻 **Код** | 📊 **%** |
| ----------------- | -----------: | -----------: | -----------------: | ---------: | -------: |
| 🟡 **JSON**       |            7 |            0 |                  0 |  **7,568** |    44.5% |
| ⚛️ **JSX**        |           86 |        1,003 |                 57 |  **4,827** |    28.4% |
| 🟠 **Kotlin**     |           85 |          453 |                 31 |  **2,089** |    12.3% |
| ☕ **Java**        |           27 |          219 |                  8 |    **630** |     3.7% |
| 📝 **Markdown**   |           10 |          140 |                  0 |    **432** |     2.5% |
| 🔧 **YAML**       |            7 |           28 |                 27 |    **322** |     1.9% |
| 🟨 **JavaScript** |           20 |           45 |                 26 |    **229** |     1.3% |
| 🐳 **Dockerfile** |           11 |           62 |                 43 |    **167** |     1.0% |
| 🗄️ **SQL**       |            6 |           25 |                  0 |    **149** |     0.9% |
| 🎨 **CSS**        |           11 |           27 |                 15 |    **118** |     0.7% |
| 🐚 **Shell**      |            1 |           28 |                118 |    **106** |     0.6% |
| 🐍 **Python**     |            4 |           25 |                  2 |     **81** |     0.5% |
| 💾 **DOS Batch**  |            1 |           21 |                  2 |     **71** |     0.4% |
| 🔨 **Gradle**     |            2 |           14 |                  1 |     **69** |     0.4% |
| 📦 **Maven**      |            1 |           10 |                  1 |     **68** |     0.4% |
| 🌐 **HTML**       |            2 |           11 |                  8 |     **58** |     0.3% |
| ⚙️ **Properties** |            2 |            2 |                  0 |     **16** |     0.1% |
| 📄 **Text**       |            3 |            0 |                  0 |      **9** |     0.1% |
| 🖼️ **SVG**       |            1 |            0 |                  0 |      **1** |     0.0% |

***

### 🏆 Топ языков по объёму кода

```
█████████████████████████████████████████████ JSON (44.5%)
████████████████████████████████ JSX (28.4%)
███████████████ Kotlin (12.3%)
████ Java (3.7%)
```

***

### 💡 Аналитика

#### 🔍 **Состав проекта**

* **Фронтенд-ориентированный**: 72.9% кода приходится на веб-технологии (JSON, JSX, JS, CSS, HTML)
* **Мобильная разработка**: Значительное присутствие Kotlin (12.3%) указывает на Android-разработку
* **Full-Stack**: Смесь бэкенда (Java, Python), фронтенда (JSX, JS) и конфигурационных файлов

#### 📊 **Метрики качества кода**

* **Доля комментариев**: 2.0% (339/17,010)
* **Доля пустых строк**: 12.4% (2,113/17,010)
* **Файлов на язык**: В среднем 15.1 файлов на тип языка

#### 🎯 **Фокус разработки**

1. **Данные-ориентированный**: Большой объём JSON указывает на архитектуру с активным использованием API/конфигураций
2. **React-экосистема**: Значительное использование JSX говорит о фронтенде на React
3. **Кроссплатформенность**: Kotlin + Java предполагает мобильную + бэкенд разработку

***

*📅 Отчёт создан по запросу | 🛠️ Работает на cloc v1.96*


# Введение в API

Документация по API генерируется автоматически.&#x20;

Именно поэтому она на английском языке в русской версии документации.


# Backend


# Checkers

Endpoints for managing checkers

## \[ADMIN] Get all checkers

> Retrieves a list of all checkers. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checkers","description":"Endpoints for managing checkers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/checkers":{"get":{"tags":["Checkers"],"summary":"[ADMIN] Get all checkers","description":"Retrieves a list of all checkers. Required admin role.","operationId":"getAll_4","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CheckerDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Create a checker

> Creates a new checker. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checkers","description":"Endpoints for managing checkers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CheckerCreate":{"type":"object","description":"Details for creating a new checker","properties":{"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Language highlight name for the checker"},"address":{"type":"string","description":"Address of the checker service"}},"required":["address","displayName","languageHighlightName"]},"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/checkers":{"post":{"tags":["Checkers"],"summary":"[ADMIN] Create a checker","description":"Creates a new checker. Required admin role.","operationId":"create_4","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckerCreate"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Checker"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get checker by ID

> Retrieves a checker by its ID. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checkers","description":"Endpoints for managing checkers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/checkers/{id}":{"get":{"tags":["Checkers"],"summary":"[ADMIN] Get checker by ID","description":"Retrieves a checker by its ID. Required admin role.","operationId":"getById_2","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CheckerDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Delete a checker

> Deletes a specific checker by its ID. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checkers","description":"Endpoints for managing checkers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/checkers/{id}":{"delete":{"tags":["Checkers"],"summary":"[ADMIN] Delete a checker","description":"Deletes a specific checker by its ID. Required admin role.","operationId":"delete_1","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Checker"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Update a checker

> Applies partial updates to a checker by its ID. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checkers","description":"Endpoints for managing checkers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonNode":{},"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/checkers/{id}":{"patch":{"tags":["Checkers"],"summary":"[ADMIN] Update a checker","description":"Applies partial updates to a checker by its ID. Required admin role.","operationId":"patch_2","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonNode"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Checker"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get checker by ID (extra fields)

> Retrieves a checker by its ID with admin-level access. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checkers","description":"Endpoints for managing checkers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/checkers/{id}/admin":{"get":{"tags":["Checkers"],"summary":"[ADMIN] Get checker by ID (extra fields)","description":"Retrieves a checker by its ID with admin-level access. Required admin role.","operationId":"getByIdADMIN","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Checker"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Competition Problems

Endpoints for managing competition problems

## \[ADMIN] Get all competition problems

> Retrieves a paginated list of all competition problems. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"PagedModelCompetitionsProblems":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionsProblems"}},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"CompetitionsProblems":{"type":"object","properties":{"priority":{"type":"integer","format":"int32"},"slug":{"type":"string"},"competition":{"$ref":"#/components/schemas/Competition"},"problem":{"$ref":"#/components/schemas/Problem"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["competition","priority","problem","slug"]},"Competition":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/User"},"uniqueItems":true},"checkers":{"type":"array","items":{"$ref":"#/components/schemas/Checker"},"uniqueItems":true},"organizer":{"$ref":"#/components/schemas/User"},"name":{"type":"string"},"description":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"showRating":{"type":"boolean"},"showOutput":{"type":"boolean"},"showInput":{"type":"boolean"},"public":{"type":"boolean"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["description","name","public","showInput","showOutput","showRating"]},"User":{"type":"object","properties":{"musername":{"type":"string"},"mpassword":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string","enum":["USER","ROLE_ADMIN","TESTTTSTCBEUYBEYUBYUCYUBYUBUBY","SYSADMIN"]},"uniqueItems":true},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"authorities":{"type":"array","items":{"$ref":"#/components/schemas/GrantedAuthority"}},"isAdmin":{"type":"boolean"},"username":{"type":"string"},"password":{"type":"string"},"enabled":{"type":"boolean"},"credentialsNonExpired":{"type":"boolean"},"accountNonExpired":{"type":"boolean"},"accountNonLocked":{"type":"boolean"}},"required":["authorities","isAdmin","roles"]},"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}},"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"Problem":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"inData":{"type":"string"},"outData":{"type":"string"},"tests":{"type":"string"}},"required":["description","examples","id","inData","name","outData","tests"]},"PageMetadata":{"type":"object","properties":{"size":{"type":"integer","format":"int64"},"number":{"type":"integer","format":"int64"},"totalElements":{"type":"integer","format":"int64"},"totalPages":{"type":"integer","format":"int64"}}},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems":{"get":{"tags":["Competition Problems"],"summary":"[ADMIN] Get all competition problems","description":"Retrieves a paginated list of all competition problems. Required admin role.","operationId":"getAll_3","parameters":[{"name":"page","in":"query","description":"Zero-based page index (0..N)","required":false,"schema":{"type":"integer","default":0,"minimum":0}},{"name":"size","in":"query","description":"The size of the page to be returned","required":false,"schema":{"type":"integer","default":20,"minimum":1}},{"name":"sort","in":"query","description":"Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.","required":false,"schema":{"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelCompetitionsProblems"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}},"deprecated":true}}}}
```

## \[ADMIN] Create a competition problem

> Creates a new competition problem.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateCompetitionProblem":{"type":"object","description":"Details for creating a competition problem","properties":{"priority":{"type":"integer","format":"int64","description":"Priority of the problem in the competition"},"slug":{"type":"string","description":"Slug identifier for the problem"},"competition_id":{"type":"integer","format":"int64","description":"ID of the competition"},"problem_id":{"type":"integer","format":"int64","description":"ID of the problem"}},"required":["competition_id","priority","problem_id","slug"]},"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems":{"post":{"tags":["Competition Problems"],"summary":"[ADMIN] Create a competition problem","description":"Creates a new competition problem.","operationId":"create_3","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCompetitionProblem"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Delete multiple competition problems

> Deletes multiple competition problems by their IDs. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems":{"delete":{"tags":["Competition Problems"],"summary":"[ADMIN] Delete multiple competition problems","description":"Deletes multiple competition problems by their IDs. Required admin role.","operationId":"deleteMany","parameters":[{"name":"ids","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer","format":"int64"}}}],"responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Update multiple competition problems

> Applies partial updates to multiple competition problems. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonNode":{},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems":{"patch":{"tags":["Competition Problems"],"summary":"[ADMIN] Update multiple competition problems","description":"Applies partial updates to multiple competition problems. Required admin role.","operationId":"patchMany","parameters":[{"name":"ids","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer","format":"int64"}}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonNode"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"type":"integer","format":"int64"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get competition problem by ID

> Retrieves details of a specific competition problem by its ID. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems/{id}":{"get":{"tags":["Competition Problems"],"summary":"[ADMIN] Get competition problem by ID","description":"Retrieves details of a specific competition problem by its ID. Required admin role.","operationId":"getOne","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Delete a competition problem

> Deletes a specific competition problem by its ID. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems/{id}":{"delete":{"tags":["Competition Problems"],"summary":"[ADMIN] Delete a competition problem","description":"Deletes a specific competition problem by its ID. Required admin role.","operationId":"delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Update a competition problem

> Applies partial updates to a specific competition problem. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonNode":{},"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems/{id}":{"patch":{"tags":["Competition Problems"],"summary":"[ADMIN] Update a competition problem","description":"Applies partial updates to a specific competition problem. Required admin role.","operationId":"patch_1","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonNode"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get multiple competition problems

> Retrieves details of multiple competition problems by their IDs. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competition Problems","description":"Endpoints for managing competition problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitionsProblems/by-ids":{"get":{"tags":["Competition Problems"],"summary":"[ADMIN] Get multiple competition problems","description":"Retrieves details of multiple competition problems by their IDs. Required admin role.","operationId":"getMany","parameters":[{"name":"ids","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer","format":"int64"}}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Users

Endpoints for managing users

## \[ADMIN] Get all users

> Retrieves a list of all users. Required admin role

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Users","description":"Endpoints for managing users"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/users":{"get":{"tags":["Users"],"summary":"[ADMIN] Get all users","description":"Retrieves a list of all users. Required admin role","operationId":"getAll","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Create user

> Create user with provided data. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Users","description":"Endpoints for managing users"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateUserDto":{"type":"object","properties":{"musername":{"type":"string","description":"Username of the user","minLength":1},"mpassword":{"type":"string","description":"Password of the user","minLength":1},"name":{"type":"string","description":"Full name of the user"}},"required":["mpassword","musername"]},"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/users":{"post":{"tags":["Users"],"summary":"[ADMIN] Create user","description":"Create user with provided data. Required admin role.","operationId":"create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserDto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UserDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Link user to competition

> Links a user to a competition. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Users","description":"Endpoints for managing users"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"LinkUserRequest":{"type":"object","description":"Request to link a user to a competition","properties":{"userId":{"type":"integer","format":"int64","description":"ID of the user"},"competitionId":{"type":"integer","format":"int64","description":"ID of the competition"}},"required":["competitionId","userId"]},"OkResponse":{"type":"object","description":"Response indicating success","properties":{"status":{"type":"string","description":"Status of the response"}},"required":["status"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/users/link":{"post":{"tags":["Users"],"summary":"[ADMIN] Link user to competition","description":"Links a user to a competition. Required admin role.","operationId":"linkUser","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkUserRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Change password

> Changes the password for the current user. Requires current password verification.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Users","description":"Endpoints for managing users"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ChangePasswordDto":{"type":"object","properties":{"currentPassword":{"type":"string"},"newPassword":{"type":"string"}},"required":["currentPassword","newPassword"]},"OkResponse":{"type":"object","description":"Response indicating success","properties":{"status":{"type":"string","description":"Status of the response"}},"required":["status"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/users/change-password":{"post":{"tags":["Users"],"summary":"Change password","description":"Changes the password for the current user. Requires current password verification.","operationId":"changePassword","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordDto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get current user

> Retrieves current user.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Users","description":"Endpoints for managing users"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"User":{"type":"object","properties":{"musername":{"type":"string"},"mpassword":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string","enum":["USER","ROLE_ADMIN","TESTTTSTCBEUYBEYUBYUCYUBYUBUBY","SYSADMIN"]},"uniqueItems":true},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"authorities":{"type":"array","items":{"$ref":"#/components/schemas/GrantedAuthority"}},"isAdmin":{"type":"boolean"},"username":{"type":"string"},"password":{"type":"string"},"enabled":{"type":"boolean"},"credentialsNonExpired":{"type":"boolean"},"accountNonExpired":{"type":"boolean"},"accountNonLocked":{"type":"boolean"}},"required":["authorities","isAdmin","roles"]},"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/users/me":{"get":{"tags":["Users"],"summary":"Get current user","description":"Retrieves current user.","operationId":"getProfile","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Profile

Endpoints for current profile

## GET /api/profile

>

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Profile","description":"Endpoints for current profile"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UserProfileDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}}},"required":["id","name","roles","username"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/profile":{"get":{"tags":["Profile"],"operationId":"getMe","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UserProfileDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## PUT /api/profile

>

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Profile","description":"Endpoints for current profile"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UserProfileEditDto":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]},"UserProfileDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}}},"required":["id","name","roles","username"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/profile":{"put":{"tags":["Profile"],"operationId":"updateProfile","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileEditDto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UserProfileDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Answer

Endpoints for answers

## Get answer by ID

> Retrieves answer details by its ID. Requires access to the answer.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Answer","description":"Endpoints for answers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"AnswerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the answer"},"user":{"$ref":"#/components/schemas/UserDto","description":"User who submitted the answer"},"status":{"type":"string","description":"Current status of the answer","enum":["IN_PROGRESS","COMPLETED"]},"score":{"type":"integer","format":"int32","description":"Score awarded for the answer"},"code":{"type":"string","description":"Code submitted by the user"},"result":{"type":"string","description":"Result of the code execution"},"checker":{"$ref":"#/components/schemas/CheckerDto","description":"Checker used to evaluate the answer"},"createdAt":{"type":"string","format":"date-time","description":"Timestamp when the answer was created"},"competitionsProblems":{"$ref":"#/components/schemas/CompetitionsProblemsDto","description":"Details of the competition problem associated with the answer"}},"required":["checker","code","createdAt","status","user"]},"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/answers/{id}":{"get":{"tags":["Answer"],"summary":"Get answer by ID","description":"Retrieves answer details by its ID. Requires access to the answer.","operationId":"getById_3","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AnswerDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get the last answer by problem and user ID

> Retrieves the most recent answer submitted by a specific user for a specific competition problem. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Answer","description":"Endpoints for answers"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"AnswerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the answer"},"user":{"$ref":"#/components/schemas/UserDto","description":"User who submitted the answer"},"status":{"type":"string","description":"Current status of the answer","enum":["IN_PROGRESS","COMPLETED"]},"score":{"type":"integer","format":"int32","description":"Score awarded for the answer"},"code":{"type":"string","description":"Code submitted by the user"},"result":{"type":"string","description":"Result of the code execution"},"checker":{"$ref":"#/components/schemas/CheckerDto","description":"Checker used to evaluate the answer"},"createdAt":{"type":"string","format":"date-time","description":"Timestamp when the answer was created"},"competitionsProblems":{"$ref":"#/components/schemas/CompetitionsProblemsDto","description":"Details of the competition problem associated with the answer"}},"required":["checker","code","createdAt","status","user"]},"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/answers/last":{"get":{"tags":["Answer"],"summary":"[ADMIN] Get the last answer by problem and user ID","description":"Retrieves the most recent answer submitted by a specific user for a specific competition problem. Required admin role.","operationId":"getLastSendByProblemAnswerAndUserId","parameters":[{"name":"compProblemId","in":"query","description":"The ID of CompetitionProblem id","required":true,"schema":{"type":"integer","format":"int64"}},{"name":"userId","in":"query","description":"The ID of the user","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AnswerDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Competitions

Endpoints for managing competitions

## Get competition by ID

> Retrieves competition details by its ID. Requires access to the competition.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}":{"get":{"tags":["Competitions"],"summary":"Get competition by ID","description":"Retrieves competition details by its ID. Requires access to the competition.","operationId":"getById","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## PUT /api/competitions/{compId}

>

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionEditDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","name","public","showInput","showOutput","showRating"]},"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}":{"put":{"tags":["Competitions"],"operationId":"update","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompetitionEditDto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get competition users

> Retrieves the list of users participating in a specific competition. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/users":{"get":{"tags":["Competitions"],"summary":"[ADMIN] Get competition users","description":"Retrieves the list of users participating in a specific competition. Required admin role.","operationId":"getUsers","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Edit competition users

> Updates the list of users participating in a specific competition. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"EditUsersRequest":{"type":"object","description":"Request to edit users","properties":{"usersIds":{"type":"array","description":"Set of user IDs to be edited","items":{"type":"integer","format":"int64"},"uniqueItems":true}},"required":["usersIds"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/users":{"put":{"tags":["Competitions"],"summary":"[ADMIN] Edit competition users","description":"Updates the list of users participating in a specific competition. Required admin role.","operationId":"editUsers","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditUsersRequest"}}},"required":true},"responses":{"202":{"description":"Accepted"},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Edit competition checkers

> Updates the list of checkers for a specific competition. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"EditUsersRequest":{"type":"object","description":"Request to edit users","properties":{"usersIds":{"type":"array","description":"Set of user IDs to be edited","items":{"type":"integer","format":"int64"},"uniqueItems":true}},"required":["usersIds"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/checkers":{"put":{"tags":["Competitions"],"summary":"[ADMIN] Edit competition checkers","description":"Updates the list of checkers for a specific competition. Required admin role.","operationId":"editCheckers","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditUsersRequest"}}},"required":true},"responses":{"202":{"description":"Accepted"},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get all competitions

> Retrieves a list of all competitions. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions":{"get":{"tags":["Competitions"],"summary":"[ADMIN] Get all competitions","description":"Retrieves a list of all competitions. Required admin role.","operationId":"getAll_2","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Create a new competition

> Creates a new competition object. Required admin role.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionCreateDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"}},"required":["description","name"]},"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions":{"post":{"tags":["Competitions"],"summary":"[ADMIN] Create a new competition","description":"Creates a new competition object. Required admin role.","operationId":"create_2","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompetitionCreateDto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Submit an answer

> Allows a user to submit an answer for a specific competition problem.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"SendAnswerRequest":{"type":"object","description":"Request to send an answer","properties":{"checker":{"type":"integer","format":"int64","description":"ID of the checker"},"src":{"type":"string","description":"Source code submitted as the answer"},"id":{"type":"integer","format":"int64","description":"ID of the answer"}},"required":["checker","id","src"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/send":{"post":{"tags":["Competitions"],"summary":"Submit an answer","description":"Allows a user to submit an answer for a specific competition problem.","operationId":"send","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendAnswerRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Join to public competition problem by ID

> Every user can join to public competition.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/publicJoin":{"post":{"tags":["Competitions"],"summary":"Join to public competition problem by ID","description":"Every user can join to public competition.","operationId":"joinToPublicCompetition","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get all answers

> Retrieves all answers submitted by the authenticated user for a specific competition.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"AnswerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the answer"},"user":{"$ref":"#/components/schemas/UserDto","description":"User who submitted the answer"},"status":{"type":"string","description":"Current status of the answer","enum":["IN_PROGRESS","COMPLETED"]},"score":{"type":"integer","format":"int32","description":"Score awarded for the answer"},"code":{"type":"string","description":"Code submitted by the user"},"result":{"type":"string","description":"Result of the code execution"},"checker":{"$ref":"#/components/schemas/CheckerDto","description":"Checker used to evaluate the answer"},"createdAt":{"type":"string","format":"date-time","description":"Timestamp when the answer was created"},"competitionsProblems":{"$ref":"#/components/schemas/CompetitionsProblemsDto","description":"Details of the competition problem associated with the answer"}},"required":["checker","code","createdAt","status","user"]},"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/sends":{"get":{"tags":["Competitions"],"summary":"Get all answers","description":"Retrieves all answers submitted by the authenticated user for a specific competition.","operationId":"getAnswers","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AnswerDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get competition problems

> Retrieves all problems associated with a specific competition.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/problems":{"get":{"tags":["Competitions"],"summary":"Get competition problems","description":"Retrieves all problems associated with a specific competition.","operationId":"getProblemsByCompetition","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get competition problem by ID

> Retrieves a specific problem by its ID within a competition.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/problems/{id}":{"get":{"tags":["Competitions"],"summary":"Get competition problem by ID","description":"Retrieves a specific problem by its ID within a competition.","operationId":"getProblemsByIdByCompetition","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CompetitionsProblemsDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get competition leaderboard

> Retrieves the leaderboard for a specific competition.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Leaderboard":{"type":"object","properties":{"score":{"type":"array","items":{"$ref":"#/components/schemas/LeaderBoardScoreOrderQuery"}},"data":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/LeaderBoardAllTasksQuery"}}}},"required":["data","score"]},"LeaderBoardScoreOrderQuery":{"type":"object","properties":{"userId":{"type":"integer","format":"int64"},"userX":{"type":"string"},"score":{"type":"integer","format":"int64"},"time":{"type":"string","format":"date-time"}},"required":["score","time","userId","userX"]},"LeaderBoardAllTasksQuery":{"type":"object","properties":{"userId":{"type":"integer","format":"int64"},"competitionproblemId":{"type":"integer","format":"int64"},"maxScore":{"type":"integer","format":"int64"}},"required":["competitionproblemId","maxScore","userId"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/{compId}/leaderboard":{"get":{"tags":["Competitions"],"summary":"Get competition leaderboard","description":"Retrieves the leaderboard for a specific competition.","operationId":"leaderboard","parameters":[{"name":"compId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Leaderboard"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get all public competitions

> Retrieves a list of public competitions.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/public":{"get":{"tags":["Competitions"],"summary":"Get all public competitions","description":"Retrieves a list of public competitions.","operationId":"getPublic","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## Get competitions available for user

> Retrieves all competitions accessible to the authenticated user.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Competitions","description":"Endpoints for managing competitions"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/competitions/me":{"get":{"tags":["Competitions"],"summary":"Get competitions available for user","description":"Retrieves all competitions accessible to the authenticated user.","operationId":"getAllAvaliableForUser","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionDto"}}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Ping Pong

Endpoints for ping-pong testing

## Ping endpoint

> Returns a 'pong' response to test the API availability.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Ping Pong","description":"Endpoints for ping-pong testing"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/api/ping":{"get":{"tags":["Ping Pong"],"summary":"Ping endpoint","description":"Returns a 'pong' response to test the API availability.","operationId":"ping","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/RenderedError"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}},"components":{"schemas":{"RenderedError":{"type":"object","description":"Details of an error response","properties":{"detail":{"type":"string","description":"Detailed error message"}},"required":["detail"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```


# Problems

Endpoints for managing problems

## \[ADMIN] Get all problems

> Retrieves a list of all problems.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Problems","description":"Endpoints for managing problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/problems":{"get":{"tags":["Problems"],"summary":"[ADMIN] Get all problems","description":"Retrieves a list of all problems.","operationId":"getAll_1","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Create a new problem

> Creates a new problem using the provided data.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Problems","description":"Endpoints for managing problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateProblemDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"tests":{"type":"string","description":"Test cases for the problem (JSON)"}},"required":["description","examples","inData","name","outData","tests"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/problems":{"post":{"tags":["Problems"],"summary":"[ADMIN] Create a new problem","description":"Creates a new problem using the provided data.","operationId":"create_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProblemDto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ProblemDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get problem by ID

> Retrieves a problem by its ID. Required admin role

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Problems","description":"Endpoints for managing problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/problems/{id}":{"get":{"tags":["Problems"],"summary":"[ADMIN] Get problem by ID","description":"Retrieves a problem by its ID. Required admin role","operationId":"getById_1","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ProblemDto"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Update a problem

> Applies partial updates to a problem by its ID.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Problems","description":"Endpoints for managing problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonNode":{},"Problem":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"inData":{"type":"string"},"outData":{"type":"string"},"tests":{"type":"string"}},"required":["description","examples","id","inData","name","outData","tests"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/problems/{id}":{"patch":{"tags":["Problems"],"summary":"[ADMIN] Update a problem","description":"Applies partial updates to a problem by its ID.","operationId":"patch","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonNode"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```

## \[ADMIN] Get problem by ID (extra fields)

> Retrieves a problem by its ID with admin-level access. Required admin role

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Problems","description":"Endpoints for managing problems"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"JWT":[]}],"components":{"securitySchemes":{"JWT":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Problem":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"inData":{"type":"string"},"outData":{"type":"string"},"tests":{"type":"string"}},"required":["description","examples","id","inData","name","outData","tests"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}},"paths":{"/api/problems/{id}/admin":{"get":{"tags":["Problems"],"summary":"[ADMIN] Get problem by ID (extra fields)","description":"Retrieves a problem by its ID with admin-level access. Required admin role","operationId":"getByIdAdmin","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}}}
```


# Auth

Endpoints for authentication

## Register

> Enter credentials to get JWT token.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Auth","description":"Endpoints for authentication"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/api/auth/register":{"post":{"tags":["Auth"],"summary":"Register","description":"Enter credentials to get JWT token.","operationId":"register","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}},"components":{"schemas":{"RegisterRequest":{"type":"object","description":"Request for user authentication","properties":{"username":{"type":"string","description":"Username of the user"},"password":{"type":"string","description":"Password of the user"},"name":{"type":"string","description":"Name of the user"}},"required":["name","password","username"]},"AuthResponse":{"type":"object","description":"Response containing authentication token","properties":{"token":{"type":"string","description":"JWT token for authentication"}},"required":["token"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```

## Login

> Enter credentials to get JWT token.

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Auth","description":"Endpoints for authentication"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/api/auth/login":{"post":{"tags":["Auth"],"summary":"Login","description":"Enter credentials to get JWT token.","operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}},"components":{"schemas":{"AuthRequest":{"type":"object","description":"Request for user authentication","properties":{"username":{"type":"string","description":"Username of the user"},"password":{"type":"string","description":"Password of the user"}},"required":["password","username"]},"AuthResponse":{"type":"object","description":"Response containing authentication token","properties":{"token":{"type":"string","description":"JWT token for authentication"}},"required":["token"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```


# Checker System API

Endpoints for checker system

## (Internal method) Handle checker system callback

> Processes the callback from the checker system, updates the answer status, and calculates the score. Used only for checkers. Access disabled if used via gateway

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"tags":[{"name":"Checker system API","description":"Endpoints for checker system"}],"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/api/check_system_callback":{"post":{"tags":["Checker system API"],"summary":"(Internal method) Handle checker system callback","description":"Processes the callback from the checker system, updates the answer status, and calculates the score. Used only for checkers. Access disabled if used via gateway","operationId":"checkerCallBack","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckerCallback"}}},"required":true},"responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDeniedResponse"}}}},"409":{"description":"Conflict","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConflictResponse"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/InternalServerErrorResponse"}}}}}}}},"components":{"schemas":{"CheckerCallback":{"type":"object","description":"Callback response from the checker","properties":{"results":{"type":"array","description":"List of program results","items":{"$ref":"#/components/schemas/ProgramResult"}},"meta":{"type":"integer","format":"int64","description":"Metadata associated with the callback"}},"required":["meta","results"]},"ProgramResult":{"type":"object","description":"Result of a program execution","properties":{"success":{"type":"boolean","description":"Indicates if the execution was successful"},"out":{"type":"string","description":"Output of the program"},"msg":{"type":"string","description":"Status message of the execution","enum":["OK","RE","CE","TL","WA","NE"]},"time":{"type":"integer","format":"int32","description":"Execution time in milliseconds"}},"required":["msg","out","success","time"]},"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}},"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```


# Models

## The InternalServerErrorResponse object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"InternalServerErrorResponse":{"type":"object","description":"Response returned when an unexpected error occurs on the server.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```

## The ConflictResponse object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"ConflictResponse":{"type":"object","description":"Response returned when the conflict in data.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```

## The UnauthorizedResponse object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"UnauthorizedResponse":{"type":"object","description":"Response returned when the user is not authenticated.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```

## The AccessDeniedResponse object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"AccessDeniedResponse":{"type":"object","description":"Response returned when the user does not have permission to access the requested resource.","properties":{"message":{"type":"string","description":"Detailed message about the error."},"code":{"type":"integer","format":"int32","description":"HTTP status code representing the error."}}}}}}
```

## The UserProfileEditDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"UserProfileEditDto":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}}}}
```

## The UserProfileDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"UserProfileDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}}},"required":["id","name","roles","username"]}}}}
```

## The CompetitionEditDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CompetitionEditDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","name","public","showInput","showOutput","showRating"]}}}}
```

## The CheckerDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]}}}}
```

## The CompetitionDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CompetitionDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition"},"checkers":{"type":"array","description":"Set of checkers associated with the competition","items":{"$ref":"#/components/schemas/CheckerDto"},"uniqueItems":true},"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"},"public":{"type":"boolean","description":"If public everyone can join into competition"},"showInput":{"type":"boolean"},"showOutput":{"type":"boolean"},"showRating":{"type":"boolean"}},"required":["description","id","name","public","showInput","showOutput","showRating"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]}}}}
```

## The EditUsersRequest object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"EditUsersRequest":{"type":"object","description":"Request to edit users","properties":{"usersIds":{"type":"array","description":"Set of user IDs to be edited","items":{"type":"integer","format":"int64"},"uniqueItems":true}},"required":["usersIds"]}}}}
```

## The CreateUserDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CreateUserDto":{"type":"object","properties":{"musername":{"type":"string","description":"Username of the user","minLength":1},"mpassword":{"type":"string","description":"Password of the user","minLength":1},"name":{"type":"string","description":"Full name of the user"}},"required":["mpassword","musername"]}}}}
```

## The UserDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]}}}}
```

## The LinkUserRequest object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"LinkUserRequest":{"type":"object","description":"Request to link a user to a competition","properties":{"userId":{"type":"integer","format":"int64","description":"ID of the user"},"competitionId":{"type":"integer","format":"int64","description":"ID of the competition"}},"required":["competitionId","userId"]}}}}
```

## The OkResponse object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"OkResponse":{"type":"object","description":"Response indicating success","properties":{"status":{"type":"string","description":"Status of the response"}},"required":["status"]}}}}
```

## The ChangePasswordDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"ChangePasswordDto":{"type":"object","properties":{"currentPassword":{"type":"string"},"newPassword":{"type":"string"}},"required":["currentPassword","newPassword"]}}}}
```

## The CreateProblemDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CreateProblemDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"tests":{"type":"string","description":"Test cases for the problem (JSON)"}},"required":["description","examples","inData","name","outData","tests"]}}}}
```

## The ProblemDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]}}}}
```

## The CompetitionCreateDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CompetitionCreateDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the competition"},"description":{"type":"string","description":"Description of the competition"},"startedAt":{"type":"string","format":"date-time","description":"Start time of the competition"},"endedAt":{"type":"string","format":"date-time","description":"End time of the competition"}},"required":["description","name"]}}}}
```

## The CreateCompetitionProblem object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CreateCompetitionProblem":{"type":"object","description":"Details for creating a competition problem","properties":{"priority":{"type":"integer","format":"int64","description":"Priority of the problem in the competition"},"slug":{"type":"string","description":"Slug identifier for the problem"},"competition_id":{"type":"integer","format":"int64","description":"ID of the competition"},"problem_id":{"type":"integer","format":"int64","description":"ID of the problem"}},"required":["competition_id","priority","problem_id","slug"]}}}}
```

## The CompetitionsProblemsDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]}}}}
```

## The SendAnswerRequest object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"SendAnswerRequest":{"type":"object","description":"Request to send an answer","properties":{"checker":{"type":"integer","format":"int64","description":"ID of the checker"},"src":{"type":"string","description":"Source code submitted as the answer"},"id":{"type":"integer","format":"int64","description":"ID of the answer"}},"required":["checker","id","src"]}}}}
```

## The CheckerCreate object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CheckerCreate":{"type":"object","description":"Details for creating a new checker","properties":{"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Language highlight name for the checker"},"address":{"type":"string","description":"Address of the checker service"}},"required":["address","displayName","languageHighlightName"]}}}}
```

## The Checker object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]}}}}
```

## The CheckerCallback object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CheckerCallback":{"type":"object","description":"Callback response from the checker","properties":{"results":{"type":"array","description":"List of program results","items":{"$ref":"#/components/schemas/ProgramResult"}},"meta":{"type":"integer","format":"int64","description":"Metadata associated with the callback"}},"required":["meta","results"]},"ProgramResult":{"type":"object","description":"Result of a program execution","properties":{"success":{"type":"boolean","description":"Indicates if the execution was successful"},"out":{"type":"string","description":"Output of the program"},"msg":{"type":"string","description":"Status message of the execution","enum":["OK","RE","CE","TL","WA","NE"]},"time":{"type":"integer","format":"int32","description":"Execution time in milliseconds"}},"required":["msg","out","success","time"]}}}}
```

## The ProgramResult object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"ProgramResult":{"type":"object","description":"Result of a program execution","properties":{"success":{"type":"boolean","description":"Indicates if the execution was successful"},"out":{"type":"string","description":"Output of the program"},"msg":{"type":"string","description":"Status message of the execution","enum":["OK","RE","CE","TL","WA","NE"]},"time":{"type":"integer","format":"int32","description":"Execution time in milliseconds"}},"required":["msg","out","success","time"]}}}}
```

## The RegisterRequest object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"RegisterRequest":{"type":"object","description":"Request for user authentication","properties":{"username":{"type":"string","description":"Username of the user"},"password":{"type":"string","description":"Password of the user"},"name":{"type":"string","description":"Name of the user"}},"required":["name","password","username"]}}}}
```

## The AuthResponse object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"AuthResponse":{"type":"object","description":"Response containing authentication token","properties":{"token":{"type":"string","description":"JWT token for authentication"}},"required":["token"]}}}}
```

## The AuthRequest object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"AuthRequest":{"type":"object","description":"Request for user authentication","properties":{"username":{"type":"string","description":"Username of the user"},"password":{"type":"string","description":"Password of the user"}},"required":["password","username"]}}}}
```

## The JsonNode object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"JsonNode":{}}}}
```

## The Problem object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"Problem":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"inData":{"type":"string"},"outData":{"type":"string"},"tests":{"type":"string"}},"required":["description","examples","id","inData","name","outData","tests"]}}}}
```

## The GrantedAuthority object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}}}}}
```

## The User object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"User":{"type":"object","properties":{"musername":{"type":"string"},"mpassword":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string","enum":["USER","ROLE_ADMIN","TESTTTSTCBEUYBEYUBYUCYUBYUBUBY","SYSADMIN"]},"uniqueItems":true},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"authorities":{"type":"array","items":{"$ref":"#/components/schemas/GrantedAuthority"}},"isAdmin":{"type":"boolean"},"username":{"type":"string"},"password":{"type":"string"},"enabled":{"type":"boolean"},"credentialsNonExpired":{"type":"boolean"},"accountNonExpired":{"type":"boolean"},"accountNonLocked":{"type":"boolean"}},"required":["authorities","isAdmin","roles"]},"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}}}}}
```

## The RenderedError object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"RenderedError":{"type":"object","description":"Details of an error response","properties":{"detail":{"type":"string","description":"Detailed error message"}},"required":["detail"]}}}}
```

## The Competition object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"Competition":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/User"},"uniqueItems":true},"checkers":{"type":"array","items":{"$ref":"#/components/schemas/Checker"},"uniqueItems":true},"organizer":{"$ref":"#/components/schemas/User"},"name":{"type":"string"},"description":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"showRating":{"type":"boolean"},"showOutput":{"type":"boolean"},"showInput":{"type":"boolean"},"public":{"type":"boolean"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["description","name","public","showInput","showOutput","showRating"]},"User":{"type":"object","properties":{"musername":{"type":"string"},"mpassword":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string","enum":["USER","ROLE_ADMIN","TESTTTSTCBEUYBEYUBYUCYUBYUBUBY","SYSADMIN"]},"uniqueItems":true},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"authorities":{"type":"array","items":{"$ref":"#/components/schemas/GrantedAuthority"}},"isAdmin":{"type":"boolean"},"username":{"type":"string"},"password":{"type":"string"},"enabled":{"type":"boolean"},"credentialsNonExpired":{"type":"boolean"},"accountNonExpired":{"type":"boolean"},"accountNonLocked":{"type":"boolean"}},"required":["authorities","isAdmin","roles"]},"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}},"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]}}}}
```

## The CompetitionsProblems object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"CompetitionsProblems":{"type":"object","properties":{"priority":{"type":"integer","format":"int32"},"slug":{"type":"string"},"competition":{"$ref":"#/components/schemas/Competition"},"problem":{"$ref":"#/components/schemas/Problem"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["competition","priority","problem","slug"]},"Competition":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/User"},"uniqueItems":true},"checkers":{"type":"array","items":{"$ref":"#/components/schemas/Checker"},"uniqueItems":true},"organizer":{"$ref":"#/components/schemas/User"},"name":{"type":"string"},"description":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"showRating":{"type":"boolean"},"showOutput":{"type":"boolean"},"showInput":{"type":"boolean"},"public":{"type":"boolean"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["description","name","public","showInput","showOutput","showRating"]},"User":{"type":"object","properties":{"musername":{"type":"string"},"mpassword":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string","enum":["USER","ROLE_ADMIN","TESTTTSTCBEUYBEYUBYUCYUBYUBUBY","SYSADMIN"]},"uniqueItems":true},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"authorities":{"type":"array","items":{"$ref":"#/components/schemas/GrantedAuthority"}},"isAdmin":{"type":"boolean"},"username":{"type":"string"},"password":{"type":"string"},"enabled":{"type":"boolean"},"credentialsNonExpired":{"type":"boolean"},"accountNonExpired":{"type":"boolean"},"accountNonLocked":{"type":"boolean"}},"required":["authorities","isAdmin","roles"]},"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}},"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"Problem":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"inData":{"type":"string"},"outData":{"type":"string"},"tests":{"type":"string"}},"required":["description","examples","id","inData","name","outData","tests"]}}}}
```

## The PageMetadata object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"PageMetadata":{"type":"object","properties":{"size":{"type":"integer","format":"int64"},"number":{"type":"integer","format":"int64"},"totalElements":{"type":"integer","format":"int64"},"totalPages":{"type":"integer","format":"int64"}}}}}}
```

## The PagedModelCompetitionsProblems object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"PagedModelCompetitionsProblems":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/CompetitionsProblems"}},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"CompetitionsProblems":{"type":"object","properties":{"priority":{"type":"integer","format":"int32"},"slug":{"type":"string"},"competition":{"$ref":"#/components/schemas/Competition"},"problem":{"$ref":"#/components/schemas/Problem"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["competition","priority","problem","slug"]},"Competition":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/User"},"uniqueItems":true},"checkers":{"type":"array","items":{"$ref":"#/components/schemas/Checker"},"uniqueItems":true},"organizer":{"$ref":"#/components/schemas/User"},"name":{"type":"string"},"description":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"showRating":{"type":"boolean"},"showOutput":{"type":"boolean"},"showInput":{"type":"boolean"},"public":{"type":"boolean"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["description","name","public","showInput","showOutput","showRating"]},"User":{"type":"object","properties":{"musername":{"type":"string"},"mpassword":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string","enum":["USER","ROLE_ADMIN","TESTTTSTCBEUYBEYUBYUCYUBYUBUBY","SYSADMIN"]},"uniqueItems":true},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"authorities":{"type":"array","items":{"$ref":"#/components/schemas/GrantedAuthority"}},"isAdmin":{"type":"boolean"},"username":{"type":"string"},"password":{"type":"string"},"enabled":{"type":"boolean"},"credentialsNonExpired":{"type":"boolean"},"accountNonExpired":{"type":"boolean"},"accountNonLocked":{"type":"boolean"}},"required":["authorities","isAdmin","roles"]},"GrantedAuthority":{"type":"object","properties":{"authority":{"type":"string"}}},"Checker":{"type":"object","properties":{"displayName":{"type":"string"},"languageHighlightName":{"type":"string"},"address":{"type":"string"},"id":{"type":"integer","format":"int64"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["address","displayName","languageHighlightName"]},"Problem":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"inData":{"type":"string"},"outData":{"type":"string"},"tests":{"type":"string"}},"required":["description","examples","id","inData","name","outData","tests"]},"PageMetadata":{"type":"object","properties":{"size":{"type":"integer","format":"int64"},"number":{"type":"integer","format":"int64"},"totalElements":{"type":"integer","format":"int64"},"totalPages":{"type":"integer","format":"int64"}}}}}}
```

## The AnswerDto object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"AnswerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the answer"},"user":{"$ref":"#/components/schemas/UserDto","description":"User who submitted the answer"},"status":{"type":"string","description":"Current status of the answer","enum":["IN_PROGRESS","COMPLETED"]},"score":{"type":"integer","format":"int32","description":"Score awarded for the answer"},"code":{"type":"string","description":"Code submitted by the user"},"result":{"type":"string","description":"Result of the code execution"},"checker":{"$ref":"#/components/schemas/CheckerDto","description":"Checker used to evaluate the answer"},"createdAt":{"type":"string","format":"date-time","description":"Timestamp when the answer was created"},"competitionsProblems":{"$ref":"#/components/schemas/CompetitionsProblemsDto","description":"Details of the competition problem associated with the answer"}},"required":["checker","code","createdAt","status","user"]},"UserDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the user"},"username":{"type":"string","description":"Username of the user"}},"required":["id","username"]},"CheckerDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the checker"},"displayName":{"type":"string","description":"Display name of the checker"},"languageHighlightName":{"type":"string","description":"Programming language used by the checker"}},"required":["displayName","languageHighlightName"]},"CompetitionsProblemsDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the competition problem"},"priority":{"type":"integer","format":"int32","description":"Priority of problem for sorting"},"problem":{"$ref":"#/components/schemas/ProblemDto","description":"Unique identifier of the competition problem"},"slug":{"type":"string","description":"Unique identifier of the competition problem"}},"required":["id","priority","problem","slug"]},"ProblemDto":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier of the problem"},"name":{"type":"string","description":"Name of the problem"},"description":{"type":"string","description":"Description of the problem"},"inData":{"type":"string","description":"Input data for the problem"},"outData":{"type":"string","description":"Expected output data for the problem"},"public":{"type":"boolean","description":"Indicates if the problem is public"}},"required":["description","examples","id","inData","name","outData"]}}}}
```

## The LeaderBoardAllTasksQuery object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"LeaderBoardAllTasksQuery":{"type":"object","properties":{"userId":{"type":"integer","format":"int64"},"competitionproblemId":{"type":"integer","format":"int64"},"maxScore":{"type":"integer","format":"int64"}},"required":["competitionproblemId","maxScore","userId"]}}}}
```

## The LeaderBoardScoreOrderQuery object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"LeaderBoardScoreOrderQuery":{"type":"object","properties":{"userId":{"type":"integer","format":"int64"},"userX":{"type":"string"},"score":{"type":"integer","format":"int64"},"time":{"type":"string","format":"date-time"}},"required":["score","time","userId","userX"]}}}}
```

## The Leaderboard object

```json
{"openapi":"3.1.0","info":{"title":"Codebattles backend","version":"0.1.0"},"components":{"schemas":{"Leaderboard":{"type":"object","properties":{"score":{"type":"array","items":{"$ref":"#/components/schemas/LeaderBoardScoreOrderQuery"}},"data":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/LeaderBoardAllTasksQuery"}}}},"required":["data","score"]},"LeaderBoardScoreOrderQuery":{"type":"object","properties":{"userId":{"type":"integer","format":"int64"},"userX":{"type":"string"},"score":{"type":"integer","format":"int64"},"time":{"type":"string","format":"date-time"}},"required":["score","time","userId","userX"]},"LeaderBoardAllTasksQuery":{"type":"object","properties":{"userId":{"type":"integer","format":"int64"},"competitionproblemId":{"type":"integer","format":"int64"},"maxScore":{"type":"integer","format":"int64"}},"required":["competitionproblemId","maxScore","userId"]}}}}
```


# Checker API


# Health Check

Endpoints for checking service health

## Root endpoint

> Returns a simple "Hello World" message.

```json
{"openapi":"3.0.3","info":{"title":"Program Check System API","version":"1.0.0"},"tags":[{"name":"HealthCheck","description":"Endpoints for checking service health"}],"servers":[{"url":"http://localhost:7070","description":"Local development server"}],"paths":{"/":{"get":{"tags":["HealthCheck"],"summary":"Root endpoint","description":"Returns a simple \"Hello World\" message.","responses":{"200":{"description":"Successful response","content":{"text/plain":{"schema":{"type":"string"}}}}}}}}}
```


# Test

Endpoints for submitting and validating test cases

## Test endpoint

> Handles test requests.

```json
{"openapi":"3.0.3","info":{"title":"Program Check System API","version":"1.0.0"},"tags":[{"name":"Test","description":"Endpoints for submitting and validating test cases"}],"servers":[{"url":"http://localhost:7070","description":"Local development server"}],"paths":{"/api/v1/test":{"post":{"tags":["Test"],"summary":"Test endpoint","description":"Handles test requests.","requestBody":{"description":"Input data for the test","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","description":"Source code to be tested"},"compiler":{"type":"string","description":"Compiler to be used"},"tests":{"type":"array","description":"List of test cases","items":{"type":"object","properties":{"input":{"type":"string","description":"Input data for the test"},"expectedOutput":{"type":"string","description":"Expected output for the test"}}}},"meta":{"type":"string","description":"Additional metadata"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response message"}}}}}},"400":{"description":"Bad request"},"500":{"description":"Internal server error"}}}}}}
```


# About the V3 System

{% hint style="success" %}
This documentation is for version v3, which is actively developed and supported
{% endhint %}

## Who This System Is For

Initially, the system was developed for schools and teachers who want to conduct lessons in a more interesting and interactive format. However, you can also organize your own competitions, for example, among your friends.

## Navigation

For your convenience, all documentation is divided into sections. You can access them from the menu on the left.

## For Developers

If you are a developer and want to write your own tools, the API description can be found in the API section.

[Backend API](/en_v3/api/backend) - main API

[Checker API](/en_v3/api/checker-api) - API for checkers that verify solutions

{% hint style="info" %}
If you found an answer to your question here, you can write to [Telegram](https://doctorixx.t.me/)
{% endhint %}


# Contribution Guidelines

If you want to help the project and contribute to it, you can create Pull Requests

A brief overview of the current existing repositories of the Codebattls system:

### Landing

<figure><img src="/files/Q0a9ZL6dnqMxgsXkrK3g" alt=""><figcaption></figcaption></figure>

The repository of the main website ([codebattles.ru](https://codebattles.ru)). Currently, it is in the user's repository due to Vercel limitations

### Codebattles

<figure><img src="/files/DAVsXENzi9Kh6HFkqNCW" alt=""><figcaption></figcaption></figure>

The main system. You can read more in this documentation

### docs\_RU\_V3

<figure><img src="/files/JsDBIWUpYnzHu61NEP0T" alt=""><figcaption></figcaption></figure>

The repository of the current documentation


# Participant Interface

<figure><img src="/files/FJgcVzU81ThQUsp0XNCL" alt=""><figcaption><p>Login Page</p></figcaption></figure>

<figure><img src="/files/wpucU7EHhC4NyDvg3duQ" alt=""><figcaption><p>Profile Page</p></figcaption></figure>

<figure><img src="/files/UiWjZhpIUQ8B1FJD7dBh" alt=""><figcaption><p>Participant's Competitions</p></figcaption></figure>

<figure><img src="/files/5U6MjARRYHuUZVsxjp6p" alt=""><figcaption><p>Competition Tasks</p></figcaption></figure>

<figure><img src="/files/RDS0YhVqLEWEMlhJBaYb" alt=""><figcaption><p>View Task 1</p></figcaption></figure>

<figure><img src="/files/XJGPu2SbNQ4CCwHwaaMT" alt=""><figcaption><p>View Task 2</p></figcaption></figure>

<figure><img src="/files/tSSCjRYowJLv0yUdVbIr" alt=""><figcaption><p>Participant's Submissions</p></figcaption></figure>

<figure><img src="/files/HO7XjCxpMciJ28qB2GY7" alt=""><figcaption><p>Competition Rating</p></figcaption></figure>

<figure><img src="/files/Y0yDoK2kSuDxmEVE4YJf" alt=""><figcaption><p>Test Completion Statuses</p></figcaption></figure>


# Administrator Interface

**Administrator Interface**

<figure><img src="/files/NaemSxYdLBUfbzuSA0R9" alt=""><figcaption></figcaption></figure>


# Tasks

<figure><img src="/files/3txDMc7MtEDNKrPpVqDX" alt=""><figcaption><p>View all tasks</p></figcaption></figure>

<figure><img src="/files/WsDQyrxamekV33VVD0Ls" alt=""><figcaption><p>Create a task</p></figcaption></figure>

<figure><img src="/files/8wKbee9VSw7vcUeIsBjE" alt=""><figcaption><p>Edit a task</p></figcaption></figure>


# Users

<figure><img src="/files/zWo5EooJmf5w1EKlP6mS" alt=""><figcaption><p>View Users</p></figcaption></figure>

<figure><img src="/files/Xqc3OHAtRXCfXozCsWsT" alt=""><figcaption><p>Create User</p></figcaption></figure>

<figure><img src="/files/y3fFbs9bZda0ERbpWlTP" alt=""><figcaption><p>Password Generation When Creating a User</p></figcaption></figure>


# Checkers

<figure><img src="/files/pj0LXqKgrxxExCQhU1gc" alt=""><figcaption><p>View checkers</p></figcaption></figure>

<figure><img src="/files/ND5Y2ONqPofgPum8gGhI" alt=""><figcaption><p>Add checker</p></figcaption></figure>

<figure><img src="/files/lYloKAIJjgoQ3XPGM5Bz" alt=""><figcaption><p>Edit checker</p></figcaption></figure>


# Competitions

<figure><img src="/files/8uQRw4xTSTKDVZbCzFE1" alt=""><figcaption><p>All Competitions</p></figcaption></figure>

<figure><img src="/files/qrMBwEPNxQS9zf7wszbf" alt=""><figcaption><p>Creating a Competition</p></figcaption></figure>

<figure><img src="/files/aNsH0hgYW8GaLIlb4cww" alt=""><figcaption><p>Competition Settings</p></figcaption></figure>

<figure><img src="/files/OxtFzZQBYLPHIPCn9H9R" alt=""><figcaption><p>Editing Competition Tasks</p></figcaption></figure>

<figure><img src="/files/iECekqdBmr3hdgBczVu9" alt=""><figcaption><p>Editing Competition Task Settings</p></figcaption></figure>

<figure><img src="/files/WSQzv458fumf0O1Xh9BT" alt=""><figcaption><p>Adding Tasks to Competitions</p></figcaption></figure>

<figure><img src="/files/e1efcmmo0bMzkTPZRHpz" alt=""><figcaption><p>Adding Checkers to Competitions</p></figcaption></figure>

<figure><img src="/files/EMpBXJ4Om2Lu38YUr1Rv" alt=""><figcaption><p>Adding Participants to Competitions</p></figcaption></figure>

<figure><img src="/files/Qxb36xMohDo4ZkIxexZe" alt=""><figcaption><p>Competition Ranking</p></figcaption></figure>


# Installation

**After installation, the interface will be available on port** <mark style="color:red;">**2500**</mark>


# Local Installation

{% hint style="danger" %}
For the current competitions, use the [Production mode](/en_v3/system-setup-and-installation/ustanovka/production-ustanovka).\
It has stricter security policies and does not contain development tools.
{% endhint %}

## Docker

{% hint style="warning" %}
If you haven't installed Docker before, please do so. Nothing will work without it [\[Installation Guide Link\]](https://docs.docker.com/engine/install/)
{% endhint %}

### Choose Your Architecture

{% tabs %}
{% tab title="x64" %}
To install, you need to download the repository and deploy the Docker Compose Container.

Downloading images from the repository:

```bash
docker compose pull
```

Start:

```sh
docker compose up
```

{% endtab %}

{% tab title="others" %}
To install, you need to download the repository and deploy the Docker Compose Container.

Building images:

```bash
docker compose build
```

Start:

```sh
docker compose up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
To run containers in the background, use the *<mark style="color:blue;">**-d**</mark>* flag

Example:

{% code fullWidth="false" %}

```bash
docker compose up -d
```

{% endcode %}
{% endhint %}

After this, please configure the programming languages. This is described on the next page.


# Production Installation

## Docker

{% hint style="warning" %}
If Docker has not been installed before, please install it. Nothing will work without it [\[Installation Guide Link\]](https://docs.docker.com/engine/install/)
{% endhint %}

### Set Environment Variables

Example: <https://github.com/CodeBattles-nn/codebattles/blob/new_backend/.env.example>

{% code title=".env.example" lineNumbers="true" %}

```properties
DB_USER=dfvdsdfvsdswvdfvdsvdfvdf
DB_PASSWORD=dvnsevhjeiwurowuqvhjevfvuodfb
DB_NAME=cb

```

{% endcode %}

{% stepper %}
{% step %}

#### Create a .env File

The structure can be found in .env.example
{% endstep %}

{% step %}

#### Set Complex Settings

In the .env file
{% endstep %}
{% endstepper %}

### Select Your Architecture

{% tabs %}
{% tab title="x64" %}
To install, you need to download the repository and deploy the Docker compose Container

pulling images from the repository:

```bash
docker compose -f prod-docker-compose.yml pull
```

starting:

```sh
docker compose -f prod-docker-compose.yml up
```

{% endtab %}

{% tab title="other" %}
To install, you need to download the repository and deploy the Docker compose Container

building images:

```bash
docker compose -f prod-docker-compose.yml build
```

starting:

```sh
docker compose -f prod-docker-compose.yml up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
To run containers in the background, use the *<mark style="color:blue;">**-d**</mark>* flag

Example:

{% code fullWidth="false" %}

```bash
docker compose up -f prod-docker-compose.yml -d
```

{% endcode %}
{% endhint %}

After this, please configure the programming languages. This is described on the next page


# Create a Competition

{% stepper %}
{% step %}

#### [Create a Competition](/en_v3/instructions/sorevnovanie/sozdanie-sorevnovaniya)

{% endstep %}

{% step %}

#### [Add Tasks](/en_v3/instructions/zadachi/dobavit-zadachu)

{% endstep %}

{% step %}

#### [Add Tasks to the Competition](/en_v3/instructions/sorevnovanie/redaktirovanie-zadach-sorevnovaniya)

{% endstep %}

{% step %}

#### [Add Checkers](/en_v3/instructions/sorevnovanie/redaktirovanie-zadach-sorevnovaniya)

{% endstep %}

{% step %}

#### [Add Participants](/en_v3/instructions/sorevnovanie/redaktirovanie-polzovatelei-sorevnovaniya)

{% endstep %}
{% endstepper %}


# Change Language

The language change tab is located at the top left

<figure><img src="/files/uSV8ni8VFfU1DQTuOQrJ" alt=""><figcaption></figcaption></figure>

When you click on it, a menu with language options opens

<figure><img src="/files/KUsfSsZR3Sbe8XGH0F1h" alt=""><figcaption></figcaption></figure>


# Competition


# Creating a Competition

{% stepper %}
{% step %}

#### Go to the Admin Panel

<figure><img src="/files/hLmc3K72BuwpHsynFERb" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Create a Competition

<figure><img src="/files/0MQaDHIinaVSpeK3ns6a" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Editing Competition Checkers

{% stepper %}
{% step %}

#### Go to the admin panel

<figure><img src="/files/hLmc3K72BuwpHsynFERb" alt=""><figcaption></figcaption></figure>

Click on the <mark style="color:yellow;">**Manage**</mark> button
{% endstep %}

{% step %}

#### Scroll down the page and find the edit checkers button

<figure><img src="/files/Rrl418b7Xpo1QR7nJX08" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Change the checkers

<figure><img src="/files/tWqnM2dH5ZBAGQKTjCk3" alt=""><figcaption></figcaption></figure>

If you don't have a checker that you would like to add, [create a new checker](/en_v3/instructions/chekery/sozdanie-chekera)
{% endstep %}
{% endstepper %}


# Editing Competition Users

{% stepper %}
{% step %}

#### Go to the admin panel

<figure><img src="/files/hLmc3K72BuwpHsynFERb" alt=""><figcaption></figcaption></figure>

Click on the <mark style="color:yellow;">**Manage**</mark> button
{% endstep %}

{% step %}

#### Click on <mark style="color:yellow;">users</mark>

<figure><img src="/files/g4BUQkKOEGHl1AMzScfP" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Edit users

<figure><img src="/files/CclxgHtNjb5yGi1nBAHm" alt=""><figcaption></figcaption></figure>

If you want to add a new user to the system, see the section [user registration](/en_v3/instructions/polzovateli/registraciya-polzovatelei)
{% endstep %}
{% endstepper %}


# Editing Competition Tasks

{% stepper %}
{% step %}

#### Go to the admin panel

<figure><img src="/files/hLmc3K72BuwpHsynFERb" alt=""><figcaption></figcaption></figure>

Click the <mark style="color:yellow;">**Manage**</mark> button
{% endstep %}

{% step %}

#### Click on Tasks

<figure><img src="/files/ZoOZHXzkQev1oZZbKjYo" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Then click the create button

<figure><img src="/files/fNIvwUtaoxnTpuP6NKRA" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Enter the required data

<figure><img src="/files/JcVDOSQn039KydV0S8vv" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Tasks


# Add a Task

{% stepper %}
{% step %}

#### Go to the admin panel

<figure><img src="/files/GlqT6p90bOT2UgpAEviy" alt=""><figcaption></figcaption></figure>

Click the <mark style="color:yellow;">**Tasks**</mark> button
{% endstep %}

{% step %}

#### Click on <mark style="color:yellow;">create</mark>

<figure><img src="/files/EmgTK9NpdBtCFKi103sv" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Create the task

<figure><img src="/files/JlGXd7cwwLmbo0p7WBXp" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Modify a Task

{% stepper %}
{% step %}

#### Go to the Admin Panel

<figure><img src="/files/GlqT6p90bOT2UgpAEviy" alt=""><figcaption></figcaption></figure>

Click on the <mark style="color:yellow;">**Tasks**</mark> button
{% endstep %}

{% step %}

#### Click on <mark style="color:yellow;">manage</mark>

<figure><img src="/files/O6TPaIoOhrBQTUpz8jPj" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Edit the Task

<figure><img src="/files/1usLFfQGW8YdlF0oVaRt" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Delete a Task

{% hint style="info" %}
Functionality is still in development
{% endhint %}


# Import from Polygon System

{% stepper %}
{% step %}

#### Go to the Polygon system and select the task

<figure><img src="/files/PsbyolvwlDNCtZfP9PEh" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Go to the Packages section

<figure><img src="/files/Adx8AjOU1B9MQoBG9p6f" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Export for Linux

<figure><img src="/files/ybMyQlV74VPUBhUXJIxL" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Go to the Codebattles platform

<figure><img src="/files/cIBdiuHDbPMP1yjSXPvV" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Upload the archive and add the task to the platform

<figure><img src="/files/eceD087uaMtEjrdARa73" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Users




---

[Next Page](/llms-full.txt/1)

