roadie/Roadie.Api.Library/Data/UserTrack.cs
2019-11-28 11:38:26 -06:00

55 lines
No EOL
1.3 KiB
C#

using Roadie.Library.Identity;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Roadie.Library.Data
{
[Table("usertrack")]
public class UserTrack : EntityBase
{
[Column("isDisliked")]
public bool? IsDisliked { get; set; }
[Column("isFavorite")]
public bool? IsFavorite { get; set; }
[Column("lastPlayed")]
public DateTime? LastPlayed { get; set; }
[Column("playedCount")]
public int? PlayedCount { get; set; }
[Column("rating")]
public short Rating { get; set; }
[ForeignKey(nameof(TrackId))]
[InverseProperty("UserTracks")]
public virtual Track Track { get; set; }
[Column("trackId")]
[Required]
public int TrackId { get; set; }
[ForeignKey(nameof(UserId))]
[InverseProperty("UserTracks")]
public virtual User User { get; set; }
[Column("userId")]
[Required]
public int UserId { get; set; }
public UserTrack()
{
}
public UserTrack(DateTime? now = null)
{
PlayedCount = 0;
Rating = 0;
IsDisliked = false;
IsFavorite = false;
LastPlayed = now ?? DateTime.UtcNow;
}
}
}