feat: media-mirror-api — координатор зеркал (REST + очередь в Postgres)

- POST /api/mirror (дубль-контроль по itemId), GET статус/by-item/список, DELETE (cancelled/S3-очистка)
- kotlinx-сериализация, Jackson выпилен из HTTP-стека (транзитив Flyway/AWS остался)
- Spring Boot 4.1.0, Kotlin 2.4.10, Flyway, Testcontainers postgres+minio
- тесты: 22, LINE 92.6%, smoke против живой БД прошёл
This commit is contained in:
Hermes Agent
2026-08-10 17:29:50 +03:00
parent 6250cb0a38
commit c0483ef3d1
25 changed files with 1430 additions and 0 deletions
@@ -0,0 +1,19 @@
CREATE SCHEMA IF NOT EXISTS media_mirror;
CREATE TABLE media_mirror.jobs (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
item_id text NOT NULL, -- itemId из Jellyfin
source_url text NOT NULL, -- URL исходника (jellyfin stream)
source_type text NOT NULL DEFAULT 'jellyfin',
status text NOT NULL DEFAULT 'new', -- new | processing | done | failed | cancelled
progress int NOT NULL DEFAULT 0, -- 0..100
video_key text, -- S3-ключ видео (после done)
audio_keys jsonb, -- [{key, title, language, index}]
error text,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
taken_at timestamptz
);
CREATE INDEX IF NOT EXISTS idx_jobs_status ON media_mirror.jobs (status, created_at);
CREATE UNIQUE INDEX IF NOT EXISTS uq_jobs_active_item
ON media_mirror.jobs (item_id)
WHERE status NOT IN ('failed', 'cancelled');