Remove scheduleUpdatedAt
This commit is contained in:
parent
a919421b47
commit
72e0ccf6d6
|
@ -2311,17 +2311,6 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'$id' => ID::custom('scheduleUpdatedAt'),
|
|
||||||
'type' => Database::VAR_DATETIME,
|
|
||||||
'format' => '',
|
|
||||||
'size' => 0,
|
|
||||||
'signed' => false,
|
|
||||||
'required' => false,
|
|
||||||
'default' => null,
|
|
||||||
'array' => false,
|
|
||||||
'filters' => ['datetime'],
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('timeout'),
|
'$id' => ID::custom('timeout'),
|
||||||
'type' => Database::VAR_INTEGER,
|
'type' => Database::VAR_INTEGER,
|
||||||
|
|
|
@ -86,7 +86,6 @@ App::post('/v1/functions')
|
||||||
'events' => $events,
|
'events' => $events,
|
||||||
'schedule' => $schedule,
|
'schedule' => $schedule,
|
||||||
'scheduleInternalId' => '',
|
'scheduleInternalId' => '',
|
||||||
'scheduleUpdatedAt' => DateTime::now(),
|
|
||||||
'timeout' => $timeout,
|
'timeout' => $timeout,
|
||||||
'search' => implode(' ', [$functionId, $name, $runtime])
|
'search' => implode(' ', [$functionId, $name, $runtime])
|
||||||
]));
|
]));
|
||||||
|
@ -416,7 +415,6 @@ App::put('/v1/functions/:functionId')
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'events' => $events,
|
'events' => $events,
|
||||||
'schedule' => $schedule,
|
'schedule' => $schedule,
|
||||||
'scheduleUpdatedAt' => DateTime::now(),
|
|
||||||
'timeout' => $timeout,
|
'timeout' => $timeout,
|
||||||
'enabled' => $enabled,
|
'enabled' => $enabled,
|
||||||
'search' => implode(' ', [$functionId, $name, $function->getAttribute('runtime')]),
|
'search' => implode(' ', [$functionId, $name, $function->getAttribute('runtime')]),
|
||||||
|
@ -424,7 +422,7 @@ App::put('/v1/functions/:functionId')
|
||||||
|
|
||||||
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
||||||
$schedule
|
$schedule
|
||||||
->setAttribute('resourceUpdatedAt', $function->getAttribute('scheduleUpdatedAt'))
|
->setAttribute('resourceUpdatedAt', DateTime::now())
|
||||||
->setAttribute('schedule', $function->getAttribute('schedule'))
|
->setAttribute('schedule', $function->getAttribute('schedule'))
|
||||||
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
||||||
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
||||||
|
@ -480,12 +478,11 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId')
|
||||||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||||
'deploymentInternalId' => $deployment->getInternalId(),
|
'deploymentInternalId' => $deployment->getInternalId(),
|
||||||
'deployment' => $deployment->getId(),
|
'deployment' => $deployment->getId(),
|
||||||
'scheduleUpdatedAt' => DateTime::now()
|
|
||||||
])));
|
])));
|
||||||
|
|
||||||
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
||||||
$schedule
|
$schedule
|
||||||
->setAttribute('resourceUpdatedAt', $function->getAttribute('scheduleUpdatedAt'))
|
->setAttribute('resourceUpdatedAt', DateTime::now())
|
||||||
->setAttribute('schedule', $function->getAttribute('schedule'))
|
->setAttribute('schedule', $function->getAttribute('schedule'))
|
||||||
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
||||||
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
||||||
|
@ -1347,13 +1344,9 @@ App::post('/v1/functions/:functionId/variables')
|
||||||
|
|
||||||
$dbForProject->deleteCachedDocument('functions', $function->getId());
|
$dbForProject->deleteCachedDocument('functions', $function->getId());
|
||||||
|
|
||||||
$function = $dbForProject->getDocument('functions', $functionId);
|
|
||||||
$function->setAttribute('scheduleUpdatedAt', DateTime::now());
|
|
||||||
$dbForProject->updateDocument('functions', $function->getId(), $function);
|
|
||||||
|
|
||||||
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
||||||
$schedule
|
$schedule
|
||||||
->setAttribute('resourceUpdatedAt', $function->getAttribute('scheduleUpdatedAt'))
|
->setAttribute('resourceUpdatedAt', DateTime::now())
|
||||||
->setAttribute('schedule', $function->getAttribute('schedule'))
|
->setAttribute('schedule', $function->getAttribute('schedule'))
|
||||||
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
||||||
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
||||||
|
@ -1475,13 +1468,9 @@ App::put('/v1/functions/:functionId/variables/:variableId')
|
||||||
|
|
||||||
$dbForProject->deleteCachedDocument('functions', $function->getId());
|
$dbForProject->deleteCachedDocument('functions', $function->getId());
|
||||||
|
|
||||||
$function = $dbForProject->getDocument('functions', $functionId);
|
|
||||||
$function->setAttribute('scheduleUpdatedAt', DateTime::now());
|
|
||||||
$dbForProject->updateDocument('functions', $function->getId(), $function);
|
|
||||||
|
|
||||||
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
||||||
$schedule
|
$schedule
|
||||||
->setAttribute('resourceUpdatedAt', $function->getAttribute('scheduleUpdatedAt'))
|
->setAttribute('resourceUpdatedAt', DateTime::now())
|
||||||
->setAttribute('schedule', $function->getAttribute('schedule'))
|
->setAttribute('schedule', $function->getAttribute('schedule'))
|
||||||
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
||||||
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
||||||
|
@ -1525,13 +1514,9 @@ App::delete('/v1/functions/:functionId/variables/:variableId')
|
||||||
$dbForProject->deleteDocument('variables', $variable->getId());
|
$dbForProject->deleteDocument('variables', $variable->getId());
|
||||||
$dbForProject->deleteCachedDocument('functions', $function->getId());
|
$dbForProject->deleteCachedDocument('functions', $function->getId());
|
||||||
|
|
||||||
$function = $dbForProject->getDocument('functions', $functionId);
|
|
||||||
$function->setAttribute('scheduleUpdatedAt', DateTime::now());
|
|
||||||
$dbForProject->updateDocument('functions', $function->getId(), $function);
|
|
||||||
|
|
||||||
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
||||||
$schedule
|
$schedule
|
||||||
->setAttribute('resourceUpdatedAt', $function->getAttribute('scheduleUpdatedAt'))
|
->setAttribute('resourceUpdatedAt', DateTime::now())
|
||||||
->setAttribute('schedule', $function->getAttribute('schedule'))
|
->setAttribute('schedule', $function->getAttribute('schedule'))
|
||||||
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
|
||||||
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
|
||||||
|
|
|
@ -208,8 +208,6 @@ class BuildsV1 extends Worker
|
||||||
|
|
||||||
Console::success("Build id: $buildId created");
|
Console::success("Build id: $buildId created");
|
||||||
|
|
||||||
$function->setAttribute('scheduleUpdatedAt', DateTime::now());
|
|
||||||
|
|
||||||
/** Set auto deploy */
|
/** Set auto deploy */
|
||||||
if ($deployment->getAttribute('activate') === true) {
|
if ($deployment->getAttribute('activate') === true) {
|
||||||
$function->setAttribute('deploymentInternalId', $deployment->getInternalId());
|
$function->setAttribute('deploymentInternalId', $deployment->getInternalId());
|
||||||
|
@ -220,7 +218,7 @@ class BuildsV1 extends Worker
|
||||||
/** Update function schedule */
|
/** Update function schedule */
|
||||||
$dbForConsole = $this->getConsoleDB();
|
$dbForConsole = $this->getConsoleDB();
|
||||||
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
|
||||||
$schedule->setAttribute('resourceUpdatedAt', $function->getAttribute('scheduleUpdatedAt'));
|
$schedule->setAttribute('resourceUpdatedAt', DateTime::now());
|
||||||
|
|
||||||
$schedule
|
$schedule
|
||||||
->setAttribute('schedule', $function->getAttribute('schedule'))
|
->setAttribute('schedule', $function->getAttribute('schedule'))
|
||||||
|
|
Loading…
Reference in a new issue