1
0
Fork 0
mirror of synced 2024-06-26 10:10:57 +12:00

fix(app): remove app resource and replace with utopia

This commit is contained in:
Torsten Dittmann 2021-07-12 11:51:58 +02:00
parent bb95ec536b
commit 18d4a0def0
5 changed files with 25 additions and 31 deletions

View file

@ -918,16 +918,16 @@ App::get('/v1/account/logs')
->inject('user')
->inject('locale')
->inject('geodb')
->inject('app')
->action(function ($response, $project, $user, $locale, $geodb, $app) {
->inject('utopia')
->action(function ($response, $project, $user, $locale, $geodb, $utopia) {
/** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Document $project */
/** @var Appwrite\Database\Document $user */
/** @var Utopia\Locale\Locale $locale */
/** @var MaxMind\Db\Reader $geodb */
/** @var Utopia\App $app */
/** @var Utopia\App $utopia */
$adapter = new AuditAdapter($app->getResource('db'));
$adapter = new AuditAdapter($utopia->getResource('db'));
$adapter->setNamespace('app_'.$project->getId());
$audit = new Audit($adapter);

View file

@ -42,11 +42,11 @@ App::get('/v1/health/db')
->label('sdk.method', 'getDB')
->label('sdk.description', '/docs/references/health/get-db.md')
->inject('response')
->inject('app')
->action(function ($response, $app) {
->inject('utopia')
->action(function ($response, $utopia) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\App $app */
$app->getResource('db');
/** @var Utopia\App $utopia */
$utopia->getResource('db');
$response->json(['status' => 'OK']);
});
@ -60,11 +60,11 @@ App::get('/v1/health/cache')
->label('sdk.method', 'getCache')
->label('sdk.description', '/docs/references/health/get-cache.md')
->inject('response')
->inject('app')
->action(function ($response, $app) {
->inject('utopia')
->action(function ($response, $utopia) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\App $register */
$app->getResource('cache');
/** @var Utopia\App $utopia */
$utopia->getResource('cache');
$response->json(['status' => 'OK']);
});

View file

@ -236,14 +236,14 @@ App::get('/v1/users/:userId/logs')
->inject('projectDB')
->inject('locale')
->inject('geodb')
->inject('app')
->action(function ($userId, $response, $project, $projectDB, $locale, $geodb, $app) {
->inject('utopia')
->action(function ($userId, $response, $project, $projectDB, $locale, $geodb, $utopia) {
/** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Document $project */
/** @var Appwrite\Database\Database $projectDB */
/** @var Utopia\Locale\Locale $locale */
/** @var MaxMind\Db\Reader $geodb */
/** @var Utopia\App $app */
/** @var Utopia\App $utopia */
$user = $projectDB->getDocument($userId);
@ -251,7 +251,7 @@ App::get('/v1/users/:userId/logs')
throw new Exception('User not found', 404);
}
$adapter = new AuditAdapter($app->getResource('db'));
$adapter = new AuditAdapter($utopia->getResource('db'));
$adapter->setNamespace('app_'.$project->getId());
$audit = new Audit($adapter);

View file

@ -87,10 +87,6 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
App::setResource('cache', function () use (&$redis) {
return $redis;
});
App::setResource('app', function() use (&$app) {
return $app;
});
try {
Authorization::cleanRoles();

20
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7983e9fe8946a99fbf818b79ff202486",
"content-hash": "e24aacead283e33130051470bb4312e6",
"packages": [
{
"name": "adhocore/jwt",
@ -2403,16 +2403,16 @@
},
{
"name": "appwrite/sdk-generator",
"version": "dev-feat-kotlin-java-docs",
"version": "0.12.0",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "966d464728b41a8c449e99d7df4bd4ddca591a25"
"reference": "ca8e34f091b3a66f94a8972cb94b0b8e1161dada"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/966d464728b41a8c449e99d7df4bd4ddca591a25",
"reference": "966d464728b41a8c449e99d7df4bd4ddca591a25",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ca8e34f091b3a66f94a8972cb94b0b8e1161dada",
"reference": "ca8e34f091b3a66f94a8972cb94b0b8e1161dada",
"shasum": ""
},
"require": {
@ -2446,9 +2446,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/feat-kotlin-java-docs"
"source": "https://github.com/appwrite/sdk-generator/tree/0.12.0"
},
"time": "2021-07-06T09:26:45+00:00"
"time": "2021-07-06T16:20:51+00:00"
},
{
"name": "composer/package-versions-deprecated",
@ -6066,9 +6066,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"appwrite/sdk-generator": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -6090,5 +6088,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.0.0"
}