Commit b18ac95b authored by philippepary's avatar philippepary
Browse files

Added currency route

parent 8e36d2be
......@@ -9,6 +9,7 @@ $files = [
"../src/lib/Model/Tax.php",
"../src/lib/Model/User.php",
"../src/http/routes/category.php",
"../src/http/routes/currency.php",
"../src/http/routes/product.php",
];
$dirs = [
......
<?php
/**
* GET currencyGetAllGet
* Summary:
* Notes: Get an array of all Currencies
* Output-Formats: [application/json]
* @rest\endpoint /currency/getAll
* @rest\method GET Get all available currencies
* @rest\response 200 array(Currency) An array of currencies
* @rest\tags currencies
*/
//
$app->GET('/api/currency/getAll', function($request, $response, $args) {
$srv = new \Pasteque\CurrenciesService();
return $response->withJson($srv->getAll());
......@@ -13,11 +14,12 @@ $app->GET('/api/currency/getAll', function($request, $response, $args) {
/**
* GET currencyGetMainGet
* Summary:
* Notes: Get Main Currency
* Output-Formats: [application/json]
* @rest\endpoint /currency/getMain
* @rest\method GET Get the main currency
* @rest\response 200 Currency The main currency
* @rest\tags currencies
*/
//
$app->GET('/api/currency/getMain', function($request, $response, $args) {
$srv = new \Pasteque\CurrenciesService();
return $response->withJson($srv->getDefault($args['id']));
......@@ -25,10 +27,11 @@ $app->GET('/api/currency/getMain', function($request, $response, $args) {
/**
* GET currencyIdGet
* Summary:
* Notes: Get a Currency
* Output-Formats: [application/json]
* @rest\endpoint /currency/{id}
* @rest\method GET Get a currency by its ID
* @rest\path Int id ID of the currency
* @rest\response 200 Currency The currency
* @rest\tags currencies
*/
$app->GET('/api/currency/{id}', function($request, $response, $args) {
$srv = new \Pasteque\CurrenciesService();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment