Добавлено управление сессиями
This commit is contained in:
22
PlaylistShared.Api/Services/TrackRemovalLogService.cs
Normal file
22
PlaylistShared.Api/Services/TrackRemovalLogService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using PlaylistShared.Api.Data;
|
||||
|
||||
public class TrackRemovalLogService
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public TrackRemovalLogService(ApplicationDbContext db) => _db = db;
|
||||
|
||||
public async Task LogRemovalAsync(Guid sharedPlaylistId, string trackId, Guid? removedByUserId, string sessionId)
|
||||
{
|
||||
var log = new TrackRemovalLog
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
SharedPlaylistId = sharedPlaylistId,
|
||||
TrackId = trackId,
|
||||
RemovedByUserId = removedByUserId,
|
||||
RemovedAtUtc = DateTime.UtcNow,
|
||||
SessionId = sessionId
|
||||
};
|
||||
_db.TrackRemovalLogs.Add(log);
|
||||
await _db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user