mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
AI review fixes
This commit is contained in:
@@ -200,7 +200,7 @@ App::post('/v1/mock/api-key-unprefixed')
|
||||
});
|
||||
|
||||
App::post('/v1/mock/time-travels')
|
||||
->desc('Create a time-travel to chane $createdAt')
|
||||
->desc('Create a time-travel to change $createdAt')
|
||||
->groups(['mock', 'api'])
|
||||
->label('scope', 'public')
|
||||
->label('docs', false)
|
||||
|
||||
@@ -317,7 +317,7 @@ class Deletes extends Action
|
||||
/* @var $dbForProject Database */
|
||||
$dbForProject = $getProjectDB($project);
|
||||
|
||||
$removalCallback = function (Document $resource) use ($dbForProject, $queueForDeletes) {
|
||||
$removalCallback = function (Document $resource) use ($dbForProject, $queueForDeletes, $project) {
|
||||
$retention = $resource->getAttribute('deploymentRetention', 0);
|
||||
|
||||
// 0 means unlimited - never delete
|
||||
@@ -327,8 +327,16 @@ class Deletes extends Action
|
||||
|
||||
$activeDeploymentId = $resource->getAttribute('deploymentId', '');
|
||||
|
||||
$resourceType = match ($resource->getCollection()) {
|
||||
'functions' => 'functions',
|
||||
'sites' => 'site',
|
||||
default => null,
|
||||
};
|
||||
|
||||
$queries = [
|
||||
Query::createdBefore(DateTime::addSeconds(new \DateTime(), -1 * $retention * 24 * 60 * 60)),
|
||||
Query::equal('resourceInternalId', [$resource->getSequence()]),
|
||||
Query::equal('resourceType', [$resourceType]),
|
||||
Query::orderDesc('$createdAt'),
|
||||
];
|
||||
|
||||
@@ -340,10 +348,11 @@ class Deletes extends Action
|
||||
'deployments',
|
||||
$queries,
|
||||
$dbForProject,
|
||||
function (Document $deployment) use ($queueForDeletes) {
|
||||
function (Document $deployment) use ($queueForDeletes, $project) {
|
||||
$queueForDeletes
|
||||
->setType(DELETE_TYPE_DOCUMENT)
|
||||
->setDocument($deployment)
|
||||
->setProject($project)
|
||||
->trigger();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -3090,7 +3090,7 @@ class SitesCustomServerTest extends Scope
|
||||
]);
|
||||
$this->assertSame(201, $response['headers']['status-code']);
|
||||
$this->assertSame(0, $response['body']['deploymentRetention']);
|
||||
$siteId[] = $response['body']['$id'];
|
||||
$siteIds[] = $response['body']['$id'];
|
||||
|
||||
$response = $this->getSite($response['body']['$id']);
|
||||
$this->assertSame(200, $response['headers']['status-code']);
|
||||
@@ -3106,7 +3106,7 @@ class SitesCustomServerTest extends Scope
|
||||
]);
|
||||
$this->assertSame(201, $response['headers']['status-code']);
|
||||
$this->assertSame(0, $response['body']['deploymentRetention']);
|
||||
$siteId[] = $response['body']['$id'];
|
||||
$siteIds[] = $response['body']['$id'];
|
||||
|
||||
$response = $this->getSite($response['body']['$id']);
|
||||
$this->assertSame(200, $response['headers']['status-code']);
|
||||
@@ -3121,7 +3121,7 @@ class SitesCustomServerTest extends Scope
|
||||
]);
|
||||
$this->assertSame(201, $response['headers']['status-code']);
|
||||
$this->assertSame(180, $response['body']['deploymentRetention']);
|
||||
$siteId[] = $response['body']['$id'];
|
||||
$siteIds[] = $response['body']['$id'];
|
||||
|
||||
$response = $this->getSite($response['body']['$id']);
|
||||
$this->assertSame(200, $response['headers']['status-code']);
|
||||
@@ -3156,7 +3156,7 @@ class SitesCustomServerTest extends Scope
|
||||
]);
|
||||
$this->assertSame(201, $response['headers']['status-code']);
|
||||
$this->assertSame(180, $response['body']['deploymentRetention']);
|
||||
$siteId[] = $response['body']['$id'];
|
||||
$siteIds[] = $response['body']['$id'];
|
||||
$siteIdToUpdate = $response['body']['$id'];
|
||||
|
||||
$response = $this->updateSite([
|
||||
|
||||
Reference in New Issue
Block a user