Facturacion, se agrega PropiedadUnidad

This commit is contained in:
2023-11-29 20:09:08 -03:00
parent 094209823a
commit 39048e12b3
24 changed files with 716 additions and 55 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace Incoviba\Controller\API\Ventas;
use PDOException;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Incoviba\Controller\API\{withJson, emptyBody};
use Incoviba\Controller\withRedis;
use Incoviba\Common\Implement\Exception\{EmptyResult,EmptyRedis};
use Incoviba\Service;
class PropiedadesUnidades
{
use emptyBody, withJson, withRedis;
public function edit(ServerRequestInterface $request, ResponseInterface $response,
Service\Venta\PropiedadUnidad $propiedadUnidadService, int $pu_id): ResponseInterface
{
$body = $request->getParsedBody();
$output = [
'propiedad_unidad_id' => $pu_id,
'input' => $body,
'edited' => false
];
try {
$pu = $propiedadUnidadService->getById($pu_id);
$propiedadUnidadService->edit($pu, (array) $body);
$output['edited'] = true;
} catch (PDOException | EmptyResult) {}
return $this->withJson($response, $output);
}
}