Repo Interface für tests
This commit is contained in:
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class TenantMicrosoftAuthRepository
|
||||
class TenantMicrosoftAuthRepository implements TenantMicrosoftAuthRepositoryInterface
|
||||
{
|
||||
private function unwrap($row): ?array
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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())',
|
||||
|
||||
26
lib/Repository/Tenant/TenantRepositoryInterface.php
Normal file
26
lib/Repository/Tenant/TenantRepositoryInterface.php
Normal 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;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserTenantRepository
|
||||
class UserTenantRepository implements UserTenantRepositoryInterface
|
||||
{
|
||||
public function listTenantIdsByUserId(int $userId): array
|
||||
{
|
||||
|
||||
14
lib/Repository/Tenant/UserTenantRepositoryInterface.php
Normal file
14
lib/Repository/Tenant/UserTenantRepositoryInterface.php
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user