TriggerUserBannedController class

Введение

  1. Описание: Контроллер TriggerUserBannedController предоставляет конечную точку API для удаления районов у водителя.
  2. Маршруты: Обрабатывается POST-запрос по маршруту /trigger/user_banned.

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

  {
    "event": {
      "data": {
        "new": {
          "id": "user_id",
          "blocked": "true"
        }
      }
    }
  }

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

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

При вызове данного триггера у водителя удаляются все связи с районами.

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

  1. Hasura: отвязка районов от водителя.

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

  1. Успешная блокировка: Возвращается статус 200 OK
    {
      'TriggerUserBannedController success: user $userId was deleted
      from driver_districts'
    }
      
  2. Ошибки обработки:
    1. Попытка блокировки юзера с blocked=false. Ожидаемый статус - 400 badRequest.
    2. Внутренние ошибки. Ожидаемый статус - 500 internalServerError.
Inheritance

Constructors

TriggerUserBannedController()

Properties

endpoint ↔ String
getter/setter pairinherited
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
userRepository → UserRepository
final

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