refactoring and stack undo delete early wip

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

stack soft delete done

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

stack undo delete done

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

stack undo: code review remarks and fixes

Signed-off-by: Manuel Arno Korfmann <manu@korfmann.info>
This commit is contained in:
Manuel Arno Korfmann
2018-07-16 00:09:43 +02:00
committed by Julius Härtl
parent f2795f120b
commit ef4ce31c47
13 changed files with 164 additions and 118 deletions

View File

@@ -27,12 +27,14 @@ class Stack extends RelationalEntity {
protected $title;
protected $boardId;
protected $deletedAt;
protected $cards = array();
protected $order;
public function __construct() {
$this->addType('id', 'integer');
$this->addType('boardId', 'integer');
$this->addType('deletedAt', 'integer');
$this->addType('order', 'integer');
}
@@ -47,4 +49,4 @@ class Stack extends RelationalEntity {
}
return $json;
}
}
}

View File

@@ -51,10 +51,17 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
public function findAll($boardId, $limit = null, $offset = null) {
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ? ORDER BY `order`';
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ? AND deleted_at = 0 ORDER BY `order`';
return $this->findEntities($sql, [$boardId], $limit, $offset);
}
public function findDeleted($boardId, $limit = null, $offset = null) {
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` s
WHERE `s`.`board_id` = ? AND NOT s.deleted_at = 0';
return $this->findEntities($sql, [$boardId], $limit, $offset);
}
public function delete(Entity $entity) {
// delete cards on stack
@@ -73,4 +80,4 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
$entity = $this->find($stackId);
return $entity->getBoardId();
}
}
}