Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce arguments for column creation function #1281

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 72 additions & 82 deletions lib/Controller/Api1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCA\Tables\Api\V1Api;
use OCA\Tables\AppInfo\Application;
use OCA\Tables\Db\ViewMapper;
use OCA\Tables\Dto\Column as ColumnDto;
use OCA\Tables\Errors\InternalError;
use OCA\Tables\Errors\NotFoundError;
use OCA\Tables\Errors\PermissionError;
Expand Down Expand Up @@ -816,34 +817,30 @@ public function createColumn(
$this->userId,
$tableId,
$viewId,
$type,
$subtype,
$title,
$mandatory,
$description,

$textDefault,
$textAllowedPattern,
$textMaxLength,

$numberPrefix,
$numberSuffix,
$numberDefault,
$numberMin,
$numberMax,
$numberDecimals,

$selectionOptions,
$selectionDefault,

$datetimeDefault,

$usergroupDefault,
$usergroupMultipleItems,
$usergroupSelectUsers,
$usergroupSelectGroups,
$usergroupShowUserStatus,

new ColumnDto(
title: $title,
type: $type,
subtype: $subtype,
mandatory: $mandatory,
description: $description,
textDefault: $textDefault,
textAllowedPattern: $textAllowedPattern,
textMaxLength: $textMaxLength,
numberDefault: $numberDefault,
numberMin: $numberMin,
numberMax: $numberMax,
numberDecimals: $numberDecimals,
numberPrefix: $numberPrefix,
numberSuffix: $numberSuffix,
selectionOptions: $selectionOptions,
selectionDefault: $selectionDefault,
datetimeDefault: $datetimeDefault,
usergroupDefault: $usergroupDefault,
usergroupMultipleItems: $usergroupMultipleItems,
usergroupSelectUsers: $usergroupSelectUsers,
usergroupSelectGroups: $usergroupSelectGroups,
showUserStatus: $usergroupShowUserStatus
),
$selectedViewIds
)->jsonSerialize());
} catch (PermissionError $e) {
Expand Down Expand Up @@ -930,32 +927,29 @@ public function updateColumn(
$columnId,
null,
$this->userId,
null,
$subtype,
$title,
$mandatory,
$description,

$textDefault,
$textAllowedPattern,
$textMaxLength,

$numberPrefix,
$numberSuffix,
$numberDefault,
$numberMin,
$numberMax,
$numberDecimals,

$selectionOptions,
$selectionDefault,
$datetimeDefault,

$usergroupDefault,
$usergroupMultipleItems,
$usergroupSelectUsers,
$usergroupSelectGroups,
$usergroupShowUserStatus,
new ColumnDto(
title: $title,
subtype: $subtype,
mandatory: $mandatory,
description: $description,
textDefault: $textDefault,
textAllowedPattern: $textAllowedPattern,
textMaxLength: $textMaxLength,
numberDefault: $numberDefault,
numberMin: $numberMin,
numberMax: $numberMax,
numberDecimals: $numberDecimals,
numberPrefix: $numberPrefix,
numberSuffix: $numberSuffix,
selectionOptions: $selectionOptions,
selectionDefault: $selectionDefault,
datetimeDefault: $datetimeDefault,
usergroupDefault: $usergroupDefault,
usergroupMultipleItems: $usergroupMultipleItems,
usergroupSelectUsers: $usergroupSelectUsers,
usergroupSelectGroups: $usergroupSelectGroups,
showUserStatus: $usergroupShowUserStatus
)
);
return new DataResponse($item->jsonSerialize());
} catch (InternalError $e) {
Expand Down Expand Up @@ -1533,34 +1527,30 @@ public function createTableColumn(
$this->userId,
$tableId,
null,
$type,
$subtype,
$title,
$mandatory,
$description,

$textDefault,
$textAllowedPattern,
$textMaxLength,

$numberPrefix,
$numberSuffix,
$numberDefault,
$numberMin,
$numberMax,
$numberDecimals,

$selectionOptions,
$selectionDefault,

$datetimeDefault,

$usergroupDefault,
$usergroupMultipleItems,
$usergroupSelectUsers,
$usergroupSelectGroups,
$usergroupShowUserStatus,

new ColumnDto(
title: $title,
type: $type,
subtype: $subtype,
mandatory: $mandatory,
description: $description,
textDefault: $textDefault,
textAllowedPattern: $textAllowedPattern,
textMaxLength: $textMaxLength,
numberDefault: $numberDefault,
numberMin: $numberMin,
numberMax: $numberMax,
numberDecimals: $numberDecimals,
numberPrefix: $numberPrefix,
numberSuffix: $numberSuffix,
selectionOptions: $selectionOptions,
selectionDefault: $selectionDefault,
datetimeDefault: $datetimeDefault,
usergroupDefault: $usergroupDefault,
usergroupMultipleItems: $usergroupMultipleItems,
usergroupSelectUsers: $usergroupSelectUsers,
usergroupSelectGroups: $usergroupSelectGroups,
showUserStatus: $usergroupShowUserStatus
),
$selectedViewIds
);
return new DataResponse($item->jsonSerialize());
Expand Down
162 changes: 52 additions & 110 deletions lib/Controller/ApiColumnsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
namespace OCA\Tables\Controller;

use OCA\Tables\Dto\Column as ColumnDto;
use OCA\Tables\Errors\InternalError;
use OCA\Tables\Errors\NotFoundError;
use OCA\Tables\Errors\PermissionError;
Expand Down Expand Up @@ -127,28 +128,19 @@ public function createNumberColumn(int $baseNodeId, string $title, ?float $numbe
$this->userId,
$tableId,
$viewId,
'number',
$subtype,
$title,
$mandatory,
$description,
null,
null,
null,
$numberPrefix,
$numberSuffix,
$numberDefault,
$numberMin,
$numberMax,
$numberDecimals,
null,
null,
null,
null,
null,
null,
null,
null,
new ColumnDto(
title: $title,
type: 'number',
subtype: $subtype,
mandatory: $mandatory,
description: $description,
numberDefault: $numberDefault,
numberMin: $numberMin,
numberMax: $numberMax,
numberDecimals: $numberDecimals,
numberPrefix: $numberPrefix,
numberSuffix: $numberSuffix
),
$selectedViewIds
);
return new DataResponse($column->jsonSerialize());
Expand Down Expand Up @@ -187,28 +179,16 @@ public function createTextColumn(int $baseNodeId, string $title, ?string $textDe
$this->userId,
$tableId,
$viewId,
'text',
$subtype,
$title,
$mandatory,
$description,
$textDefault,
$textAllowedPattern,
$textMaxLength,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
new ColumnDto(
title: $title,
type: 'text',
subtype: $subtype,
mandatory: $mandatory,
description: $description,
textDefault: $textDefault,
textAllowedPattern: $textAllowedPattern,
textMaxLength: $textMaxLength
),
$selectedViewIds
);
return new DataResponse($column->jsonSerialize());
Expand Down Expand Up @@ -246,28 +226,15 @@ public function createSelectionColumn(int $baseNodeId, string $title, string $se
$this->userId,
$tableId,
$viewId,
'selection',
$subtype,
$title,
$mandatory,
$description,
null,
null,
null,
null,
null,
null,
null,
null,
null,
$selectionOptions,
$selectionDefault,
null,
null,
null,
null,
null,
null,
new ColumnDto(
title: $title,
type: 'selection',
subtype: $subtype,
mandatory: $mandatory,
description: $description,
selectionOptions: $selectionOptions,
selectionDefault: $selectionDefault
),
$selectedViewIds
);
return new DataResponse($column->jsonSerialize());
Expand Down Expand Up @@ -304,28 +271,14 @@ public function createDatetimeColumn(int $baseNodeId, string $title, ?string $da
$this->userId,
$tableId,
$viewId,
'text',
$subtype,
$title,
$mandatory,
$description,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
$datetimeDefault,
null,
null,
null,
null,
null,
new ColumnDto(
title: $title,
type: 'datetime',
subtype: $subtype,
mandatory: $mandatory,
description: $description,
datetimeDefault: $datetimeDefault
),
$selectedViewIds
);
return new DataResponse($column->jsonSerialize());
Expand Down Expand Up @@ -363,28 +316,17 @@ public function createUsergroupColumn(int $baseNodeId, string $title, ?string $u
$this->userId,
$tableId,
$viewId,
'usergroup',
null,
$title,
$mandatory,
$description,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
$usergroupDefault,
$usergroupMultipleItems,
$usergroupSelectUsers,
$usergroupSelectGroups,
$showUserStatus,
new ColumnDto(
title: $title,
type: 'usergroup',
mandatory: $mandatory,
description: $description,
usergroupDefault: $usergroupDefault,
usergroupMultipleItems: $usergroupMultipleItems,
usergroupSelectUsers: $usergroupSelectUsers,
usergroupSelectGroups: $usergroupSelectGroups,
showUserStatus: $showUserStatus
),
$selectedViewIds
);
return new DataResponse($column->jsonSerialize());
Expand Down
Loading
Loading