Секция 2: Модель данных

Основные сущности и связи в PostgreSQL

ER-диаграмма
👤 User
id UUID PK
username str unique
email str unique
password_hash str
role enum (admin, user)
is_active bool
created_at timestamp
🎬 Recording
id UUID PK
user_id FK → User
title str
file_path str
file_size bigint
duration interval
format str (mp4, webm, mp3…)
source enum (web, telegram, lensa)
status enum (uploaded, processing, done, error)
created_at timestamp
📝 Transcription
id UUID PK
recording_id FK → Recording
text text
segments JSONB (таймкоды)
language str
whisper_model str
processing_time interval
created_at timestamp
📋 Protocol
id UUID PK
transcription_id FK → Transcription
template_id FK → PromptTemplate
content JSONB (структурированный)
raw_text text
llm_model str
status enum (generating, done, error)
created_at timestamp
updated_at timestamp
📐 PromptTemplate
id UUID PK
name str
description str
type enum (client_survey, internal, standup, custom)
system_prompt text
user_prompt text
output_schema JSONB
is_default bool
created_at timestamp
📄 ExportFile
id UUID PK
protocol_id FK → Protocol
format enum (docx, pdf, md)
file_path str
file_size bigint
created_at timestamp
Связи: User 1→N Recording → 1→1 Transcription → 1→N Protocol → 1→N ExportFile
PromptTemplate 1→N Protocol

Управление хранилищем