diff --git a/lib/Controller/CardController.php b/lib/Controller/CardController.php index dcb3e6046..a518c65ed 100644 --- a/lib/Controller/CardController.php +++ b/lib/Controller/CardController.php @@ -94,8 +94,8 @@ class CardController extends Controller { * @param $deletedAt * @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); + public function update($id, $title, $stackId, $type, $order, $description, $duedate, $deletedAt, $dueDone) { + return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId, $duedate, $deletedAt, null, $dueDone); } /** diff --git a/lib/Db/Card.php b/lib/Db/Card.php index 4e24719ba..cebd81e5f 100644 --- a/lib/Db/Card.php +++ b/lib/Db/Card.php @@ -36,17 +36,19 @@ class Card extends RelationalEntity { protected $lastModified; protected $lastEditor; protected $createdAt; - protected $labels; - protected $assignedUsers; - protected $attachments; - protected $attachmentCount; protected $owner; protected $order; protected $archived = false; protected $duedate; protected $notified = false; protected $deletedAt = 0; + protected $dueDone = false; + + protected $labels; + protected $assignedUsers; protected $commentsUnread = 0; + protected $attachments; + protected $attachmentCount = 0; private $databaseType = 'sqlite'; @@ -64,6 +66,8 @@ class Card extends RelationalEntity { $this->addType('archived', 'boolean'); $this->addType('notified', 'boolean'); $this->addType('deletedAt', 'integer'); + $this->addType('dueDone', 'boolean'); + $this->addRelation('labels'); $this->addRelation('assignedUsers'); $this->addRelation('attachments'); diff --git a/lib/Migration/Version10200Date20201104190344.php b/lib/Migration/Version10200Date20201104190344.php new file mode 100644 index 000000000..72e0f5152 --- /dev/null +++ b/lib/Migration/Version10200Date20201104190344.php @@ -0,0 +1,54 @@ +getTable('deck_cards'); + + if (!$table->hasColumn('due_done')) { + $table->addColumn('due_done', 'boolean', [ + 'notnull' => false, + 'default' => false + ]); + } + + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + } +} diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 030c10e5c..d33c94e92 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -261,7 +261,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, $order = 0, $description = '', $owner, $duedate = null, ?int $deletedAt = null, ?bool $archived = null, ?bool $dueDone = null) { if (is_numeric($id) === false) { throw new BadRequestException('card id must be a number'); } @@ -320,6 +320,9 @@ class CardService { if ($archived !== null) { $card->setArchived($archived); } + if ($dueDone !== null) { + $card->setDueDone($dueDone); + } // Trigger update events before setting description as it is handled separately @@ -590,7 +593,7 @@ class CardService { */ public function findAllWithDue($userId) { $cards = $this->cardMapper->findAllWithDue($userId); - + return $cards; } @@ -602,7 +605,7 @@ class CardService { */ public function findAssignedCards($userId) { $cards = $this->cardMapper->findAssignedCards($userId); - + return $cards; } } diff --git a/src/components/cards/CardMenu.vue b/src/components/cards/CardMenu.vue index c922b076d..f2d35959c 100644 --- a/src/components/cards/CardMenu.vue +++ b/src/components/cards/CardMenu.vue @@ -24,22 +24,43 @@