refactor: improvemets
All checks were successful
Build Test / test (pull_request) Successful in 1m44s
JS Unit Tests / test (pull_request) Successful in 1m45s
PHP Unit Tests / test (pull_request) Successful in 2m24s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-24 19:12:26 -04:00
parent 3e899a50bd
commit 4730b75a05
11 changed files with 1730 additions and 20 deletions

View File

@@ -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;
}
/**