- register_max_webhook.py, fetch_schema.py - n8n-code-node-max-normalize.js (max_id, callback из callback.user, contact из vcf_info) - n8n-code-add-menu-buttons.js (меню с callback, request_contact, Главное меню) - docs: max-webhook, max-curl-http-request, max-api (форматы, кнопки, контакт), clpr vs sprf - README, SITUATION, схемы sprf_ и clpr_, .gitignore Co-authored-by: Cursor <cursoragent@cursor.com>
218 lines
8.5 KiB
Markdown
218 lines
8.5 KiB
Markdown
# Структура таблиц sprf_ (public, default_db)
|
|
## sprf_chat_messages
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('sprf_chat_messages_id_seq'::reg... |
|
|
| claim_id | uuid | | YES | |
|
|
| from_user | boolean | | YES | |
|
|
| message_text | text | | YES | |
|
|
| file_id | text | | YES | |
|
|
| sent_at | timestamp with time zone | | YES | |
|
|
|
|
## sprf_claim_documents
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | |
|
|
| claim_id | character varying | | YES | |
|
|
| field_name | text | | YES | |
|
|
| file_id | text | | YES | |
|
|
| uploaded_at | timestamp with time zone | | YES | |
|
|
|
|
## sprf_claim_statuses
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| code | text | | NO | |
|
|
| description | text | | YES | |
|
|
|
|
## sprf_claim_types
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| code | text | | NO | |
|
|
| description | text | | YES | |
|
|
|
|
## sprf_claims
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | character varying | | NO | |
|
|
| user_id | integer | | YES | |
|
|
| type_code | text | | YES | |
|
|
| status_code | text | | YES | |
|
|
| policy_number | text | | YES | |
|
|
| payload | jsonb | | YES | |
|
|
| created_at | timestamp with time zone | | YES | |
|
|
| updated_at | timestamp with time zone | | YES | |
|
|
| session_token | character varying | | YES | |
|
|
| unified_id | character varying | | YES | |
|
|
| telegram_id | bigint | | YES | |
|
|
| channel | text | | YES | |
|
|
| is_confirmed | boolean | | YES | false |
|
|
|
|
## sprf_conversation_state
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| user_id | integer | | NO | |
|
|
| current_step | text | | YES | |
|
|
| data | jsonb | | YES | |
|
|
| updated_at | timestamp with time zone | | YES | |
|
|
|
|
## sprf_court_decisions
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | gen_random_uuid() |
|
|
| uuid | character varying | 36 | NO | (gen_random_uuid())::text |
|
|
| file_name | character varying | 500 | NO | |
|
|
| file_size | bigint | | YES | |
|
|
| mime_type | character varying | 100 | YES | |
|
|
| file_hash | character varying | 64 | NO | |
|
|
| s3_url | text | | NO | |
|
|
| telegram_message_id | bigint | | YES | |
|
|
| telegram_chat_id | bigint | | YES | |
|
|
| telegram_user_id | bigint | | NO | |
|
|
| telegram_username | character varying | 255 | YES | |
|
|
| telegram_full_name | character varying | 500 | YES | |
|
|
| ocr_processed | boolean | | YES | false |
|
|
| ocr_processed_at | timestamp with time zone | | YES | |
|
|
| ocr_text | text | | YES | |
|
|
| ocr_pages_data | jsonb | | YES | |
|
|
| ocr_pages_count | integer | | YES | |
|
|
| vector_processed | boolean | | YES | false |
|
|
| vector_processed_at | timestamp with time zone | | YES | |
|
|
| vector_store_id | character varying | 255 | YES | |
|
|
| vector_file_ids | jsonb | | YES | |
|
|
| nsfw_checked | boolean | | YES | false |
|
|
| nsfw_result | boolean | | YES | false |
|
|
| nsfw_score | numeric | | YES | |
|
|
| processing_status | character varying | 50 | YES | 'pending'::character varying |
|
|
| processing_error | text | | YES | |
|
|
| uploaded_at | timestamp with time zone | | YES | CURRENT_TIMESTAMP |
|
|
| updated_at | timestamp with time zone | | YES | CURRENT_TIMESTAMP |
|
|
| crm_claim_id | integer | | YES | |
|
|
| crm_project_id | integer | | YES | |
|
|
| metadata | jsonb | | YES | '{}'::jsonb |
|
|
| court_raw_json | jsonb | | YES | '{}'::jsonb |
|
|
|
|
## sprf_court_decisions_view
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | YES | |
|
|
| uuid | character varying | 36 | YES | |
|
|
| file_name | character varying | 500 | YES | |
|
|
| file_size | bigint | | YES | |
|
|
| mime_type | character varying | 100 | YES | |
|
|
| telegram_user_id | bigint | | YES | |
|
|
| telegram_username | character varying | 255 | YES | |
|
|
| telegram_full_name | character varying | 500 | YES | |
|
|
| ocr_processed | boolean | | YES | |
|
|
| ocr_pages_count | integer | | YES | |
|
|
| vector_processed | boolean | | YES | |
|
|
| processing_status | character varying | 50 | YES | |
|
|
| uploaded_at | timestamp with time zone | | YES | |
|
|
| updated_at | timestamp with time zone | | YES | |
|
|
| ocr_text_preview | text | | YES | |
|
|
| crm_claim_id | integer | | YES | |
|
|
| crm_project_id | integer | | YES | |
|
|
|
|
## sprf_dialog_history_tg
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('sprf_dialog_history_tg_id_seq':... |
|
|
| telegram_id | bigint | | YES | |
|
|
| role | character varying | | YES | |
|
|
| message | text | | YES | |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
| session_token | character varying | | YES | |
|
|
| claim_id | character varying | | YES | |
|
|
| message_type | text | | YES | |
|
|
| payload | jsonb | | YES | |
|
|
| tg_message_id | bigint | | YES | |
|
|
| tg_update_id | bigint | | YES | |
|
|
|
|
## sprf_document_embeddings
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| document_id | uuid | | YES | |
|
|
| chunk_index | integer | | YES | |
|
|
| embedding | USER-DEFINED | | YES | |
|
|
|
|
## sprf_documents
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | |
|
|
| source | text | | YES | |
|
|
| content | text | | YES | |
|
|
| metadata | jsonb | | YES | |
|
|
| created_at | timestamp with time zone | | YES | |
|
|
|
|
## sprf_operators
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('sprf_operators_id_seq'::regclas... |
|
|
| telegram_id | bigint | | YES | |
|
|
| name | text | | YES | |
|
|
| is_active | boolean | | YES | |
|
|
| created_at | timestamp with time zone | | YES | |
|
|
|
|
## sprf_sessions
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | gen_random_uuid() |
|
|
| user_id | integer | | YES | |
|
|
| session_token | character varying | | YES | |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
| last_activity | timestamp with time zone | | YES | |
|
|
| expires_at | timestamp with time zone | | YES | |
|
|
|
|
## sprf_user_accounts
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('sprf_user_accounts_id_seq'::reg... |
|
|
| user_id | integer | | YES | |
|
|
| channel | text | | YES | |
|
|
| channel_user_id | text | | YES | |
|
|
|
|
## sprf_users
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('sprf_users_id_seq'::regclass) |
|
|
| universal_id | uuid | | YES | |
|
|
| phone | character varying | | YES | |
|
|
| created_at | timestamp with time zone | | YES | |
|
|
| updated_at | timestamp with time zone | | YES | |
|
|
| unified_id | character varying | | YES | |
|
|
|
|
## sprf_users_tg
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| telegram_id | bigint | | NO | |
|
|
| phone_number | character varying | | YES | |
|
|
| first_name_tg | character varying | | YES | |
|
|
| last_name_tg | character varying | | YES | |
|
|
| username | character varying | | YES | |
|
|
| language_code | character varying | | YES | |
|
|
| is_premium | boolean | | YES | |
|
|
| unified_id | character varying | | YES | |
|
|
| birth_date | character varying | | YES | |
|
|
| birth_place | character varying | | YES | |
|
|
| inn | character varying | | YES | |
|
|
| address | character varying | | YES | |
|
|
| email | character varying | | YES | |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
| updated_at | timestamp with time zone | | YES | now() |
|
|
| first_name | character varying | | YES | |
|
|
| last_name | character varying | | YES | |
|
|
| middle_name | character varying | | YES | |
|
|
| is_confirmed | boolean | | YES | false |
|
|
|
|
## sprf_wizard_questions
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('sprf_wizard_questions_id_seq'::... |
|
|
| claim_type | text | | YES | |
|
|
| step_key | text | | YES | |
|
|
| question_text | text | | YES | |
|
|
| answer_type | text | | YES | |
|
|
| step_order | integer | | YES | |
|
|
| options | jsonb | | YES | |
|
|
| is_required | boolean | | YES | |
|
|
|