- Add LdapSyncQueue model for deferred LDAP operations - Add Celery tasks: process_ldap_queue_item, process_ldap_queue - Refactor all LDAP signals (employee, department, group, position) to enqueue operations on DirectoryLdapError/DirectoryServiceError - Add _queue.py helper for enqueuing with automatic Celery dispatch - Add Celery Beat periodic task (every 60s) for queue processing - Add management command: ldap_queue (status/retry/cleanup) - Add migration 0043_ldap_sync_queue - Add 18 tests covering model, tasks, signals, and enqueue logic - Include LDAP services refactoring (base_service, constants, user_login_service, user_mapper_service, user_password_service, phone_utils)
27 lines
800 B
Python
27 lines
800 B
Python
"""Утилита для нормализации телефонных номеров.
|
|
|
|
Обёртка над общей функцией _normalize_phone из employees.utils,
|
|
чтобы не создавать зависимость domain → employees.utils напрямую.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from employees.utils import _normalize_phone
|
|
|
|
|
|
def normalize_phone(raw: Optional[str]) -> Optional[str]:
|
|
"""Нормализует телефонный номер в формат E.164.
|
|
|
|
Args:
|
|
raw: Сырой номер телефона из LDAP (может быть None).
|
|
|
|
Returns:
|
|
Нормализованный номер в E.164 или None.
|
|
"""
|
|
return _normalize_phone(raw)
|
|
|
|
|
|
__all__ = ["normalize_phone"]
|