get project db key by region
This commit is contained in:
parent
3c9a05f466
commit
7977aaa609
1 changed files with 51 additions and 56 deletions
|
@ -104,7 +104,7 @@ App::post('/v1/projects')
|
||||||
'passwordHistory' => 0,
|
'passwordHistory' => 0,
|
||||||
'passwordDictionary' => false,
|
'passwordDictionary' => false,
|
||||||
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG,
|
'duration' => Auth::TOKEN_EXPIRATION_LOGIN_LONG,
|
||||||
'personalDataCheck' => false
|
'personalDataCheck' => false,
|
||||||
];
|
];
|
||||||
foreach ($auth as $method) {
|
foreach ($auth as $method) {
|
||||||
$auths[$method['key'] ?? ''] = true;
|
$auths[$method['key'] ?? ''] = true;
|
||||||
|
@ -122,7 +122,7 @@ App::post('/v1/projects')
|
||||||
var_dump('region');
|
var_dump('region');
|
||||||
var_dump($region);
|
var_dump($region);
|
||||||
if ($region !== 'default') {
|
if ($region !== 'default') {
|
||||||
$databases = array_filter($databases, function ($value, $region) {
|
$databases = array_filter($databases, function ($value) use ($region) {
|
||||||
return str_contains($value, $region);
|
return str_contains($value, $region);
|
||||||
});
|
});
|
||||||
var_dump('databases');
|
var_dump('databases');
|
||||||
|
@ -1369,7 +1369,7 @@ App::post('/v1/projects/:projectId/platforms')
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
'store' => $store,
|
'store' => $store,
|
||||||
'hostname' => $hostname
|
'hostname' => $hostname,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$platform = $dbForConsole->createDocument('platforms', $platform);
|
$platform = $dbForConsole->createDocument('platforms', $platform);
|
||||||
|
@ -1532,7 +1532,6 @@ App::delete('/v1/projects/:projectId/platforms/:platformId')
|
||||||
$response->noContent();
|
$response->noContent();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// CUSTOM SMTP and Templates
|
// CUSTOM SMTP and Templates
|
||||||
App::patch('/v1/projects/:projectId/smtp')
|
App::patch('/v1/projects/:projectId/smtp')
|
||||||
->desc('Update SMTP')
|
->desc('Update SMTP')
|
||||||
|
@ -1615,7 +1614,7 @@ App::patch('/v1/projects/:projectId/smtp')
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$smtp = [
|
$smtp = [
|
||||||
'enabled' => false
|
'enabled' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1701,7 +1700,6 @@ App::get('/v1/projects/:projectId/templates/sms/:type/:locale')
|
||||||
->action(function (string $projectId, string $type, string $locale, Response $response, Database $dbForConsole) {
|
->action(function (string $projectId, string $type, string $locale, Response $response, Database $dbForConsole) {
|
||||||
|
|
||||||
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
|
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
|
||||||
|
|
||||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||||
|
|
||||||
if ($project->isEmpty()) {
|
if ($project->isEmpty()) {
|
||||||
|
@ -1723,7 +1721,6 @@ App::get('/v1/projects/:projectId/templates/sms/:type/:locale')
|
||||||
$response->dynamic(new Document($template), Response::MODEL_SMS_TEMPLATE);
|
$response->dynamic(new Document($template), Response::MODEL_SMS_TEMPLATE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
App::get('/v1/projects/:projectId/templates/email/:type/:locale')
|
App::get('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||||
->desc('Get custom email template')
|
->desc('Get custom email template')
|
||||||
->groups(['api', 'projects'])
|
->groups(['api', 'projects'])
|
||||||
|
@ -1766,7 +1763,7 @@ App::get('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'subject' => $localeObj->getText('emails.'.$type.'.subject'),
|
'subject' => $localeObj->getText('emails.'.$type.'.subject'),
|
||||||
'senderEmail' => '',
|
'senderEmail' => '',
|
||||||
'senderName' => ''
|
'senderName' => '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1795,7 +1792,6 @@ App::patch('/v1/projects/:projectId/templates/sms/:type/:locale')
|
||||||
->action(function (string $projectId, string $type, string $locale, string $message, Response $response, Database $dbForConsole) {
|
->action(function (string $projectId, string $type, string $locale, string $message, Response $response, Database $dbForConsole) {
|
||||||
|
|
||||||
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
|
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
|
||||||
|
|
||||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||||
|
|
||||||
if ($project->isEmpty()) {
|
if ($project->isEmpty()) {
|
||||||
|
@ -1804,7 +1800,7 @@ App::patch('/v1/projects/:projectId/templates/sms/:type/:locale')
|
||||||
|
|
||||||
$templates = $project->getAttribute('templates', []);
|
$templates = $project->getAttribute('templates', []);
|
||||||
$templates['sms.'.$type.'-'.$locale] = [
|
$templates['sms.'.$type.'-'.$locale] = [
|
||||||
'message' => $message
|
'message' => $message,
|
||||||
];
|
];
|
||||||
|
|
||||||
$project = $dbForConsole->updateDocument('projects', $project->getId(), $project->setAttribute('templates', $templates));
|
$project = $dbForConsole->updateDocument('projects', $project->getId(), $project->setAttribute('templates', $templates));
|
||||||
|
@ -1850,7 +1846,7 @@ App::patch('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||||
'senderEmail' => $senderEmail,
|
'senderEmail' => $senderEmail,
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'replyTo' => $replyTo,
|
'replyTo' => $replyTo,
|
||||||
'message' => $message
|
'message' => $message,
|
||||||
];
|
];
|
||||||
|
|
||||||
$project = $dbForConsole->updateDocument('projects', $project->getId(), $project->setAttribute('templates', $templates));
|
$project = $dbForConsole->updateDocument('projects', $project->getId(), $project->setAttribute('templates', $templates));
|
||||||
|
@ -1862,7 +1858,7 @@ App::patch('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||||
'senderEmail' => $senderEmail,
|
'senderEmail' => $senderEmail,
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'replyTo' => $replyTo,
|
'replyTo' => $replyTo,
|
||||||
'message' => $message
|
'message' => $message,
|
||||||
]), Response::MODEL_EMAIL_TEMPLATE);
|
]), Response::MODEL_EMAIL_TEMPLATE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1884,7 +1880,6 @@ App::delete('/v1/projects/:projectId/templates/sms/:type/:locale')
|
||||||
->action(function (string $projectId, string $type, string $locale, Response $response, Database $dbForConsole) {
|
->action(function (string $projectId, string $type, string $locale, Response $response, Database $dbForConsole) {
|
||||||
|
|
||||||
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
|
throw new Exception(Exception::GENERAL_NOT_IMPLEMENTED);
|
||||||
|
|
||||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||||
|
|
||||||
if ($project->isEmpty()) {
|
if ($project->isEmpty()) {
|
||||||
|
@ -1905,7 +1900,7 @@ App::delete('/v1/projects/:projectId/templates/sms/:type/:locale')
|
||||||
$response->dynamic(new Document([
|
$response->dynamic(new Document([
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'locale' => $locale,
|
'locale' => $locale,
|
||||||
'message' => $template['message']
|
'message' => $template['message'],
|
||||||
]), Response::MODEL_SMS_TEMPLATE);
|
]), Response::MODEL_SMS_TEMPLATE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1950,6 +1945,6 @@ App::delete('/v1/projects/:projectId/templates/email/:type/:locale')
|
||||||
'senderEmail' => $template['senderEmail'],
|
'senderEmail' => $template['senderEmail'],
|
||||||
'subject' => $template['subject'],
|
'subject' => $template['subject'],
|
||||||
'replyTo' => $template['replyTo'],
|
'replyTo' => $template['replyTo'],
|
||||||
'message' => $template['message']
|
'message' => $template['message'],
|
||||||
]), Response::MODEL_EMAIL_TEMPLATE);
|
]), Response::MODEL_EMAIL_TEMPLATE);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue