Repo Interface für tests

This commit is contained in:
2026-03-05 08:26:51 +01:00
parent 8f4dd5840d
commit 4b31fc7664
171 changed files with 3518 additions and 2297 deletions

View File

@@ -1,6 +1,6 @@
# Architektur-Kompass # Architektur-Kompass
Letzte Aktualisierung: 2026-02-25 Letzte Aktualisierung: 2026-03-04
## Ziel ## Ziel
@@ -34,8 +34,10 @@ Verbindliche Kurzregeln für Architekturentscheidungen.
- In `pages/admin/**` keine `Factory::class`-Referenzen. - In `pages/admin/**` keine `Factory::class`-Referenzen.
- Request-Input in Actions nur über `requestInput()` lesen. - Request-Input in Actions nur über `requestInput()` lesen.
- Validierungsfehler über `FormErrors` führen und für APIs mit `ApiResponse::validationFromFormErrors(...)` ausgeben. - Validierungsfehler über `FormErrors` führen und für APIs mit `ApiResponse::validationFromFormErrors(...)` ausgeben.
- In `pages/api/v1/**` kein direktes JSON-Body-Lesen über `ApiResponse::readJsonBody(...)`.
- `Flash` nur für Redirect-/Outcome-Meldungen verwenden, nicht als primäre Validation-Struktur. - `Flash` nur für Redirect-/Outcome-Meldungen verwenden, nicht als primäre Validation-Struktur.
- Listen-Endpoints in `pages/**/data().php` sind GET-only (`gridRequireGetRequest()`). - Listen-Endpoints in `pages/**/data().php` sind GET-only (`gridRequireGetRequest()`).
- Query-Filter in `data().php` über `gridParseFilters(...)` + `filter-schema.php` normalisieren.
- Grid-Query-Parameter (`limit`, `offset`, `order`, `dir`) in `data().php` über `gridQueryLimitOffset()` und `gridQueryOrderDir()` normalisieren. - Grid-Query-Parameter (`limit`, `offset`, `order`, `dir`) in `data().php` über `gridQueryLimitOffset()` und `gridQueryOrderDir()` normalisieren.
## Instanziierungsregeln (MUSS) ## Instanziierungsregeln (MUSS)
@@ -61,6 +63,13 @@ Verbindliche Kurzregeln für Architekturentscheidungen.
- Für einzelne Views setzen Actions explizit `$viewAuth['page']` (bevorzugt über `UiCapabilityMap` + `UiAccessService::pageCapabilities()`). - Für einzelne Views setzen Actions explizit `$viewAuth['page']` (bevorzugt über `UiCapabilityMap` + `UiAccessService::pageCapabilities()`).
- In `templates/**` keine direkten `can('...')`- oder Permission-Key-Checks. - In `templates/**` keine direkten `can('...')`- oder Permission-Key-Checks.
## Frontend-Page-Module (MUSS)
- In `pages/**` und `templates/**` sind inline `<script type="module">...</script>` ohne `src` verboten.
- Seiteninitialisierung liegt in dedizierten ESM-Page-Modulen unter `web/js/pages/*`.
- Pro Seite wird Konfiguration per `<script type="application/json" id="page-config-<page-key>">...</script>` bereitgestellt und im Modul über `readPageConfig(...)` gelesen.
- In `pages/**` und `templates/**` muessen alle JS-`src` (eigene und Vendor) ueber `assetVersion('...js...')` laufen.
## Mindestchecks vor Merge ## Mindestchecks vor Merge
```bash ```bash
@@ -80,6 +89,7 @@ Struktur-Gates zusätzlich:
(rg -n '\bDB::' pages -g '*.php' || true) | wc -l (rg -n '\bDB::' pages -g '*.php' || true) | wc -l
(rg -n 'app\([^\n]*Factory::class\)->create' pages/admin -g '*.php' || true) | wc -l (rg -n 'app\([^\n]*Factory::class\)->create' pages/admin -g '*.php' || true) | wc -l
(rg -n 'Factory::class' pages/admin -g '*.php' || true) | wc -l (rg -n 'Factory::class' pages/admin -g '*.php' || true) | wc -l
(rg -n 'ApiResponse::readJsonBody\(' pages/api/v1 -g '*.php' || true) | wc -l
``` ```
Architektur-Contract: Architektur-Contract:

View File

@@ -38,6 +38,9 @@ Kurze Definition of Done vor Merge.
- [ ] Aktive Filter-Chips vorhanden (`data-active-filter-chips`) und Remove/Clear funktionieren - [ ] Aktive Filter-Chips vorhanden (`data-active-filter-chips`) und Remove/Clear funktionieren
- [ ] Kein Legacy-Toggle in Listen (`data-toolbar-toggle`, `data-filter-overflow`, `data-filter-toggle`) - [ ] Kein Legacy-Toggle in Listen (`data-toolbar-toggle`, `data-filter-overflow`, `data-filter-toggle`)
- [ ] Falls Save-Filter vorhanden: gespeicherter Zustand stammt aus Applied State (`gridConfig.baseUrl()`) - [ ] Falls Save-Filter vorhanden: gespeicherter Zustand stammt aus Applied State (`gridConfig.baseUrl()`)
- [ ] Keine inline `<script type="module">`-Blöcke in `pages/**`/`templates/**`; Seitenlogik liegt in `web/js/pages/*`
- [ ] Für Seitenmodule ist Config über `<script type="application/json" id="page-config-...">` bereitgestellt
- [ ] JS-`src` in `pages/**`/`templates/**` nur über `assetVersion('...js...')`
- [ ] Service-Auflösung in `pages/**`/`templates/**`/`lib/Support/**` nur via `app(Foo::class)` - [ ] Service-Auflösung in `pages/**`/`templates/**`/`lib/Support/**` nur via `app(Foo::class)`
- [ ] Keine `new ...Factory()` in `lib/Service/**` außerhalb `*Factory.php` - [ ] Keine `new ...Factory()` in `lib/Service/**` außerhalb `*Factory.php`
- [ ] Keine direkten `new ...Service()`, `new ...Gateway()`, `new ...Repository()` in `lib/Service/**` außerhalb `*Factory.php` - [ ] Keine direkten `new ...Service()`, `new ...Gateway()`, `new ...Repository()` in `lib/Service/**` außerhalb `*Factory.php`
@@ -52,6 +55,7 @@ Kurze Definition of Done vor Merge.
- [ ] Keine sensiblen Daten in Fehlern/Logs - [ ] Keine sensiblen Daten in Fehlern/Logs
- [ ] Für `pages/**/data().php`: GET-only + Query-Normalisierung (`gridRequireGetRequest`, `gridParseFilters`) - [ ] Für `pages/**/data().php`: GET-only + Query-Normalisierung (`gridRequireGetRequest`, `gridParseFilters`)
- [ ] Für `pages/**/data().php`: Filter über `gridParseFilters(...)` statt Inline-Parsing - [ ] Für `pages/**/data().php`: Filter über `gridParseFilters(...)` statt Inline-Parsing
- [ ] Für `pages/api/v1/**`: kein `ApiResponse::readJsonBody(...)`, Input nur über `requestInput()`
- [ ] Bei MultiSelect-Filtern: CSV-Query (`foo=a,b`) + serverseitige `IN`-Filter mit Limit - [ ] Bei MultiSelect-Filtern: CSV-Query (`foo=a,b`) + serverseitige `IN`-Filter mit Limit
- [ ] Keine Listen-Alias-Keys (`*_id` neben `*_ids`) neu einführen - [ ] Keine Listen-Alias-Keys (`*_id` neben `*_ids`) neu einführen
- [ ] Input nur über `requestInput()` und Validation über `FormErrors` (`/docs/request-input-validation.md`) - [ ] Input nur über `requestInput()` und Validation über `FormErrors` (`/docs/request-input-validation.md`)

View File

@@ -33,7 +33,18 @@ Empfohlenes Muster:
Template für neue Komponenten: Template für neue Komponenten:
- `/web/js/components/_template.js` - bestehende Komponenten als Referenz verwenden (`/web/js/components/*.js`)
## Page Module Contract (Hard Cut)
Für seitenbezogene Initialisierung gilt verbindlich:
- Kein inline `<script type="module">` in `pages/**` oder `templates/**`.
- Pro Seite genau ein externes Modul unter `web/js/pages/*` laden.
- Serverseitige Daten für dieses Modul über
`<script type="application/json" id="page-config-...">...</script>` bereitstellen.
- Page-Module lesen Config zentral über `readPageConfig(...)` aus `web/js/core/app-page-config.js`.
- JS-`src` in `pages/**` und `templates/**` nur über `assetVersion('...js...')`.
## Defensive DOM-Nutzung ## Defensive DOM-Nutzung

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Access;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class PermissionRepository class PermissionRepository implements PermissionRepositoryInterface
{ {
public function list(): array public function list(): array
{ {

View File

@@ -0,0 +1,22 @@
<?php
namespace MintyPHP\Repository\Access;
interface PermissionRepositoryInterface
{
public function list(): array;
public function listActive(): array;
public function listPaged(array $options): array;
public function find(int $id): ?array;
public function findByKey(string $key): ?array;
public function create(array $data): ?int;
public function update(int $id, array $data): bool;
public function delete(int $id): bool;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Access;
use MintyPHP\DB; use MintyPHP\DB;
class RolePermissionRepository class RolePermissionRepository implements RolePermissionRepositoryInterface
{ {
public function listPermissionIdsByRoleId(int $roleId): array public function listPermissionIdsByRoleId(int $roleId): array
{ {

View File

@@ -0,0 +1,20 @@
<?php
namespace MintyPHP\Repository\Access;
interface RolePermissionRepositoryInterface
{
public function listPermissionIdsByRoleId(int $roleId): array;
public function countPermissionsByRoleIds(array $roleIds): array;
public function replaceForRole(int $roleId, array $permissionIds): bool;
public function listRoleIdsByPermissionId(int $permissionId): array;
public function replaceForPermission(int $permissionId, array $roleIds): bool;
public function listPermissionKeysByRoleIds(array $roleIds): array;
public function listPermissionsWithRolesByRoleIds(array $roleIds): array;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Access;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class RoleRepository class RoleRepository implements RoleRepositoryInterface
{ {
private function unwrap(?array $row): ?array private function unwrap(?array $row): ?array
{ {
@@ -159,7 +159,7 @@ class RoleRepository
return $count ? ((int) $count > 0) : false; return $count ? ((int) $count > 0) : false;
} }
public function create(array $data) public function create(array $data): mixed
{ {
return DB::insert( return DB::insert(
'insert into roles (uuid, description, code, active, created_by, created) values (?,?,?,?,?,NOW())', 'insert into roles (uuid, description, code, active, created_by, created) values (?,?,?,?,?,NOW())',

View File

@@ -0,0 +1,30 @@
<?php
namespace MintyPHP\Repository\Access;
interface RoleRepositoryInterface
{
public function list(): array;
public function listActive(): array;
public function listByIds(array $roleIds): array;
public function listIds(): array;
public function listActiveIds(): array;
public function listPaged(array $options): array;
public function find(int $id): ?array;
public function findByUuid(string $uuid): ?array;
public function existsByCode(string $code, int $excludeId = 0): bool;
public function create(array $data): mixed;
public function update(int $id, array $data): bool;
public function delete(int $id): bool;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Access;
use MintyPHP\DB; use MintyPHP\DB;
class UserRoleRepository class UserRoleRepository implements UserRoleRepositoryInterface
{ {
public function listRoleIdsByUserId(int $userId): array public function listRoleIdsByUserId(int $userId): array
{ {

View File

@@ -0,0 +1,16 @@
<?php
namespace MintyPHP\Repository\Access;
interface UserRoleRepositoryInterface
{
public function listRoleIdsByUserId(int $userId): array;
public function replaceForUser(int $userId, array $roleIds): bool;
public function listUserIdsByRoleIds(array $roleIds): array;
public function countUsersByRoleIds(array $roleIds): array;
public function countActiveUsersByRoleIds(array $roleIds): array;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Audit;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class ApiAuditLogRepository class ApiAuditLogRepository implements ApiAuditLogRepositoryInterface
{ {
private const FILTER_OPTIONS_LIMIT_MAX = 200; private const FILTER_OPTIONS_LIMIT_MAX = 200;

View File

@@ -0,0 +1,16 @@
<?php
namespace MintyPHP\Repository\Audit;
interface ApiAuditLogRepositoryInterface
{
public function create(array $data): int|false;
public function listPaged(array $filters): array;
public function listFilterOptions(int $limit = 200): array;
public function find(int $id): ?array;
public function purgeOlderThanDays(int $days): int;
}

View File

@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\ImportAuditStatus;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class ImportAuditRunRepository class ImportAuditRunRepository implements ImportAuditRunRepositoryInterface
{ {
private const FILTER_OPTIONS_LIMIT_MAX = 200; private const FILTER_OPTIONS_LIMIT_MAX = 200;

View File

@@ -0,0 +1,18 @@
<?php
namespace MintyPHP\Repository\Audit;
interface ImportAuditRunRepositoryInterface
{
public function createRunning(array $data): int|false;
public function finishById(int $id, array $data): bool;
public function listPaged(array $filters): array;
public function listFilterOptions(int $limit = 200): array;
public function find(int $id): ?array;
public function purgeOlderThanDays(int $days): int;
}

View File

@@ -7,7 +7,7 @@ use MintyPHP\Domain\Taxonomy\SystemAuditOutcome;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class SystemAuditLogRepository class SystemAuditLogRepository implements SystemAuditLogRepositoryInterface
{ {
private const FILTER_OPTIONS_LIMIT_MAX = 200; private const FILTER_OPTIONS_LIMIT_MAX = 200;

View File

@@ -0,0 +1,16 @@
<?php
namespace MintyPHP\Repository\Audit;
interface SystemAuditLogRepositoryInterface
{
public function create(array $data): int|false;
public function listPaged(array $filters): array;
public function listFilterOptions(int $limit = 200): array;
public function find(int $id): ?array;
public function purgeOlderThanDays(int $days): int;
}

View File

@@ -8,7 +8,7 @@ use MintyPHP\Domain\Taxonomy\UserLifecycleTriggerType;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class UserLifecycleAuditRepository class UserLifecycleAuditRepository implements UserLifecycleAuditRepositoryInterface
{ {
private const FILTER_OPTIONS_LIMIT_MAX = 200; private const FILTER_OPTIONS_LIMIT_MAX = 200;

View File

@@ -0,0 +1,22 @@
<?php
namespace MintyPHP\Repository\Audit;
interface UserLifecycleAuditRepositoryInterface
{
public function create(array $row): int|false;
public function updateStatus(int $id, string $status, ?string $reasonCode = null): bool;
public function listPaged(array $filters): array;
public function listFilterOptions(int $limit = 200): array;
public function find(int $id): ?array;
public function findDeleteEventForRestore(int $id, bool $forUpdate = false): ?array;
public function markRestored(int $id, int $restoredBy, int $restoredUserId): bool;
public function purgeOlderThanDays(int $days): int;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Auth;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class ApiTokenRepository class ApiTokenRepository implements ApiTokenRepositoryInterface
{ {
private const UUID_REGEX = '/^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i'; private const UUID_REGEX = '/^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i';

View File

@@ -0,0 +1,44 @@
<?php
namespace MintyPHP\Repository\Auth;
interface ApiTokenRepositoryInterface
{
public function isUuid(string $value): bool;
public function create(
int $userId,
string $name,
string $selector,
string $tokenHash,
?int $tenantId,
?string $expiresAt,
?int $createdBy
): ?int;
public function findBySelector(string $selector): ?array;
public function find(int $id): ?array;
public function findByUuid(string $uuid): ?array;
public function findByUuidForUser(string $uuid, int $userId): ?array;
public function updateLastUsed(int $id, string $ip): bool;
public function revoke(int $id): bool;
public function revokeByUuidForUser(string $uuid, int $userId): bool;
public function revokeAllForUser(int $userId, ?int $tenantId = null): int;
public function revokeAllActiveByAdmin(): int;
public function listByUserId(int $userId, int $limit = 25): array;
public function countActiveForUser(int $userId): int;
public function countActiveForUserExcludingId(int $userId, int $excludeId): int;
public function countActive(): int;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Auth;
use MintyPHP\DB; use MintyPHP\DB;
class EmailVerificationRepository class EmailVerificationRepository implements EmailVerificationRepositoryInterface
{ {
public function create(int $userId, string $codeHash, string $expiresAt): ?int public function create(int $userId, string $codeHash, string $expiresAt): ?int
{ {

View File

@@ -0,0 +1,18 @@
<?php
namespace MintyPHP\Repository\Auth;
interface EmailVerificationRepositoryInterface
{
public function create(int $userId, string $codeHash, string $expiresAt): ?int;
public function invalidateForUser(int $userId): bool;
public function findActiveByUserId(int $userId): ?array;
public function findById(int $id): ?array;
public function incrementAttempts(int $id): bool;
public function markUsed(int $id): bool;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Auth;
use MintyPHP\DB; use MintyPHP\DB;
class PasswordResetRepository class PasswordResetRepository implements PasswordResetRepositoryInterface
{ {
private function unwrapList($rows): array private function unwrapList($rows): array
{ {

View File

@@ -0,0 +1,20 @@
<?php
namespace MintyPHP\Repository\Auth;
interface PasswordResetRepositoryInterface
{
public function create(int $userId, string $codeHash, string $expiresAt): ?int;
public function invalidateForUser(int $userId): bool;
public function findActiveByUserId(int $userId): ?array;
public function findById(int $id): ?array;
public function incrementAttempts(int $id): bool;
public function markUsed(int $id): bool;
public function listByUserId(int $userId, int $limit = 20): array;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Auth;
use MintyPHP\DB; use MintyPHP\DB;
class RememberTokenRepository class RememberTokenRepository implements RememberTokenRepositoryInterface
{ {
private function unwrapList($rows): array private function unwrapList($rows): array
{ {

View File

@@ -0,0 +1,22 @@
<?php
namespace MintyPHP\Repository\Auth;
interface RememberTokenRepositoryInterface
{
public function create(int $userId, string $selector, string $tokenHash, string $expiresAt): ?int;
public function findBySelector(string $selector): ?array;
public function updateToken(int $id, string $tokenHash, string $expiresAt): bool;
public function expireAllByAdmin(): int;
public function deleteById(int $id): bool;
public function deleteByUserId(int $userId): bool;
public function listByUserId(int $userId, int $limit = 20): array;
public function countActive(): int;
}

View File

@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\MailLogStatus;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class MailLogRepository class MailLogRepository implements MailLogRepositoryInterface
{ {
public function create(array $data): ?int public function create(array $data): ?int
{ {

View File

@@ -0,0 +1,16 @@
<?php
namespace MintyPHP\Repository\Mail;
interface MailLogRepositoryInterface
{
public function create(array $data): ?int;
public function markSent(int $id, ?string $providerMessageId = null): bool;
public function markFailed(int $id, string $errorMessage): bool;
public function listPaged(array $options): array;
public function find(int $id): ?array;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Org;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class DepartmentRepository class DepartmentRepository implements DepartmentRepositoryInterface
{ {
private function unwrap(?array $row): ?array private function unwrap(?array $row): ?array
{ {
@@ -284,7 +284,7 @@ class DepartmentRepository
return $count ? (int) $count : 0; return $count ? (int) $count : 0;
} }
public function create(array $data) public function create(array $data): mixed
{ {
return DB::insert( return DB::insert(
'insert into departments (uuid, description, tenant_id, code, cost_center, active, created_by, created) values (?,?,?,?,?,?,?,NOW())', 'insert into departments (uuid, description, tenant_id, code, cost_center, active, created_by, created) values (?,?,?,?,?,?,?,NOW())',

View File

@@ -0,0 +1,36 @@
<?php
namespace MintyPHP\Repository\Org;
interface DepartmentRepositoryInterface
{
public function list(): array;
public function listIds(): array;
public function listActiveIdsByTenantIds(array $tenantIds): array;
public function listByTenantIds(array $tenantIds): array;
public function listByIds(array $departmentIds, bool $includeInactive = false): array;
public function listPaged(array $options): array;
public function find(int $id): ?array;
public function findByUuid(string $uuid): ?array;
public function existsByCode(string $code, int $excludeId = 0): bool;
public function existsByTenantAndDescription(int $tenantId, string $description, int $excludeId = 0): bool;
public function countByTenantId(int $tenantId): int;
public function create(array $data): mixed;
public function update(int $id, array $data): bool;
public function setTenant(int $id, int $tenantId): bool;
public function delete(int $id): bool;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Org;
use MintyPHP\DB; use MintyPHP\DB;
class UserDepartmentRepository class UserDepartmentRepository implements UserDepartmentRepositoryInterface
{ {
public function listDepartmentIdsByUserId(int $userId): array public function listDepartmentIdsByUserId(int $userId): array
{ {

View File

@@ -0,0 +1,16 @@
<?php
namespace MintyPHP\Repository\Org;
interface UserDepartmentRepositoryInterface
{
public function listDepartmentIdsByUserId(int $userId): array;
public function replaceForUser(int $userId, array $departmentIds): bool;
public function removeInvalidForDepartment(int $departmentId): int;
public function countUsersByDepartmentIds(array $departmentIds): array;
public function countActiveUsersByDepartmentIds(array $departmentIds): array;
}

View File

@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobStatus;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class ScheduledJobRepository class ScheduledJobRepository implements ScheduledJobRepositoryInterface
{ {
public function create(array $data): int|false public function create(array $data): int|false
{ {

View File

@@ -0,0 +1,30 @@
<?php
namespace MintyPHP\Repository\Scheduler;
interface ScheduledJobRepositoryInterface
{
public function create(array $data): int|false;
public function find(int $id): ?array;
public function findByKey(string $jobKey): ?array;
public function listPaged(array $filters): array;
public function listDueJobs(string $nowUtc, int $limit = 20): array;
public function updateJobMeta(int $id, array $data): bool;
public function markRunning(int $id, string $startedAtUtc): bool;
public function finishRun(
int $id,
string $status,
string $startedAtUtc,
string $finishedAtUtc,
?string $nextRunAtUtc,
?string $errorCode,
?string $errorMessage
): bool;
}

View File

@@ -7,7 +7,7 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobTriggerType;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class ScheduledJobRunRepository class ScheduledJobRunRepository implements ScheduledJobRunRepositoryInterface
{ {
public function create(array $data): int|false public function create(array $data): int|false
{ {

View File

@@ -0,0 +1,12 @@
<?php
namespace MintyPHP\Repository\Scheduler;
interface ScheduledJobRunRepositoryInterface
{
public function create(array $data): int|false;
public function listPagedByJobId(int $jobId, array $filters): array;
public function purgeOlderThanDays(int $days): int;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Scheduler;
use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult; use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult;
use MintyPHP\DB; use MintyPHP\DB;
class SchedulerRuntimeRepository class SchedulerRuntimeRepository implements SchedulerRuntimeRepositoryInterface
{ {
public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool
{ {

View File

@@ -0,0 +1,10 @@
<?php
namespace MintyPHP\Repository\Scheduler;
interface SchedulerRuntimeRepositoryInterface
{
public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool;
public function findStatus(): ?array;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Search;
use MintyPHP\DB; use MintyPHP\DB;
class SearchQueryRepository class SearchQueryRepository implements SearchQueryRepositoryInterface
{ {
/** /**
* @param array<int, mixed> $params * @param array<int, mixed> $params

View File

@@ -0,0 +1,17 @@
<?php
namespace MintyPHP\Repository\Search;
interface SearchQueryRepositoryInterface
{
/**
* @param array<int, mixed> $params
* @return array<int, mixed>
*/
public function selectRows(string $sql, array $params = []): array;
/**
* @param array<int, mixed> $params
*/
public function selectCount(string $sql, array $params = []): int;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Security;
use MintyPHP\DB; use MintyPHP\DB;
class RateLimitRepository class RateLimitRepository implements RateLimitRepositoryInterface
{ {
public function findByScopeAndHash(string $scope, string $subjectHash): ?array public function findByScopeAndHash(string $scope, string $subjectHash): ?array
{ {

View File

@@ -0,0 +1,25 @@
<?php
namespace MintyPHP\Repository\Security;
interface RateLimitRepositoryInterface
{
public function findByScopeAndHash(string $scope, string $subjectHash): ?array;
public function create(
string $scope,
string $subjectHash,
int $hits,
string $windowStartedAt,
?string $blockedUntil
): bool;
public function updateStateById(
int $id,
int $hits,
string $windowStartedAt,
?string $blockedUntil
): bool;
public function deleteByScopeAndHash(string $scope, string $subjectHash): bool;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Settings;
use MintyPHP\DB; use MintyPHP\DB;
class SettingRepository class SettingRepository implements SettingRepositoryInterface
{ {
public function find(string $key): ?array public function find(string $key): ?array
{ {

View File

@@ -0,0 +1,12 @@
<?php
namespace MintyPHP\Repository\Settings;
interface SettingRepositoryInterface
{
public function find(string $key): ?array;
public function getValue(string $key): ?string;
public function set(string $key, ?string $value, ?string $description = null): bool;
}

View File

@@ -12,7 +12,7 @@ use MintyPHP\Domain\Taxonomy\UserLifecycleAction;
use MintyPHP\Domain\Taxonomy\UserLifecycleStatus; use MintyPHP\Domain\Taxonomy\UserLifecycleStatus;
use MintyPHP\DB; use MintyPHP\DB;
class AdminStatsRepository class AdminStatsRepository implements AdminStatsRepositoryInterface
{ {
/** /**
* @return array<string, mixed> * @return array<string, mixed>

View File

@@ -0,0 +1,11 @@
<?php
namespace MintyPHP\Repository\Stats;
interface AdminStatsRepositoryInterface
{
/**
* @return array<string, mixed>
*/
public function buildViewData(): array;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Support;
use MintyPHP\DB; use MintyPHP\DB;
class DatabaseSessionRepository class DatabaseSessionRepository implements DatabaseSessionRepositoryInterface
{ {
public function acquireAdvisoryLock(string $lockName, int $timeoutSeconds = 0): bool public function acquireAdvisoryLock(string $lockName, int $timeoutSeconds = 0): bool
{ {

View File

@@ -0,0 +1,16 @@
<?php
namespace MintyPHP\Repository\Support;
interface DatabaseSessionRepositoryInterface
{
public function acquireAdvisoryLock(string $lockName, int $timeoutSeconds = 0): bool;
public function releaseAdvisoryLock(string $lockName): void;
public function beginTransaction(): void;
public function commitTransaction(): void;
public function rollbackTransaction(): void;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
use MintyPHP\DB; use MintyPHP\DB;
class TenantMicrosoftAuthRepository class TenantMicrosoftAuthRepository implements TenantMicrosoftAuthRepositoryInterface
{ {
private function unwrap($row): ?array private function unwrap($row): ?array
{ {

View File

@@ -0,0 +1,12 @@
<?php
namespace MintyPHP\Repository\Tenant;
interface TenantMicrosoftAuthRepositoryInterface
{
public function findByTenantId(int $tenantId): ?array;
public function listByTenantIds(array $tenantIds): array;
public function upsertByTenantId(int $tenantId, array $data): bool;
}

View File

@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\TenantStatus;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class TenantRepository class TenantRepository implements TenantRepositoryInterface
{ {
private function unwrap(?array $row): ?array private function unwrap(?array $row): ?array
{ {
@@ -168,7 +168,7 @@ class TenantRepository
return $this->unwrap($row); return $this->unwrap($row);
} }
public function create(array $data) public function create(array $data): mixed
{ {
return DB::insert( return DB::insert(
'insert into tenants (uuid, description, address, postal_code, city, country, region, vat_id, tax_number, phone, fax, email, support_email, support_phone, billing_email, website, privacy_url, imprint_url, primary_color, default_theme, allow_user_theme, status, status_changed_at, status_changed_by, created_by, created) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW())', 'insert into tenants (uuid, description, address, postal_code, city, country, region, vat_id, tax_number, phone, fax, email, support_email, support_phone, billing_email, website, privacy_url, imprint_url, primary_color, default_theme, allow_user_theme, status, status_changed_at, status_changed_by, created_by, created) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW())',

View File

@@ -0,0 +1,26 @@
<?php
namespace MintyPHP\Repository\Tenant;
interface TenantRepositoryInterface
{
public function list(): array;
public function listIds(): array;
public function listByIds(array $tenantIds): array;
public function listActiveIdsByIds(array $tenantIds): array;
public function listPaged(array $options): array;
public function find(int $id): ?array;
public function findByUuid(string $uuid): ?array;
public function create(array $data): mixed;
public function update(int $id, array $data): bool;
public function delete(int $id): bool;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
use MintyPHP\DB; use MintyPHP\DB;
class UserTenantRepository class UserTenantRepository implements UserTenantRepositoryInterface
{ {
public function listTenantIdsByUserId(int $userId): array public function listTenantIdsByUserId(int $userId): array
{ {

View File

@@ -0,0 +1,14 @@
<?php
namespace MintyPHP\Repository\Tenant;
interface UserTenantRepositoryInterface
{
public function listTenantIdsByUserId(int $userId): array;
public function replaceForUser(int $userId, array $tenantIds): bool;
public function countUsersByTenantIds(array $tenantIds): array;
public function countActiveUsersByTenantIds(array $tenantIds): array;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\User;
use MintyPHP\DB; use MintyPHP\DB;
class UserExternalIdentityRepository class UserExternalIdentityRepository implements UserExternalIdentityRepositoryInterface
{ {
private function unwrap($row): ?array private function unwrap($row): ?array
{ {
@@ -39,7 +39,7 @@ class UserExternalIdentityRepository
return $this->unwrap($row); return $this->unwrap($row);
} }
public function createLink(array $data) public function createLink(array $data): mixed
{ {
return DB::insert( return DB::insert(
'insert into user_external_identities (user_id, provider, oid, tid, issuer, subject, email_at_link_time, created) values (?,?,?,?,?,?,?,NOW())', 'insert into user_external_identities (user_id, provider, oid, tid, issuer, subject, email_at_link_time, created) values (?,?,?,?,?,?,?,NOW())',

View File

@@ -0,0 +1,12 @@
<?php
namespace MintyPHP\Repository\User;
interface UserExternalIdentityRepositoryInterface
{
public function findByProviderTidOid(string $provider, string $tid, string $oid): ?array;
public function findByProviderIssuerSubject(string $provider, string $issuer, string $subject): ?array;
public function createLink(array $data): mixed;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\User;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class UserListQueryRepository class UserListQueryRepository implements UserListQueryRepositoryInterface
{ {
private function buildUserFilters(array $options): array private function buildUserFilters(array $options): array
{ {

View File

@@ -0,0 +1,8 @@
<?php
namespace MintyPHP\Repository\User;
interface UserListQueryRepositoryInterface
{
public function listPaged(array $options): array;
}

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\User;
use MintyPHP\DB; use MintyPHP\DB;
class UserReadRepository class UserReadRepository implements UserReadRepositoryInterface
{ {
public function findAuthzSnapshot(int $userId): ?array public function findAuthzSnapshot(int $userId): ?array
{ {

View File

@@ -0,0 +1,20 @@
<?php
namespace MintyPHP\Repository\User;
interface UserReadRepositoryInterface
{
public function findAuthzSnapshot(int $userId): ?array;
public function find(int $id): ?array;
public function findByUuid(string $uuid): ?array;
public function findByEmail(string $email): ?array;
public function listPrivilegedUserIdsByPermissionKeys(array $permissionKeys): array;
public function listIdsForAutoDeactivate(int $days, array $excludedUserIds, int $limit = 500): array;
public function listIdsForAutoDelete(int $days, array $excludedUserIds, int $limit = 500): array;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\User;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class UserSavedFilterRepository class UserSavedFilterRepository implements UserSavedFilterRepositoryInterface
{ {
private function unwrapList($rows): array private function unwrapList($rows): array
{ {

View File

@@ -0,0 +1,14 @@
<?php
namespace MintyPHP\Repository\User;
interface UserSavedFilterRepositoryInterface
{
public function listByUserAndContext(int $userId, string $context): array;
public function countByUserAndContext(int $userId, string $context): int;
public function create(array $data): int|false;
public function deleteByUuidForUserAndContext(string $uuid, int $userId, string $context): bool;
}

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\User;
use MintyPHP\DB; use MintyPHP\DB;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class UserWriteRepository class UserWriteRepository implements UserWriteRepositoryInterface
{ {
public function updateLastLogin(int $userId, string $provider = 'local'): void public function updateLastLogin(int $userId, string $provider = 'local'): void
{ {

View File

@@ -0,0 +1,40 @@
<?php
namespace MintyPHP\Repository\User;
interface UserWriteRepositoryInterface
{
public function updateLastLogin(int $userId, string $provider = 'local'): void;
public function bumpAuthzVersion(int $userId): bool;
public function bumpAuthzVersionByUserIds(array $userIds): int;
public function create(array $data): int|false;
public function update(int $id, array $data): bool;
public function setActive(int $id, bool $active, ?int $changedBy = null): bool;
public function setCurrentTenant(int $id, int $tenantId): bool;
public function setActiveByUuids(array $uuids, bool $active, ?int $modifiedBy = null): bool;
public function setInactiveByIds(array $userIds, ?int $changedBy = null): int;
public function deleteByIds(array $userIds): int;
public function setLocale(int $id, string $locale): bool;
public function setTheme(int $id, string $theme): bool;
public function updateProfileFieldsFromSso(int $id, array $fields): bool;
public function setPassword(int $id, string $password): bool;
public function setEmailVerified(int $id): bool;
public function delete(int $id): bool;
public function deleteByUuids(array $uuids): bool;
}

View File

@@ -3,8 +3,11 @@
namespace MintyPHP\Service\Access; namespace MintyPHP\Service\Access;
use MintyPHP\Repository\Access\PermissionRepository; use MintyPHP\Repository\Access\PermissionRepository;
use MintyPHP\Repository\Access\PermissionRepositoryInterface;
use MintyPHP\Repository\Access\RolePermissionRepository; use MintyPHP\Repository\Access\RolePermissionRepository;
use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
use MintyPHP\Repository\Access\UserRoleRepository; use MintyPHP\Repository\Access\UserRoleRepository;
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
class AccessRepositoryFactory class AccessRepositoryFactory
{ {
@@ -12,17 +15,17 @@ class AccessRepositoryFactory
private ?RolePermissionRepository $rolePermissionRepository = null; private ?RolePermissionRepository $rolePermissionRepository = null;
private ?UserRoleRepository $userRoleRepository = null; private ?UserRoleRepository $userRoleRepository = null;
public function createPermissionRepository(): PermissionRepository public function createPermissionRepository(): PermissionRepositoryInterface
{ {
return $this->permissionRepository ??= new PermissionRepository(); return $this->permissionRepository ??= new PermissionRepository();
} }
public function createRolePermissionRepository(): RolePermissionRepository public function createRolePermissionRepository(): RolePermissionRepositoryInterface
{ {
return $this->rolePermissionRepository ??= new RolePermissionRepository(); return $this->rolePermissionRepository ??= new RolePermissionRepository();
} }
public function createUserRoleRepository(): UserRoleRepository public function createUserRoleRepository(): UserRoleRepositoryInterface
{ {
return $this->userRoleRepository ??= new UserRoleRepository(); return $this->userRoleRepository ??= new UserRoleRepository();
} }

View File

@@ -2,9 +2,9 @@
namespace MintyPHP\Service\Access; namespace MintyPHP\Service\Access;
use MintyPHP\Repository\Access\PermissionRepository; use MintyPHP\Repository\Access\PermissionRepositoryInterface;
use MintyPHP\Repository\Access\RolePermissionRepository; use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
use MintyPHP\Repository\Access\UserRoleRepository; use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
class AccessServicesFactory class AccessServicesFactory
{ {
@@ -19,17 +19,17 @@ class AccessServicesFactory
$this->accessPolicyFactoryResolver = \Closure::fromCallable($accessPolicyFactoryResolver); $this->accessPolicyFactoryResolver = \Closure::fromCallable($accessPolicyFactoryResolver);
} }
public function createPermissionRepository(): PermissionRepository public function createPermissionRepository(): PermissionRepositoryInterface
{ {
return $this->accessRepositoryFactory->createPermissionRepository(); return $this->accessRepositoryFactory->createPermissionRepository();
} }
public function createRolePermissionRepository(): RolePermissionRepository public function createRolePermissionRepository(): RolePermissionRepositoryInterface
{ {
return $this->accessRepositoryFactory->createRolePermissionRepository(); return $this->accessRepositoryFactory->createRolePermissionRepository();
} }
public function createUserRoleRepository(): UserRoleRepository public function createUserRoleRepository(): UserRoleRepositoryInterface
{ {
return $this->accessRepositoryFactory->createUserRoleRepository(); return $this->accessRepositoryFactory->createUserRoleRepository();
} }

View File

@@ -2,9 +2,9 @@
namespace MintyPHP\Service\Access; namespace MintyPHP\Service\Access;
use MintyPHP\Repository\Access\PermissionRepository; use MintyPHP\Repository\Access\PermissionRepositoryInterface;
use MintyPHP\Repository\Access\RolePermissionRepository; use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
use MintyPHP\Repository\Access\UserRoleRepository; use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
use MintyPHP\Service\Audit\SystemAuditService; use MintyPHP\Service\Audit\SystemAuditService;
class PermissionService class PermissionService
@@ -12,9 +12,9 @@ class PermissionService
private array $apiPermissionCache = []; private array $apiPermissionCache = [];
public function __construct( public function __construct(
private readonly PermissionRepository $permissionRepository, private readonly PermissionRepositoryInterface $permissionRepository,
private readonly RolePermissionRepository $rolePermissionRepository, private readonly RolePermissionRepositoryInterface $rolePermissionRepository,
private readonly UserRoleRepository $userRoleRepository, private readonly UserRoleRepositoryInterface $userRoleRepository,
private readonly SystemAuditService $systemAuditService private readonly SystemAuditService $systemAuditService
) { ) {
} }

View File

@@ -2,14 +2,14 @@
namespace MintyPHP\Service\Access; namespace MintyPHP\Service\Access;
use MintyPHP\Repository\Access\RoleRepository; use MintyPHP\Repository\Access\RoleRepositoryInterface;
use MintyPHP\Service\Audit\SystemAuditService; use MintyPHP\Service\Audit\SystemAuditService;
use MintyPHP\Service\Directory\DirectorySettingsGateway; use MintyPHP\Service\Directory\DirectorySettingsGateway;
class RoleService class RoleService
{ {
public function __construct( public function __construct(
private readonly RoleRepository $roleRepository, private readonly RoleRepositoryInterface $roleRepository,
private readonly DirectorySettingsGateway $settingsGateway, private readonly DirectorySettingsGateway $settingsGateway,
private readonly SystemAuditService $systemAuditService private readonly SystemAuditService $systemAuditService
) { ) {

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Service\Audit;
use MintyPHP\Http\ApiAuth; use MintyPHP\Http\ApiAuth;
use MintyPHP\Http\RequestContext; use MintyPHP\Http\RequestContext;
use MintyPHP\Repository\Audit\ApiAuditLogRepository; use MintyPHP\Repository\Audit\ApiAuditLogRepositoryInterface;
class ApiAuditService class ApiAuditService
{ {
@@ -15,7 +15,7 @@ class ApiAuditService
private ?array $context = null; private ?array $context = null;
public function __construct(private readonly ApiAuditLogRepository $apiAuditLogRepository) public function __construct(private readonly ApiAuditLogRepositoryInterface $apiAuditLogRepository)
{ {
} }

View File

@@ -3,8 +3,11 @@
namespace MintyPHP\Service\Audit; namespace MintyPHP\Service\Audit;
use MintyPHP\Repository\Audit\ApiAuditLogRepository; use MintyPHP\Repository\Audit\ApiAuditLogRepository;
use MintyPHP\Repository\Audit\ApiAuditLogRepositoryInterface;
use MintyPHP\Repository\Audit\SystemAuditLogRepository; use MintyPHP\Repository\Audit\SystemAuditLogRepository;
use MintyPHP\Repository\Audit\SystemAuditLogRepositoryInterface;
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository; use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
use MintyPHP\Repository\Audit\UserLifecycleAuditRepositoryInterface;
class AuditRepositoryFactory class AuditRepositoryFactory
{ {
@@ -12,17 +15,17 @@ class AuditRepositoryFactory
private ?UserLifecycleAuditRepository $userLifecycleAuditRepository = null; private ?UserLifecycleAuditRepository $userLifecycleAuditRepository = null;
private ?SystemAuditLogRepository $systemAuditLogRepository = null; private ?SystemAuditLogRepository $systemAuditLogRepository = null;
public function createApiAuditLogRepository(): ApiAuditLogRepository public function createApiAuditLogRepository(): ApiAuditLogRepositoryInterface
{ {
return $this->apiAuditLogRepository ??= new ApiAuditLogRepository(); return $this->apiAuditLogRepository ??= new ApiAuditLogRepository();
} }
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepositoryInterface
{ {
return $this->userLifecycleAuditRepository ??= new UserLifecycleAuditRepository(); return $this->userLifecycleAuditRepository ??= new UserLifecycleAuditRepository();
} }
public function createSystemAuditLogRepository(): SystemAuditLogRepository public function createSystemAuditLogRepository(): SystemAuditLogRepositoryInterface
{ {
return $this->systemAuditLogRepository ??= new SystemAuditLogRepository(); return $this->systemAuditLogRepository ??= new SystemAuditLogRepository();
} }

View File

@@ -2,9 +2,9 @@
namespace MintyPHP\Service\Audit; namespace MintyPHP\Service\Audit;
use MintyPHP\Repository\Audit\ApiAuditLogRepository; use MintyPHP\Repository\Audit\ApiAuditLogRepositoryInterface;
use MintyPHP\Repository\Audit\SystemAuditLogRepository; use MintyPHP\Repository\Audit\SystemAuditLogRepositoryInterface;
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository; use MintyPHP\Repository\Audit\UserLifecycleAuditRepositoryInterface;
use MintyPHP\Service\Settings\SettingGateway; use MintyPHP\Service\Settings\SettingGateway;
class AuditServicesFactory class AuditServicesFactory
@@ -19,17 +19,17 @@ class AuditServicesFactory
private readonly SettingGateway $settingGateway private readonly SettingGateway $settingGateway
) {} ) {}
public function createApiAuditLogRepository(): ApiAuditLogRepository public function createApiAuditLogRepository(): ApiAuditLogRepositoryInterface
{ {
return $this->auditRepositoryFactory->createApiAuditLogRepository(); return $this->auditRepositoryFactory->createApiAuditLogRepository();
} }
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepositoryInterface
{ {
return $this->auditRepositoryFactory->createUserLifecycleAuditRepository(); return $this->auditRepositoryFactory->createUserLifecycleAuditRepository();
} }
public function createSystemAuditLogRepository(): SystemAuditLogRepository public function createSystemAuditLogRepository(): SystemAuditLogRepositoryInterface
{ {
return $this->auditRepositoryFactory->createSystemAuditLogRepository(); return $this->auditRepositoryFactory->createSystemAuditLogRepository();
} }

View File

@@ -3,7 +3,7 @@
namespace MintyPHP\Service\Audit; namespace MintyPHP\Service\Audit;
use MintyPHP\Domain\Taxonomy\ImportAuditStatus; use MintyPHP\Domain\Taxonomy\ImportAuditStatus;
use MintyPHP\Repository\Audit\ImportAuditRunRepository; use MintyPHP\Repository\Audit\ImportAuditRunRepositoryInterface;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
class ImportAuditService class ImportAuditService
@@ -15,7 +15,7 @@ class ImportAuditService
*/ */
private array $startedAtByRunId = []; private array $startedAtByRunId = [];
public function __construct(private readonly ImportAuditRunRepository $importAuditRunRepository) public function __construct(private readonly ImportAuditRunRepositoryInterface $importAuditRunRepository)
{ {
} }

View File

@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\SystemAuditChannel;
use MintyPHP\Domain\Taxonomy\SystemAuditOutcome; use MintyPHP\Domain\Taxonomy\SystemAuditOutcome;
use MintyPHP\Http\RequestContext; use MintyPHP\Http\RequestContext;
use MintyPHP\Http\ApiAuth; use MintyPHP\Http\ApiAuth;
use MintyPHP\Repository\Audit\SystemAuditLogRepository; use MintyPHP\Repository\Audit\SystemAuditLogRepositoryInterface;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
use MintyPHP\Service\Settings\SettingGateway; use MintyPHP\Service\Settings\SettingGateway;
@@ -17,7 +17,7 @@ class SystemAuditService
private const RETENTION_DAYS_FALLBACK = 365; private const RETENTION_DAYS_FALLBACK = 365;
public function __construct( public function __construct(
private readonly SystemAuditLogRepository $systemAuditLogRepository, private readonly SystemAuditLogRepositoryInterface $systemAuditLogRepository,
private readonly SystemAuditRedactionService $systemAuditRedactionService, private readonly SystemAuditRedactionService $systemAuditRedactionService,
private readonly SettingGateway $settingGateway private readonly SettingGateway $settingGateway
) { ) {

View File

@@ -5,7 +5,7 @@ namespace MintyPHP\Service\Audit;
use MintyPHP\Domain\Taxonomy\UserLifecycleAction; use MintyPHP\Domain\Taxonomy\UserLifecycleAction;
use MintyPHP\Domain\Taxonomy\UserLifecycleStatus; use MintyPHP\Domain\Taxonomy\UserLifecycleStatus;
use MintyPHP\Domain\Taxonomy\UserLifecycleTriggerType; use MintyPHP\Domain\Taxonomy\UserLifecycleTriggerType;
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository; use MintyPHP\Repository\Audit\UserLifecycleAuditRepositoryInterface;
use MintyPHP\Support\Crypto; use MintyPHP\Support\Crypto;
class UserLifecycleAuditService class UserLifecycleAuditService
@@ -42,7 +42,7 @@ class UserLifecycleAuditService
'active_changed_at', 'active_changed_at',
]; ];
public function __construct(private readonly UserLifecycleAuditRepository $userLifecycleAuditRepository) public function __construct(private readonly UserLifecycleAuditRepositoryInterface $userLifecycleAuditRepository)
{ {
} }

View File

@@ -2,17 +2,17 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Repository\Auth\ApiTokenRepository; use MintyPHP\Repository\Auth\ApiTokenRepositoryInterface;
use MintyPHP\Repository\Support\DatabaseSessionRepository; use MintyPHP\Repository\Support\DatabaseSessionRepository;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
class ApiTokenService class ApiTokenService
{ {
private const MAX_TOKENS_PER_USER = 10; private const MAX_TOKENS_PER_USER = 10;
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly ApiTokenRepository $apiTokenRepository, private readonly ApiTokenRepositoryInterface $apiTokenRepository,
private readonly AuthSettingsGateway $settingsGateway, private readonly AuthSettingsGateway $settingsGateway,
private readonly AuthScopeGateway $scopeGateway, private readonly AuthScopeGateway $scopeGateway,
private readonly DatabaseSessionRepository $databaseSessionRepository private readonly DatabaseSessionRepository $databaseSessionRepository

View File

@@ -2,11 +2,11 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Repository\User\UserExternalIdentityRepository; use MintyPHP\Repository\User\UserExternalIdentityRepositoryInterface;
class AuthExternalIdentityGateway class AuthExternalIdentityGateway
{ {
public function __construct(private readonly UserExternalIdentityRepository $userExternalIdentityRepository) public function __construct(private readonly UserExternalIdentityRepositoryInterface $userExternalIdentityRepository)
{ {
} }

View File

@@ -3,12 +3,19 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Repository\Auth\ApiTokenRepository; use MintyPHP\Repository\Auth\ApiTokenRepository;
use MintyPHP\Repository\Auth\ApiTokenRepositoryInterface;
use MintyPHP\Repository\Auth\EmailVerificationRepository; use MintyPHP\Repository\Auth\EmailVerificationRepository;
use MintyPHP\Repository\Auth\EmailVerificationRepositoryInterface;
use MintyPHP\Repository\Auth\PasswordResetRepository; use MintyPHP\Repository\Auth\PasswordResetRepository;
use MintyPHP\Repository\Auth\PasswordResetRepositoryInterface;
use MintyPHP\Repository\Auth\RememberTokenRepository; use MintyPHP\Repository\Auth\RememberTokenRepository;
use MintyPHP\Repository\Auth\RememberTokenRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepository; use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepository;
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepository; use MintyPHP\Repository\Tenant\TenantRepository;
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
use MintyPHP\Repository\User\UserExternalIdentityRepository; use MintyPHP\Repository\User\UserExternalIdentityRepository;
use MintyPHP\Repository\User\UserExternalIdentityRepositoryInterface;
class AuthRepositoryFactory class AuthRepositoryFactory
{ {
@@ -20,37 +27,37 @@ class AuthRepositoryFactory
private ?TenantMicrosoftAuthRepository $tenantMicrosoftAuthRepository = null; private ?TenantMicrosoftAuthRepository $tenantMicrosoftAuthRepository = null;
private ?UserExternalIdentityRepository $userExternalIdentityRepository = null; private ?UserExternalIdentityRepository $userExternalIdentityRepository = null;
public function createApiTokenRepository(): ApiTokenRepository public function createApiTokenRepository(): ApiTokenRepositoryInterface
{ {
return $this->apiTokenRepository ??= new ApiTokenRepository(); return $this->apiTokenRepository ??= new ApiTokenRepository();
} }
public function createRememberTokenRepository(): RememberTokenRepository public function createRememberTokenRepository(): RememberTokenRepositoryInterface
{ {
return $this->rememberTokenRepository ??= new RememberTokenRepository(); return $this->rememberTokenRepository ??= new RememberTokenRepository();
} }
public function createPasswordResetRepository(): PasswordResetRepository public function createPasswordResetRepository(): PasswordResetRepositoryInterface
{ {
return $this->passwordResetRepository ??= new PasswordResetRepository(); return $this->passwordResetRepository ??= new PasswordResetRepository();
} }
public function createEmailVerificationRepository(): EmailVerificationRepository public function createEmailVerificationRepository(): EmailVerificationRepositoryInterface
{ {
return $this->emailVerificationRepository ??= new EmailVerificationRepository(); return $this->emailVerificationRepository ??= new EmailVerificationRepository();
} }
public function createTenantRepository(): TenantRepository public function createTenantRepository(): TenantRepositoryInterface
{ {
return $this->tenantRepository ??= new TenantRepository(); return $this->tenantRepository ??= new TenantRepository();
} }
public function createTenantMicrosoftAuthRepository(): TenantMicrosoftAuthRepository public function createTenantMicrosoftAuthRepository(): TenantMicrosoftAuthRepositoryInterface
{ {
return $this->tenantMicrosoftAuthRepository ??= new TenantMicrosoftAuthRepository(); return $this->tenantMicrosoftAuthRepository ??= new TenantMicrosoftAuthRepository();
} }
public function createUserExternalIdentityRepository(): UserExternalIdentityRepository public function createUserExternalIdentityRepository(): UserExternalIdentityRepositoryInterface
{ {
return $this->userExternalIdentityRepository ??= new UserExternalIdentityRepository(); return $this->userExternalIdentityRepository ??= new UserExternalIdentityRepository();
} }

View File

@@ -3,8 +3,8 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Auth; use MintyPHP\Auth;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Repository\User\UserWriteRepository; use MintyPHP\Repository\User\UserWriteRepositoryInterface;
use MintyPHP\Router; use MintyPHP\Router;
use MintyPHP\Service\User\UserAccountService; use MintyPHP\Service\User\UserAccountService;
use MintyPHP\Service\User\UserTenantContextService; use MintyPHP\Service\User\UserTenantContextService;
@@ -15,8 +15,8 @@ use MintyPHP\Support\Flash;
class AuthService class AuthService
{ {
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly UserWriteRepository $userWriteRepository, private readonly UserWriteRepositoryInterface $userWriteRepository,
private readonly UserAccountService $userAccountService, private readonly UserAccountService $userAccountService,
private readonly UserTenantContextService $userTenantContextService, private readonly UserTenantContextService $userTenantContextService,
private readonly RememberMeService $rememberMeService, private readonly RememberMeService $rememberMeService,

View File

@@ -2,11 +2,11 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Repository\Tenant\TenantRepository; use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
class AuthTenantGateway class AuthTenantGateway
{ {
public function __construct(private readonly TenantRepository $tenantRepository) public function __construct(private readonly TenantRepositoryInterface $tenantRepository)
{ {
} }

View File

@@ -4,9 +4,9 @@ namespace MintyPHP\Service\Auth;
use MintyPHP\Http\Request; use MintyPHP\Http\Request;
use MintyPHP\I18n; use MintyPHP\I18n;
use MintyPHP\Repository\Auth\EmailVerificationRepository; use MintyPHP\Repository\Auth\EmailVerificationRepositoryInterface;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Repository\User\UserWriteRepository; use MintyPHP\Repository\User\UserWriteRepositoryInterface;
use MintyPHP\Service\Mail\MailService; use MintyPHP\Service\Mail\MailService;
class EmailVerificationService class EmailVerificationService
@@ -16,9 +16,9 @@ class EmailVerificationService
private const MAX_ATTEMPTS = 5; private const MAX_ATTEMPTS = 5;
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly UserWriteRepository $userWriteRepository, private readonly UserWriteRepositoryInterface $userWriteRepository,
private readonly EmailVerificationRepository $emailVerificationRepository, private readonly EmailVerificationRepositoryInterface $emailVerificationRepository,
private readonly MailService $mailService private readonly MailService $mailService
) { ) {
} }

View File

@@ -4,8 +4,8 @@ namespace MintyPHP\Service\Auth;
use MintyPHP\Http\Request; use MintyPHP\Http\Request;
use MintyPHP\I18n; use MintyPHP\I18n;
use MintyPHP\Repository\Auth\PasswordResetRepository; use MintyPHP\Repository\Auth\PasswordResetRepositoryInterface;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Service\Mail\MailService; use MintyPHP\Service\Mail\MailService;
use MintyPHP\Service\User\UserPasswordService; use MintyPHP\Service\User\UserPasswordService;
@@ -16,8 +16,8 @@ class PasswordResetService
private const MAX_ATTEMPTS = 5; private const MAX_ATTEMPTS = 5;
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly PasswordResetRepository $passwordResetRepository, private readonly PasswordResetRepositoryInterface $passwordResetRepository,
private readonly UserPasswordService $userPasswordService, private readonly UserPasswordService $userPasswordService,
private readonly RememberMeService $rememberMeService, private readonly RememberMeService $rememberMeService,
private readonly MailService $mailService private readonly MailService $mailService

View File

@@ -4,9 +4,9 @@ namespace MintyPHP\Service\Auth;
use MintyPHP\Auth; use MintyPHP\Auth;
use MintyPHP\I18n; use MintyPHP\I18n;
use MintyPHP\Repository\Auth\RememberTokenRepository; use MintyPHP\Repository\Auth\RememberTokenRepositoryInterface;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Repository\User\UserWriteRepository; use MintyPHP\Repository\User\UserWriteRepositoryInterface;
use MintyPHP\Service\User\UserTenantContextService; use MintyPHP\Service\User\UserTenantContextService;
use MintyPHP\Session; use MintyPHP\Session;
@@ -16,9 +16,9 @@ class RememberMeService
private const LIFETIME_DAYS = 30; private const LIFETIME_DAYS = 30;
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly UserWriteRepository $userWriteRepository, private readonly UserWriteRepositoryInterface $userWriteRepository,
private readonly RememberTokenRepository $rememberTokenRepository, private readonly RememberTokenRepositoryInterface $rememberTokenRepository,
private readonly UserTenantContextService $userTenantContextService, private readonly UserTenantContextService $userTenantContextService,
private readonly AuthPermissionGateway $permissionGateway, private readonly AuthPermissionGateway $permissionGateway,
private readonly AuthSavedFilterGateway $savedFilterGateway private readonly AuthSavedFilterGateway $savedFilterGateway

View File

@@ -2,19 +2,19 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Repository\Tenant\UserTenantRepository; use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Repository\User\UserWriteRepository; use MintyPHP\Repository\User\UserWriteRepositoryInterface;
use MintyPHP\Service\User\UserAssignmentService; use MintyPHP\Service\User\UserAssignmentService;
use MintyPHP\Service\User\UserAvatarService; use MintyPHP\Service\User\UserAvatarService;
class SsoUserLinkService class SsoUserLinkService
{ {
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly UserWriteRepository $userWriteRepository, private readonly UserWriteRepositoryInterface $userWriteRepository,
private readonly UserAssignmentService $userAssignmentService, private readonly UserAssignmentService $userAssignmentService,
private readonly UserTenantRepository $userTenantRepository, private readonly UserTenantRepositoryInterface $userTenantRepository,
private readonly AuthSettingsGateway $settingsGateway, private readonly AuthSettingsGateway $settingsGateway,
private readonly AuthTenantSsoGateway $tenantSsoGateway, private readonly AuthTenantSsoGateway $tenantSsoGateway,
private readonly AuthAvatarGateway $avatarGateway, private readonly AuthAvatarGateway $avatarGateway,

View File

@@ -2,7 +2,7 @@
namespace MintyPHP\Service\Auth; namespace MintyPHP\Service\Auth;
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepository; use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepositoryInterface;
class TenantSsoService class TenantSsoService
{ {
@@ -20,7 +20,7 @@ class TenantSsoService
public function __construct( public function __construct(
private readonly AuthTenantGateway $tenantGateway, private readonly AuthTenantGateway $tenantGateway,
private readonly TenantMicrosoftAuthRepository $tenantMicrosoftAuthRepository, private readonly TenantMicrosoftAuthRepositoryInterface $tenantMicrosoftAuthRepository,
private readonly AuthSettingsGateway $settingsGateway, private readonly AuthSettingsGateway $settingsGateway,
private readonly AuthCryptoGateway $cryptoGateway private readonly AuthCryptoGateway $cryptoGateway
) { ) {

View File

@@ -3,8 +3,11 @@
namespace MintyPHP\Service\Directory; namespace MintyPHP\Service\Directory;
use MintyPHP\Repository\Access\RoleRepository; use MintyPHP\Repository\Access\RoleRepository;
use MintyPHP\Repository\Access\RoleRepositoryInterface;
use MintyPHP\Repository\Org\DepartmentRepository; use MintyPHP\Repository\Org\DepartmentRepository;
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepository; use MintyPHP\Repository\Tenant\TenantRepository;
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
class DirectoryRepositoryFactory class DirectoryRepositoryFactory
{ {
@@ -12,17 +15,17 @@ class DirectoryRepositoryFactory
private ?DepartmentRepository $departmentRepository = null; private ?DepartmentRepository $departmentRepository = null;
private ?RoleRepository $roleRepository = null; private ?RoleRepository $roleRepository = null;
public function createTenantRepository(): TenantRepository public function createTenantRepository(): TenantRepositoryInterface
{ {
return $this->tenantRepository ??= new TenantRepository(); return $this->tenantRepository ??= new TenantRepository();
} }
public function createDepartmentRepository(): DepartmentRepository public function createDepartmentRepository(): DepartmentRepositoryInterface
{ {
return $this->departmentRepository ??= new DepartmentRepository(); return $this->departmentRepository ??= new DepartmentRepository();
} }
public function createRoleRepository(): RoleRepository public function createRoleRepository(): RoleRepositoryInterface
{ {
return $this->roleRepository ??= new RoleRepository(); return $this->roleRepository ??= new RoleRepository();
} }

View File

@@ -2,9 +2,9 @@
namespace MintyPHP\Service\Directory; namespace MintyPHP\Service\Directory;
use MintyPHP\Repository\Access\RoleRepository; use MintyPHP\Repository\Access\RoleRepositoryInterface;
use MintyPHP\Repository\Org\DepartmentRepository; use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepository; use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
use MintyPHP\Service\Access\RoleService; use MintyPHP\Service\Access\RoleService;
use MintyPHP\Service\Audit\AuditServicesFactory; use MintyPHP\Service\Audit\AuditServicesFactory;
use MintyPHP\Service\Org\DepartmentService; use MintyPHP\Service\Org\DepartmentService;
@@ -54,17 +54,17 @@ class DirectoryServicesFactory
); );
} }
public function createTenantRepository(): TenantRepository public function createTenantRepository(): TenantRepositoryInterface
{ {
return $this->directoryRepositoryFactory->createTenantRepository(); return $this->directoryRepositoryFactory->createTenantRepository();
} }
public function createDepartmentRepository(): DepartmentRepository public function createDepartmentRepository(): DepartmentRepositoryInterface
{ {
return $this->directoryRepositoryFactory->createDepartmentRepository(); return $this->directoryRepositoryFactory->createDepartmentRepository();
} }
public function createRoleRepository(): RoleRepository public function createRoleRepository(): RoleRepositoryInterface
{ {
return $this->directoryRepositoryFactory->createRoleRepository(); return $this->directoryRepositoryFactory->createRoleRepository();
} }

View File

@@ -3,12 +3,13 @@
namespace MintyPHP\Service\Import; namespace MintyPHP\Service\Import;
use MintyPHP\Repository\Audit\ImportAuditRunRepository; use MintyPHP\Repository\Audit\ImportAuditRunRepository;
use MintyPHP\Repository\Audit\ImportAuditRunRepositoryInterface;
class ImportRepositoryFactory class ImportRepositoryFactory
{ {
private ?ImportAuditRunRepository $importAuditRunRepository = null; private ?ImportAuditRunRepository $importAuditRunRepository = null;
public function createImportAuditRunRepository(): ImportAuditRunRepository public function createImportAuditRunRepository(): ImportAuditRunRepositoryInterface
{ {
return $this->importAuditRunRepository ??= new ImportAuditRunRepository(); return $this->importAuditRunRepository ??= new ImportAuditRunRepository();
} }

View File

@@ -2,7 +2,7 @@
namespace MintyPHP\Service\Import; namespace MintyPHP\Service\Import;
use MintyPHP\Repository\Audit\ImportAuditRunRepository; use MintyPHP\Repository\Audit\ImportAuditRunRepositoryInterface;
use MintyPHP\Service\Access\AccessServicesFactory; use MintyPHP\Service\Access\AccessServicesFactory;
use MintyPHP\Service\Access\PermissionGateway; use MintyPHP\Service\Access\PermissionGateway;
use MintyPHP\Service\Audit\ImportAuditService; use MintyPHP\Service\Audit\ImportAuditService;
@@ -86,7 +86,7 @@ class ImportServicesFactory
return $this->importTempFileService ??= new ImportTempFileService(); return $this->importTempFileService ??= new ImportTempFileService();
} }
private function getImportAuditRunRepository(): ImportAuditRunRepository private function getImportAuditRunRepository(): ImportAuditRunRepositoryInterface
{ {
return $this->importRepositoryFactory->createImportAuditRunRepository(); return $this->importRepositoryFactory->createImportAuditRunRepository();
} }

View File

@@ -2,15 +2,15 @@
namespace MintyPHP\Service\Import\Profile; namespace MintyPHP\Service\Import\Profile;
use MintyPHP\Repository\Org\DepartmentRepository; use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepository; use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
use MintyPHP\Service\Org\DepartmentService; use MintyPHP\Service\Org\DepartmentService;
class DepartmentImportGateway class DepartmentImportGateway
{ {
public function __construct( public function __construct(
private readonly DepartmentRepository $departmentRepository, private readonly DepartmentRepositoryInterface $departmentRepository,
private readonly TenantRepository $tenantRepository, private readonly TenantRepositoryInterface $tenantRepository,
private readonly DepartmentService $departmentService private readonly DepartmentService $departmentService
) { ) {
} }
@@ -44,12 +44,12 @@ class DepartmentImportGateway
return $this->departmentService()->createFromAdmin($input, $currentUserId); return $this->departmentService()->createFromAdmin($input, $currentUserId);
} }
private function departmentRepository(): DepartmentRepository private function departmentRepository(): DepartmentRepositoryInterface
{ {
return $this->departmentRepository; return $this->departmentRepository;
} }
private function tenantRepository(): TenantRepository private function tenantRepository(): TenantRepositoryInterface
{ {
return $this->tenantRepository; return $this->tenantRepository;
} }

View File

@@ -2,17 +2,17 @@
namespace MintyPHP\Service\Import\Profile; namespace MintyPHP\Service\Import\Profile;
use MintyPHP\Repository\Access\RoleRepository; use MintyPHP\Repository\Access\RoleRepositoryInterface;
use MintyPHP\Repository\Org\DepartmentRepository; use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepository; use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
use MintyPHP\Repository\User\UserReadRepository; use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Service\User\UserAccountService; use MintyPHP\Service\User\UserAccountService;
use MintyPHP\Service\User\UserRepositoryFactory; use MintyPHP\Service\User\UserRepositoryFactory;
class UserImportGateway class UserImportGateway
{ {
public function __construct( public function __construct(
private readonly UserReadRepository $userReadRepository, private readonly UserReadRepositoryInterface $userReadRepository,
private readonly UserAccountService $userAccountService, private readonly UserAccountService $userAccountService,
private readonly UserRepositoryFactory $userRepositoryFactory private readonly UserRepositoryFactory $userRepositoryFactory
) { ) {
@@ -62,17 +62,17 @@ class UserImportGateway
return $this->userAccountService->createFromAdmin($input, $currentUserId); return $this->userAccountService->createFromAdmin($input, $currentUserId);
} }
private function tenantRepository(): TenantRepository private function tenantRepository(): TenantRepositoryInterface
{ {
return $this->userRepositoryFactory->createTenantRepository(); return $this->userRepositoryFactory->createTenantRepository();
} }
private function roleRepository(): RoleRepository private function roleRepository(): RoleRepositoryInterface
{ {
return $this->userRepositoryFactory->createRoleRepository(); return $this->userRepositoryFactory->createRoleRepository();
} }
private function departmentRepository(): DepartmentRepository private function departmentRepository(): DepartmentRepositoryInterface
{ {
return $this->userRepositoryFactory->createDepartmentRepository(); return $this->userRepositoryFactory->createDepartmentRepository();
} }

View File

@@ -2,11 +2,11 @@
namespace MintyPHP\Service\Mail; namespace MintyPHP\Service\Mail;
use MintyPHP\Repository\Mail\MailLogRepository; use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
class MailLogService class MailLogService
{ {
public function __construct(private readonly MailLogRepository $mailLogRepository) public function __construct(private readonly MailLogRepositoryInterface $mailLogRepository)
{ {
} }

View File

@@ -3,12 +3,13 @@
namespace MintyPHP\Service\Mail; namespace MintyPHP\Service\Mail;
use MintyPHP\Repository\Mail\MailLogRepository; use MintyPHP\Repository\Mail\MailLogRepository;
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
class MailRepositoryFactory class MailRepositoryFactory
{ {
private ?MailLogRepository $mailLogRepository = null; private ?MailLogRepository $mailLogRepository = null;
public function createMailLogRepository(): MailLogRepository public function createMailLogRepository(): MailLogRepositoryInterface
{ {
return $this->mailLogRepository ??= new MailLogRepository(); return $this->mailLogRepository ??= new MailLogRepository();
} }

View File

@@ -4,7 +4,7 @@ namespace MintyPHP\Service\Mail;
use MintyPHP\Domain\Taxonomy\MailLogStatus; use MintyPHP\Domain\Taxonomy\MailLogStatus;
use MintyPHP\I18n; use MintyPHP\I18n;
use MintyPHP\Repository\Mail\MailLogRepository; use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
use MintyPHP\Service\Settings\SettingGateway; use MintyPHP\Service\Settings\SettingGateway;
use PHPMailer\PHPMailer\Exception as MailerException; use PHPMailer\PHPMailer\Exception as MailerException;
use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\PHPMailer;
@@ -12,7 +12,7 @@ use PHPMailer\PHPMailer\PHPMailer;
class MailService class MailService
{ {
public function __construct( public function __construct(
private readonly MailLogRepository $mailLogRepository, private readonly MailLogRepositoryInterface $mailLogRepository,
private readonly SettingGateway $settingGateway private readonly SettingGateway $settingGateway
) { ) {
} }

View File

@@ -2,7 +2,7 @@
namespace MintyPHP\Service\Mail; namespace MintyPHP\Service\Mail;
use MintyPHP\Repository\Mail\MailLogRepository; use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
use MintyPHP\Service\Settings\SettingGateway; use MintyPHP\Service\Settings\SettingGateway;
class MailServicesFactory class MailServicesFactory
@@ -15,7 +15,7 @@ class MailServicesFactory
private readonly SettingGateway $settingGateway private readonly SettingGateway $settingGateway
) {} ) {}
public function createMailLogRepository(): MailLogRepository public function createMailLogRepository(): MailLogRepositoryInterface
{ {
return $this->mailRepositoryFactory->createMailLogRepository(); return $this->mailRepositoryFactory->createMailLogRepository();
} }

View File

@@ -2,7 +2,7 @@
namespace MintyPHP\Service\Org; namespace MintyPHP\Service\Org;
use MintyPHP\Repository\Org\DepartmentRepository; use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Service\Audit\SystemAuditService; use MintyPHP\Service\Audit\SystemAuditService;
use MintyPHP\Service\Directory\DirectoryScopeGateway; use MintyPHP\Service\Directory\DirectoryScopeGateway;
use MintyPHP\Service\Directory\DirectorySettingsGateway; use MintyPHP\Service\Directory\DirectorySettingsGateway;
@@ -12,7 +12,7 @@ class DepartmentService
{ {
public function __construct( public function __construct(
private readonly UserServicesFactory $userServicesFactory, private readonly UserServicesFactory $userServicesFactory,
private readonly DepartmentRepository $departmentRepository, private readonly DepartmentRepositoryInterface $departmentRepository,
private readonly DirectorySettingsGateway $settingsGateway, private readonly DirectorySettingsGateway $settingsGateway,
private readonly DirectoryScopeGateway $scopeGateway, private readonly DirectoryScopeGateway $scopeGateway,
private readonly SystemAuditService $systemAuditService private readonly SystemAuditService $systemAuditService

View File

@@ -2,16 +2,16 @@
namespace MintyPHP\Service\Scheduler; namespace MintyPHP\Service\Scheduler;
use MintyPHP\Repository\Scheduler\ScheduledJobRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
class ScheduledJobService class ScheduledJobService
{ {
private const RUN_RETENTION_DAYS = 90; private const RUN_RETENTION_DAYS = 90;
public function __construct( public function __construct(
private readonly ScheduledJobRepository $scheduledJobRepository, private readonly ScheduledJobRepositoryInterface $scheduledJobRepository,
private readonly ScheduledJobRunRepository $scheduledJobRunRepository, private readonly ScheduledJobRunRepositoryInterface $scheduledJobRunRepository,
private readonly ScheduledJobRegistry $scheduledJobRegistry, private readonly ScheduledJobRegistry $scheduledJobRegistry,
private readonly ScheduleCalculator $scheduleCalculator private readonly ScheduleCalculator $scheduleCalculator
) { ) {

View File

@@ -3,8 +3,11 @@
namespace MintyPHP\Service\Scheduler; namespace MintyPHP\Service\Scheduler;
use MintyPHP\Repository\Scheduler\ScheduledJobRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRepository;
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository; use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
class SchedulerRepositoryFactory class SchedulerRepositoryFactory
{ {
@@ -12,17 +15,17 @@ class SchedulerRepositoryFactory
private ?ScheduledJobRunRepository $scheduledJobRunRepository = null; private ?ScheduledJobRunRepository $scheduledJobRunRepository = null;
private ?SchedulerRuntimeRepository $schedulerRuntimeRepository = null; private ?SchedulerRuntimeRepository $schedulerRuntimeRepository = null;
public function createScheduledJobRepository(): ScheduledJobRepository public function createScheduledJobRepository(): ScheduledJobRepositoryInterface
{ {
return $this->scheduledJobRepository ??= new ScheduledJobRepository(); return $this->scheduledJobRepository ??= new ScheduledJobRepository();
} }
public function createScheduledJobRunRepository(): ScheduledJobRunRepository public function createScheduledJobRunRepository(): ScheduledJobRunRepositoryInterface
{ {
return $this->scheduledJobRunRepository ??= new ScheduledJobRunRepository(); return $this->scheduledJobRunRepository ??= new ScheduledJobRunRepository();
} }
public function createSchedulerRuntimeRepository(): SchedulerRuntimeRepository public function createSchedulerRuntimeRepository(): SchedulerRuntimeRepositoryInterface
{ {
return $this->schedulerRuntimeRepository ??= new SchedulerRuntimeRepository(); return $this->schedulerRuntimeRepository ??= new SchedulerRuntimeRepository();
} }

View File

@@ -6,9 +6,9 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobRunStatus;
use MintyPHP\Domain\Taxonomy\ScheduledJobTriggerType; use MintyPHP\Domain\Taxonomy\ScheduledJobTriggerType;
use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult; use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult;
use MintyPHP\Domain\Taxonomy\SystemAuditOutcome; use MintyPHP\Domain\Taxonomy\SystemAuditOutcome;
use MintyPHP\Repository\Scheduler\ScheduledJobRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository; use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
use MintyPHP\Repository\Support\DatabaseSessionRepository; use MintyPHP\Repository\Support\DatabaseSessionRepository;
use MintyPHP\Repository\Support\RepoQuery; use MintyPHP\Repository\Support\RepoQuery;
use MintyPHP\Service\Audit\SystemAuditService; use MintyPHP\Service\Audit\SystemAuditService;
@@ -27,9 +27,9 @@ class SchedulerRunService
public function __construct( public function __construct(
private readonly ScheduledJobService $scheduledJobService, private readonly ScheduledJobService $scheduledJobService,
private readonly ScheduledJobRepository $scheduledJobRepository, private readonly ScheduledJobRepositoryInterface $scheduledJobRepository,
private readonly ScheduledJobRunRepository $scheduledJobRunRepository, private readonly ScheduledJobRunRepositoryInterface $scheduledJobRunRepository,
private readonly SchedulerRuntimeRepository $schedulerRuntimeRepository, private readonly SchedulerRuntimeRepositoryInterface $schedulerRuntimeRepository,
private readonly ScheduledJobRegistry $scheduledJobRegistry, private readonly ScheduledJobRegistry $scheduledJobRegistry,
private readonly ScheduleCalculator $scheduleCalculator, private readonly ScheduleCalculator $scheduleCalculator,
private readonly DatabaseSessionRepository $databaseSessionRepository, private readonly DatabaseSessionRepository $databaseSessionRepository,

View File

@@ -2,9 +2,9 @@
namespace MintyPHP\Service\Scheduler; namespace MintyPHP\Service\Scheduler;
use MintyPHP\Repository\Scheduler\ScheduledJobRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository; use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository; use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
use MintyPHP\Repository\Support\DatabaseSessionRepository; use MintyPHP\Repository\Support\DatabaseSessionRepository;
use MintyPHP\Service\Audit\AuditServicesFactory; use MintyPHP\Service\Audit\AuditServicesFactory;
use MintyPHP\Service\Audit\SystemAuditService; use MintyPHP\Service\Audit\SystemAuditService;
@@ -54,17 +54,17 @@ class SchedulerServicesFactory
return $this->getUserLifecycleService(); return $this->getUserLifecycleService();
} }
private function getScheduledJobRepository(): ScheduledJobRepository private function getScheduledJobRepository(): ScheduledJobRepositoryInterface
{ {
return $this->schedulerRepositoryFactory->createScheduledJobRepository(); return $this->schedulerRepositoryFactory->createScheduledJobRepository();
} }
private function getScheduledJobRunRepository(): ScheduledJobRunRepository private function getScheduledJobRunRepository(): ScheduledJobRunRepositoryInterface
{ {
return $this->schedulerRepositoryFactory->createScheduledJobRunRepository(); return $this->schedulerRepositoryFactory->createScheduledJobRunRepository();
} }
private function getSchedulerRuntimeRepository(): SchedulerRuntimeRepository private function getSchedulerRuntimeRepository(): SchedulerRuntimeRepositoryInterface
{ {
return $this->schedulerRepositoryFactory->createSchedulerRuntimeRepository(); return $this->schedulerRepositoryFactory->createSchedulerRuntimeRepository();
} }

Some files were not shown because too many files have changed in this diff Show More