feat: lots more improvements
Some checks failed
JS Unit Tests / test (pull_request) Failing after 29s
Build Test / test (pull_request) Successful in 31s
PHP Unit Tests / test (pull_request) Successful in 1m12s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-04-25 15:41:16 -04:00
parent 86e4772d45
commit 99a68737d1
26 changed files with 902 additions and 596 deletions

View File

@@ -299,12 +299,16 @@ class DefaultController extends ControllerAbstract {
if (!is_array($data['data'])) {
throw new InvalidArgumentException(self::ERR_INVALID_DATA);
}
if (isset($data['delta']) && !is_bool($data['delta'])) {
throw new InvalidArgumentException('Invalid parameter: delta must be a boolean');
}
return $this->mailManager->serviceUpdate(
$tenantId,
$userId,
$data['provider'],
$data['identifier'],
$data['delta'] ?? false,
$data['data']
);
}

View File

@@ -247,17 +247,18 @@ class Manager {
* @param string $userId User identifier for context
* @param string $providerId Provider identifier
* @param string|int $serviceId Service identifier
* @param bool $delta Whether the update is a delta (partial) update or a full replacement
* @param array $data Updated service configuration data
*
* @return ServiceBaseInterface Updated service
*
* @throws InvalidArgumentException If provider doesn't support service modification or service not found
*/
public function serviceUpdate(string $tenantId, string $userId, string $providerId, string|int $serviceId, array $data): ServiceBaseInterface {
public function serviceUpdate(string $tenantId, string $userId, string $providerId, string|int $serviceId, bool $delta = false, array $data): ServiceBaseInterface {
// retrieve provider and service
$provider = $this->providerFetch($tenantId, $userId, $providerId);
if ($provider instanceof ProviderServiceMutateInterface === false) {
throw new InvalidArgumentException("Provider '$providerId' does not support service creation");
throw new InvalidArgumentException("Provider '$providerId' does not support service modification");
}
// Fetch existing service
@@ -267,7 +268,7 @@ class Manager {
}
// Update with new data
$service->jsonDeserialize($data);
$service->jsonDeserialize($data, $delta);
// Modify the service
$provider->serviceModify($tenantId, $userId, $service);
@@ -294,7 +295,7 @@ class Manager {
// retrieve provider and service
$provider = $this->providerFetch($tenantId, $userId, $providerId);
if ($provider instanceof ProviderServiceMutateInterface === false) {
throw new InvalidArgumentException("Provider '$providerId' does not support service creation");
throw new InvalidArgumentException("Provider '$providerId' does not support service deletion");
}
// Fetch existing service