Refactoring, database structure changed
This commit is contained in:
32
WatchIt.Database/Model/Roles/Role.cs
Normal file
32
WatchIt.Database/Model/Roles/Role.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using WatchIt.Database.Model.Media;
|
||||
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public abstract class Role
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public RoleType Type { get; set; }
|
||||
public long MediumId { get; set; }
|
||||
public long PersonId { get; set; }
|
||||
public uint Version { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
// Medium
|
||||
public virtual Medium Medium { get; set; } = default!;
|
||||
|
||||
// Person
|
||||
public virtual People.Person Person { get; set; } = default!;
|
||||
|
||||
// Ratings
|
||||
public virtual IEnumerable<RoleRating> Ratings { get; set; } = default!;
|
||||
public virtual IEnumerable<Accounts.Account> RatedBy { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
}
|
||||
20
WatchIt.Database/Model/Roles/RoleActor.cs
Normal file
20
WatchIt.Database/Model/Roles/RoleActor.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public class RoleActor : Role
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public short ActorTypeId { get; set; }
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
// Actor type
|
||||
public virtual RoleActorType ActorType { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
}
|
||||
20
WatchIt.Database/Model/Roles/RoleActorType.cs
Normal file
20
WatchIt.Database/Model/Roles/RoleActorType.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public class RoleActorType
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public short Id { get; set; }
|
||||
public string Name { get; set; } = default!;
|
||||
public uint Version { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public virtual IEnumerable<RoleActor> Roles { get; set; } = new List<RoleActor>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
19
WatchIt.Database/Model/Roles/RoleCreator.cs
Normal file
19
WatchIt.Database/Model/Roles/RoleCreator.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public class RoleCreator : Role
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public short CreatorTypeId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
// Creator type
|
||||
public virtual RoleCreatorType CreatorType { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
}
|
||||
20
WatchIt.Database/Model/Roles/RoleCreatorType.cs
Normal file
20
WatchIt.Database/Model/Roles/RoleCreatorType.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public class RoleCreatorType
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public short Id { get; set; }
|
||||
public string Name { get; set; } = default!;
|
||||
public uint Version { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
public virtual IEnumerable<RoleCreator> Roles { get; set; } = new List<RoleCreator>();
|
||||
|
||||
#endregion
|
||||
}
|
||||
26
WatchIt.Database/Model/Roles/RoleRating.cs
Normal file
26
WatchIt.Database/Model/Roles/RoleRating.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public class RoleRating : IRatingEntity
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public long AccountId { get; set; }
|
||||
public Guid RoleId { get; set; }
|
||||
public byte Rating { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public uint Version { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region NAVIGATION
|
||||
|
||||
// Account
|
||||
public virtual Accounts.Account Account { get; set; } = default!;
|
||||
|
||||
// Role
|
||||
public virtual Role Role { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
}
|
||||
7
WatchIt.Database/Model/Roles/RoleType.cs
Normal file
7
WatchIt.Database/Model/Roles/RoleType.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace WatchIt.Database.Model.Roles;
|
||||
|
||||
public enum RoleType : byte
|
||||
{
|
||||
Actor = 0,
|
||||
Creator = 1,
|
||||
}
|
||||
Reference in New Issue
Block a user