Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #686 from portabilis/portabilis-patch-2019-12-02
[2.2] Portabilis patch 02/12/2019
- Loading branch information
Showing
93 changed files
with
3,719 additions
and
1,521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Contracts; | ||
|
||
use App\Models\LegacyRegistration; | ||
|
||
interface CopyRegistrationData | ||
{ | ||
/** | ||
* @param LegacyRegistration $newRegistration | ||
* @param LegacyRegistration $oldRegistration | ||
* | ||
* @return void | ||
*/ | ||
public function copy( | ||
LegacyRegistration $newRegistration, | ||
LegacyRegistration $oldRegistration | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
|
||
class RegistrationEvent | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
public $registration; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct($registration) | ||
{ | ||
$this->registration = $registration; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Exceptions\Transfer; | ||
|
||
class MissingAbsenceType extends TransferException | ||
{ | ||
public function __construct() | ||
{ | ||
$message = 'O tipo de presença da regra de avaliação é inválido'; | ||
|
||
parent::__construct($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Exceptions\Transfer; | ||
|
||
class MissingDescriptiveOpinionType extends TransferException | ||
{ | ||
public function __construct() | ||
{ | ||
$message = 'O tipo de parecer da regra de avaliação é inválido'; | ||
|
||
parent::__construct($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Exceptions\Transfer; | ||
|
||
class StagesAreNotSame extends TransferException | ||
{ | ||
public function __construct() | ||
{ | ||
$message = 'As escolas ou turmas trabalham com quantidade de etapas diferentes.'; | ||
|
||
parent::__construct($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Exceptions\Transfer; | ||
|
||
use Exception; | ||
|
||
class TransferException extends Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Services\UrlPresigner; | ||
use Illuminate\Http\Request; | ||
use Redirect; | ||
|
||
class OpenPrivateUrlController extends Controller | ||
{ | ||
public function open(Request $request, UrlPresigner $urlPresigner) | ||
{ | ||
$presignedUrl = $urlPresigner->getPresignedUrl($request->url); | ||
|
||
return Redirect::away($presignedUrl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Listeners; | ||
|
||
use App\Services\TransferRegistrationDataService; | ||
|
||
class AcceptTransferRequestListener | ||
{ | ||
/** | ||
* @var TransferRegistrationDataService | ||
*/ | ||
private $service; | ||
|
||
/** | ||
* @param TransferRegistrationDataService $service | ||
*/ | ||
public function __construct(TransferRegistrationDataService $service) | ||
{ | ||
$this->service = $service; | ||
} | ||
|
||
/** | ||
* Handle the event. | ||
* | ||
* @param object $event | ||
* | ||
* @return void | ||
*/ | ||
public function handle($event) | ||
{ | ||
$transfer = $this->service->getTransfer($event->registration); | ||
|
||
if (empty($transfer)) { | ||
return; | ||
} | ||
|
||
$this->acceptTransferRequest($transfer, $event->registration); | ||
} | ||
|
||
/** | ||
* @param $transfer | ||
* @param $newRegistration | ||
*/ | ||
private function acceptTransferRequest($transfer, $newRegistration) | ||
{ | ||
$transfer->update([ | ||
'ref_cod_matricula_entrada' => $newRegistration->cod_matricula | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\Listeners; | ||
|
||
use App\Exceptions\Transfer\MissingDescriptiveOpinionType; | ||
use App\Exceptions\Transfer\StagesAreNotSame; | ||
use App\Services\TransferRegistrationDataService; | ||
|
||
class CopyTransferDataListener | ||
{ | ||
/** | ||
* @var TransferRegistrationDataService | ||
*/ | ||
protected $service; | ||
|
||
/** | ||
* @param TransferRegistrationDataService $service | ||
*/ | ||
public function __construct(TransferRegistrationDataService $service) | ||
{ | ||
$this->service = $service; | ||
} | ||
|
||
/** | ||
* Handle the event. | ||
* | ||
* @param object $event | ||
* | ||
* @throws MissingDescriptiveOpinionType | ||
* @throws StagesAreNotSame | ||
* | ||
* @return void | ||
*/ | ||
public function handle($event) | ||
{ | ||
$this->service->transferData($event->registration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
|
||
class LegacyDisciplineAbsence extends Model | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $table = 'modules.falta_componente_curricular'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'falta_aluno_id', | ||
'componente_curricular_id', | ||
'quantidade', | ||
'etapa', | ||
]; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public $timestamps = false; | ||
|
||
/** | ||
* @return BelongsTo | ||
*/ | ||
public function studentAbsence() | ||
{ | ||
return $this->belongsTo(LegacyStudentAbsence::class, 'falta_aluno_id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class LegacyDisciplineDependence extends Model | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $table = 'pmieducar.disciplina_dependencia'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $primaryKey = 'cod_disciplina_dependencia'; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public $timestamps = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
|
||
class LegacyDisciplineDescriptiveOpinion extends Model | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $table = 'modules.parecer_componente_curricular'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'parecer_aluno_id', | ||
'componente_curricular_id', | ||
'parecer', | ||
'etapa', | ||
]; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public $timestamps = false; | ||
|
||
|
||
/** | ||
* @return BelongsTo | ||
*/ | ||
public function studentDescriptiveOpinion() | ||
{ | ||
return $this->belongsTo(LegacyStudentDescriptiveOpinion::class, 'parecer_aluno_id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.