diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-09-02 18:41:51 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-09-02 18:41:51 -0500 |
| commit | 2805a4c368e9585162f6379bb862e0951790613e (patch) | |
| tree | 82955c9ebac885f99f34b52b147be5ccc94a5d46 /src/slskd/Events/Types | |
| parent | 51836f520fe400a33ad9daab932f13c2ed24467d (diff) | |
| download | slskd-2805a4c368e9585162f6379bb862e0951790613e.tar.gz | |
rename types back :shrug:
Diffstat (limited to 'src/slskd/Events/Types')
| -rw-r--r-- | src/slskd/Events/Types/EventRecord.cs (renamed from src/slskd/Events/Types/Event.cs) | 10 | ||||
| -rw-r--r-- | src/slskd/Events/Types/Events.cs | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/slskd/Events/Types/Event.cs b/src/slskd/Events/Types/EventRecord.cs index 5b57aa5d..921daa4e 100644 --- a/src/slskd/Events/Types/Event.cs +++ b/src/slskd/Events/Types/EventRecord.cs @@ -28,7 +28,7 @@ using Microsoft.EntityFrameworkCore; [Index(nameof(Timestamp))] [Index(nameof(Type))] -public record Event +public record EventRecord { public DateTime Timestamp { get; init; } = DateTime.UtcNow; public string Type { get; private set; } @@ -46,7 +46,7 @@ public record Event }; /// <summary> - /// Converts the specified event <paramref name="e"/> into an instance of <see cref="Event"/> + /// Converts the specified event <paramref name="e"/> into an instance of <see cref="EventRecord"/> /// for the purpose of database storage. /// </summary> /// <remarks> @@ -58,8 +58,8 @@ public record Event /// <param name="e">The Event to convert.</param> /// <typeparam name="T">The specific type of the Event.</typeparam> /// <returns>The converted EventRecord.</returns> - public static Event From<T>(BaseEvent e) - where T : BaseEvent + public static EventRecord From<T>(Event e) + where T : Event { // this will be 'slskd.NameOfEvent'; we want to chop off 'slskd.' and 'Event' = 'NameOf' var type = e.GetType().Name.Split('.').TakeLast(1).First(); @@ -73,7 +73,7 @@ public record Event data.Remove(nameof(Id).ToLower()); data.Remove(nameof(Data).ToLower()); - return new Event + return new EventRecord { Timestamp = e.Timestamp, Type = type, diff --git a/src/slskd/Events/Types/Events.cs b/src/slskd/Events/Types/Events.cs index 416074e6..20ec3f9f 100644 --- a/src/slskd/Events/Types/Events.cs +++ b/src/slskd/Events/Types/Events.cs @@ -20,20 +20,20 @@ namespace slskd.Events; using System; using slskd.Transfers; -public abstract record BaseEvent +public abstract record Event { public Guid Id { get; } = Guid.NewGuid(); public DateTime Timestamp { get; init; } = DateTime.UtcNow; } -public sealed record DownloadFileCompleteEvent : BaseEvent +public sealed record DownloadFileCompleteEvent : Event { public string LocalFilename { get; init; } public string RemoteFilename { get; init; } public Transfer Transfer { get; init; } } -public sealed record DownloadDirectoryCompleteEvent : BaseEvent +public sealed record DownloadDirectoryCompleteEvent : Event { public string LocalDirectoryName { get; init; } public string RemoteDirectoryName { get; init; } |
