5 Commits

Author SHA1 Message Date
lizerk
beb4b8b86b refactor(departments): unify department feed and discussion flows 2026-04-14 16:14:52 +03:00
lizerk
6ee32111db chore: configure vscode flake8 and commit lint cleanup 2026-03-31 19:17:56 +03:00
lizerk
2815efe069 chore: finalize backend lint cleanup 2026-03-31 17:53:29 +03:00
lizerk
0217bc1a38 refactor: migrate comments to unified communications system
- Delete legacy Comment models (feed.Comment, documents.DocumentComment, requests_app.RequestComment)
- Create migration scripts to move data to communications.Message
- Add comments_helpers.py for unified comment operations
- Update API endpoints: /api/v1/posts/{id}/comments/, /api/v1/requests/{id}/comments/
- Fix notifications.0010_drop_old_tables migration with SeparateDatabaseAndState
- Implement real-time comments_count via GenericForeignKey annotations
- Update frontend API client to use new endpoints
- Update JavaScript files for new comment API routes
- Remove deprecated API endpoints and serializers
- Clean up signal handlers and admin registrations

Deployment tested: all migrations apply successfully on fresh database
2026-03-11 23:56:41 +03:00
lizerk
7e410ebff8 refactor(feed): реструктуризация notifications в модульную архитектуру
Проблема:
- Монолитный notification_signals.py (~200 строк) смешивал разные concerns
- Сложно поддерживать и понимать логику уведомлений
- Отсутствовала интеграция с API для уведомлений о лайках

Решение:
Разделен на модульную структуру feed/notifications/:
- config.py - NotificationVerbs, MessageTemplates, ActionURLs, truncate_text
- handlers.py - notify_new_post(), notify_comment(), notify_post_reaction(), get_post_recipients()
- signals.py - Django signal receivers (@receiver)
- __init__.py - публичный API модуля

Изменения:
- Создан: feed/notifications/ модуль с 4 файлами
- Переименован: notification_signals.py → notification_signals.py.old
- Изменен: apps.py - обновлен импорт на feed.notifications
- Изменен: api/v1/feed/views.py - добавлен вызов notify_post_reaction() в метод like()

Преимущества:
- ✅ Единообразие с requests_app и procurement
- ✅ Четкое разделение ответственности (SRP)
- ✅ Легче тестировать отдельные компоненты
- ✅ Публичный API через __init__.py
- ✅ Уведомления о лайках теперь работают
- ✅ Централизованные шаблоны сообщений

Верификация:
- python manage.py check - успешно
2026-03-10 13:05:58 +03:00