Add lastModified field to labels

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-04-10 16:39:57 +02:00
parent d9305fc347
commit b0eaae6705
4 changed files with 26 additions and 1 deletions

View File

@@ -29,10 +29,12 @@ class Label extends RelationalEntity {
protected $color;
protected $boardId;
protected $cardId;
protected $lastModified;
public function __construct() {
$this->addType('id', 'integer');
$this->addType('boardId', 'integer');
$this->addType('cardId', 'integer');
$this->addType('lastModified', 'integer');
}
}

View File

@@ -23,6 +23,7 @@
namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection;
@@ -54,6 +55,19 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
return $this->findEntities($sql, [$boardId], $limit, $offset);
}
public function insert(Entity $entity) {
$entity->setLastModified(time());
return parent::insert($entity);
}
public function update(Entity $entity, $updateModified = true) {
if ($updateModified) {
$entity->setLastModified(time());
}
return parent::update($entity);
}
public function getAssignedLabelsForBoard($boardId) {
$labels = $this->findAssignedLabelsForBoard($boardId);
$result = array();