Commit 2968ef74 authored by alissonalbuquerque's avatar alissonalbuquerque
Browse files

Add correcoes de refatoracao de query e de usuario com multiplos perfis

parent 7225f6dc
<?php
namespace App\Queries;
use App\Models\UserType;
class UserTypeQuery extends CustomQuery
{
public function __construct()
{
$this->query = UserType::where([]);
self::$instance = $this;
}
}
......@@ -15,7 +15,6 @@ class CreateUsersTable extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->tinyInteger('type');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
......
......@@ -13,11 +13,11 @@ class UpdateUserTable extends Migration
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->integer('type')->default(0)->change();
$table->string('document')->default("")->change();
$table->integer('status')->default(1)->change();
});
// Schema::table('users', function (Blueprint $table) {
// $table->integer('type')->default(0)->change();
// $table->string('document')->default("")->change();
// $table->integer('status')->default(1)->change();
// });
}
/**
......
......@@ -16,6 +16,7 @@ class CreateEnsinoAulasTable extends Migration
Schema::create('ensino_aulas', function (Blueprint $table) {
$table->id();
$table->foreignId('user_pad_id')->notNull();
$table->tinyInteger('dimensao')->nullable();
$table->string('cod_atividade')->notNull();
$table->string('componente_curricular')->notNull();
$table->string('curso')->notNull();
......@@ -37,4 +38,5 @@ class CreateEnsinoAulasTable extends Migration
{
Schema::dropIfExists('ensino_aulas');
}
}
......@@ -15,11 +15,14 @@ class CreateAvaliacaoTable extends Migration
{
Schema::create('avaliacao', function (Blueprint $table) {
$table->id();
$table->integer('ch_semanal')->notNull();
$table->integer('status')->notNull();
$table->string('descricao')->notNull();
$table->integer('tarefa_id')->notNull();
$table->foreignId('avaliador_id')->notNull();
$table->unsignedBigInteger('tarefa_id')->notNull();
$table->foreignId('avaliador_id')->nullable();
$table->tinyInteger('type')->notNull();
$table->tinyInteger('status')->notNull();
$table->string('descricao')->nullable();
$table->integer('ch_semanal')->nullable();
$table->integer('ch_total')->nullable();
$table->timestamps();
$table->softDeletes();
});
......
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserTypeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_type', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id');
$table->tinyInteger('type');
$table->tinyInteger('status');
$table->boolean('selected');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_type');
}
}
......@@ -24,6 +24,7 @@ class DatabaseSeeder extends Seeder
PadSeeder::class,
DisciplinaSeeder::class,
EvaluatorSeeder::class,
UserTypeSeeder::class
]);
}
......
......@@ -4,7 +4,7 @@ namespace Database\Seeders;
use App\Models\PAD;
use App\Models\User;
use App\Models\Util\Status;
use Illuminate\Database\Seeder;
class PadSeeder extends Seeder
......@@ -21,7 +21,7 @@ class PadSeeder extends Seeder
'nome' => "2022.1",
'data_inicio' => "2022-02-01",
'data_fim' => "2022-06-01",
'status' => 0
'status' => Status::ATIVO,
]);
PAD::create([
......@@ -29,7 +29,7 @@ class PadSeeder extends Seeder
'nome' => "2022.2",
'data_inicio' => "2022-07-01",
'data_fim' => "2022-12-01",
'status' => 1
'status' => Status::ATIVO,
]);
}
}
......@@ -5,6 +5,7 @@ namespace Database\Seeders;
use App\Models\Curso;
use App\Models\Unidade;
use App\Models\User;
use App\Models\Util\Status;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
......@@ -23,13 +24,12 @@ class UserSeeder extends Seeder
foreach($ids as $id)
{
User::create([
'type' => User::TYPE_TEACHER,
'name' => "Professor {$id}",
'email' => "professor{$id}@upe.br",
'email_verified_at' => null,
'password' => Hash::make('@professor'),
'document' => "00000000{$id}",
'status' => User::STATUS_ACTIVE,
'status' => Status::ATIVO,
'campus_id' => 3,
'curso_id' => 1,
]);
......@@ -37,39 +37,36 @@ class UserSeeder extends Seeder
// UserAdmin
User::create([
'type' => User::TYPE_ADMIN,
'name' => "Admin",
'email' => "admin@upe.br",
'email_verified_at' => null,
'password' => Hash::make('@admin'),
'document' => "100000000",
'status' => User::STATUS_ACTIVE,
'status' => Status::ATIVO,
'campus_id' => NULL,
'curso_id' => NULL,
]);
//UserDirector
User::create([
'type' => User::TYPE_DIRECTOR,
'name' => "Director",
'email' => "director@upe.br",
'email_verified_at' => null,
'password' => Hash::make('@director'),
'document' => "100000000",
'status' => User::STATUS_ACTIVE,
'status' => Status::ATIVO,
'campus_id' => 1,
'curso_id' => 1,
]);
//UserDirector
User::create([
'type' => User::TYPE_COORDINATOR,
'name' => "Coordinator",
'email' => "coordinator@upe.br",
'email_verified_at' => null,
'password' => Hash::make('@coordinator'),
'document' => "100000000",
'status' => User::STATUS_ACTIVE,
'status' => Status::ATIVO,
'campus_id' => 1,
'curso_id' => 1,
]);
......
<?php
namespace Database\Seeders;
use App\Models\User;
use App\Models\UserType;
use App\Models\Util\Status;
use Illuminate\Database\Seeder;
class UserTypeSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$teachers = [1,2,3,4,5];
foreach($teachers as $teacher)
{
UserType::create([
'user_id' => $teacher,
'type' => UserType::TEACHER,
'status' => Status::INATIVO,
'selected' => true,
]);
}
UserType::create([
'user_id' => 6,
'type' => UserType::ADMIN,
'status' => Status::INATIVO,
'selected' => true,
]);
}
}
......@@ -16,7 +16,7 @@
<h3 class="text-center"> <i class="bi bi-book-half"></i> </h3>
<h5 class="text-center"> PAD: {{ $userPad->pad->nome }} </h4>
<h5 class="text-center"> Status: {{ $userPad->pad->getStatusAsText() }} </h4>
<h5 class="text-center"> Status: {{ $userPad->pad->statusAsString() }} </h4>
<a class="stretched-link" href="{{ route('pad_view', ['id' => $userPad->id]) }}"></a>
</div>
</div>
......
......@@ -55,7 +55,7 @@
<td>{{ $pad->nome }}</td>
<td>{{ $pad->getDateInicio() }}</td>
<td>{{ $pad->getDateFim() }}</td>
<td>{{ $pad->getStatusAsText() }}</td>
<td>{{ $pad->statusAsString() }}</td>
<td>
@include('components.buttons.btn-edit', [
'btn_class' => 'btn btn-primary',
......
......@@ -26,7 +26,7 @@
<h1 class="text-center"> <i class="bi bi-journal-bookmark-fill"></i> </h1>
@endif
<h5 class="text-center"> PAD: {{ $userPad->pad->nome }} </h4>
<h5 class="text-center"> Status: {{ $userPad->pad->getStatusAsText() }} </h4>
<h5 class="text-center"> Status: {{ $userPad->pad->statusAsString() }} </h4>
<a class="stretched-link" href="{{ route('pad_view', ['id' => $userPad->id]) }}"></a>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment