Refactoring, database structure changed
This commit is contained in:
59
WatchIt.Database/Model/Accounts/Account.cs
Normal file
59
WatchIt.Database/Model/Accounts/Account.cs
Normal 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
|
||||
}
|
||||
26
WatchIt.Database/Model/Accounts/AccountBackgroundPicture.cs
Normal file
26
WatchIt.Database/Model/Accounts/AccountBackgroundPicture.cs
Normal 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
|
||||
}
|
||||
24
WatchIt.Database/Model/Accounts/AccountFollow.cs
Normal file
24
WatchIt.Database/Model/Accounts/AccountFollow.cs
Normal 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
|
||||
}
|
||||
23
WatchIt.Database/Model/Accounts/AccountProfilePicture.cs
Normal file
23
WatchIt.Database/Model/Accounts/AccountProfilePicture.cs
Normal 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
|
||||
}
|
||||
23
WatchIt.Database/Model/Accounts/AccountRefreshToken.cs
Normal file
23
WatchIt.Database/Model/Accounts/AccountRefreshToken.cs
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user