Repo Interface für tests
This commit is contained in:
@@ -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())',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
8
lib/Repository/User/UserListQueryRepositoryInterface.php
Normal file
8
lib/Repository/User/UserListQueryRepositoryInterface.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\User;
|
||||
|
||||
interface UserListQueryRepositoryInterface
|
||||
{
|
||||
public function listPaged(array $options): array;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\User;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserReadRepository
|
||||
class UserReadRepository implements UserReadRepositoryInterface
|
||||
{
|
||||
public function findAuthzSnapshot(int $userId): ?array
|
||||
{
|
||||
|
||||
20
lib/Repository/User/UserReadRepositoryInterface.php
Normal file
20
lib/Repository/User/UserReadRepositoryInterface.php
Normal 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;
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
14
lib/Repository/User/UserSavedFilterRepositoryInterface.php
Normal file
14
lib/Repository/User/UserSavedFilterRepositoryInterface.php
Normal 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;
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
40
lib/Repository/User/UserWriteRepositoryInterface.php
Normal file
40
lib/Repository/User/UserWriteRepositoryInterface.php
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user