UpdateDistrictsAndProvincesController class

Введение

  1. Описание: Контроллер UpdateDistrictsAndProvincesController предоставляет конечную точку API для обновления районов и провинций в хасуре.
  2. Маршруты: Обрабатывается GET-запрос по маршруту /districts/update-from-crm.

Формат запроса

Валидация и преобразование данных

Основная логика

Контроллер запрашивает данные по районам из GEO_API, а так же из Hasura. Производится разбиение по 3 группам: provinces, updatedDistricts(новые районы), deletedDistrictsIds(районы удаленные в гео-сервисе). После данные обновляются в Hasura.

Взаимодействие с микросервисами

  1. Hasura: Получение и обновление районов.
  2. GEO_API: Получение списка районов.

Ответы сервера

  1. Успешное обновление: Возвращается статус 200 OK с текстом:
    UpdateDistrictsAndProvincesController: CRM districts synced successfully
  2. Внутренние ошибки. Ожидаемый статус - 500 internalServerError.
Inheritance
  • Object
  • Controller
  • UpdateDistrictsAndProvincesController

Constructors

UpdateDistrictsAndProvincesController()

Properties

endpoint ↔ String
getter/setter pairinherited
geoRepository → GeoRepository
final
hashCode → int
The hash code for this object.
no setterinherited
request ↔ Request
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(Request request) → FutureOr<Response>
inherited
handler() → Future<Response>
Must be implemented
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestAsJson() → Future
Reads request value and parse as json
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited