Refactoring, database structure changed

This commit is contained in:
2025-03-03 00:56:32 +01:00
Unverified
parent d3805ef3db
commit c603c41c0b
913 changed files with 21764 additions and 32775 deletions

View File

@@ -0,0 +1,59 @@
using WatchIt.Database.Model.Genders;
using WatchIt.Database.Model.Media;
using WatchIt.Database.Model.Roles;
namespace WatchIt.Database.Model.Accounts;
public class Account
{
#region PROPERTIES
public long Id { get; set; }
public string Username { get; set; } = default!;
public string Email { get; set; } = default!;
public byte[] Password { get; set; } = default!;
public string LeftSalt { get; set; } = default!;
public string RightSalt { get; set; } = default!;
public bool IsAdmin { get; set; } = false;
public DateTimeOffset JoinDate { get; set; }
public DateTimeOffset ActiveDate { get; set; }
public string? Description { get; set; }
public short? GenderId { get; set; }
public uint Version { get; set; }
#endregion
#region NAVIGATION
// Profile picture
public virtual AccountProfilePicture? ProfilePicture { get; set; }
// Background picture
public virtual AccountBackgroundPicture? BackgroundPicture { get; set; }
// Refresh tokens
public virtual IEnumerable<AccountRefreshToken> RefreshTokens { get; set; } = new List<AccountRefreshToken>();
// Follows
public virtual IEnumerable<AccountFollow> FollowsRelationshipObjects { get; set; } = new List<AccountFollow>();
public virtual IEnumerable<Account> Follows { get; set; } = new List<Account>();
// Followers
public virtual IEnumerable<AccountFollow> FollowersRelationshipObjects { get; set; } = new List<AccountFollow>();
public virtual IEnumerable<Account> Followers { get; set; } = new List<Account>();
// Gender
public virtual Gender? Gender { get; set; }
// Media ratings
public virtual IEnumerable<MediumRating> MediaRatings { get; set; } = new List<MediumRating>();
public virtual IEnumerable<Medium> MediaRated { get; set; } = new List<Medium>();
// Roles ratings
public virtual IEnumerable<RoleRating> RolesRatings { get; set; } = new List<RoleRating>();
public virtual IEnumerable<Role> RolesRated { get; set; } = new List<Role>();
#endregion
}

View File

@@ -0,0 +1,26 @@
using WatchIt.Database.Model.Photos;
namespace WatchIt.Database.Model.Accounts;
public class AccountBackgroundPicture
{
#region PROPERTIES
public long AccountId { get; set; }
public Guid BackgroundId { get; set; }
public uint Version { get; set; }
#endregion
#region NAVIGATION
// Account
public virtual Account Account { get; set; } = default!;
// Background
public virtual PhotoBackground Background { get; set; } = default!;
#endregion
}

View File

@@ -0,0 +1,24 @@
namespace WatchIt.Database.Model.Accounts;
public class AccountFollow
{
#region PROPERTIES
public long FollowerId { get; set; }
public long FollowedId { get; set; }
public uint Version { get; set; }
#endregion
#region NAVIGATION
// Follower
public virtual Account Follower { get; set; } = default!;
// Followed
public virtual Account Followed { get; set; } = default!;
#endregion
}

View File

@@ -0,0 +1,23 @@
namespace WatchIt.Database.Model.Accounts;
public class AccountProfilePicture : IImageEntity
{
#region PROPERTIES
public long AccountId { get; set; }
public byte[] Image { get; set; } = default!;
public string MimeType { get; set; } = default!;
public DateTimeOffset UploadDate { get; set; }
public uint Version { get; set; }
#endregion
#region NAVIGATION
// Account
public virtual Account Account { get; set; } = default!;
#endregion
}

View File

@@ -0,0 +1,23 @@
namespace WatchIt.Database.Model.Accounts;
public class AccountRefreshToken
{
#region PROPERTIES
public Guid Token { get; set; }
public long AccountId { get; set; }
public DateTimeOffset ExpirationDate { get; set; }
public bool IsExtendable { get; set; }
public uint Version { get; set; }
#endregion
#region NAVIGATION
// Account
public virtual Account Account { get; set; } = default!;
#endregion
}