Browse Source

Implements IModule in QueueController

main
lucas cardoso 2 years ago
parent
commit
22e6b54353
  1. 36
      app/Controllers/QueueController.php
  2. 2
      index.php

36
app/Controllers/QueueController.php

@ -3,11 +3,13 @@
namespace app\Controllers;
use app\Core\Controller;
use app\Models\QueueModel;
use app\Controllers\ClientController;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Throwable;
use app\Repositories\QueueRepository;
use app\Interfaces\IModule;
use Slim\Routing\RouteCollectorProxy;
/**
* ringall -> 'Simultaneo'
@ -16,27 +18,31 @@ use Throwable;
* random -> 'Randomico'
* rrordered -> 'Sequencial'
*/
/**
* Description of QueueController
*
* @author Lucas Awade
*/
class QueueController extends Controller
class QueueController extends Controller implements IModule
{
/** @var QueueModel $queue model de Queue */
protected $queueModel;
protected QueueRepository $queueRepository;
public function __construct()
{
$this->queueModel = new QueueModel();
$this->queueRepository = new QueueRepository();
}
static function path()
{
return '/filas';
}
static function route()
{
return function (RouteCollectorProxy $group) {
$group->get('', [self::class, 'filas']);
};
}
public function listAllQueueWhatsApp($option = null)
{
try {
$response = ['QUEUE' => '', 'LIST' => ''];
$search = $this->queueModel->list();
$search = $this->queueRepository->list();
$strmsg = "Informe o numero do setor para o atendimento: \n";
$count = 1;
if (count($search) == 1) {
@ -58,16 +64,12 @@ class QueueController extends Controller
}
return false;
}
public function listaAllFilas()
{
return $this->queueModel->list();
}
function filas(Request $request, Response $response, $args): Response
{
try {
$params = $request->getQueryParams();
$data = $this->queueModel->list($params);
$data = $this->queueRepository->list($params);
$response->getBody()->write(
$this->retorno(
"Sucesso",

2
index.php

@ -26,7 +26,7 @@ $app->get('/info', function ($request, $response, array $args) {
// Add error middleware
$app->addErrorMiddleware(true, true, true);
$app->get('/filas', [QueueController::class, 'filas']);
$app->group(QueueController::path(), QueueController::route());
$app->group(PausaController::path(), PausaController::route());

Loading…
Cancel
Save