Skip to content

Commit

Permalink
Merge branch 'release/2.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
vicmagpac committed Jul 1, 2021
2 parents e0192e1 + 9122100 commit cdba852
Show file tree
Hide file tree
Showing 84 changed files with 4,860 additions and 173 deletions.
24 changes: 18 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=UTC

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_CONNECTION=pgsql
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

CACHE_DRIVER=memcached
QUEUE_DRIVER=sync

JWT_KEY=
AUTH_TOKEN_TEST=

MAIL_HOST=127.0.0.1
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_FROM_ADDRESS=

USER_TEST=
USER_TEST_PASSWORD=
20 changes: 20 additions & 0 deletions .github/workflows/lumen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lumen

on: [push, pull_request]

jobs:
lumen-build:

runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '7.4'
- uses: actions/checkout@v2
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Directory Permissions
run: chmod -R 777 storage
69 changes: 69 additions & 0 deletions app/DAO/ResidenciaMultiprofissional/AtividadeModuloDAO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace App\DAO\ResidenciaMultiprofissional;

use App\Model\ResidenciaMultiprofissional\AtividadeModulo;
use Illuminate\Support\Facades\DB;

class AtividadeModuloDAO
{
private $model;
private $enfaseDAO;
private $nucleoProfissionalDAO;

public function __construct()
{
$this->model = new AtividadeModulo();
$this->enfaseDAO = new EnfaseDAO();
$this->nucleoProfissionalDAO = new NucleoProfissionalDAO();
}

public function get($id)
{
$select = DB::select("SELECT * FROM {$this->model->getTable()} WHERE unidadetematicaid = :unidadetematicaid", ['unidadetematicaid' => $id]);
if (count($select)) {
$atividadeModulo = new AtividadeModulo();

$select = $select[0];

$atividadeModulo->id = $select->unidadetematicaid;
$atividadeModulo->periodo = $select->periodo;
$atividadeModulo->descricao = $select->descricao;
$atividadeModulo->sumula = $select->sumula;
$atividadeModulo->cargaHoraria = $select->cargahoraria;

$atividadeModulo->enfases = $this->getEnfasesAtividadeModulo($select->unidadetematicaid);
$atividadeModulo->nucleosprofissionais = $this->getNucleosProfissionaisAtividadeModulo($select->unidadetematicaid);
}
return $atividadeModulo;
}

public function getEnfasesAtividadeModulo($id)
{
$select = DB::select('SELECT * FROM res.enfasedaunidadetematica WHERE unidadetematicaid = :unidadetematicaid', ['unidadetematicaid' => $id]);
$enfases = array();

if (count($select)) {
foreach ($select as $enfase) {
$enfases[] = $this->enfaseDAO->get($enfase->enfaseid);
}
}

return $enfases;
}

public function getNucleosProfissionaisAtividadeModulo($id)
{
$select = DB::select('SELECT * FROM res.nucleodaunidadetematica WHERE unidadetematicaid = :unidadetematicaid', ['unidadetematicaid' => $id]);
$nucleos = array();

if (count($select)) {
foreach ($select as $nucleo) {
$nucleos[] = $this->nucleoProfissionalDAO->get($nucleo->nucleoprofissionalid);
}
}

return $nucleos;
}

}
159 changes: 159 additions & 0 deletions app/DAO/ResidenciaMultiprofissional/CargaHorariaComplementarDAO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?php

namespace App\DAO\ResidenciaMultiprofissional;

use App\Model\BaseModel\BaseModelSagu;
use App\Model\ResidenciaMultiprofissional\CargaHorariaComplementar;
use App\Model\ResidenciaMultiprofissional\OfertaModuloFalta;
use Illuminate\Support\Facades\DB;

class CargaHorariaComplementarDAO
{
private $model;
private $cargaHorariaComplementarTipoDAO;

public function __construct()
{
$this->model = new CargaHorariaComplementar();
$this->cargaHorariaComplementarTipoDAO = new CargaHorariaComplementarTipoDAO();
}

public function get($id)
{
$select = DB::select(
"SELECT * FROM {$this->model->getTable()}
WHERE cargahorariacomplementarid = :cargahorariacomplementarid",
[
'cargahorariacomplementarid' => $id
]
);
$cargaHorariaComplementar = new CargaHorariaComplementar();

if (count($select)) {
$select = $select[0];

$cargaHorariaComplementar->id = $select->cargahorariacomplementarid;
$cargaHorariaComplementar->tipoCargaHorariaComplementar = $this->cargaHorariaComplementarTipoDAO->get($select->tipodecargahorariacomplementarid);
$cargaHorariaComplementar->residente = $select->residenteid;
$cargaHorariaComplementar->cargaHoraria = $select->cargahoraria;
$cargaHorariaComplementar->justificativa = $select->justificativa;
$cargaHorariaComplementar->tipoCargaHoraria = $select->tipocargahoraria;
$cargaHorariaComplementar->oferta = $select->ofertadeunidadetematicaid;

}

return $cargaHorariaComplementar;
}

public function getCargaHorariaComplementarDoResidenteNaOferta($residenteId, $ofertaId)
{
$select = DB::select(
"SELECT cargahorariacomplementarid FROM {$this->model->getTable()}
WHERE residenteid = :residenteid
AND ofertadeunidadetematicaid = :ofertadeunidadetematicaid",
[
'residenteid' => $residenteId,
'ofertadeunidadetematicaid' => $ofertaId
]
);


$cargaHorariaComplementarResidente = [];
if (count($select)) {
foreach ($select as $cargaHorariaComplementar) {
$cargaHorariaComplementarResidente[] = $this->get($cargaHorariaComplementar->cargahorariacomplementarid);
}
}
return $cargaHorariaComplementarResidente;
}

public function getCargaHorariaComplementarDoResidenteNaOfertaPorTipo($residenteId, $ofertaId, $tipoCargaHoraria)
{
$select = DB::select(
"SELECT cargahorariacomplementarid FROM {$this->model->getTable()}
WHERE residenteid = :residenteid
AND ofertadeunidadetematicaid = :ofertadeunidadetematicaid
AND tipocargahoraria = :tipocargahoraria
",
[
'residenteid' => $residenteId,
'ofertadeunidadetematicaid' => $ofertaId,
'tipocargahoraria' => $tipoCargaHoraria
]
);

$cargaHorariaComplementarResidente = 0;
if (count($select)) {
foreach ($select as $cargaHorariaComplementar) {
$cargaHorariaComplementarResidenteObj = $this->get($cargaHorariaComplementar->cargahorariacomplementarid);
$cargaHorariaComplementarResidente += $cargaHorariaComplementarResidenteObj->cargaHoraria;
}
}
return $cargaHorariaComplementarResidente;
}

public function insert(CargaHorariaComplementar $cargaHorariaComplementar)
{
$result = DB::insert("
insert into {$this->model->getTable()}
(tipodecargahorariacomplementarid, residenteid, cargahoraria, tipocargahoraria, ofertadeunidadetematicaid, justificativa)
values (?, ?, ?, ?, ?, ?)",
[
$cargaHorariaComplementar->tipoCargaHorariaComplementar,
$cargaHorariaComplementar->residente,
$cargaHorariaComplementar->cargaHoraria,
$cargaHorariaComplementar->tipoCargaHoraria,
$cargaHorariaComplementar->oferta,
$cargaHorariaComplementar->justificativa
]);

if ($result) {
$rowId = DB::connection()->getPdo()->lastInsertId();
return $this->get($rowId);
}

return $result;
}

public function update(CargaHorariaComplementar $cargaHorariaComplementar)
{
$result = DB::update("
UPDATE {$this->model->getTable()}
SET
tipodecargahorariacomplementarid = ?,
residenteid = ?,
cargahoraria = ?,
tipocargahoraria = ?,
ofertadeunidadetematicaid = ?,
justificativa = ?
WHERE cargahorariacomplementarid = ?",
[
$cargaHorariaComplementar->tipoCargaHorariaComplementar,
$cargaHorariaComplementar->residente,
$cargaHorariaComplementar->cargaHoraria,
$cargaHorariaComplementar->tipoCargaHoraria,
$cargaHorariaComplementar->oferta,
$cargaHorariaComplementar->justificativa,
$cargaHorariaComplementar->id
]);

if ($result) {
return $this->get($cargaHorariaComplementar->id);
}

return $result;
}

public function delete(CargaHorariaComplementar $cargaHorariaComplementar)
{
$result = DB::update("
DELETE FROM {$this->model->getTable()}
WHERE cargahorariacomplementarid = ?",
[
$cargaHorariaComplementar->id
]);

return $result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\DAO\ResidenciaMultiprofissional;

use App\Model\ResidenciaMultiprofissional\CargaHorariaComplementarTipo;
use Illuminate\Support\Facades\DB;

class CargaHorariaComplementarTipoDAO
{
private $model;

public function __construct()
{
$this->model = new CargaHorariaComplementarTipo();
}

public function get($id)
{
$select = DB::select(
"SELECT * FROM {$this->model->getTable()}
WHERE tipodecargahorariacomplementarid = :tipodecargahorariacomplementarid",
[
'tipodecargahorariacomplementarid' => $id
]
);
$cargaHorariaComplementarTipo = new CargaHorariaComplementarTipo();

if (count($select)) {
$select = $select[0];

$cargaHorariaComplementarTipo->id = $select->tipodecargahorariacomplementarid;
$cargaHorariaComplementarTipo->descricao = $select->descricao;
}

return $cargaHorariaComplementarTipo;
}

public function retornaTodos()
{
$select = DB::select(
"SELECT tipodecargahorariacomplementarid FROM {$this->model->getTable()}"
);

$tiposCargaHorariaComplementar = [];
if (count($select)) {
foreach ($select as $tipo) {
$tiposCargaHorariaComplementar[] = $this->get($tipo->tipodecargahorariacomplementarid);
}
}

return $tiposCargaHorariaComplementar;
}
}
44 changes: 44 additions & 0 deletions app/DAO/ResidenciaMultiprofissional/EnfaseDAO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace App\DAO\ResidenciaMultiprofissional;

use App\Model\ResidenciaMultiprofissional\Enfase;
use Illuminate\Support\Facades\DB;

class EnfaseDAO
{
private $model;

public function __construct()
{
$this->model = new Enfase();
}

public function get($id)
{
$select = DB::select("SELECT * FROM {$this->model->getTable()} WHERE enfaseid = :enfaseid", ['enfaseid' => $id]);
if (count($select)) {
$enfase = new Enfase();

$select = $select[0];

$enfase->id = $select->enfaseid;
$enfase->descricao = $select->descricao;
$enfase->abreviatura = $select->abreviatura;
}
return $enfase;
}

public function getEnfases()
{
$select = DB::select("SELECT * FROM {$this->model->getTable()} ORDER BY descricao");
$enfases = array();
if (count($select)) {
foreach ($select as $enfase) {
$enfases[] = $this->get($enfase->enfaseid);
}
}

return $enfases;
}
}
Loading

0 comments on commit cdba852

Please sign in to comment.