mirror of
https://github.com/nextcloud/tables.git
synced 2025-08-18 08:19:08 +00:00
fix: Adapt reset of the update methods to use the new archived flag
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@ -17,7 +17,7 @@ return [
|
||||
// -> 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'], // needs archived
|
||||
['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
|
||||
@ -61,7 +61,7 @@ return [
|
||||
['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'], // needs archived
|
||||
['name' => 'table#update', 'url' => '/table/{id}', 'verb' => 'PUT'],
|
||||
['name' => 'table#destroy', 'url' => '/table/{id}', 'verb' => 'DELETE'],
|
||||
|
||||
// view
|
||||
@ -115,7 +115,7 @@ return [
|
||||
['name' => 'ApiTables#index', 'url' => '/api/2/tables', 'verb' => 'GET'],
|
||||
['name' => 'ApiTables#show', 'url' => '/api/2/tables/{id}', 'verb' => 'GET'],
|
||||
['name' => 'ApiTables#create', 'url' => '/api/2/tables', 'verb' => 'POST'],
|
||||
['name' => 'ApiTables#update', 'url' => '/api/2/tables/{id}', 'verb' => 'PUT'], // needs archived
|
||||
['name' => 'ApiTables#update', 'url' => '/api/2/tables/{id}', 'verb' => 'PUT'],
|
||||
['name' => 'ApiTables#destroy', 'url' => '/api/2/tables/{id}', 'verb' => 'DELETE'],
|
||||
['name' => 'ApiTables#transfer', 'url' => '/api/2/tables/{id}/transfer', 'verb' => 'PUT'],
|
||||
|
||||
|
@ -44,7 +44,8 @@ class RenameTable extends Command {
|
||||
|
||||
protected function configure(): void {
|
||||
$this
|
||||
->setName('tables:rename')
|
||||
->setName('tables:update')
|
||||
->setAliases('tables:rename')
|
||||
->setDescription('Rename a table.')
|
||||
->addArgument(
|
||||
'ID',
|
||||
@ -62,6 +63,12 @@ class RenameTable extends Command {
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'New emoji.'
|
||||
)
|
||||
->addOption(
|
||||
'archived',
|
||||
'a',
|
||||
InputOption::VALUE_NONE,
|
||||
'Archived'
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
@ -74,9 +81,10 @@ class RenameTable extends Command {
|
||||
$id = $input->getArgument('ID');
|
||||
$title = $input->getArgument('title');
|
||||
$emoji = $input->getOption('emoji');
|
||||
$archived = $input->getOption('archived');
|
||||
|
||||
try {
|
||||
$table = $this->tableService->update($id, $title, $emoji, '');
|
||||
$table = $this->tableService->update($id, $title, $emoji, $archived, '');
|
||||
|
||||
$arr = $table->jsonSerialize();
|
||||
unset($arr['hasShares']);
|
||||
|
@ -178,9 +178,9 @@ class Api1Controller extends ApiController {
|
||||
* 403: No permissions
|
||||
* 404: Not found
|
||||
*/
|
||||
public function updateTable(int $tableId, string $title = null, string $emoji = null): DataResponse {
|
||||
public function updateTable(int $tableId, string $title = null, string $emoji = null, ?bool $archived = false): DataResponse {
|
||||
try {
|
||||
return new DataResponse($this->tableService->update($tableId, $title, $emoji, $this->userId)->jsonSerialize());
|
||||
return new DataResponse($this->tableService->update($tableId, $title, $emoji, $archived, $this->userId)->jsonSerialize());
|
||||
} catch (PermissionError $e) {
|
||||
$this->logger->warning('A permission error occurred: ' . $e->getMessage());
|
||||
$message = ['message' => $e->getMessage()];
|
||||
|
@ -44,6 +44,8 @@ namespace OCA\Tables;
|
||||
* createdAt: string,
|
||||
* lastEditBy: string,
|
||||
* lastEditAt: string,
|
||||
* archived: bool,
|
||||
* favorite: bool,
|
||||
* isShared: bool,
|
||||
* onSharePermissions: ?array{
|
||||
* read: bool,
|
||||
|
Reference in New Issue
Block a user