- 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>
192 lines
7.4 KiB
Markdown
192 lines
7.4 KiB
Markdown
# Структура таблиц clpr_ (public, default_db)
|
|
## clpr_chat_messages
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('clpr_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 | now() |
|
|
|
|
## clpr_claim_documents
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | gen_random_uuid() |
|
|
| claim_id | character varying | | YES | |
|
|
| field_name | text | | YES | |
|
|
| file_id | text | | YES | |
|
|
| uploaded_at | timestamp with time zone | | YES | now() |
|
|
| file_name | text | | YES | |
|
|
| original_file_name | text | | YES | |
|
|
| file_hash | character varying | 64 | YES | |
|
|
| ocr_status | character varying | 20 | YES | 'pending'::character varying |
|
|
| ocr_processed_at | timestamp with time zone | | YES | |
|
|
| ocr_error | text | | YES | |
|
|
| document_type | character varying | 50 | YES | |
|
|
| document_label | character varying | 255 | YES | |
|
|
| match_score | integer | | YES | |
|
|
| match_status | character varying | 20 | YES | 'pending'::character varying |
|
|
| match_reason | text | | YES | |
|
|
| match_checked_at | timestamp without time zone | | YES | |
|
|
| document_summary | text | | YES | |
|
|
|
|
## clpr_claim_statuses
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| code | text | | NO | |
|
|
| description | text | | YES | |
|
|
|
|
## clpr_claim_types
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| code | text | | NO | |
|
|
| description | text | | YES | |
|
|
|
|
## clpr_claims
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | gen_random_uuid() |
|
|
| session_token | character varying | | YES | |
|
|
| unified_id | character varying | | YES | |
|
|
| telegram_id | bigint | | YES | |
|
|
| channel | text | | YES | |
|
|
| user_id | integer | | YES | |
|
|
| type_code | text | | YES | |
|
|
| status_code | text | | YES | |
|
|
| policy_number | text | | YES | |
|
|
| payload | jsonb | | YES | |
|
|
| is_confirmed | boolean | | YES | false |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
| updated_at | timestamp with time zone | | YES | now() |
|
|
| expires_at | timestamp with time zone | | YES | |
|
|
| contact_id | text | | YES | |
|
|
| phone | text | | YES | |
|
|
|
|
## clpr_conversation_state
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| user_id | integer | | NO | |
|
|
| current_step | text | | YES | |
|
|
| data | jsonb | | YES | |
|
|
| updated_at | timestamp with time zone | | YES | |
|
|
|
|
## clpr_dialog_history_tg
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('clpr_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 | uuid | | YES | |
|
|
| message_type | text | | YES | |
|
|
| payload | jsonb | | YES | |
|
|
| tg_message_id | bigint | | YES | |
|
|
| tg_update_id | bigint | | YES | |
|
|
|
|
## clpr_document_embeddings
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | YES | |
|
|
| embedding | USER-DEFINED | | YES | |
|
|
| text | text | | YES | |
|
|
| metadata | jsonb | | YES | |
|
|
|
|
## clpr_documents
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | uuid | | NO | gen_random_uuid() |
|
|
| source | text | | YES | |
|
|
| content | text | | YES | |
|
|
| metadata | jsonb | | YES | |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
|
|
## clpr_menu_commands
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | bigint | | NO | nextval('clpr_menu_commands_id_seq'::reg... |
|
|
| command | text | | NO | |
|
|
| description | text | | YES | |
|
|
| action | text | | YES | |
|
|
| reply_text | text | | YES | |
|
|
| menu_id | text | | NO | 'main'::text |
|
|
| menu_version | integer | | NO | 1 |
|
|
| created_at | timestamp with time zone | | NO | now() |
|
|
| updated_at | timestamp with time zone | | YES | |
|
|
|
|
## clpr_operators
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('clpr_operators_id_seq'::regclas... |
|
|
| telegram_id | bigint | | YES | |
|
|
| name | text | | YES | |
|
|
| is_active | boolean | | YES | |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
|
|
## clpr_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 | |
|
|
|
|
## clpr_user_accounts
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('clpr_user_accounts_id_seq'::reg... |
|
|
| user_id | integer | | YES | |
|
|
| channel | text | | YES | |
|
|
| channel_user_id | text | | YES | |
|
|
|
|
## clpr_users
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('clpr_users_id_seq'::regclass) |
|
|
| universal_id | uuid | | YES | |
|
|
| unified_id | character varying | | YES | |
|
|
| phone | character varying | | YES | |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
| updated_at | timestamp with time zone | | YES | now() |
|
|
| contact_data_confirmed_at | timestamp with time zone | | YES | |
|
|
|
|
## clpr_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 | |
|
|
| first_name | character varying | | YES | |
|
|
| last_name | character varying | | YES | |
|
|
| middle_name | 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 | |
|
|
| is_confirmed | boolean | | YES | false |
|
|
| created_at | timestamp with time zone | | YES | now() |
|
|
| updated_at | timestamp with time zone | | YES | now() |
|
|
|
|
## clpr_wizard_questions
|
|
| Колонка | Тип | Размер | NULL | Default |
|
|
|---------|-----|--------|------|--------|
|
|
| id | integer | | NO | nextval('clpr_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 | |
|
|
|