add torrent download events #4

This commit is contained in:
ghost 2023-10-11 01:42:19 +03:00
parent 964dae97aa
commit 855929f592
6 changed files with 162 additions and 6 deletions

View file

@ -151,6 +151,67 @@ class ActivityService
return $activity;
}
/// Torrent Download
public function addEventTorrentDownloadFileAdd(
int $userId,
int $added,
int $torrentId
): ?Activity
{
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_TORRENT_DOWNLOAD_FILE_ADD
);
$activity->setUserId(
$userId
);
$activity->setAdded(
$added
);
$activity->setTorrentId(
$torrentId
);
$this->entityManagerInterface->persist($activity);
$this->entityManagerInterface->flush();
return $activity;
}
public function addEventTorrentDownloadMagnetAdd(
int $userId,
int $added,
int $torrentId
): ?Activity
{
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_TORRENT_DOWNLOAD_MAGNET_ADD
);
$activity->setUserId(
$userId
);
$activity->setAdded(
$added
);
$activity->setTorrentId(
$torrentId
);
$this->entityManagerInterface->persist($activity);
$this->entityManagerInterface->flush();
return $activity;
}
/// Torrent star
public function addEventTorrentStarAdd(
int $userId,

View file

@ -630,7 +630,7 @@ class TorrentService
->findTorrentDownloadFilesTotalByTorrentId($torrentId);
}
public function registerTorrentDownloadFile(
public function addTorrentDownloadFile(
int $torrentId,
int $userId,
int $added
@ -672,7 +672,7 @@ class TorrentService
->findTorrentDownloadMagnetsTotalByTorrentId($torrentId);
}
public function registerTorrentDownloadMagnet(
public function addTorrentDownloadMagnet(
int $torrentId,
int $userId,
int $added