implement locales moderation methods

This commit is contained in:
ghost 2023-10-08 14:21:15 +03:00
parent fafca13b32
commit d34ff8ecc6
3 changed files with 192 additions and 14 deletions

View file

@ -158,6 +158,36 @@ class TorrentService
->findTorrentSensitive($torrentId);
}
// Update
public function toggleTorrentLocalesApproved(
int $id
): ?TorrentLocales
{
$torrentLocales = $this->getTorrentLocales($id);
$torrentLocales->setApproved(
!$torrentLocales->isApproved() // toggle current value
);
$this->entityManagerInterface->persist($torrentLocales);
$this->entityManagerInterface->flush();
return $torrentLocales;
}
// Delete
public function deleteTorrentLocales(
int $id
): ?TorrentLocales
{
$torrentLocales = $this->getTorrentLocales($id);
$this->entityManagerInterface->remove($torrentLocales);
$this->entityManagerInterface->flush();
return $torrentLocales;
}
// Setters
public function add(
string $filepath,