Add lastModified field to labels
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -317,6 +317,13 @@
|
|||||||
<notnull>true</notnull>
|
<notnull>true</notnull>
|
||||||
<length>8</length>
|
<length>8</length>
|
||||||
</field>
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>last_modified</name>
|
||||||
|
<type>integer</type>
|
||||||
|
<default></default>
|
||||||
|
<notnull>false</notnull>
|
||||||
|
<unsigned>true</unsigned>
|
||||||
|
</field>
|
||||||
<index>
|
<index>
|
||||||
<name>deck_labels_board_id_index</name>
|
<name>deck_labels_board_id_index</name>
|
||||||
<field>
|
<field>
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ class Label extends RelationalEntity {
|
|||||||
protected $color;
|
protected $color;
|
||||||
protected $boardId;
|
protected $boardId;
|
||||||
protected $cardId;
|
protected $cardId;
|
||||||
|
protected $lastModified;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->addType('id', 'integer');
|
$this->addType('id', 'integer');
|
||||||
$this->addType('boardId', 'integer');
|
$this->addType('boardId', 'integer');
|
||||||
$this->addType('cardId', 'integer');
|
$this->addType('cardId', 'integer');
|
||||||
|
$this->addType('lastModified', 'integer');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
|
|
||||||
|
use OCP\AppFramework\Db\Entity;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
|
|
||||||
@@ -54,6 +55,19 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
return $this->findEntities($sql, [$boardId], $limit, $offset);
|
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) {
|
public function getAssignedLabelsForBoard($boardId) {
|
||||||
$labels = $this->findAssignedLabelsForBoard($boardId);
|
$labels = $this->findAssignedLabelsForBoard($boardId);
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class LabelTest extends TestCase {
|
|||||||
'title' => 'My Label',
|
'title' => 'My Label',
|
||||||
'boardId' => 123,
|
'boardId' => 123,
|
||||||
'cardId' => null,
|
'cardId' => null,
|
||||||
|
'lastModified' => null,
|
||||||
'color' => '000000'
|
'color' => '000000'
|
||||||
], $label->jsonSerialize());
|
], $label->jsonSerialize());
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ class LabelTest extends TestCase {
|
|||||||
'title' => 'My Label',
|
'title' => 'My Label',
|
||||||
'boardId' => null,
|
'boardId' => null,
|
||||||
'cardId' => 123,
|
'cardId' => 123,
|
||||||
|
'lastModified' => null,
|
||||||
'color' => '000000'
|
'color' => '000000'
|
||||||
], $label->jsonSerialize());
|
], $label->jsonSerialize());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user