TextRepository gains findByUser; JsonTextRepository and the fake implement filtering by stored userId. TextController splits the list endpoint into getMyTexts (own) and getAllTexts (admin), and getText now requires the session user, returning 403 to non-owners while admins bypass.
24 lines
387 B
PHP
24 lines
387 B
PHP
<?php
|
|
|
|
namespace App\Text;
|
|
|
|
use App\Text\Text;
|
|
use App\Text\CreateTextDto;
|
|
use App\User\User;
|
|
|
|
interface TextRepository
|
|
{
|
|
public function create(CreateTextDto $dto): Text;
|
|
|
|
public function find(int $id): ?Text;
|
|
|
|
/**
|
|
* @return Text[]
|
|
*/
|
|
public function getAll(): array;
|
|
|
|
/**
|
|
* @return Text[]
|
|
*/
|
|
public function findByUser(User $user): array;
|
|
}
|