Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Engine\Domain\Repository; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Universal Record Co-Owner Relational Repository Contract. |
| 13 | * |
| 14 | * Manages M:M user co-ownership assignments across all system modules. |
| 15 | * |
| 16 | * @package App\Core\Engine\Domain\Repository |
| 17 | */ |
| 18 | interface RecordCoOwnerRepositoryInterface |
| 19 | { |
| 20 | /** |
| 21 | * Retrieves list of co-owner user IDs for a given module record. |
| 22 | * |
| 23 | * @param string $moduleName Module machine name. |
| 24 | * @param int $recordId Target record ID. |
| 25 | * @return array<int> List of user IDs. |
| 26 | */ |
| 27 | public function findCoOwnerIds(string $moduleName, int $recordId): array; |
| 28 | |
| 29 | /** |
| 30 | * Synchronizes co-owner user IDs for a module record (diff insert / delete). |
| 31 | * |
| 32 | * @param string $moduleName Module machine name. |
| 33 | * @param int $recordId Target record ID. |
| 34 | * @param array<int> $userIds Desired list of co-owner user IDs. |
| 35 | */ |
| 36 | public function syncCoOwners(string $moduleName, int $recordId, array $userIds): void; |
| 37 | |
| 38 | /** |
| 39 | * Adds single co-owner to a record. |
| 40 | * |
| 41 | * @param string $moduleName Module machine name. |
| 42 | * @param int $recordId Target record ID. |
| 43 | * @param int $userId User ID. |
| 44 | */ |
| 45 | public function addCoOwner(string $moduleName, int $recordId, int $userId): void; |
| 46 | |
| 47 | /** |
| 48 | * Removes single co-owner from a record. |
| 49 | * |
| 50 | * @param string $moduleName Module machine name. |
| 51 | * @param int $recordId Target record ID. |
| 52 | * @param int $userId User ID. |
| 53 | */ |
| 54 | public function removeCoOwner(string $moduleName, int $recordId, int $userId): void; |
| 55 | |
| 56 | /** |
| 57 | * Checks whether given user is a co-owner of the record. |
| 58 | * |
| 59 | * @param string $moduleName Module machine name. |
| 60 | * @param int $recordId Target record ID. |
| 61 | * @param int $userId User ID. |
| 62 | * @return bool True if co-owner. |
| 63 | */ |
| 64 | public function isCoOwner(string $moduleName, int $recordId, int $userId): bool; |
| 65 | |
| 66 | /** |
| 67 | * Deletes all co-owner assignments for a deleted record. |
| 68 | * |
| 69 | * @param string $moduleName Module machine name. |
| 70 | * @param int $recordId Target record ID. |
| 71 | */ |
| 72 | public function deleteForRecord(string $moduleName, int $recordId): void; |
| 73 | } |