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

@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
use MintyPHP\DB;
class TenantMicrosoftAuthRepository
class TenantMicrosoftAuthRepository implements TenantMicrosoftAuthRepositoryInterface
{
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\Repository\Support\RepoQuery;
class TenantRepository
class TenantRepository implements TenantRepositoryInterface
{
private function unwrap(?array $row): ?array
{
@@ -168,7 +168,7 @@ class TenantRepository
return $this->unwrap($row);
}
public function create(array $data)
public function create(array $data): mixed
{
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())',

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;
class UserTenantRepository
class UserTenantRepository implements UserTenantRepositoryInterface
{
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;
}