lizerk
51aecacf09
feat(communications): Refactor Chat model to universal GenericForeignKey
BREAKING CHANGES (backward compatible with data migration):
- Add context_object (GenericFK) to replace department FK
- Add flags (JSONField) to replace is_main boolean
- Add extra_data (JSONField) for extensibility
- Rename include_all_employees → include_all_users
NEW FEATURES:
- Generic context support (Department, Project, Team, etc.)
- Flexible flags system without migrations
- Settings-based participant resolver callback
- Zero data loss migrations (4 migrations)
MIGRATIONS:
- 0031: Add new fields (context_object, flags, extra_data)
- 0032: Migrate department → context_object (15 chats)
- 0033: Migrate is_main → flags['is_primary'] (15 chats)
- 0034: Rename include_all_employees → include_all_users
FILES CHANGED:
- models.py: Refactored Chat.get_participants() with callback support
- employees/utils.py: Added resolve_chat_participants() callback
- settings.py: Added COMMUNICATIONS_PARTICIPANT_RESOLVER setting
- verify_chat_migration.py: Command to verify data integrity
TESTED:
✅ All 32 chats migrated successfully
✅ Legacy department FK still works
✅ Context-based chats work (GenericFK)
✅ Global/private/announcement chats work
✅ Participants resolver callback works
2026-03-11 14:21:57 +03:00
..
2026-03-10 18:09:06 +03:00
2026-02-16 17:07:15 +03:00
2026-03-11 14:21:57 +03:00
2026-03-11 09:53:55 +03:00
2026-03-10 13:37:59 +03:00
2026-03-11 14:21:57 +03:00
2026-03-11 14:21:57 +03:00
2026-03-10 13:07:05 +03:00
2026-03-10 13:18:57 +03:00
2026-02-17 18:32:30 +03:00
2026-03-11 08:48:26 +03:00
2026-03-10 12:38:39 +03:00
2026-03-09 21:35:36 +03:00
2026-03-10 12:28:03 +03:00
2026-03-11 13:37:44 +03:00
2026-03-10 18:09:06 +03:00
2026-03-10 13:18:57 +03:00
2026-03-10 13:58:53 +03:00
2026-02-27 16:36:16 +03:00
2026-03-10 15:21:28 +03:00
2025-07-30 08:15:53 +03:00
2025-09-03 17:17:44 +03:00
2025-07-30 08:15:53 +03:00
2026-02-17 18:34:16 +03:00
2026-02-24 15:40:50 +03:00
2026-03-05 11:49:55 +03:00
2026-03-06 19:01:27 +03:00