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\User;
use MintyPHP\DB;
class UserExternalIdentityRepository
class UserExternalIdentityRepository implements UserExternalIdentityRepositoryInterface
{
private function unwrap($row): ?array
{
@@ -39,7 +39,7 @@ class UserExternalIdentityRepository
return $this->unwrap($row);
}
public function createLink(array $data)
public function createLink(array $data): mixed
{
return DB::insert(
'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\Repository\Support\RepoQuery;
class UserListQueryRepository
class UserListQueryRepository implements UserListQueryRepositoryInterface
{
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;
class UserReadRepository
class UserReadRepository implements UserReadRepositoryInterface
{
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\Repository\Support\RepoQuery;
class UserSavedFilterRepository
class UserSavedFilterRepository implements UserSavedFilterRepositoryInterface
{
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\Repository\Support\RepoQuery;
class UserWriteRepository
class UserWriteRepository implements UserWriteRepositoryInterface
{
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;
}