This commit is contained in:
2021-11-30 18:04:41 -03:00
parent 87323b22d8
commit f589ff960b
56 changed files with 1960 additions and 0 deletions

12
resources/routes/auth.php Normal file
View File

@ -0,0 +1,12 @@
<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Incoviba\API\Common\Service\Auth as Service;
$app->get('/auth/generate', function(Request $request, Response $response, Service $service): Response {
$key = $service->generate();
$response->getBody()->write(json_encode(['key' => $key]));
return $response
->withStatus(200)
->withHeader('content-type', 'application/json');
});

View File

@ -0,0 +1,12 @@
<?php
use Incoviba\API\Common\Controller\Bancos;
$app->group('/bancos', function ($app) {
$app->post('/add[/]', [Bancos::class, 'add']);
$app->get('[/]', Bancos::class);
});
$app->group('/banco/{banco_id}', function ($app) {
$app->put('/edit[/]', [Bancos::class, 'edit']);
$app->delete('/delete[/]', [Bancos::class, 'delete']);
$app->get('[/]', [Bancos::class, 'show']);
});

View File

@ -0,0 +1,5 @@
<?php
use Incoviba\API\Common\Controller\Base;
$app->get('[/]', Base::class);
$app->get('/php/info[/]', [Base::class, 'info']);

View File

@ -0,0 +1,13 @@
<?php
use Incoviba\API\Common\Controller\Inmobiliarias;
$app->group('/inmobiliarias', function ($app) {
$app->post('/add[/]', [Inmobiliarias::class, 'add']);
$app->get('[/]', Inmobiliarias::class);
});
$app->group('/inmobiliaria/{inmobiliaria_rut}', function ($app) {
$app->get('/proyectos[/]', [Inmobiliarias::class, 'proyectos']);
$app->put('/edit[/]', [Inmobiliarias::class, 'edit']);
$app->delete('/delete[/]', [Inmobiliarias::class, 'delete']);
$app->get('[/]', [Inmobiliarias::class, 'show']);
});

View File

@ -0,0 +1,12 @@
<?php
use Incoviba\API\Common\Controller\Propietarios;
$app->group('/propietarios', function ($app) {
$app->post('/add[/]', [Propietarios::class, 'add']);
$app->get('[/]', Propietarios::class);
});
$app->group('/propietario/{propietario_rut}', function ($app) {
$app->put('/edit[/]', [Propietarios::class, 'edit']);
$app->delete('/edit[/]', [Propietarios::class, 'delete']);
$app->get('[/]', [Propietarios::class, 'show']);
});

View File

@ -0,0 +1,12 @@
<?php
use Incoviba\API\Common\Controller\Proyectos;
$app->group('/proyectos', function ($app) {
$app->post('/add[/]', [Proyectos::class, 'add']);
$app->get('[/]', Proyectos::class);
});
$app->group('/proyecto/{proyecto_id}', function ($app) {
$app->put('/edit[/]', [Proyectos::class, 'edit']);
$app->delete('/edit[/]', [Proyectos::class, 'delete']);
$app->get('[/]', [Proyectos::class, 'show']);
});

View File

@ -0,0 +1,16 @@
<?php
$folder = implode(DIRECTORY_SEPARATOR, [
__DIR__,
'tipos'
]);
if (file_exists($folder)) {
$app->group('/tipos', function ($app) use ($folder) {
$files = new DirectoryIterator($folder);
foreach ($files as $file) {
if ($file->isDir() or $file->getExtension() !== 'php') {
continue;
}
include_once $file->getRealPath();
}
});
}

View File

@ -0,0 +1,12 @@
<?php
use Incoviba\API\Common\Controller\Sociedades;
$app->group('/sociedades', function ($app) {
$app->post('/add[/]', [Sociedades::class, 'add']);
$app->get('[/]', Sociedades::class);
});
$app->group('/sociedad/{sociedad_id}', function ($app) {
$app->put('/edit[/]', [Sociedades::class, 'edit']);
$app->delete('/edit[/]', [Sociedades::class, 'delete']);
$app->get('[/]', [Sociedades::class, 'show']);
});

View File

@ -0,0 +1,12 @@
<?php
use Incoviba\API\Common\Controller\Ventas;
$app->group('/ventas', function ($app) {
$app->post('/add[/]', [Ventas::class, 'add']);
$app->get('[/]', Ventas::class);
});
$app->group('/venta/{venta_id}', function ($app) {
$app->put('/edit[/]', [Ventas::class, 'edit']);
$app->delete('/edit[/]', [Ventas::class, 'delete']);
$app->get('[/]', [Ventas::class, 'show']);
});