1111
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using LiveRecorder.Domain.Enums;
|
||||
|
||||
namespace LiveRecorder.Domain.Entities;
|
||||
|
||||
public class LiveRoom
|
||||
{
|
||||
private LiveRoom()
|
||||
{
|
||||
}
|
||||
|
||||
public LiveRoom(
|
||||
LivePlatformType platform,
|
||||
string sourceUrl,
|
||||
string roomId,
|
||||
string normalizedUrl,
|
||||
DateTimeOffset createdAt)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
Platform = platform;
|
||||
SourceUrl = sourceUrl;
|
||||
RoomId = roomId;
|
||||
NormalizedUrl = normalizedUrl;
|
||||
IsEnabled = true;
|
||||
AvailabilityStatus = LiveRoomAvailabilityStatus.Unknown;
|
||||
CreatedAt = createdAt;
|
||||
UpdatedAt = createdAt;
|
||||
}
|
||||
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
public LivePlatformType Platform { get; private set; }
|
||||
|
||||
public string SourceUrl { get; private set; } = string.Empty;
|
||||
|
||||
public string RoomId { get; private set; } = string.Empty;
|
||||
|
||||
public string NormalizedUrl { get; private set; } = string.Empty;
|
||||
|
||||
public string? Title { get; private set; }
|
||||
|
||||
public string? AnchorName { get; private set; }
|
||||
|
||||
public string? CoverUrl { get; private set; }
|
||||
|
||||
public bool IsEnabled { get; private set; }
|
||||
|
||||
public bool HasSentLiveNotificationForCurrentSession { get; private set; }
|
||||
|
||||
public LiveRoomAvailabilityStatus AvailabilityStatus { get; private set; }
|
||||
|
||||
public DateTimeOffset CreatedAt { get; private set; }
|
||||
|
||||
public DateTimeOffset UpdatedAt { get; private set; }
|
||||
|
||||
public DateTimeOffset? LastCheckedAt { get; private set; }
|
||||
|
||||
public ICollection<RecordTask> RecordTasks { get; private set; } = new List<RecordTask>();
|
||||
|
||||
public void UpdateSource(string sourceUrl, string normalizedUrl, DateTimeOffset updatedAt)
|
||||
{
|
||||
SourceUrl = sourceUrl;
|
||||
NormalizedUrl = normalizedUrl;
|
||||
UpdatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public void UpdateRoomId(string roomId, DateTimeOffset updatedAt)
|
||||
{
|
||||
RoomId = roomId;
|
||||
UpdatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public void UpdateMetadata(string? title, string? anchorName, string? coverUrl, DateTimeOffset updatedAt)
|
||||
{
|
||||
Title = title;
|
||||
AnchorName = anchorName;
|
||||
CoverUrl = coverUrl;
|
||||
UpdatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public void UpdateAvailability(LiveRoomAvailabilityStatus availabilityStatus, DateTimeOffset checkedAt)
|
||||
{
|
||||
AvailabilityStatus = availabilityStatus;
|
||||
if (availabilityStatus != LiveRoomAvailabilityStatus.Live)
|
||||
{
|
||||
HasSentLiveNotificationForCurrentSession = false;
|
||||
}
|
||||
|
||||
LastCheckedAt = checkedAt;
|
||||
UpdatedAt = checkedAt;
|
||||
}
|
||||
|
||||
public void SetEnabled(bool isEnabled, DateTimeOffset updatedAt)
|
||||
{
|
||||
IsEnabled = isEnabled;
|
||||
UpdatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public void MarkLiveNotificationSent(DateTimeOffset updatedAt)
|
||||
{
|
||||
HasSentLiveNotificationForCurrentSession = true;
|
||||
UpdatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user