igor_nadein
7a3402f1b6
refactor(employees): simplify partial_update using ExternalSystemSyncMixin
Replaced _perform_user_update (180+ lines) with clean mixin approach:
Before:
- _perform_user_update(): 180 lines of manual LDAP/DB coordination
- Manual transaction management
- Direct DirectoryService.update_user() calls with transaction.atomic inside
- Complex error handling
- Duplicate email verification logic
After:
- partial_update(): delegates to super() + email verification (30 lines)
- perform_update(): only avatar handling (20 lines)
- prepare_external_data(): builds LDAP changes dict with avatar_bytes
- Миксин автоматически управляет транзакциями
Changes:
1. partial_update(): simplified to super() + email verification
2. perform_update(): handles avatar file -> ContentFile
3. prepare_external_data(): extracts LDAP fields (first_name, last_name, email, etc),
converts avatar to bytes, passes move_to_department_dn and group_cns
4. update_user_in_ldap_only(): updated signature to accept move_to_department_dn, group_cns
Code reduction: 200 lines -> 80 lines
Benefits: cleaner, automatic rollback, consistent with create()
Next: можно удалить _perform_user_update() если не используется
manage.py check: no issues
2026-02-16 17:08:45 +03:00
..
2026-02-16 17:08:45 +03:00
2025-09-09 17:55:15 +03:00
2026-02-12 15:59:53 +03:00
2026-02-16 17:07:15 +03:00
2026-01-22 01:33:42 +03:00
2026-02-16 17:07:15 +03:00
2026-01-09 14:56:44 +03:00
2026-02-16 17:08:45 +03:00
2026-02-16 16:21:45 +03:00
2026-01-09 14:48:43 +03:00
2025-11-20 09:00:55 +03:00
2026-01-13 10:19:26 +03:00
2026-01-22 01:33:42 +03:00
2026-01-22 01:33:42 +03:00
2026-01-13 15:02:29 +03:00
2025-09-11 17:56:33 +03:00
2026-02-12 16:04:34 +03:00
2026-02-12 15:59:53 +03:00
2026-02-16 17:07:15 +03:00
2025-07-30 08:15:53 +03:00
2026-01-05 10:47:56 +03:00
2026-01-08 16:14:00 +03:00
2026-02-11 12:52:25 +03:00
2025-11-20 09:00:55 +03:00
2025-09-03 17:17:44 +03:00
2026-02-11 12:52:25 +03:00
2025-07-30 08:15:53 +03:00
2026-01-05 07:41:34 +03:00
2026-01-22 01:33:42 +03:00
2026-01-08 16:14:00 +03:00
2026-01-06 07:48:04 +03:00
2026-02-11 12:52:25 +03:00
2026-02-11 12:52:25 +03:00
2026-01-08 16:55:54 +03:00
2026-01-09 15:07:55 +03:00
2026-01-22 01:33:42 +03:00
2026-01-22 01:33:42 +03:00
2026-01-22 01:33:42 +03:00
2026-02-12 15:59:53 +03:00
2026-01-13 09:18:25 +03:00