database changes
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using WatchIt.Database.Model.Account;
|
||||
|
||||
namespace WatchIt.Database.Model.Configuration.Account;
|
||||
|
||||
public class AccountFollowConfiguration : IEntityTypeConfiguration<AccountFollow>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AccountFollow> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.AccountFollower)
|
||||
.WithMany(x => x.AccountFollows)
|
||||
.HasForeignKey(x => x.AccountFollowerId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.AccountFollowerId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.AccountFollowed)
|
||||
.WithMany(x => x.AccountFollowedBy)
|
||||
.HasForeignKey(x => x.AccountFollowedId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.AccountFollowedId)
|
||||
.IsRequired();
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,6 @@ public class GenreConfiguration : IEntityTypeConfiguration<Genre>
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Description)
|
||||
.HasMaxLength(1000);
|
||||
|
||||
// Navigation
|
||||
builder.HasMany(x => x.Media)
|
||||
.WithMany(x => x.Genres)
|
||||
|
||||
@@ -39,6 +39,9 @@ public class Account
|
||||
public virtual IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; } = new List<RatingMediaSeriesEpisode>();
|
||||
|
||||
public virtual IEnumerable<AccountRefreshToken> AccountRefreshTokens { get; set; } = new List<AccountRefreshToken>();
|
||||
|
||||
public virtual IEnumerable<AccountFollow> AccountFollows { get; set; } = new List<AccountFollow>();
|
||||
public virtual IEnumerable<AccountFollow> AccountFollowedBy { get; set; } = new List<AccountFollow>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace WatchIt.Database.Model.Account;
|
||||
|
||||
public class AccountFollow
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public long AccountFollowerId { get; set; }
|
||||
public long AccountFollowedId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public virtual Account AccountFollower { get; set; } = null!;
|
||||
public virtual Account AccountFollowed { get; set; } = null!;
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -8,7 +8,6 @@ public class Genre
|
||||
|
||||
public short Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user