feat(tracks): add user listening history

Record a listening-history entry when a stream ticket is issued and expose GET /users/{id}/listening-history to read it back.
This commit is contained in:
2026-07-14 04:54:35 +02:00
parent 18d3aea853
commit a40f3da247
9 changed files with 882 additions and 5 deletions
@@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
#pragma warning disable CS8618
[Table("ListeningHistory")]
public class ListeningHistory
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public DateTime ListenedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(UserId) )]
public User User { get; set; }
[ForeignKey(nameof(TrackId)) ]
public Track Track { get; set; }
}
}