Skip to content

Commit

Permalink
Updated API
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Hempel <Philipp.Hempel1@web.de>
  • Loading branch information
Hephi2 committed Jul 28, 2023
1 parent 453f23d commit 7aefa91
Show file tree
Hide file tree
Showing 24 changed files with 229 additions and 292 deletions.
33 changes: 14 additions & 19 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,43 @@
// -> tables
['name' => 'api1#index', 'url' => '/api/1/tables', 'verb' => 'GET'],
['name' => 'api1#createTable', 'url' => '/api/1/tables', 'verb' => 'POST'],
['name' => 'api1#updateTable', 'url' => '/api/1/tables/{tableId}', 'verb' => 'PUT'],
['name' => 'api1#getTable', 'url' => '/api/1/tables/{tableId}', 'verb' => 'GET'],
['name' => 'api1#deleteTable', 'url' => '/api/1/tables/{tableId}', 'verb' => 'DELETE'],
// -> views
['name' => 'api1#indexViews', 'url' => '/api/1/tables/{tableId}/views', 'verb' => 'GET'],
['name' => 'api1#createView', 'url' => '/api/1/tables/{tableId}/views', 'verb' => 'POST'],
['name' => 'api1#getView', 'url' => '/api/1/views/{viewId}', 'verb' => 'GET'],
['name' => 'api1#deleteView', 'url' => '/api/1/views/{viewId}', 'verb' => 'DELETE'],
['name' => 'api1#updateView', 'url' => '/api/1/views/{viewId}', 'verb' => 'PUT'],
['name' => 'api1#deleteView', 'url' => '/api/1/views/{viewId}', 'verb' => 'DELETE'],
// -> share
['name' => 'api1#getShare', 'url' => '/api/1/shares/{shareId}', 'verb' => 'GET'],
['name' => 'api1#indexViewShares', 'url' => '/api/1/views/{viewId}/shares', 'verb' => 'GET'],
['name' => 'api1#indexTableManageShares', 'url' => '/api/1/tables/{tableId}/shares', 'verb' => 'GET'],
['name' => 'api1#createShare', 'url' => '/api/1/shares', 'verb' => 'POST'],
['name' => 'api1#deleteShare', 'url' => '/api/1/shares/{shareId}', 'verb' => 'DELETE'],
['name' => 'api1#updateSharePermissions', 'url' => '/api/1/shares/{shareId}', 'verb' => 'PUT'],
// -> share -> table
['name' => 'api1#indexTableShares', 'url' => '/api/1/tables/{tableId}/shares', 'verb' => 'GET'],
['name' => 'api1#createTableShare', 'url' => '/api/1/tables/{tableId}/shares', 'verb' => 'POST'],
// -> columns
['name' => 'api1#indexTableColumns', 'url' => '/api/1/tables/{tableId}/columns', 'verb' => 'GET'],
['name' => 'api1#createTableColumn', 'url' => '/api/1/tables/{tableId}/columns', 'verb' => 'POST'],
['name' => 'api1#indexViewColumns', 'url' => '/api/1/views/{viewId}/columns', 'verb' => 'GET'],
['name' => 'api1#getColumn', 'url' => '/api/1/columns/{columnId}', 'verb' => 'GET'],
['name' => 'api1#deleteColumn', 'url' => '/api/1/columns/{columnId}', 'verb' => 'DELETE'],
['name' => 'api1#createColumn', 'url' => '/api/1/views/{viewId}/columns', 'verb' => 'POST'],
['name' => 'api1#updateColumn', 'url' => '/api/1/columns/{columnId}', 'verb' => 'PUT'],
// -> rows -> table
['name' => 'api1#getColumn', 'url' => '/api/1/columns/{columnId}', 'verb' => 'GET'],
['name' => 'api1#deleteColumn', 'url' => '/api/1/columns/{columnId}', 'verb' => 'DELETE'],
// -> rows
['name' => 'api1#indexTableRowsSimple', 'url' => '/api/1/tables/{tableId}/rows/simple', 'verb' => 'GET'],
['name' => 'api1#createRow', 'url' => '/api/1/tables/{tableId}/rows', 'verb' => 'POST'],
// -> rows -> view
['name' => 'api1#indexViewRows', 'url' => '/api/1/views/{viewId}/rows', 'verb' => 'GET'],
// -> row
['name' => 'api1#createRow', 'url' => '/api/1/views/{viewId}/rows', 'verb' => 'POST'],
['name' => 'api1#getRow', 'url' => '/api/1/rows/{rowId}', 'verb' => 'GET'],
['name' => 'api1#updateRow', 'url' => '/api/1/rows/{rowId}', 'verb' => 'PUT'],
['name' => 'api1#deleteRow', 'url' => '/api/1/rows/{rowId}', 'verb' => 'DELETE'],
['name' => 'api1#updateRow', 'url' => '/api/1/views/{viewId}/rows/{rowId}', 'verb' => 'PUT'],
['name' => 'api1#deleteRow', 'url' => '/api/1/views/{viewId}/rows/{rowId}', 'verb' => 'DELETE'],
// -> import
['name' => 'api1#createImport', 'url' => '/api/1/import/table/{tableId}', 'verb' => 'POST'],
['name' => 'api1#createImport', 'url' => '/api/1/import/views/{viewId}', 'verb' => 'POST'],


// table
['name' => 'table#index', 'url' => '/table', 'verb' => 'GET'],
['name' => 'table#show', 'url' => '/table/{id}', 'verb' => 'GET'],
['name' => 'table#create', 'url' => '/table', 'verb' => 'POST'],
['name' => 'table#update', 'url' => '/table/{id}', 'verb' => 'PUT'],
['name' => 'table#destroy', 'url' => '/table/{id}', 'verb' => 'DELETE'],

// view
Expand All @@ -77,8 +73,7 @@
// rows
['name' => 'row#show', 'url' => '/row/{id}', 'verb' => 'GET'],
['name' => 'row#indexView', 'url' => '/row/view/{viewId}', 'verb' => 'GET'],
['name' => 'row#create', 'url' => '/row/column/{columnId}', 'verb' => 'POST'],
['name' => 'row#createComplete', 'url' => '/row', 'verb' => 'POST'],
['name' => 'row#create', 'url' => '/row', 'verb' => 'POST'],
['name' => 'row#update', 'url' => '/row/{id}/column/{columnId}', 'verb' => 'PUT'],
['name' => 'row#updateSet', 'url' => '/row/{id}', 'verb' => 'PUT'],
['name' => 'row#destroy', 'url' => '/view/{viewId}/row/{id}', 'verb' => 'DELETE'],
Expand All @@ -92,6 +87,6 @@
['name' => 'share#destroy', 'url' => '/share/{id}', 'verb' => 'DELETE'],

// import
['name' => 'import#import', 'url' => '/import/table/{tableId}', 'verb' => 'POST'],
['name' => 'import#import', 'url' => '/import/view/{viewId}', 'verb' => 'POST'],
]
];
5 changes: 3 additions & 2 deletions lib/Api/V1Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ public function __construct(ColumnService $columnService, RowService $rowService
* @throws InternalError
* @throws PermissionError
*/
public function getData(int $viewId, ?int $limit, ?int $offset): array {
public function getData(int $viewId, ?int $limit, ?int $offset, string $userId):
array {
$columns = $this->columnService->findAllByView($viewId);

$rows = $this->rowService->findAllByView($viewId, $limit, $offset);
$rows = $this->rowService->findAllByView($viewId, $userId, $limit, $offset);

$data = [];

Expand Down
Loading

0 comments on commit 7aefa91

Please sign in to comment.