handler method

  1. @override
Future<Response> handler()
override

Must be implemented

Implementation

@override
Future<Response> handler() async {
  try {
    final failureOrResult = await umbrellaRepository.syncProducts();

    return failureOrResult.fold(
      (l) {
        print('Error: ${l.toString()}');

        return Response.internalServerError(
            body: 'ProductsSyncController: cron exception: $l'
        );
      },
      (_) {
        print('CRM districts synced successfully');

        return Response.ok(
            'ProductsSyncController: cron success: Products synced successfully');
      },
    );
  } catch (e) {
    return Response.internalServerError(body: 'ProductsSyncController: $e');
  }
}