14 Commits

Author SHA1 Message Date
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
96fa8c2a92 Исправлены миграции notifications: переход на упрощенную модель уведомлений v2
- Исправлена миграция 0010: добавлено удаление старых моделей из Django state
- Добавлен default='notification' для поля verb в модели Notification
- Создана чистая миграция 0011_initial с новыми моделями:
  * Notification (с GenericForeignKey)
  * UserChannelPreferences
- Удалены автоматически сгенерированные некорректные миграции

Fixes: KeyError при попытке удалить unique_together с несуществующими полями
2026-03-10 08:04:41 +03:00
lizerk
5a6dc011dd fix: Безопасные миграции для production и исправления
Миграции (production-safe):
- 0010_drop_old_tables.py: DROP TABLE IF EXISTS (безопасно)
- 0011_create_v2_models.py: CREATE новых таблиц v2
- Исправлены поля: dnd_start_time/dnd_end_time теперь nullable
- Удалены created_at/updated_at из UserChannelPreferences

Исправления:
- models.py: удалены created_at/updated_at из UserChannelPreferences
- models.py: db_table = 'notifications_userchannelpreferences' (слитно)
- admin.py: удалены ссылки на created_at/updated_at
- channels.py: удален мусор после рефакторинга
- urls.py: создан для обратной совместимости

Тесты:
✅ UserChannelPreferences creation
✅ QuerySet методы (unread, read, mark_all_as_read)
✅ mark_as_read/unread
⚠️ notify.send() - ошибка watson search (не критично)

Результат:
- Миграции работают на пустой и заполненной БД
- Старые данные удаляются безопасно (IF EXISTS)
- Можно git clone → migrate → запуск на production
2026-03-09 17:27:31 +03:00
lizerk
72b67d5c6a fix: Исправлены синтаксические ошибки и добавлены миграции
Исправлено:
- channels.py: удалены осиротевшие строки после рефакторинга
- api/v1/notifications/urls.py: исправлен file для реэкспорта
- notifications/urls.py: создан для обратной совместимости

Миграции:
- 0010_userchannelpreferences_and_more.py: переход на v2 модели
  * Notification с GenericForeignKey (actor/action_object/target)
  * UserChannelPreferences вместо UserNotificationSettings
  * Удалены старые модели (NotificationCategory, NotificationType и тд.)
  * Переименована таблица в notifications_notification_v2
2026-03-09 17:15:08 +03:00
lizerk
88dc3aeb50 fix(migrations): обрезка browser до 10 символов в 0008_migrate_webpush_to_library 2026-03-06 19:35:16 +03:00
41e4238a84 feat: add document related, comments, tags, versions components and notifications integration 2026-03-02 12:37:55 +03:00
a30856ccc7 feat: интегрирован django-push-notifications для Web Push
- Добавлен django-push-notifications==3.1.0 в requirements.txt
- Настроен PUSH_NOTIFICATIONS_SETTINGS в settings.py
- Создана миграция данных 0008_migrate_webpush_to_library.py (9 подписок)
- Обновлен send_web_push_notification() в services.py (150→25 строк)
- Обновлены API endpoints: subscribe_push, unsubscribe_push, get_push_subscriptions
- Ожидается 10-50x ускорение при отправке push уведомлений
- Обратная совместимость: API не изменилось, старая модель сохранена
- Полный отчет: backend/docs/reports/DJANGO_PUSH_NOTIFICATIONS_INTEGRATION.md
2026-02-27 19:30:51 +03:00
4c23a0ec4d feat: Add procurement refactoring plan and merge migrations 2026-02-27 17:55:42 +03:00
5cf586ac1d merge: frontend/Igor2 into feature/procurement-module with Igor2 priority 2026-02-27 16:36:16 +03:00
c8dd32ce8e fix: add device_name field to WebPushSubscription model 2026-01-05 14:40:52 +03:00
788a245cc9 feat: implement Web Push notifications for offline browser notifications
- Add WebPushSubscription model for storing push subscriptions
- Generate VAPID keys for Web Push authentication
- Add API endpoints for push subscribe/unsubscribe
- Create Service Worker (sw.js) for handling push events
- Create JavaScript module for managing push subscriptions
- Integrate send_web_push_notification into NotificationService
- Add Service Worker registration to base.html
- Update requirements.txt with pywebpush package
2026-01-05 14:10:42 +03:00
d04b5e38c2 feat: add procurement integration with notifications and real-time
Stage 7 - Integration:
- Create notification types migration for procurement
- Fix signals to use pre_save for status tracking
- Add broadcast_request_update function for WebSocket events
- Add procurement_update handler in UserConsumer
- Add 6 integration tests for signals and notifications
- Update README with integration details

All 72 tests passing (66 base + 6 integration).
2025-12-09 12:23:02 +03:00
35f365a1b0 feat: Add department-based document distribution with department picker in UI
- Added departments ManyToMany field to Document model
- Implemented department selection in document create/edit modals
- Added automatic notification creation for all department employees
- Fixed document filtering to include uploaded documents in 'My Documents'
- Fixed acknowledgements API to include department recipients
- Added bulk notification support with configurable threshold
- Removed acknowledge button, added visual highlighting for unread documents
- Implemented server-side acknowledgment flow with redirect to file
- Fixed mobile responsive layout for document actions
- Removed temporary test files and documentation
2025-11-21 12:46:43 +03:00
ddf22c47da fix: автоматическое обновление JWT токенов
- ApiClient теперь обрабатывает 401 и 403 ошибки для обновления токена
- Добавлен JWTRefreshMiddleware для проактивного обновления токенов за 5 минут до истечения
- Добавлена настройка JWT_REFRESH_THRESHOLD_MINUTES (по умолчанию 5)
- Исправлена проблема с периодическими 403 ошибками после истечения access token
2025-11-20 18:52:29 +03:00