refactor: improvemets
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -91,7 +91,7 @@ class ServiceStore
|
||||
/**
|
||||
* Retrieve a single service by ID
|
||||
*/
|
||||
public function fetch(string $tenantId, string $userId, string|int $serviceId): ?Service
|
||||
public function fetch(string $tenantId, string $userId, string|int $serviceId): ?array
|
||||
{
|
||||
$document = $this->dataStore->selectCollection(self::COLLECTION_NAME)->findOne([
|
||||
'tid' => $tenantId,
|
||||
@@ -107,13 +107,13 @@ class ServiceStore
|
||||
$document['identity']['secret'] = $this->crypto->decrypt($document['identity']['secret']);
|
||||
}
|
||||
|
||||
return (new Service())->fromStore($document);
|
||||
return $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new service
|
||||
*/
|
||||
public function create(string $tenantId, string $userId, Service $service): Service
|
||||
public function create(string $tenantId, string $userId, Service $service): array
|
||||
{
|
||||
$document = $service->toStore();
|
||||
|
||||
@@ -129,15 +129,15 @@ class ServiceStore
|
||||
|
||||
$result = $this->dataStore->selectCollection(self::COLLECTION_NAME)->insertOne($document);
|
||||
|
||||
return (new Service())->fromStore($document);
|
||||
return $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify an existing service
|
||||
*/
|
||||
public function modify(string $tenantId, string $userId, Service $service): Service
|
||||
public function modify(string $tenantId, string $userId, Service $service): array
|
||||
{
|
||||
$serviceId = $service->id();
|
||||
$serviceId = $service->identifier();
|
||||
if (empty($serviceId)) {
|
||||
throw new \InvalidArgumentException('Service ID is required for update');
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class ServiceStore
|
||||
['$set' => $document]
|
||||
);
|
||||
|
||||
return (new Service())->fromStore($document);
|
||||
return $document;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user