Skip to content

Commit

Permalink
🔨 #270 alterando chamadas
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Jul 30, 2022
1 parent c07c893 commit f8436a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
21 changes: 9 additions & 12 deletions appexemplo_v2.0/api/api_controllers/Meta_tipoAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public static function selectAll(Request $request, Response $response, array $ar
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$msgJson = json_encode($msg);
$response->getBody()->write( $msgJson );
return $response->withHeader('Content-Type', 'application/json');
$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}

//--------------------------------------------------------------------------------
Expand All @@ -53,9 +52,8 @@ public static function selectById(Request $request, Response $response, array $a
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$msgJson = json_encode($msg);
$response->getBody()->write( $msgJson );
return $response->withHeader('Content-Type', 'application/json');
$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}

//--------------------------------------------------------------------------------
Expand All @@ -75,9 +73,8 @@ public static function save(Request $request, Response $response, array $args)
$controller = new \Meta_tipo;
$controller->save($vo);

$msgJson = json_encode($msg);
$response->getBody()->write( $msgJson );
return $response->withHeader('Content-Type', 'application/json');
$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}

//--------------------------------------------------------------------------------
Expand All @@ -86,8 +83,8 @@ public static function delete(Request $request, Response $response, array $args)
$id = $args['id'];
$controller = new \Meta_tipo;
$msg = $controller->delete($id);
$msgJson = json_encode($msg);
$response->getBody()->write( $msgJson );
return $response->withHeader('Content-Type', 'application/json');

$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function selectAll(Request $request, Response $response, array $ar
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$response = $response->withJson($msg);
$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}

Expand All @@ -52,7 +52,7 @@ public static function selectById(Request $request, Response $response, array $a
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$response = $response->withJson($msg);
$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}
}
14 changes: 14 additions & 0 deletions appexemplo_v2.0/api/routes2.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@
$app->get($urlGrupo.'/{id:[0-9]+}', SelfilhosmenuqtdAPI::class . ':selectById');
});

//--------------------------------------------------------------------
// TABLE: acesso_menu
//--------------------------------------------------------------------
$urlGrupo = $urlChamada.'acesso_menu';
$app->group($urlGrupo, function(RouteCollectorProxy $group) use ($app,$urlGrupo) {
$app->get($urlGrupo.'', Acesso_menuAPI::class . ':selectAll');
$app->get($urlGrupo.'/{id:[0-9]+}', Acesso_menuAPI::class . ':selectById');


$app->post($urlGrupo.'', Acesso_menuAPI::class . ':save');
$app->put($urlGrupo.'/{id:[0-9]+}', Acesso_menuAPI::class . ':save');
$app->delete($urlGrupo.'/{id:[0-9]+}', Acesso_menuAPI::class . ':delete');
});

//--------------------------------------------------------------------
// TABLE: meta_tipo
//--------------------------------------------------------------------
Expand Down

0 comments on commit f8436a0

Please sign in to comment.