Refactor update to have proper order of optional parameters

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-05-28 14:03:47 +02:00
parent 12de4376e6
commit f6eea0e467
6 changed files with 9 additions and 12 deletions

View File

@@ -95,7 +95,7 @@ class CardApiController extends ApiController {
* Update a card
*/
public function update($title, $type, $order = 0, $description = '', $owner, $duedate = null, $archived = null) {
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $order, $description, $owner, $duedate, 0, $archived);
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $owner, $description, $order, $duedate, 0, $archived);
return new DataResponse($card, HTTP::STATUS_OK);
}

View File

@@ -95,7 +95,7 @@ class CardController extends Controller {
* @return \OCP\AppFramework\Db\Entity
*/
public function update($id, $title, $stackId, $type, $order, $description, $duedate, $deletedAt) {
return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId, $duedate, $deletedAt);
return $this->cardService->update($id, $title, $stackId, $type, $this->userId, $description, $order, $duedate, $deletedAt);
}
/**

View File

@@ -257,9 +257,9 @@ class CardService {
* @param $title
* @param $stackId
* @param $type
* @param $order
* @param $description
* @param $owner
* @param $description
* @param $order
* @param $duedate
* @return \OCP\AppFramework\Db\Entity
* @throws StatusException
@@ -268,7 +268,7 @@ class CardService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws BadRequestException
*/
public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt = null, $archived = null) {
public function update($id, $title, $stackId, $type, $owner, $description = '', $order = 0, $duedate = null, $deletedAt = null, $archived = null) {
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}