1
0
Fork 0
mirror of synced 2024-07-09 00:16:13 +12:00

pause project

This commit is contained in:
Damodar Lohani 2023-03-21 01:52:32 +00:00
parent 8b79438755
commit 3bd92187f4
3 changed files with 21 additions and 1 deletions

View file

@ -578,6 +578,17 @@ $collections = [
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('paused'),
'type' => Database::VAR_BOOLEAN,
'format' => '',
'size' => 0,
'signed' => true,
'required' => false,
'default' => false,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('legalName'),
'type' => Database::VAR_STRING,

View file

@ -108,6 +108,7 @@ App::post('/v1/projects')
'logo' => $logo,
'url' => $url,
'version' => APP_VERSION_STABLE,
'paused' => false,
'legalName' => $legalName,
'legalCountry' => $legalCountry,
'legalState' => $legalState,
@ -369,6 +370,7 @@ App::patch('/v1/projects/:projectId')
->label('sdk.response.model', Response::MODEL_PROJECT)
->param('projectId', '', new UID(), 'Project unique ID.')
->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
->param('paused', null, new Boolean(), 'Pause project', true)
->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
->param('logo', '', new Text(1024), 'Project logo.', true)
->param('url', '', new URL(), 'Project URL.', true)
@ -380,7 +382,7 @@ App::patch('/v1/projects/:projectId')
->param('legalTaxId', '', new Text(256), 'Project legal tax ID. Max length: 256 chars.', true)
->inject('response')
->inject('dbForConsole')
->action(function (string $projectId, string $name, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForConsole) {
->action(function (string $projectId, string $name, bool $paused, string $description, string $logo, string $url, string $legalName, string $legalCountry, string $legalState, string $legalCity, string $legalAddress, string $legalTaxId, Response $response, Database $dbForConsole) {
$project = $dbForConsole->getDocument('projects', $projectId);
@ -390,6 +392,7 @@ App::patch('/v1/projects/:projectId')
$project = $dbForConsole->updateDocument('projects', $project->getId(), $project
->setAttribute('name', $name)
->setAttribute('paused', $paused ?? $project->getAttribute('paused', false))
->setAttribute('description', $description)
->setAttribute('logo', $logo)
->setAttribute('url', $url)

View file

@ -66,6 +66,12 @@ class Project extends Model
'default' => '',
'example' => '5f5c451b403cb',
])
->addRule('paused', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Project Paused.',
'default' => false,
'example' => true,
])
->addRule('legalName', [
'type' => self::TYPE_STRING,
'description' => 'Company legal name.',