implement torrent search features

This commit is contained in:
ghost 2023-10-10 04:07:59 +03:00
parent e9375f9127
commit 8ab4c0b9cf
7 changed files with 293 additions and 12 deletions

View file

@ -246,11 +246,11 @@ class TorrentService
}
// Torrent
public function getTorrent(int $id): ?Torrent
public function getTorrent(int $torrentId): ?Torrent
{
return $this->entityManagerInterface
->getRepository(Torrent::class)
->find($id);
->find($torrentId);
}
public function addTorrent(
@ -285,6 +285,15 @@ class TorrentService
);
}
public function searchTorrents(string $query) : array
{
return $this->entityManagerInterface
->getRepository(Torrent::class)
->searchByKeywords(
explode(' ', $query)
);
}
public function setTorrentsApprovedByUserId(
int $userId,
bool $value