add torrent star event support #4

This commit is contained in:
ghost 2023-10-11 01:09:34 +03:00
parent ef84fefca3
commit a3dd5a81a9
7 changed files with 174 additions and 6 deletions

View file

@ -55,6 +55,7 @@ class ActivityService
return $activity;
}
/// User star
public function addEventUserStarAdd(
int $userId,
int $added,
@ -64,7 +65,7 @@ class ActivityService
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_USER_STAR_DELETE
Activity::EVENT_USER_STAR_ADD
);
$activity->setUserId(
@ -121,6 +122,67 @@ class ActivityService
// Torrent
/// Torrent star
public function addEventTorrentStarAdd(
int $userId,
int $added,
int $torrentId
): ?Activity
{
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_TORRENT_STAR_ADD
);
$activity->setUserId(
$userId
);
$activity->setTorrentId(
$torrentId
);
$activity->setAdded(
$added
);
$this->entityManagerInterface->persist($activity);
$this->entityManagerInterface->flush();
return $activity;
}
public function addEventTorrentStarDelete(
int $userId,
int $added,
int $torrentId
): ?Activity
{
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_TORRENT_STAR_DELETE
);
$activity->setUserId(
$userId
);
$activity->setTorrentId(
$torrentId
);
$activity->setAdded(
$added
);
$this->entityManagerInterface->persist($activity);
$this->entityManagerInterface->flush();
return $activity;
}
/// Torrent locales
public function addEventTorrentLocalesAdd(
int $userId,