cards soft delete wip

Signed-off-by: Manuel Arno Korfmann <manu@korfmann.info>

cards: softdelete done; undo delete wip

Signed-off-by: Manuel Arno Korfmann <manu@korfmann.info>

show deleted cards in board settings sidebar wip

Signed-off-by: Manuel Arno Korfmann <manu@korfmann.info>

CardMapper#findDeleted: fix bug in entity property assigning

Signed-off-by: Manuel Arno Korfmann <manu@korfmann.info>
This commit is contained in:
Manuel Arno Korfmann
2018-07-09 23:49:42 +02:00
committed by Julius Härtl
parent 3e4dedf397
commit 2ef4b55af4
10 changed files with 88 additions and 2 deletions

View File

@@ -42,6 +42,7 @@ class Card extends RelationalEntity {
protected $archived = false;
protected $duedate;
protected $notified = false;
protected $deletedAt;
private $databaseType = 'sqlite';
@@ -58,6 +59,7 @@ class Card extends RelationalEntity {
$this->addType('createdAt', 'integer');
$this->addType('archived', 'boolean');
$this->addType('notified', 'boolean');
$this->addType('deletedAt', 'integer');
$this->addRelation('labels');
$this->addRelation('assignedUsers');
$this->addRelation('attachments');

View File

@@ -124,6 +124,13 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
return $this->findEntities($sql, [$stackId], $limit, $offset);
}
public function findDeleted($boardId, $limit = null, $offset = null) {
$sql = 'SELECT c.* FROM `*PREFIX*deck_cards` c
INNER JOIN `*PREFIX*deck_stacks` s ON s.id = c.stack_id
WHERE `s`.`board_id` = ? AND NOT c.archived AND NOT c.deleted_at = 0 AND c.deleted_at <= ? ORDER BY `c`.`order`';
return $this->findEntities($sql, [$boardId, time()], $limit, $offset);
}
public function findAllArchived($stackId, $limit = null, $offset = null) {
$sql = 'SELECT * FROM `*PREFIX*deck_cards` WHERE `stack_id`=? AND archived ORDER BY `last_modified`';
return $this->findEntities($sql, [$stackId], $limit, $offset);
@@ -197,4 +204,4 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
}
}
}