feat: establish reservation portal foundation

This commit is contained in:
2026-08-04 15:24:08 +01:00
commit c96264ae96
226 changed files with 32232 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Database\Factories;
use App\Domain\Inventory\Models\SnipeAsset;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<SnipeAsset> */
class SnipeAssetFactory extends Factory
{
protected $model = SnipeAsset::class;
public function definition(): array
{
$category = fake()->randomElement(['Portáteis', 'Projetores', 'Fotografia', 'Áudio']);
$id = fake()->unique()->numberBetween(1000, 99999);
return [
'snipe_asset_id' => $id,
'asset_tag' => 'EPVC-'.str_pad((string) $id, 5, '0', STR_PAD_LEFT),
'name' => match ($category) {
'Portáteis' => fake()->randomElement(['MacBook Air 13', 'Dell Latitude 5440', 'Lenovo ThinkPad E14']),
'Projetores' => fake()->randomElement(['Projetor Epson EB-FH06', 'Projetor BenQ MH560']),
'Fotografia' => fake()->randomElement(['Canon EOS R10', 'Kit Sony Alpha 6400']),
default => fake()->randomElement(['Gravador Zoom H5', 'Kit Rode Wireless GO']),
},
'model_id' => fake()->numberBetween(1, 50),
'model_name' => fake()->bothify('Modelo ##??'),
'category_id' => array_search($category, ['Portáteis', 'Projetores', 'Fotografia', 'Áudio'], true) + 1,
'category_name' => $category,
'manufacturer' => fake()->company(),
'status_id' => 1,
'status_name' => 'Pronto a disponibilizar',
'location_id' => fake()->numberBetween(1, 4),
'location_name' => fake()->randomElement(['Biblioteca', 'Serviços de Informática', 'Sala de Audiovisuais']),
'requestable' => true,
'synced_at' => now(),
'source_updated_at' => now(),
'content_hash' => fake()->sha256(),
'active' => true,
];
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'department' => fake()->randomElement(['Docentes', 'Direção', 'Serviços de Informática', 'Secretaria']),
'active' => true,
'remember_token' => Str::random(10),
'two_factor_secret' => null,
'two_factor_recovery_codes' => null,
'two_factor_confirmed_at' => null,
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
/**
* Indicate that the model has two-factor authentication configured.
*/
public function withTwoFactor(): static
{
return $this->state(fn (array $attributes) => [
'two_factor_secret' => encrypt('secret'),
'two_factor_recovery_codes' => encrypt(json_encode(['recovery-code-1'])),
'two_factor_confirmed_at' => now(),
]);
}
}