From aaa84979c8742cb16fcd8e2da3e1e63148c9882c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aryel=20Tupinamb=C3=A1?= Date: Wed, 10 Oct 2018 20:22:04 +0000 Subject: [PATCH 01/13] Mudancas do arquivo sh --- deploy.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) mode change 100644 => 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755 index 832df59a..eac493da --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -git pull origin master composer install --no-interaction --prefer-dist --optimize-autoloader echo "" | sudo -S service php7.1-fpm reload @@ -9,4 +8,4 @@ then php artisan cache:clear php artisan queue:restart php artisan optimize -fi \ No newline at end of file +fi From ee8ca2b8da6ca6f762b5a42062219624ce2eefda Mon Sep 17 00:00:00 2001 From: Manoel Filho Date: Fri, 26 Oct 2018 10:03:01 -0300 Subject: [PATCH 02/13] =?UTF-8?q?Valida=C3=A7=C3=A3o=20no=20backend=20das?= =?UTF-8?q?=20datas=20referentes=20ao=20update=20das=20etapas=20de=20obser?= =?UTF-8?q?va=C3=A7=C3=A3o.=20O=20m=C3=A9todo=20para=20salvar=20um=20StepC?= =?UTF-8?q?ase=20foi=20modificado=20para=20evitar=20a=20atualiza=C3=A7?= =?UTF-8?q?=C3=A3o=20que=20n=C3=A3o=20est=C3=A1=20no=20prazo=20definido=20?= =?UTF-8?q?nas=20configura=C3=A7=C3=B5es=20do=20munic=C3=ADpio.=20Uma=20at?= =?UTF-8?q?ualiza=C3=A7=C3=A3o=20da=20etapa=20de=20observa=C3=A7=C3=A3o=20?= =?UTF-8?q?1,=202,=203=20ou=204=20s=C3=B3=20pode=20ser=20feita=20se=20esti?= =?UTF-8?q?ver=20na=20data=20do=20prazo=20definido=20pelo=20munic=C3=ADpio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Resources/StepsController.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/app/Http/Controllers/Resources/StepsController.php b/app/Http/Controllers/Resources/StepsController.php index df4b68b6..722dc87b 100644 --- a/app/Http/Controllers/Resources/StepsController.php +++ b/app/Http/Controllers/Resources/StepsController.php @@ -15,14 +15,18 @@ use BuscaAtivaEscolar\CaseSteps\CaseStep; +use BuscaAtivaEscolar\CaseSteps\Observacao; +use BuscaAtivaEscolar\CaseSteps\Rematricula; use BuscaAtivaEscolar\Child; use BuscaAtivaEscolar\Http\Controllers\BaseController; use BuscaAtivaEscolar\Scopes\TenantScope; use BuscaAtivaEscolar\Search\Search; use BuscaAtivaEscolar\Serializers\SimpleArraySerializer; +use BuscaAtivaEscolar\Tenant; use BuscaAtivaEscolar\Transformers\StepTransformer; use BuscaAtivaEscolar\Transformers\UserTransformer; use BuscaAtivaEscolar\User; +use Carbon\Carbon; class StepsController extends BaseController { @@ -56,6 +60,50 @@ public function update($step_type, $step_id) { $validation = $step->validate($data); + //Custom validation for date update in ChildCase Observacao + if($step_type == "BuscaAtivaEscolar\CaseSteps\Observacao") { + + $deadline = 0; + $latest_update = null; + $today = Carbon::now(); + + $tenant = Tenant::find($step->getAttribute('tenant_id')); + + if ($step->getSlug() == "1a_observacao") { + + $deadline = $tenant->getSettings()->stepDeadlines['1a_observacao']; + $latest_step = Rematricula::where( [ ['case_id', '=', $step->case_id], ['step_index', '=', 50] ] )->first(); + $latest_update = $latest_step->updated_at; + $difference_days = $today->diffInDays($latest_update); + if( $difference_days < $deadline ) return $this->api_failure("A etapa ainda não está no perído para cadastro."); + + } elseif ($step->getSlug() == "2a_observacao") { + + $deadline = $tenant->getSettings()->stepDeadlines['2a_observacao']; + $latest_step = Observacao::where( [ ['case_id', '=', $step->case_id], ['step_index', '=', 60] ] )->first(); + $latest_update = $latest_step->updated_at; + $difference_days = $today->diffInDays($latest_update); + if( $difference_days < $deadline ) return $this->api_failure("A etapa ainda não está no perído para cadastro"); + + } elseif ($step->getSlug() == "3a_observacao") { + + $deadline = $tenant->getSettings()->stepDeadlines['3a_observacao']; + $latest_step = Observacao::where( [ ['case_id', '=', $step->case_id], ['step_index', '=', 70] ] )->first(); + $latest_update = $latest_step->updated_at; + $difference_days = $today->diffInDays($latest_update); + if( $difference_days < $deadline ) return $this->api_failure("A etapa ainda não está no perído para cadastro"); + + }elseif ($step->getSlug() == "4a_observacao") { + + $deadline = $tenant->getSettings()->stepDeadlines['4a_observacao']; + $latest_step = Observacao::where( [ ['case_id', '=', $step->case_id], ['step_index', '=', 80] ] )->first(); + $latest_update = $latest_step->updated_at; + $difference_days = $today->diffInDays($latest_update); + if( $difference_days < $deadline ) return $this->api_failure("A etapa ainda não está no perído para cadastro"); + } + } + //Final Custom validation ----------------------------------------- + if($validation->fails()) return $this->api_validation_failed('validation_failed', $validation); $input = $step->setFields($data); @@ -143,4 +191,5 @@ public function assignUser($step_type, $step_id, Search $search) { } } + } \ No newline at end of file From 35398cc6db9118853850561fa0ed8f2e56cbbc92 Mon Sep 17 00:00:00 2001 From: Homolog Server Date: Tue, 30 Oct 2018 18:27:58 +0000 Subject: [PATCH 03/13] Ajuste deploy --- deploy.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index b9280dc7..221784b1 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -git pull origin master composer install --no-interaction --prefer-dist --optimize-autoloader echo "" | sudo -S service php7.1-fpm reload @@ -9,4 +8,4 @@ then php artisan cache:clear php artisan queue:work --timeout=0 php artisan optimize -fi \ No newline at end of file +fi From b811e0d36af7c835cbee6b5d5561e4512fd31349 Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Tue, 30 Oct 2018 17:25:53 -0300 Subject: [PATCH 04/13] Deploy: ajuste --- deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy.sh b/deploy.sh index 221784b1..2c53caec 100644 --- a/deploy.sh +++ b/deploy.sh @@ -9,3 +9,4 @@ then php artisan queue:work --timeout=0 php artisan optimize fi +exit 1; \ No newline at end of file From 5fd20cdcacaccc9b401a9e3a0262240c3b3f61f2 Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Tue, 30 Oct 2018 17:28:59 -0300 Subject: [PATCH 05/13] Deploy: ajuste --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 2c53caec..7aa9c6f1 100644 --- a/deploy.sh +++ b/deploy.sh @@ -9,4 +9,4 @@ then php artisan queue:work --timeout=0 php artisan optimize fi -exit 1; \ No newline at end of file +exit 0 \ No newline at end of file From 56b1fa9a578e25f90cdc9b7212a765f990ac4928 Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Tue, 30 Oct 2018 17:37:17 -0300 Subject: [PATCH 06/13] Deploy: ajuste1 --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 7aa9c6f1..7986683c 100644 --- a/deploy.sh +++ b/deploy.sh @@ -9,4 +9,4 @@ then php artisan queue:work --timeout=0 php artisan optimize fi -exit 0 \ No newline at end of file +done \ No newline at end of file From 520601eabd08ee20619194990b6b3ffab50eaada Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Tue, 30 Oct 2018 17:40:03 -0300 Subject: [PATCH 07/13] Deploy: ajuste2 --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 7986683c..9aae2bc8 100644 --- a/deploy.sh +++ b/deploy.sh @@ -7,6 +7,6 @@ then php artisan migrate --force php artisan cache:clear php artisan queue:work --timeout=0 - php artisan optimize + php artisan optimize --timeout=0 fi done \ No newline at end of file From 413009a437c7909a246eaeada3c9144b57af3492 Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Tue, 30 Oct 2018 18:18:41 -0300 Subject: [PATCH 08/13] Deploy: ajuste --- deploy.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index 9aae2bc8..4d6cd6a9 100644 --- a/deploy.sh +++ b/deploy.sh @@ -6,7 +6,6 @@ if [ -f artisan ] then php artisan migrate --force php artisan cache:clear - php artisan queue:work --timeout=0 - php artisan optimize --timeout=0 -fi -done \ No newline at end of file + #php artisan queue:work --timeout=0 + php artisan optimize +fi \ No newline at end of file From f282d18f8bf821b685ab9362bee4d1bb5207fd33 Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Fri, 2 Nov 2018 17:42:30 -0300 Subject: [PATCH 09/13] Jobs: Groups, Tenant for updates --- .../Commands/AddAndCheckGroupIntoNewCase.php | 102 +++++++++++++++++ .../Commands/AddPriorityTenantNewMotive.php | 105 ++++++++++++++++++ app/Console/Kernel.php | 2 + 3 files changed, 209 insertions(+) create mode 100644 app/Console/Commands/AddAndCheckGroupIntoNewCase.php create mode 100644 app/Console/Commands/AddPriorityTenantNewMotive.php diff --git a/app/Console/Commands/AddAndCheckGroupIntoNewCase.php b/app/Console/Commands/AddAndCheckGroupIntoNewCase.php new file mode 100644 index 00000000..670bef9d --- /dev/null +++ b/app/Console/Commands/AddAndCheckGroupIntoNewCase.php @@ -0,0 +1,102 @@ +alerts = [ + 10 => true, // Adolescente em conflito com a lei + 20 => true, // Criança ou adolescente com deficiência(s) + 30 => true, // Criança ou adolescente com doença(s) que impeça(m) ou dificulte(m) a frequência à escola + 40 => true, // Criança ou adolescente em abrigo + 50 => true, // Criança ou adolescente em situação de rua + 60 => true, // Criança ou adolescente vítima de abuso / violência sexual + 70 => true, // Evasão porque sente a escola desinteressante + 80 => true, // Falta de documentação da criança ou adolescente + 90 => true, // Falta de infraestrutura escolar + 100 => true, // Falta de transporte escolar + 110 => true, // Gravidez na adolescência + 120 => true, // Preconceito ou discriminação racial + 130 => true, // Trabalho infantil + 140 => true, // Uso, abuso ou dependência de substâncias psicoativas + 150 => true, // Violência familiar + 160 => true, // Violência na escola + 500 => false, // Importados do Educacenso + 61 => true, // Crianças ou adolescentes migrantes estrangeiros + ]; + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $this->comment("Processo de atualização dos grupos iniciada."); + $results = \DB::select('SELECT * FROM groups'); + foreach ($results as $key => $values) { + $unserialize = unserialize($values->settings); + if (!empty($unserialize->alerts)) { + $keyReturn = $this->checkMotiveExist($unserialize->alerts); + if (!empty($keyReturn)) { + $unserialize->alerts[$keyReturn] = true; + $this->updateSetting($values->id, $unserialize); + } + } + } + $this->comment($this->count, ' linhas atualizadas'); + } + + private function checkMotiveExist($alertsBase) + { + foreach ($this->alerts as $key => $value) { + if (!array_key_exists($key, $alertsBase) && $value == true) { + return $key; + } + } + } + + private function updateSetting($id, $values) + { + $serializeValues = addslashes(serialize($values)); + $sql = "UPDATE groups SET settings = '$serializeValues' WHERE id = '$id'"; + $update = \DB::update($sql); + if ($update) { + $this->comment($id .' atualizado'); + $this->count++; + } + } +} diff --git a/app/Console/Commands/AddPriorityTenantNewMotive.php b/app/Console/Commands/AddPriorityTenantNewMotive.php new file mode 100644 index 00000000..bd259be7 --- /dev/null +++ b/app/Console/Commands/AddPriorityTenantNewMotive.php @@ -0,0 +1,105 @@ +alerts = [ + 10 => true, // Adolescente em conflito com a lei + 20 => true, // Criança ou adolescente com deficiência(s) + 30 => true, // Criança ou adolescente com doença(s) que impeça(m) ou dificulte(m) a frequência à escola + 40 => true, // Criança ou adolescente em abrigo + 50 => true, // Criança ou adolescente em situação de rua + 60 => true, // Criança ou adolescente vítima de abuso / violência sexual + 70 => true, // Evasão porque sente a escola desinteressante + 80 => true, // Falta de documentação da criança ou adolescente + 90 => true, // Falta de infraestrutura escolar + 100 => true, // Falta de transporte escolar + 110 => true, // Gravidez na adolescência + 120 => true, // Preconceito ou discriminação racial + 130 => true, // Trabalho infantil + 140 => true, // Uso, abuso ou dependência de substâncias psicoativas + 150 => true, // Violência familiar + 160 => true, // Violência na escola + 500 => false, // Importados do Educacenso + 61 => true, // Crianças ou adolescentes migrantes estrangeiros + ]; + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $this->comment("Processo de atualização dos tenants iniciada."); + $results = \DB::select('SELECT * FROM tenants'); + foreach ($results as $key => $values) { + $unserialize = unserialize($values->settings); + if (!empty($unserialize->alertPriorities)) { + $keyReturn = $this->checkMotiveExist($unserialize->alertPriorities); + if (!empty($keyReturn)) { + $unserialize->alertPriorities[$keyReturn] = 'high'; + $this->updateSetting($values->id, $unserialize); + } + } + } + $this->comment($this->count, ' linhas atualizadas'); + } + + private function checkMotiveExist($alertsBase) + { + foreach ($this->alerts as $key => $value) { + if (!array_key_exists($key, $alertsBase) && $value == true) { + return $key; + } + } + } + + private function updateSetting($id, $values) + { + $serializeValues = addslashes(serialize($values)); + $sql = "UPDATE tenants SET settings = '$serializeValues' WHERE id = '$id'"; + $update = \DB::update($sql); + if ($update) { + $this->comment($id .' atualizado'); + $this->count++; + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index c9faf241..56345ea1 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -30,6 +30,8 @@ class Kernel extends ConsoleKernel Commands\GenerateSchoolsJSON::class, Commands\GenerateStaticDataSQL::class, Commands\ManualEducacensoImport::class, + Commands\AddAndCheckGroupIntoNewCase::class, + Commands\AddPriorityTenantNewMotive::class, ]; /** From 2c2e69e4ef7eca281643f9a4e940e30c5bd3cccd Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Fri, 2 Nov 2018 17:45:00 -0300 Subject: [PATCH 10/13] =?UTF-8?q?Jobs:=20Groups,=20coment=C3=A1rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/AddAndCheckGroupIntoNewCase.php | 3 +++ app/Console/Commands/AddPriorityTenantNewMotive.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/AddAndCheckGroupIntoNewCase.php b/app/Console/Commands/AddAndCheckGroupIntoNewCase.php index 670bef9d..0c6431ef 100644 --- a/app/Console/Commands/AddAndCheckGroupIntoNewCase.php +++ b/app/Console/Commands/AddAndCheckGroupIntoNewCase.php @@ -1,4 +1,7 @@ Date: Fri, 2 Nov 2018 13:30:26 -0300 Subject: [PATCH 11/13] =?UTF-8?q?Issue=5F53=20Valida=C3=A7=C3=A3o=20de=20s?= =?UTF-8?q?eguran=C3=A7a=20no=20backend=20para=20impedir=20o=20update=20da?= =?UTF-8?q?s=20configura=C3=A7=C3=B5es=20de=20grupos=20onde=20o=20grupo=20?= =?UTF-8?q?do=20tipo=20Secretaria=20Municipal=20de=20Educa=C3=A7=C3=A3o=20?= =?UTF-8?q?n=C3=A3o=20tem=20permiss=C3=A3o=20de=20visualiza=C3=A7=C3=A3o?= =?UTF-8?q?=20e=20notifica=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Resources/GroupsController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Resources/GroupsController.php b/app/Http/Controllers/Resources/GroupsController.php index 203266f6..7578076f 100644 --- a/app/Http/Controllers/Resources/GroupsController.php +++ b/app/Http/Controllers/Resources/GroupsController.php @@ -57,10 +57,19 @@ public function store() { public function update_settings(Group $group) { $settings = $group->getSettings(); + + if( strtolower($group->name) == "secretaria municipal de educação" || strtolower($group->name) == "secretaria de educação" ){ + $request = request('settings', []); + foreach ($request['alerts'] as $key => $alert){ + if($key !== 500 AND $alert !== true){ + return response()->json(['status' => 'error', 'message' => 'O grupo Secretaria Municipal de Educação, obrigatoriamente, deve estar selecionado para todos os motivos de evasão escolar.' ], 405); + } + } + } + $settings->update( request('settings', []) ); $group->setSettings($settings); - - return response()->json(['status' => 'ok']); + return response()->json(['status' => 'ok']); } public function update(Group $group) { From 5bc1eae9cd31a1efb266fdbf834d6607441dea24 Mon Sep 17 00:00:00 2001 From: Sandy Santos Date: Mon, 5 Nov 2018 11:33:38 -0200 Subject: [PATCH 12/13] Log for task --- .../Commands/AddAndCheckGroupIntoNewCase.php | 21 ++++++++++++++++-- .../Commands/AddPriorityTenantNewMotive.php | 22 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/AddAndCheckGroupIntoNewCase.php b/app/Console/Commands/AddAndCheckGroupIntoNewCase.php index 0c6431ef..57e44857 100644 --- a/app/Console/Commands/AddAndCheckGroupIntoNewCase.php +++ b/app/Console/Commands/AddAndCheckGroupIntoNewCase.php @@ -6,6 +6,7 @@ namespace BuscaAtivaEscolar\Console\Commands; use Illuminate\Console\Command; +use Log; class AddAndCheckGroupIntoNewCase extends Command { @@ -26,10 +27,20 @@ class AddAndCheckGroupIntoNewCase extends Command /** * @var array */ + private $alerts; + /** + * @var int + */ private $count = 0; + /** + * @var array + */ + + private $log = []; + /** * Create a new command instance. * @@ -80,7 +91,8 @@ public function handle() } } } - $this->comment($this->count, ' linhas atualizadas'); + $this->comment($this->count. ' linhas atualizadas'); + Log::info('Log Group:', $this->log); } private function checkMotiveExist($alertsBase) @@ -98,8 +110,13 @@ private function updateSetting($id, $values) $sql = "UPDATE groups SET settings = '$serializeValues' WHERE id = '$id'"; $update = \DB::update($sql); if ($update) { - $this->comment($id .' atualizado'); + $this->comment($id . ' atualizado'); $this->count++; + $logId = $id; + array_push($this->log, $logId); + } else { + $logId = 'fail' . $id; + array_push($this->log, $logId); } } } diff --git a/app/Console/Commands/AddPriorityTenantNewMotive.php b/app/Console/Commands/AddPriorityTenantNewMotive.php index 17f34d80..b0c3f47f 100644 --- a/app/Console/Commands/AddPriorityTenantNewMotive.php +++ b/app/Console/Commands/AddPriorityTenantNewMotive.php @@ -2,9 +2,11 @@ /** * Job para atualizar prioridade para os motivivos sem status */ + namespace BuscaAtivaEscolar\Console\Commands; use Illuminate\Console\Command; +use Log; class AddPriorityTenantNewMotive extends Command { @@ -20,17 +22,27 @@ class AddPriorityTenantNewMotive extends Command * * @var string */ + protected $description = 'Put value hight for tenants config'; /** * @var array */ + private $alerts; + /** * @var int */ + private $count = 0; + /** + * @var array + */ + + private $log = []; + /** * Create a new command instance. @@ -82,7 +94,8 @@ public function handle() } } } - $this->comment($this->count, ' linhas atualizadas'); + $this->comment($this->count . ' linhas atualizadas'); + Log::info('Log Tenant:', $this->log); } private function checkMotiveExist($alertsBase) @@ -100,8 +113,13 @@ private function updateSetting($id, $values) $sql = "UPDATE tenants SET settings = '$serializeValues' WHERE id = '$id'"; $update = \DB::update($sql); if ($update) { - $this->comment($id .' atualizado'); + $this->comment($id . ' atualizado'); $this->count++; + $logId = $id; + array_push($this->log, $logId); + } else { + $logId = 'fail' . $id; + array_push($this->log, $logId); } } } From 363917a6d4a0a7f15c21720566e4a61236b0b21e Mon Sep 17 00:00:00 2001 From: Manoel Filho Date: Sat, 10 Nov 2018 10:33:59 -0200 Subject: [PATCH 13/13] =?UTF-8?q?Acr=C3=A9scimo=20do=20motivo=20do=20cance?= =?UTF-8?q?lamento=20do=20alerta=20na=20lista=20de=20casos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Child.php | 1 + app/Transformers/ChildSearchResultsTransformer.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/Child.php b/app/Child.php index 24a90495..ba83fe80 100644 --- a/app/Child.php +++ b/app/Child.php @@ -451,6 +451,7 @@ public function buildSearchDocument() : array { if($this->currentCase) { $data['case_status'] = $this->currentCase->case_status; + $data['cancel_reason'] = $this->currentCase->cancel_reason; if($this->currentCase->case_cause_ids) { // TODO: refactor this $data['cause_name'] = join(", ", array_map(function ($cause_id) { diff --git a/app/Transformers/ChildSearchResultsTransformer.php b/app/Transformers/ChildSearchResultsTransformer.php index 9d5f7c50..98139104 100644 --- a/app/Transformers/ChildSearchResultsTransformer.php +++ b/app/Transformers/ChildSearchResultsTransformer.php @@ -65,6 +65,8 @@ public function transform($document) { 'deadline_status' => $document['_source']['deadline_status'] ?? null, 'alert_status' => $document['_source']['alert_status'] ?? null, + 'cancel_reason' => $document['_source']['cancel_reason'] ?? null, + 'created_at' => isset($document['_source']['created_at']) ? Carbon::createFromTimestamp(strtotime($document['_source']['created_at']))->toIso8601String() : null, 'updated_at' => isset($document['_source']['updated_at']) ? Carbon::createFromTimestamp(strtotime($document['_source']['updated_at']))->toIso8601String() : null,