diff --git a/database_schema.md b/database_schema.md new file mode 100644 index 0000000..5209de6 --- /dev/null +++ b/database_schema.md @@ -0,0 +1,557 @@ +# πŸ—„ Π‘Ρ…Π΅ΠΌΠ° Π±Π°Π·Ρ‹ Π΄Π°Π½Π½Ρ‹Ρ… + +## achievements + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('achievements_id_seq'::regclass) | +| code | text | NO | | +| category | text | YES | 'general'::text | +| name_pl | text | NO | | +| name_ru | text | NO | | +| name_uk | text | NO | | +| name_en | text | NO | | +| description_pl | text | YES | ''::text | +| description_ru | text | YES | ''::text | +| description_uk | text | YES | ''::text | +| description_en | text | YES | ''::text | +| icon | text | YES | 'πŸ†'::text | +| requirement_type | text | NO | | +| requirement_value | integer | YES | 0 | + +## ai_user_context + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| current_level | character varying | YES | | +| completed_topics | integer | YES | 0 | +| completed_lessons | integer | YES | 0 | +| overall_mastery | numeric | YES | | +| strong_skills | jsonb | YES | '[]'::jsonb | +| weak_skills | jsonb | YES | '[]'::jsonb | +| uncertain_skills | jsonb | YES | '[]'::jsonb | +| recurring_errors | jsonb | YES | '[]'::jsonb | +| recommended_topics | jsonb | YES | '[]'::jsonb | +| recommended_lessons | jsonb | YES | '[]'::jsonb | +| last_analysis_at | timestamp without time zone | YES | | +| analytics_enabled | boolean | YES | false | +| level_topics_total | integer | YES | 0 | +| level_completion_percent | numeric | YES | 0 | + +## bubble_words_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| levels_completed | integer | YES | 0 | +| total_score | integer | YES | 0 | +| recent_words | ARRAY | YES | '{}'::text[] | +| level | text | YES | 'A1'::text | +| current_hints_used | integer | YES | 0 | + +## chat_history + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('chat_history_id_seq'::regclass) | +| user_id | bigint | YES | | +| message | text | NO | | +| is_user | boolean | YES | true | +| created_at | timestamp without time zone | YES | now() | + +## chat_usage + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('chat_usage_id_seq'::regclass) | +| user_id | bigint | YES | | +| usage_date | date | YES | CURRENT_DATE | +| message_count | integer | YES | 0 | + +## daily_logins + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| login_date | date | NO | CURRENT_DATE | + +## daily_phrases + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('daily_phrases_id_seq'::regclass) | +| phrase_date | date | NO | | +| phrase_pl | text | NO | | +| translations | jsonb | NO | '{}'::jsonb | +| grammar_breakdowns | jsonb | NO | '{}'::jsonb | +| created_at | timestamp without time zone | YES | now() | + +## feed_attachments + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('feed_attachments_id_seq'::regclass) | +| post_id | bigint | NO | | +| file_path | text | NO | | +| file_type | text | YES | 'image'::text | +| order_number | integer | NO | 0 | +| created_at | timestamp without time zone | YES | now() | + +## feed_posts + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('feed_posts_id_seq'::regclass) | +| section | text | NO | | +| source_language | text | NO | 'ru'::text | +| title_pl | text | YES | | +| title_ru | text | YES | | +| title_uk | text | YES | | +| title_en | text | YES | | +| body_pl | text | YES | | +| body_ru | text | YES | | +| body_uk | text | YES | | +| body_en | text | YES | | +| link_url | text | YES | | +| telegram_url | text | YES | | +| author_id | bigint | NO | | +| is_pinned | boolean | YES | false | +| is_published | boolean | YES | true | +| created_at | timestamp without time zone | YES | now() | +| updated_at | timestamp without time zone | YES | now() | +| edited_at | timestamp without time zone | YES | | +| expires_at | timestamp without time zone | YES | | + +## learning_lessons + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('learning_lessons_id_seq'::regclass) | +| lesson_id | character varying | NO | | +| topic_id | character varying | NO | | +| order_number | integer | NO | | +| skill_tag | character varying | NO | | +| title_pl | text | NO | | +| title_ru | text | NO | | +| title_uk | text | NO | | +| title_en | text | NO | | +| objective_pl | text | YES | | +| objective_ru | text | YES | | +| objective_uk | text | YES | | +| objective_en | text | YES | | +| explanation_pl | text | YES | | +| explanation_ru | text | YES | | +| explanation_uk | text | YES | | +| explanation_en | text | YES | | +| is_active | boolean | YES | true | +| edited_at | timestamp without time zone | YES | | + +## learning_levels + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('learning_levels_id_seq'::regclass) | +| code | character varying | NO | | +| name_pl | text | NO | | +| name_ru | text | NO | | +| name_uk | text | NO | | +| name_en | text | NO | | +| sort_order | integer | NO | | +| is_active | boolean | YES | true | + +## learning_questions + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('learning_questions_id_seq'::regclass) | +| question_id | character varying | NO | | +| lesson_id | character varying | YES | | +| topic_id | character varying | NO | | +| context_type | character varying | NO | | +| question_type | character varying | NO | | +| skill_tag | character varying | NO | | +| difficulty | integer | NO | | +| prompt_pl | text | YES | | +| prompt_ru | text | YES | | +| prompt_uk | text | YES | | +| prompt_en | text | YES | | +| correct_answer | text | YES | | +| hint_type | character varying | YES | | +| hint_value | text | YES | | +| is_test_question | boolean | YES | false | +| test_order | integer | YES | | +| options_language | text | YES | 'pl'::text | +| edited_at | timestamp without time zone | YES | | + +## learning_sessions + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('learning_sessions_id_seq'::regclass) | +| user_id | bigint | NO | | +| level_code | character varying | NO | | +| topic_id | character varying | NO | | +| session_type | character varying | NO | | +| started_at | timestamp without time zone | NO | now() | +| completed_at | timestamp without time zone | YES | | +| is_completed | boolean | YES | false | + +## learning_topics + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('learning_topics_id_seq'::regclass) | +| topic_id | character varying | NO | | +| level_code | character varying | NO | | +| order_number | integer | NO | | +| name_pl | text | NO | | +| name_ru | text | NO | | +| name_uk | text | NO | | +| name_en | text | NO | | +| description_pl | text | YES | | +| description_ru | text | YES | | +| description_uk | text | YES | | +| description_en | text | YES | | +| is_active | boolean | YES | true | +| edited_at | timestamp without time zone | YES | | + +## lesson_examples + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('lesson_examples_id_seq'::regclass) | +| lesson_id | character varying | NO | | +| order_number | integer | NO | | +| text_pl | text | NO | | +| text_ru | text | YES | | +| text_uk | text | YES | | +| text_en | text | YES | | +| audio_url | text | YES | | +| edited_at | timestamp without time zone | YES | | + +## lesson_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('lesson_progress_id_seq'::regclass) | +| user_id | bigint | YES | | +| level | text | YES | 'A1'::text | +| topic | text | YES | ''::text | +| correct_count | integer | YES | 0 | +| total_questions | integer | YES | 0 | +| created_at | timestamp without time zone | YES | now() | + +## level_words + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('level_words_id_seq'::regclass) | +| level_id | integer | YES | | +| word_pl | text | NO | | +| translation_ru | text | YES | ''::text | +| translation_uk | text | YES | ''::text | +| translation_en | text | YES | ''::text | +| level | text | YES | 'A1'::text | +| edited_at | timestamp without time zone | YES | | + +## levels + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('levels_id_seq'::regclass) | +| level_number | integer | NO | | +| grid_size | integer | NO | | +| game_type | text | YES | 'wordsearch'::text | +| theme | text | YES | ''::text | +| grid_letters | jsonb | NO | '[]'::jsonb | +| word_paths | jsonb | NO | '{}'::jsonb | +| level | text | YES | 'A1'::text | + +## question_options + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('question_options_id_seq'::regclass) | +| question_id | character varying | NO | | +| option_key | character varying | NO | | +| text_pl | text | YES | | +| text_ru | text | YES | | +| text_uk | text | YES | | +| text_en | text | YES | | +| is_correct | boolean | NO | | +| wrong_because | character varying | YES | | +| edited_at | timestamp without time zone | YES | | + +## sentence_hints_used + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| sentence_id | integer | NO | | +| used_at | timestamp without time zone | YES | now() | + +## sentence_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| sentence_id | integer | NO | | +| completed_at | timestamp without time zone | YES | | +| score | integer | YES | 0 | +| level | text | YES | 'A1'::text | + +## sentences + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('sentences_id_seq'::regclass) | +| sentence_number | integer | NO | | +| theme | text | YES | ''::text | +| sentence_pl | text | NO | | +| translation_ru | text | YES | ''::text | +| translation_uk | text | YES | ''::text | +| translation_en | text | YES | ''::text | +| difficulty | integer | YES | 1 | +| level | text | YES | 'A1'::text | +| edited_at | timestamp without time zone | YES | | + +## support_messages + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('support_messages_id_seq'::regclass) | +| ticket_id | bigint | NO | | +| sender_id | bigint | NO | | +| message | text | NO | | +| is_read | boolean | YES | false | +| created_at | timestamp without time zone | YES | now() | + +## support_tickets + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('support_tickets_id_seq'::regclass) | +| user_id | bigint | NO | | +| status | text | YES | 'open'::text | +| created_at | timestamp without time zone | YES | now() | +| updated_at | timestamp without time zone | YES | now() | + +## teacher_ai_usage + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('teacher_ai_usage_id_seq'::regclass) | +| user_id | bigint | NO | | +| usage_date | date | YES | CURRENT_DATE | +| command_count | integer | YES | 0 | + +## teacher_chat_history + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('teacher_chat_history_id_seq'::regclass) | +| user_id | bigint | NO | | +| messages | jsonb | NO | '[]'::jsonb | +| updated_at | timestamp without time zone | YES | now() | + +## teacher_reactions + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('teacher_reactions_id_seq'::regclass) | +| reaction_type | character varying | NO | | +| text_pl | text | NO | | +| text_ru | text | NO | | +| text_uk | text | NO | | +| text_en | text | NO | | + +## typing_hints_used + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| sentence_id | integer | NO | | +| used_at | timestamp without time zone | YES | now() | + +## typing_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| sentence_id | integer | NO | | +| completed_at | timestamp without time zone | YES | now() | + +## user_achievements + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| achievement_id | integer | NO | | +| unlocked_at | timestamp without time zone | YES | now() | + +## user_learning_answers + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('user_learning_answers_id_seq'::regclass) | +| user_id | bigint | NO | | +| session_id | bigint | NO | | +| level_code | character varying | NO | | +| topic_id | character varying | NO | | +| lesson_id | character varying | YES | | +| question_id | character varying | NO | | +| selected_answer | text | YES | | +| correct | boolean | YES | | +| skill_tag | character varying | NO | | +| question_type | character varying | NO | | +| context_type | character varying | NO | | +| difficulty | integer | NO | | +| time_taken_ms | integer | YES | | +| attempt_number | integer | YES | 1 | +| hint_used | boolean | YES | false | +| wrong_because | character varying | YES | | +| is_final_answer | boolean | YES | true | +| created_at | timestamp without time zone | YES | now() | + +## user_learning_answers_archive + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('user_learning_answers_archive_id_seq'::re | +| user_id | bigint | NO | | +| skill_tag | character varying | NO | | +| correct | boolean | YES | | +| wrong_because | character varying | YES | | +| created_at | date | YES | | +| archived_at | timestamp without time zone | YES | now() | + +## user_lesson_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('user_lesson_progress_id_seq'::regclass) | +| user_id | bigint | NO | | +| lesson_id | character varying | NO | | +| started_at | timestamp without time zone | YES | | +| completed_at | timestamp without time zone | YES | | +| attempts_count | integer | YES | 0 | +| correct_count | integer | YES | 0 | +| best_score | numeric | YES | | +| average_time_ms | integer | YES | | +| completed | boolean | YES | false | + +## user_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| level_id | integer | NO | | +| completed_at | timestamp without time zone | YES | | +| hints_used | integer | YES | 0 | +| score | integer | YES | 0 | +| level | text | YES | 'A1'::text | +| current_streak | integer | YES | 0 | + +## user_skill_mastery + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('user_skill_mastery_id_seq'::regclass) | +| user_id | bigint | NO | | +| skill_tag | character varying | NO | | +| attempts_count | integer | YES | 0 | +| correct_count | integer | YES | 0 | +| recognition_score | numeric | YES | | +| production_score | numeric | YES | | +| application_score | numeric | YES | | +| retention_score | numeric | YES | | +| hint_dependency | numeric | YES | | +| average_time_ms | integer | YES | | +| recent_accuracy | numeric | YES | | +| long_term_accuracy | numeric | YES | | +| mastery_score | numeric | YES | | +| confidence | numeric | YES | | +| last_attempt_at | timestamp without time zone | YES | | +| median_time_ms | integer | YES | 0 | +| recognition_attempts | integer | YES | 0 | +| recognition_correct | integer | YES | 0 | +| production_attempts | integer | YES | 0 | +| production_correct | integer | YES | 0 | +| application_attempts | integer | YES | 0 | +| application_correct | integer | YES | 0 | +| median_correct_time_ms | integer | YES | 0 | +| median_wrong_time_ms | integer | YES | 0 | +| last_3_accuracy | numeric | YES | | +| last_5_accuracy | numeric | YES | | +| last_10_accuracy | numeric | YES | | +| error_count | integer | YES | 0 | +| repeated_error_count | integer | YES | 0 | +| days_since_last_attempt | integer | YES | 0 | +| previous_mastery_score | numeric | YES | 0 | +| mastery_delta | numeric | YES | 0 | +| trend | text | YES | 'insufficient_data'::text | +| retention_status | text | YES | 'fresh'::text | +| fluency_score | numeric | YES | 0 | +| passive_knowledge_score | numeric | YES | 0 | +| active_knowledge_score | numeric | YES | 0 | + +## user_topic_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | bigint | NO | nextval('user_topic_progress_id_seq'::regclass) | +| user_id | bigint | NO | | +| topic_id | character varying | NO | | +| lessons_total | integer | YES | 0 | +| lessons_completed | integer | YES | 0 | +| test_started | boolean | YES | false | +| test_completed | boolean | YES | false | +| test_score | numeric | YES | | +| topic_mastery | numeric | YES | | +| confidence | numeric | YES | | +| completed_at | timestamp without time zone | YES | | + +## users + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| telegram_id | bigint | NO | | +| username | text | YES | | +| app_language | text | YES | 'pl'::text | +| created_at | timestamp without time zone | YES | now() | +| last_completed_level | integer | YES | 0 | +| id | integer | NO | nextval('users_id_seq'::regclass) | +| current_level | text | YES | 'A1'::text | + +## voice_usage + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('voice_usage_id_seq'::regclass) | +| user_id | bigint | YES | | +| usage_date | date | YES | CURRENT_DATE | +| voice_count | integer | YES | 0 | + +## word_quiz_progress + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| user_id | bigint | NO | | +| words_guessed | integer | YES | 0 | +| total_score | integer | YES | 0 | +| correct_streak | integer | YES | 0 | +| recent_words | ARRAY | YES | '{}'::text[] | +| level | text | YES | 'A1'::text | +| current_mistakes | integer | YES | 0 | + +## wrong_because_explanations + +| Колонка | Π’ΠΈΠΏ | NULL | Default | +|---------|-----|------|---------| +| id | integer | NO | nextval('wrong_because_explanations_id_seq'::regcl | +| wrong_because | character varying | NO | | +| explanation_pl | text | NO | | +| explanation_ru | text | NO | | +| explanation_uk | text | NO | | +| explanation_en | text | NO | | diff --git a/endpoints_inventory.md b/endpoints_inventory.md new file mode 100644 index 0000000..ced4bb6 --- /dev/null +++ b/endpoints_inventory.md @@ -0,0 +1,174 @@ +# πŸ›£ ВсС эндпоинты ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π° + +## achievements.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/achievements` + +- `GET /achievements/user` +- `POST /achievements/track-login` +- `POST /achievements/track-teacher-menu` +- `POST /achievements/track-progress` +- `POST /achievements/track-cheatsheets` +- `POST /achievements/track-pronunciation` +- `POST /achievements/track-ai-assistant` +- `POST /achievements/track-alphabet` +- `POST /achievements/track-rules` + +## admin.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/admin` + +- `GET /admin/dashboard` +- `GET /admin/sentry-errors` + +## admin_content.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/admin/content` + +- `GET /admin/content/summary` +- `GET /admin/content/words/levels` +- `GET /admin/content/words/level/{level}` +- `GET /admin/content/words/word/{word_id}` +- `PUT /admin/content/words/word/{word_id}` +- `POST /admin/content/words/level/{level}` +- `GET /admin/content/texts/levels` +- `GET /admin/content/texts/level/{level}` +- `GET /admin/content/texts/text/{text_id}` +- `PUT /admin/content/texts/text/{text_id}` +- `POST /admin/content/texts/level/{level}` +- `GET /admin/content/lessons/levels` +- `GET /admin/content/lessons/level/{level}/topics` +- `GET /admin/content/lessons/topic/{topic_id}` +- `GET /admin/content/lessons/lesson/{lesson_id}` +- `PUT /admin/content/lessons/lesson/{lesson_id}` +- `GET /admin/content/wrong-because` + +## assistant.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/assistant` + +- `POST /assistant/chat` +- `POST /assistant/save-analytics` +- `GET /assistant/stats/personal` +- `GET /assistant/stats/admin` +- `GET /assistant/limit` +- `GET /assistant/history` +- `POST /assistant/history/clear` + +## bubblewords.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/bubblewords` + +- `GET /bubblewords/next` +- `POST /bubblewords/complete` +- `GET /bubblewords/progress` + +## feed.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `` + +- `GET /feed/{section}` +- `GET /feed/post/{post_id}` +- `POST /admin/feed/post` +- `PUT /admin/feed/post/{post_id}` +- `POST /admin/feed/post/{post_id}/delete` +- `POST /admin/feed/upload-image` +- `POST /admin/feed/translate` + +## game.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/game` + +- `GET /game/progress` +- `GET /game/level/{level_number}` +- `POST /game/check-word` +- `POST /game/complete-level` + +## hints.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/hints` + +- `GET /hints/first-letter/{level_id}` +- `GET /hints/word-list/{level_id}` +- `GET /hints/remaining/{level_id}` + +## leaderboard.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/leaderboard` + +- `GET /leaderboard/admin/stats` +- `GET /leaderboard/top` + +## learning.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/learning` + +- `GET /learning/levels` +- `GET /learning/topics` +- `GET /learning/topics/{topic_id}` +- `GET /learning/lessons/{lesson_id}` +- `GET /learning/test/{topic_id}` +- `POST /learning/session/start` +- `POST /learning/answer` +- `POST /learning/session/complete` +- `GET /learning/progress` +- `POST /learning/analytics` +- `GET /learning/ai/context` +- `POST /learning/practice/start` + +## pronunciation.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/pronunciation` + +- `GET /pronunciation/next` + +## sentences.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/sentences` + +- `GET /sentences/{sentence_id}/hint` +- `GET /sentences/next` +- `POST /sentences/check` +- `GET /sentences/stats` + +## support.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/support` + +- `POST /support/send` +- `GET /support/user-tickets` +- `GET /support/user-messages/{ticket_id}` +- `GET /support/user-unread-count` +- `POST /support/delete-ticket/{ticket_id}` +- `GET /support/admin-tickets` +- `GET /support/admin-messages/{ticket_id}` +- `POST /support/admin-reply` +- `GET /support/unread-count` +- `POST /support/translate` + +## teacher.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/teacher` + +- `GET /teacher/phrase-of-day` +- `POST /teacher/resume` +- `POST /teacher/start` +- `POST /teacher/answer` +- `POST /teacher/explain` +- `POST /teacher/examples` +- `POST /teacher/free-message` +- `POST /teacher/diagnostic-test` +- `POST /teacher/translate-to-polish` +- `GET /teacher/progress` +- `POST /teacher/history/save` +- `GET /teacher/history/load` +- `POST /teacher/history/clear` + +## typing.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/typing` + +- `GET /typing/next` +- `POST /typing/check` +- `GET /typing/hint/{sentence_id}` +- `GET /typing/progress` + +## users.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/users` + +- `POST /users/register` +- `GET /users/me/is-admin` +- `POST /users/set-language` +- `POST /users/set-level` + +## wordquiz.py +**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `/wordquiz` + +- `GET /wordquiz/next` +- `POST /wordquiz/check` +- `GET /wordquiz/progress` diff --git a/scripts/dump_inventory.py b/scripts/dump_inventory.py new file mode 100644 index 0000000..99f79b6 --- /dev/null +++ b/scripts/dump_inventory.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +""" +Π˜Π½Π²Π΅Π½Ρ‚Π°Ρ€ΠΈΠ·Π°Ρ†ΠΈΡ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π°: всС эндпоинты + схСма Π±Π°Π·Ρ‹. + +Запуск: python scripts/dump_inventory.py +Π Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚: endpoints_inventory.md + database_schema.md +""" +import asyncio +import re +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).parent.parent)) + +from database import get_pool + + +def dump_endpoints() -> None: + """Π‘ΠΎΠ±ΠΈΡ€Π°Π΅Ρ‚ всС эндпоинты ΠΈΠ· routers/*.py.""" + routers_dir = Path("routers") + lines = ["# πŸ›£ ВсС эндпоинты ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π°", ""] + total = 0 + + for router_file in sorted(routers_dir.glob("*.py")): + if router_file.name == "__init__.py": + continue + + content = router_file.read_text(encoding="utf-8") + + prefix_match = re.search(r'APIRouter\(prefix="([^"]+)"', content) + prefix = prefix_match.group(1) if prefix_match else "" + + endpoints = re.findall( + r'@router\.(get|post|put|delete|patch)\("([^"]+)"', + content, + ) + + if endpoints: + lines.append(f"## {router_file.name}") + lines.append(f"**ΠŸΡ€Π΅Ρ„ΠΈΠΊΡ:** `{prefix}`") + lines.append("") + for method, path in endpoints: + full_path = f"{prefix}{path}" if path.startswith("/") else f"{prefix}/{path}" + lines.append(f"- `{method.upper()} {full_path}`") + total += 1 + lines.append("") + + Path("endpoints_inventory.md").write_text("\n".join(lines), encoding="utf-8") + print(f"βœ… endpoints_inventory.md β€” {total} эндпоинтов") + + +async def dump_schema() -> None: + """Π‘ΠΎΠ±ΠΈΡ€Π°Π΅Ρ‚ всС Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹ ΠΈ ΠΊΠΎΠ»ΠΎΠ½ΠΊΠΈ ΠΈΠ· Π±Π°Π·Ρ‹.""" + pool = await get_pool() + async with pool.acquire() as conn: + tables = await conn.fetch(""" + SELECT table_name + FROM information_schema.tables + WHERE table_schema = 'public' + AND table_type = 'BASE TABLE' + ORDER BY table_name + """) + + lines = ["# πŸ—„ Π‘Ρ…Π΅ΠΌΠ° Π±Π°Π·Ρ‹ Π΄Π°Π½Π½Ρ‹Ρ…", ""] + total = 0 + + for t in tables: + table_name = t["table_name"] + lines.append(f"## {table_name}") + lines.append("") + + cols = await conn.fetch(""" + SELECT column_name, data_type, is_nullable, column_default + FROM information_schema.columns + WHERE table_name = $1 + ORDER BY ordinal_position + """, table_name) + + lines.append("| Колонка | Π’ΠΈΠΏ | NULL | Default |") + lines.append("|---------|-----|------|---------|") + for c in cols: + nullable = "YES" if c["is_nullable"] == "YES" else "NO" + default = (c["column_default"] or "")[:50] + lines.append(f"| {c['column_name']} | {c['data_type']} | {nullable} | {default} |") + lines.append("") + total += 1 + + await pool.close() + + Path("database_schema.md").write_text("\n".join(lines), encoding="utf-8") + print(f"βœ… database_schema.md β€” {total} Ρ‚Π°Π±Π»ΠΈΡ†") + + +async def main() -> None: + dump_endpoints() + await dump_schema() + print("πŸŽ‰ Π“ΠΎΡ‚ΠΎΠ²ΠΎ!") + + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/smoke_test_report.md b/smoke_test_report.md new file mode 100644 index 0000000..e03a8a1 --- /dev/null +++ b/smoke_test_report.md @@ -0,0 +1,17 @@ +# πŸ§ͺ Smoke-test ΠΎΡ‚Ρ‡Ρ‘Ρ‚ (Ρ€Π΅Π°Π»ΡŒΠ½Ρ‹ΠΉ ΡŽΠ·Π΅Ρ€, Ρ€Π΅Π°Π»ΡŒΠ½Π°Ρ Π‘Π”) + +**Π”Π°Ρ‚Π°:** 2026-09-26 09:13 UTC +**Π˜Ρ‚ΠΎΠ³ΠΎ:** 10/10 сцСнариСв ΠΏΡ€ΠΎΡˆΠ»ΠΈ + +## βœ… ΠŸΠΎΠ΄Ρ‚Π²Π΅Ρ€ΠΆΠ΄Π΅Π½ΠΎ Ρ€Π°Π±ΠΎΡ‡ΠΈΠΌ + +- **pronunciation_pool_stress** (pronunciation) β€” 30/30 запросов ΡƒΡΠΏΠ΅ΡˆΠ½Ρ‹, 29 ΡƒΠ½ΠΈΠΊΠ°Π»ΡŒΠ½Ρ‹Ρ… слов +- **hints_db_increment** (hints) β€” GET Π²Π΅Ρ€Π½ΡƒΠ» 200, hints_used 0 β†’ 1 +- **game_complete_level_full_flow** (game) β€” idempotent=True, api_score=90, db_score=90 +- **wordquiz_correct_answer** (wordquiz) β€” status=200, correct=True, total_score 0 β†’ 50 +- **wordquiz_wrong_answer** (wordquiz) β€” status=200, current_mistakes 0 β†’ 1 +- **bubblewords_complete_flow** (bubblewords) β€” status=200, levels 0β†’1, score 0β†’100 +- **sentences_check_wrong** (sentences) β€” status=200, score 0 β†’ 0 (Π½Π΅Π²Π΅Ρ€Π½Ρ‹ΠΉ ΠΎΡ‚Π²Π΅Ρ‚) +- **typing_progress_flow** (typing) β€” status=200, sentence_id=4625, typing_progress записан=True +- **users_set_language** (users) β€” status=200, app_language pl β†’ ru (ΠΎΠΆΠΈΠ΄Π°Π»ΠΈ ru) +- **achievements_track_login** (achievements) β€” status=200, daily_logins 0 β†’ 1