Add update consolidado command and queuing

This commit is contained in:
2022-04-18 22:13:17 -04:00
parent cf27465d75
commit 6ff584013f
19 changed files with 328 additions and 70 deletions

View File

@ -1,11 +1,13 @@
<?php
namespace Contabilidad\Common\Controller;
use Carbon\Carbon;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use ProVM\Common\Factory\Model as Factory;
use ProVM\Common\Define\Controller\Json;
use Contabilidad\Common\Service\Consolidar as Service;
use Contabilidad\Cuenta;
use Contabilidad\Consolidado;
class Consolidados {
@ -50,4 +52,15 @@ class Consolidados {
}
return $this->withJson($response, []);
}
public function update(Request $request, Response $response, Factory $factory, Service $service, $mes, $cuenta_id): Response {
try {
$cuenta = $factory->find(Cuenta::class)->one($cuenta_id);
$mes = Carbon::parse($mes);
$service->consolidarCuenta($cuenta, $mes);
} catch (\Error | \Exception $e) {
error_log($e);
throw $e;
}
return $this->withJson($response, []);
}
}