mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Merge pull request #9534 from appwrite/feat-active-deployment-details
Feat: Active deployment details - status, creation date
This commit is contained in:
commit
963760678c
10 changed files with 54 additions and 1 deletions
|
|
@ -579,6 +579,17 @@ return [
|
|||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('deploymentCreatedAt'),
|
||||
'type' => Database::VAR_DATETIME,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
'signed' => false,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => ['datetime'],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('vars'),
|
||||
'type' => Database::VAR_STRING,
|
||||
|
|
@ -1003,7 +1014,17 @@ return [
|
|||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
|
||||
[
|
||||
'$id' => ID::custom('deploymentCreatedAt'),
|
||||
'type' => Database::VAR_DATETIME,
|
||||
'format' => '',
|
||||
'size' => 0,
|
||||
'signed' => false,
|
||||
'required' => false,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
'filters' => ['datetime'],
|
||||
],
|
||||
[
|
||||
'$id' => ID::custom('deploymentScreenshotLight'), // File ID from 'screenshots' Console bucket
|
||||
'type' => Database::VAR_STRING,
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ class Delete extends Action
|
|||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||
'deploymentId' => '',
|
||||
'deploymentInternalId' => '',
|
||||
'deploymentCreatedAt' => '',
|
||||
])));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ class Update extends Base
|
|||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||
'deploymentInternalId' => $deployment->getInternalId(),
|
||||
'deploymentId' => $deployment->getId(),
|
||||
'deploymentCreatedAt' => $deployment->getCreatedAt(),
|
||||
])));
|
||||
|
||||
// Inform scheduler if function is still active
|
||||
|
|
|
|||
|
|
@ -868,6 +868,7 @@ class Builds extends Action
|
|||
|
||||
$resource->setAttribute('deploymentId', $deployment->getId());
|
||||
$resource->setAttribute('deploymentInternalId', $deployment->getInternalId());
|
||||
$resource->setAttribute('deploymentCreatedAt', $deployment->getCreatedAt());
|
||||
$resource = $dbForProject->updateDocument('functions', $resource->getId(), $resource);
|
||||
|
||||
$queries = [
|
||||
|
|
@ -900,6 +901,7 @@ class Builds extends Action
|
|||
$resource->setAttribute('deploymentInternalId', $deployment->getInternalId());
|
||||
$resource->setAttribute('deploymentScreenshotDark', $deployment->getAttribute('screenshotDark', ''));
|
||||
$resource->setAttribute('deploymentScreenshotLight', $deployment->getAttribute('screenshotLight', ''));
|
||||
$resource->setAttribute('deploymentCreatedAt', $deployment->getCreatedAt());
|
||||
$resource = $dbForProject->updateDocument('sites', $resource->getId(), $resource);
|
||||
$queries = [
|
||||
Query::equal("projectInternalId", [$project->getInternalId()]),
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class Delete extends Action
|
|||
'deploymentInternalId' => '',
|
||||
'deploymentScreenshotDark' => '',
|
||||
'deploymentScreenshotLight' => '',
|
||||
'deploymentCreatedAt' => '',
|
||||
])));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ class Update extends Base
|
|||
'deploymentId' => $deployment->getId(),
|
||||
'deploymentScreenshotDark' => $deployment->getAttribute('screenshotDark', ''),
|
||||
'deploymentScreenshotLight' => $deployment->getAttribute('screenshotLight', ''),
|
||||
'deploymentCreatedAt' => $deployment->getCreatedAt(),
|
||||
])));
|
||||
|
||||
$queries = [
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ class Func extends Model
|
|||
'default' => '',
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('deploymentCreatedAt', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Active deployment creation date in ISO 8601 format.',
|
||||
'default' => '',
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
])
|
||||
->addRule('scopes', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Allowed permission scopes.',
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ class Site extends Model
|
|||
'default' => '',
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('deploymentCreatedAt', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Active deployment creation date in ISO 8601 format.',
|
||||
'default' => '',
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
])
|
||||
->addRule('deploymentScreenshotLight', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Screenshot of active deployment with light theme preference file ID.',
|
||||
|
|
|
|||
|
|
@ -493,6 +493,13 @@ class FunctionsCustomServerTest extends Scope
|
|||
$totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize'];
|
||||
$this->assertEquals($totalSize, $deployment['body']['totalSize']);
|
||||
|
||||
$function = $this->getFunction($functionId);
|
||||
$this->assertEquals(200, $function['headers']['status-code']);
|
||||
$this->assertNotEmpty($function['body']['deploymentId']);
|
||||
$this->assertNotEmpty($function['body']['deploymentCreatedAt']);
|
||||
$this->assertEquals($deployment['body']['$id'], $function['body']['deploymentId']);
|
||||
$this->assertEquals($deployment['body']['$createdAt'], $function['body']['deploymentCreatedAt']);
|
||||
|
||||
$function = $this->cleanupFunction($functionId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -367,6 +367,13 @@ class SitesCustomServerTest extends Scope
|
|||
$totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize'];
|
||||
$this->assertEquals($totalSize, $deployment['body']['totalSize']);
|
||||
|
||||
$site = $this->getSite($siteId);
|
||||
$this->assertEquals(200, $site['headers']['status-code']);
|
||||
$this->assertNotEmpty($site['body']['deploymentId']);
|
||||
$this->assertNotEmpty($site['body']['deploymentCreatedAt']);
|
||||
$this->assertEquals($deployment['body']['$id'], $site['body']['deploymentId']);
|
||||
$this->assertEquals($deployment['body']['$createdAt'], $site['body']['deploymentCreatedAt']);
|
||||
|
||||
$this->cleanupSite($siteId);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue