feat(allocation): implement resource allocation feature

- Add AllocationController with CRUD + bulk endpoints
- Add AllocationValidationService for capacity/estimate validation
- Add AllocationMatrixService for optimized matrix queries
- Add AllocationPolicy for authorization
- Add AllocationResource for API responses
- Add frontend allocationService and matrix UI
- Add E2E tests for allocation matrix (20 tests)
- Add unit tests for validation service and policies
- Fix month format conversion (YYYY-MM to YYYY-MM-01)
This commit is contained in:
2026-02-25 16:28:47 -05:00
parent fedfc21425
commit 3324c4f156
35 changed files with 3337 additions and 67 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Policies;
use App\Models\Allocation;
use App\Models\User;
class AllocationPolicy
{
/**
* Determine whether the user can view any allocations.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view a specific allocation.
*/
public function view(User $user, Allocation $allocation): bool
{
return true;
}
/**
* Determine whether the user can create allocations.
*/
public function create(User $user): bool
{
return in_array($user->role, ['superuser', 'manager']);
}
/**
* Determine whether the user can update allocations.
*/
public function update(User $user, Allocation $allocation): bool
{
return in_array($user->role, ['superuser', 'manager']);
}
/**
* Determine whether the user can delete allocations.
*/
public function delete(User $user, Allocation $allocation): bool
{
return in_array($user->role, ['superuser', 'manager']);
}
}