mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Address more PR reviews
This commit is contained in:
+9
-2
@@ -29,7 +29,7 @@ ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT
|
||||
RUN npm ci
|
||||
RUN npm run build
|
||||
|
||||
FROM meldiron/base:0.2.3 as final
|
||||
FROM appwrite/base:0.4.2 as final
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
@@ -45,6 +45,7 @@ ENV _APP_SERVER=swoole \
|
||||
_APP_LOCALE=en \
|
||||
_APP_WORKER_PER_CORE= \
|
||||
_APP_DOMAIN=localhost \
|
||||
_APP_DOMAIN_FUNCTIONS=functions.localhost \
|
||||
_APP_DOMAIN_TARGET=localhost \
|
||||
_APP_HOME=https://appwrite.io \
|
||||
_APP_EDITION=community \
|
||||
@@ -122,7 +123,13 @@ ENV _APP_SERVER=swoole \
|
||||
_APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 \
|
||||
_APP_MAINTENANCE_INTERVAL=86400 \
|
||||
_APP_LOGGING_PROVIDER= \
|
||||
_APP_LOGGING_CONFIG=
|
||||
_APP_LOGGING_CONFIG= \
|
||||
_APP_VCS_GITHUB_APP_NAME= \
|
||||
_APP_VCS_GITHUB_PRIVATE_KEY= \
|
||||
_APP_VCS_GITHUB_APP_ID= \
|
||||
_APP_VCS_GITHUB_CLIENT_ID= \
|
||||
_APP_VCS_GITHUB_CLIENT_SECRET= \
|
||||
_APP_VCS_GITHUB_WEBHOOK_SECRET=
|
||||
|
||||
RUN apk add git
|
||||
|
||||
|
||||
@@ -330,18 +330,18 @@ return [
|
||||
'description' => 'Installation with the requested ID could not be found.',
|
||||
'code' => 404,
|
||||
],
|
||||
Exception::REPOSITORY_NOT_FOUND => [
|
||||
'name' => Exception::REPOSITORY_NOT_FOUND,
|
||||
Exception::PROVIDER_REPOSITORY_NOT_FOUND => [
|
||||
'name' => Exception::PROVIDER_REPOSITORY_NOT_FOUND,
|
||||
'description' => 'Repository with the requested ID could not be found.',
|
||||
'code' => 404,
|
||||
],
|
||||
Exception::VCS_REPOSITORY_NOT_FOUND => [
|
||||
'name' => Exception::VCS_REPOSITORY_NOT_FOUND,
|
||||
Exception::REPOSITORY_NOT_FOUND => [
|
||||
'name' => Exception::REPOSITORY_NOT_FOUND,
|
||||
'description' => 'VCS Repository with the requested ID could not be found.',
|
||||
'code' => 404,
|
||||
],
|
||||
Exception::VCS_CONTRIBUTION_ALREADY_AUTHORIZED => [
|
||||
'name' => Exception::VCS_CONTRIBUTION_ALREADY_AUTHORIZED,
|
||||
Exception::PROVIDER_CONTRIBUTION_CONFLICT => [
|
||||
'name' => Exception::PROVIDER_CONTRIBUTION_CONFLICT,
|
||||
'description' => 'External ontribution is already authorized.',
|
||||
'code' => 409,
|
||||
],
|
||||
|
||||
@@ -898,6 +898,66 @@ return [
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'category' => 'VCS (Version Control System)',
|
||||
'description' => '',
|
||||
'variables' => [
|
||||
[
|
||||
'name' => '_APP_VCS_GITHUB_APP_NAME',
|
||||
'description' => 'Name of your GitHub app. You can find it in URL of your GitHub application.',
|
||||
'introduction' => '1.4.0',
|
||||
'default' => '',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
'filter' => ''
|
||||
],
|
||||
[
|
||||
'name' => '_APP_VCS_GITHUB_PRIVATE_KEY',
|
||||
'description' => 'GitHub app RSA private key. You can generate private keys from GitHub application settings.',
|
||||
'introduction' => '1.4.0',
|
||||
'default' => '',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
'filter' => ''
|
||||
],
|
||||
[
|
||||
'name' => '_APP_VCS_GITHUB_APP_ID',
|
||||
'description' => 'GitHub application ID. You can find it in your GitHub application details.',
|
||||
'introduction' => '1.4.0',
|
||||
'default' => '',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
'filter' => ''
|
||||
],
|
||||
[
|
||||
'name' => '_APP_VCS_GITHUB_CLIENT_ID',
|
||||
'description' => 'GitHub client ID. You can find it in your GitHub application details.',
|
||||
'introduction' => '1.4.0',
|
||||
'default' => '',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
'filter' => ''
|
||||
],
|
||||
[
|
||||
'name' => '_APP_VCS_GITHUB_CLIENT_SECRET',
|
||||
'description' => 'GitHub client secret. You can generate secrets in your GitHub application settings.',
|
||||
'introduction' => '1.4.0',
|
||||
'default' => '',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
'filter' => ''
|
||||
],
|
||||
[
|
||||
'name' => '_APP_VCS_GITHUB_WEBHOOK_SECRET',
|
||||
'description' => 'GitHub webhook secret. You can configure it in your GitHub application settings under webhook section.',
|
||||
'introduction' => '1.4.0',
|
||||
'default' => '',
|
||||
'required' => false,
|
||||
'question' => '',
|
||||
'filter' => ''
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'category' => 'Maintenance',
|
||||
'description' => '',
|
||||
|
||||
+13
-13
@@ -95,7 +95,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
|
||||
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
||||
|
||||
if (empty($repositoryName)) {
|
||||
throw new Exception(Exception::REPOSITORY_NOT_FOUND);
|
||||
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
|
||||
}
|
||||
|
||||
$isAuthorized = !$external;
|
||||
@@ -227,7 +227,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
|
||||
}
|
||||
};
|
||||
|
||||
App::get('/v1/vcs/github/installations')
|
||||
App::get('/v1/vcs/github/authorize')
|
||||
->desc('Install GitHub App')
|
||||
->groups(['api', 'vcs'])
|
||||
->label('scope', 'public')
|
||||
@@ -402,7 +402,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories/:pr
|
||||
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
||||
|
||||
if (empty($repositoryName)) {
|
||||
throw new Exception(Exception::REPOSITORY_NOT_FOUND);
|
||||
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
|
||||
}
|
||||
|
||||
$files = $github->listRepositoryContents($owner, $repositoryName, $providerRootDirectory);
|
||||
@@ -444,7 +444,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||
->label('sdk.description', '')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_REPOSITORY_LIST)
|
||||
->label('sdk.response.model', Response::MODEL_PROVIDER_REPOSITORY_LIST)
|
||||
->param('installationId', '', new Text(256), 'Installation Id')
|
||||
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
|
||||
->inject('gitHub')
|
||||
@@ -561,7 +561,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||
$response->dynamic(new Document([
|
||||
'repositories' => $repos,
|
||||
'total' => \count($repos),
|
||||
]), Response::MODEL_REPOSITORY_LIST);
|
||||
]), Response::MODEL_PROVIDER_REPOSITORY_LIST);
|
||||
});
|
||||
|
||||
App::post('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||
@@ -573,7 +573,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||
->label('sdk.description', '')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_REPOSITORY)
|
||||
->label('sdk.response.model', Response::MODEL_PROVIDER_REPOSITORY)
|
||||
->param('installationId', '', new Text(256), 'Installation Id')
|
||||
->param('name', '', new Text(256), 'Repository name (slug)')
|
||||
->param('private', '', new Boolean(false), 'Mark repository public or private')
|
||||
@@ -635,7 +635,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories')
|
||||
$repository['organization'] = $installation->getAttribute('organization', '');
|
||||
$repository['provider'] = $installation->getAttribute('provider', '');
|
||||
|
||||
$response->dynamic(new Document($repository), Response::MODEL_REPOSITORY);
|
||||
$response->dynamic(new Document($repository), Response::MODEL_PROVIDER_REPOSITORY);
|
||||
});
|
||||
|
||||
App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:providerRepositoryId')
|
||||
@@ -647,7 +647,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
||||
->label('sdk.description', '')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_REPOSITORY)
|
||||
->label('sdk.response.model', Response::MODEL_PROVIDER_REPOSITORY)
|
||||
->param('installationId', '', new Text(256), 'Installation Id')
|
||||
->param('providerRepositoryId', '', new Text(256), 'Repository Id')
|
||||
->inject('gitHub')
|
||||
@@ -672,7 +672,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
||||
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
||||
|
||||
if (empty($repositoryName)) {
|
||||
throw new Exception(Exception::REPOSITORY_NOT_FOUND);
|
||||
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
|
||||
}
|
||||
|
||||
$repository = $github->getRepository($owner, $repositoryName);
|
||||
@@ -682,7 +682,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
||||
$repository['organization'] = $installation->getAttribute('organization', '');
|
||||
$repository['provider'] = $installation->getAttribute('provider', '');
|
||||
|
||||
$response->dynamic(new Document($repository), Response::MODEL_REPOSITORY);
|
||||
$response->dynamic(new Document($repository), Response::MODEL_PROVIDER_REPOSITORY);
|
||||
});
|
||||
|
||||
App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:providerRepositoryId/branches')
|
||||
@@ -719,7 +719,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
|
||||
$repositoryName = $github->getRepositoryName($providerRepositoryId) ?? '';
|
||||
|
||||
if (empty($repositoryName)) {
|
||||
throw new Exception(Exception::REPOSITORY_NOT_FOUND);
|
||||
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
|
||||
}
|
||||
|
||||
$branches = $github->listBranches($owner, $repositoryName) ?? [];
|
||||
@@ -996,11 +996,11 @@ App::patch('/v1/vcs/github/installations/:installationId/repositories/:repositor
|
||||
]);
|
||||
|
||||
if ($repository->isEmpty()) {
|
||||
throw new Exception(Exception::VCS_REPOSITORY_NOT_FOUND);
|
||||
throw new Exception(Exception::REPOSITORY_NOT_FOUND);
|
||||
}
|
||||
|
||||
if (\in_array($providerPullRequestId, $repository->getAttribute('providerPullRequestIds', []))) {
|
||||
throw new Exception(Exception::VCS_CONTRIBUTION_ALREADY_AUTHORIZED);
|
||||
throw new Exception(Exception::PROVIDER_CONTRIBUTION_CONFLICT);
|
||||
}
|
||||
|
||||
$providerPullRequestIds = \array_unique(\array_merge($repository->getAttribute('providerPullRequestIds', []), [$providerPullRequestId]));
|
||||
|
||||
@@ -462,9 +462,9 @@ class DeletesV1 extends Worker
|
||||
$functionInternalId = $document->getInternalId();
|
||||
|
||||
/**
|
||||
* Delete routes
|
||||
* Delete rules
|
||||
*/
|
||||
Console::info("Deleting routes for function " . $functionId);
|
||||
Console::info("Deleting rules for function " . $functionId);
|
||||
$this->deleteByGroup('rules', [
|
||||
Query::equal('resourceType', ['function']),
|
||||
Query::equal('resourceInternalId', [$functionInternalId]),
|
||||
|
||||
@@ -108,9 +108,9 @@ class Exception extends \Exception
|
||||
|
||||
/** VCS */
|
||||
public const INSTALLATION_NOT_FOUND = 'installation_not_found';
|
||||
public const PROVIDER_REPOSITORY_NOT_FOUND = 'provider_repository_not_found';
|
||||
public const REPOSITORY_NOT_FOUND = 'repository_not_found';
|
||||
public const VCS_REPOSITORY_NOT_FOUND = 'vcs_repository_not_found';
|
||||
public const VCS_CONTRIBUTION_ALREADY_AUTHORIZED = 'vcs_contribution_already_authorized';
|
||||
public const PROVIDER_CONTRIBUTION_CONFLICT = 'provider_contribution_conflict';
|
||||
|
||||
/** Functions */
|
||||
public const FUNCTION_NOT_FOUND = 'function_not_found';
|
||||
|
||||
@@ -40,8 +40,6 @@ class Specs extends Action
|
||||
|
||||
public function action(string $version, string $mode, Registry $register): void
|
||||
{
|
||||
// $db = $register->get('db');
|
||||
// $redis = $register->get('cache');
|
||||
$appRoutes = App::getRoutes();
|
||||
$response = new Response(new HttpResponse());
|
||||
$mocks = ($mode === 'mocks');
|
||||
|
||||
@@ -73,9 +73,8 @@ use Appwrite\Utopia\Response\Model\HealthStatus;
|
||||
use Appwrite\Utopia\Response\Model\HealthTime;
|
||||
use Appwrite\Utopia\Response\Model\HealthVersion;
|
||||
use Appwrite\Utopia\Response\Model\Installation;
|
||||
use Appwrite\Utopia\Response\Model\Repository;
|
||||
use Appwrite\Utopia\Response\Model\Mock; // Keep last
|
||||
use Appwrite\Utopia\Response\Model\Provider;
|
||||
use Appwrite\Utopia\Response\Model\ProviderRepository;
|
||||
use Appwrite\Utopia\Response\Model\Runtime;
|
||||
use Appwrite\Utopia\Response\Model\UsageBuckets;
|
||||
use Appwrite\Utopia\Response\Model\UsageCollection;
|
||||
@@ -87,6 +86,7 @@ use Appwrite\Utopia\Response\Model\UsageProject;
|
||||
use Appwrite\Utopia\Response\Model\UsageStorage;
|
||||
use Appwrite\Utopia\Response\Model\UsageUsers;
|
||||
use Appwrite\Utopia\Response\Model\Variable;
|
||||
use Appwrite\Utopia\Response\Model\Mock; // Keep last
|
||||
|
||||
/**
|
||||
* @method Response setStatusCode(int $code = 200)
|
||||
@@ -183,8 +183,8 @@ class Response extends SwooleResponse
|
||||
// VCS
|
||||
public const MODEL_INSTALLATION = 'installation';
|
||||
public const MODEL_INSTALLATION_LIST = 'installationList';
|
||||
public const MODEL_REPOSITORY = 'repository';
|
||||
public const MODEL_REPOSITORY_LIST = 'repositoryList';
|
||||
public const MODEL_PROVIDER_REPOSITORY = 'providerRepository';
|
||||
public const MODEL_PROVIDER_REPOSITORY_LIST = 'providerRepositoryList';
|
||||
public const MODEL_BRANCH = 'branch';
|
||||
public const MODEL_BRANCH_LIST = 'branchList';
|
||||
public const MODEL_DETECTION = 'detection';
|
||||
@@ -275,7 +275,7 @@ class Response extends SwooleResponse
|
||||
->setModel(new BaseList('Memberships List', self::MODEL_MEMBERSHIP_LIST, 'memberships', self::MODEL_MEMBERSHIP))
|
||||
->setModel(new BaseList('Functions List', self::MODEL_FUNCTION_LIST, 'functions', self::MODEL_FUNCTION))
|
||||
->setModel(new BaseList('Installations List', self::MODEL_INSTALLATION_LIST, 'installations', self::MODEL_INSTALLATION))
|
||||
->setModel(new BaseList('Repositories List', self::MODEL_REPOSITORY_LIST, 'repositories', self::MODEL_REPOSITORY))
|
||||
->setModel(new BaseList('Provider Repositories List', self::MODEL_PROVIDER_REPOSITORY_LIST, 'providerRepositories', self::MODEL_PROVIDER_REPOSITORY))
|
||||
->setModel(new BaseList('Branches List', self::MODEL_BRANCH_LIST, 'branches', self::MODEL_BRANCH))
|
||||
->setModel(new BaseList('Runtimes List', self::MODEL_RUNTIME_LIST, 'runtimes', self::MODEL_RUNTIME))
|
||||
->setModel(new BaseList('Deployments List', self::MODEL_DEPLOYMENT_LIST, 'deployments', self::MODEL_DEPLOYMENT))
|
||||
@@ -332,7 +332,7 @@ class Response extends SwooleResponse
|
||||
->setModel(new Membership())
|
||||
->setModel(new Func())
|
||||
->setModel(new Installation())
|
||||
->setModel(new Repository())
|
||||
->setModel(new ProviderRepository())
|
||||
->setModel(new Detection())
|
||||
->setModel(new Branch())
|
||||
->setModel(new Runtime())
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ namespace Appwrite\Utopia\Response\Model;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class Repository extends Model
|
||||
class ProviderRepository extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -63,7 +63,7 @@ class Repository extends Model
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'Repository';
|
||||
return 'ProviderRepository';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +73,6 @@ class Repository extends Model
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return Response::MODEL_REPOSITORY;
|
||||
return Response::MODEL_PROVIDER_REPOSITORY;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user