auth changes

This commit is contained in:
2024-03-28 19:17:46 +01:00
Unverified
parent 0d9a42dd24
commit fcca2119a5
45 changed files with 6588 additions and 55 deletions

View File

@@ -22,8 +22,8 @@ namespace WatchIt.Database.Model.Account
public long Id { get; set; }
public string Username { get; set; }
public string Email { get; set; }
public string Description { get; set; }
public short GenderId { get; set; }
public string? Description { get; set; }
public short? GenderId { get; set; }
public Guid? ProfilePictureId { get; set; }
public Guid? BackgroundPictureId { get; set; }
public byte[] Password { get; set; }
@@ -49,6 +49,8 @@ namespace WatchIt.Database.Model.Account
public IEnumerable<RatingMediaSeriesSeason> RatingMediaSeriesSeason { get; set; }
public IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; }
public IEnumerable<AccountRefreshToken> AccountRefreshTokens { get; set; }
#endregion
@@ -76,10 +78,8 @@ namespace WatchIt.Database.Model.Account
builder.HasOne(x => x.Gender)
.WithMany()
.HasForeignKey(x => x.GenderId)
.IsRequired();
builder.Property(x => x.GenderId)
.IsRequired();
.HasForeignKey(x => x.GenderId);
builder.Property(x => x.GenderId);
builder.HasOne(x => x.ProfilePicture)
.WithOne(x => x.Account)
@@ -104,7 +104,8 @@ namespace WatchIt.Database.Model.Account
.IsRequired();
builder.Property(x => x.IsAdmin)
.IsRequired();
.IsRequired()
.HasDefaultValue(false);
builder.Property(x => x.CreationDate)
.IsRequired()

View File

@@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WatchIt.Database.Model.Account
{
public class AccountRefreshToken : IEntity<AccountRefreshToken>
{
#region PROPERTIES
public Guid Id { get; set; }
public long AccountId { get; set; }
public DateTime ExpirationDate { get; set; }
public bool IsExtendable { get; set; }
#endregion
#region NAVIGATION
public Account Account { get; set; }
#endregion
#region PUBLIC METHODS
static void IEntity<AccountRefreshToken>.Build(EntityTypeBuilder<AccountRefreshToken> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.HasOne(x => x.Account)
.WithMany(x => x.AccountRefreshTokens)
.HasForeignKey(x => x.AccountId)
.IsRequired();
builder.Property(x => x.AccountId)
.IsRequired();
builder.Property(x => x.ExpirationDate)
.IsRequired();
builder.Property(x => x.IsExtendable)
.IsRequired();
}
#endregion
}
}