Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Repositories\interfaces; |
| 4 | |
| 5 | use App\Http\Models\Auth\User; |
| 6 | use App\Http\Models\RolePlayProjects; |
| 7 | use Illuminate\Database\Eloquent\Collection; |
| 8 | |
| 9 | /** |
| 10 | * Data access contract for RolePlayProjects (personas). |
| 11 | * |
| 12 | * Keeps controllers/services off the model — they never hand-roll ::where() |
| 13 | * chains, they ask this repository for the slice they need. This also makes |
| 14 | * the eventual SQL migration a narrower blast radius. |
| 15 | */ |
| 16 | interface IRolePlayProjectsRepository |
| 17 | { |
| 18 | /** |
| 19 | * List personas owned by a user, with optional filters. |
| 20 | * |
| 21 | * @param array{type?: string|null, last_practiced_days?: int|null} $filters |
| 22 | * @return Collection<int, RolePlayProjects> Ordered by created_at desc. |
| 23 | */ |
| 24 | public function listForUser(User $user, array $filters = []): Collection; |
| 25 | |
| 26 | /** |
| 27 | * Count non-soft-deleted personas owned by a user. |
| 28 | * |
| 29 | * Used by both the dashboard "projects total" card and the subscription |
| 30 | * info endpoint for the lifetime-quota indicator. |
| 31 | */ |
| 32 | public function countForUser(User $user): int; |
| 33 | |
| 34 | /** |
| 35 | * Return the ids of all user-owned {@see RolePlayProjects} that were |
| 36 | * cloned from a given corporate persona, optionally narrowed to a |
| 37 | * single user. |
| 38 | * |
| 39 | * @param string $companyProjectId The {@see \App\Http\Models\CompanyRolePlayProject} id. |
| 40 | * @param string|null $userId If non-null, only include clones owned by this user. |
| 41 | * @return array<int, string> |
| 42 | */ |
| 43 | public function cloneIdsOf(string $companyProjectId, ?string $userId = null): array; |
| 44 | } |