refactor: use new documents interfaces
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
+16
-19
@@ -220,8 +220,8 @@ class MetaStore {
|
||||
'cid' => empty($location) ? self::ROOT_COLLECTION_ID : $location,
|
||||
'nid' => UUID::v4(),
|
||||
'type' => NodeType::Collection->value,
|
||||
'created' => date('c'),
|
||||
'modified' => date('c'),
|
||||
'created' => (int) round(microtime(true) * 1000),
|
||||
'modified' => (int) round(microtime(true) * 1000),
|
||||
'properties' => $collection->getProperties()->toStore(),
|
||||
];
|
||||
$data['signature'] = time();
|
||||
@@ -237,7 +237,7 @@ class MetaStore {
|
||||
*/
|
||||
public function collectionModify(string $tenantId, string $userId, string|int $identifier, CollectionResource $collection): CollectionResource {
|
||||
$data = [
|
||||
'modified' => date('c'),
|
||||
'modified' => (int) round(microtime(true) * 1000),
|
||||
'properties' => $collection->getProperties()->toStore(),
|
||||
];
|
||||
$data['signature'] = time();
|
||||
@@ -287,7 +287,7 @@ class MetaStore {
|
||||
public function collectionMove(string $tenantId, string $userId, string|int $identifier, string|int|null $location): CollectionResource {
|
||||
$data = [
|
||||
'cid' => empty($location) ? self::ROOT_COLLECTION_ID : $location,
|
||||
'modified' => date('c'),
|
||||
'modified' => (int) round(microtime(true) * 1000),
|
||||
];
|
||||
|
||||
$this->_store->selectCollection($this->_NodeTable)->updateOne(
|
||||
@@ -311,7 +311,7 @@ class MetaStore {
|
||||
|
||||
$source = $collections[$identifier];
|
||||
$newCollection = $this->collectionFresh();
|
||||
$newCollection->setLabel($source->getLabel());
|
||||
$newCollection->getProperties()->fromStore($source->getProperties()->toStore());
|
||||
|
||||
$newNode = $this->collectionCreate($tenantId, $userId, $location, $newCollection);
|
||||
|
||||
@@ -420,8 +420,8 @@ class MetaStore {
|
||||
'cid' => empty($collection) ? self::ROOT_COLLECTION_ID : $collection,
|
||||
'nid' => UUID::v4(),
|
||||
'type' => NodeType::Entity->value,
|
||||
'created' => date('c'),
|
||||
'modified' => date('c'),
|
||||
'created' => (int) round(microtime(true) * 1000),
|
||||
'modified' => (int) round(microtime(true) * 1000),
|
||||
'properties' => $entity->getProperties()->toStore(),
|
||||
];
|
||||
$entity['signature'] = time();
|
||||
@@ -452,7 +452,7 @@ class MetaStore {
|
||||
$attributes['properties'] = $data['properties'] ?? [];
|
||||
}
|
||||
|
||||
$attributes['modified'] = date('c');
|
||||
$attributes['modified'] = (int) round(microtime(true) * 1000);
|
||||
$attributes['signature'] = time();
|
||||
|
||||
$this->_store->selectCollection($this->_NodeTable)->updateOne(
|
||||
@@ -491,9 +491,9 @@ class MetaStore {
|
||||
*/
|
||||
public function entityMove(string $tenantId, string $userId, string|int|null $collection, string|int $identifier, string|int|null $destination): EntityResource {
|
||||
$data = [
|
||||
'pid' => $destination,
|
||||
'modifiedOn' => date('c'),
|
||||
'modifiedBy' => $userId,
|
||||
'cid' => empty($destination) ? self::ROOT_COLLECTION_ID : $destination,
|
||||
'modified' => (int) round(microtime(true) * 1000),
|
||||
'signature' => time(),
|
||||
];
|
||||
|
||||
$this->_store->selectCollection($this->_NodeTable)->updateOne(
|
||||
@@ -501,8 +501,8 @@ class MetaStore {
|
||||
['$set' => $data]
|
||||
);
|
||||
$this->chronicleNode($tenantId, $userId, $identifier, 2);
|
||||
|
||||
$entities = $this->entityFetch($tenantId, $userId, $destination, $identifier);
|
||||
|
||||
$entities = $this->entityFetch($tenantId, $userId, empty($destination) ? self::ROOT_COLLECTION_ID : $destination, $identifier);
|
||||
return $entities[$identifier];
|
||||
}
|
||||
|
||||
@@ -517,11 +517,8 @@ class MetaStore {
|
||||
|
||||
$source = $entities[$identifier];
|
||||
$newEntity = new EntityResource();
|
||||
$newEntity->setLabel($source->getLabel());
|
||||
$newEntity->setMime($source->getMime());
|
||||
$newEntity->setFormat($source->getFormat());
|
||||
$newEntity->setEncoding($source->getEncoding());
|
||||
|
||||
$newEntity->getProperties()->fromStore($source->getProperties()->toStore());
|
||||
|
||||
return $this->entityCreate($tenantId, $userId, $destination, $newEntity, ['path' => null]);
|
||||
}
|
||||
|
||||
@@ -596,7 +593,7 @@ class MetaStore {
|
||||
$cursor = $this->_store->selectCollection($this->_NodeTable)->find([
|
||||
'tid' => $tenantId,
|
||||
'uid' => $userId,
|
||||
'pid' => $parentId,
|
||||
'cid' => $parentId,
|
||||
'type' => NodeType::Collection->value,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user