project reorganized
This commit is contained in:
25
.dockerignore
Normal file
25
.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/.git
|
||||||
|
**/.gitignore
|
||||||
|
**/.project
|
||||||
|
**/.settings
|
||||||
|
**/.toolstarget
|
||||||
|
**/.vs
|
||||||
|
**/.vscode
|
||||||
|
**/.idea
|
||||||
|
**/*.*proj.user
|
||||||
|
**/*.dbmdl
|
||||||
|
**/*.jfm
|
||||||
|
**/azds.yaml
|
||||||
|
**/bin
|
||||||
|
**/charts
|
||||||
|
**/docker-compose*
|
||||||
|
**/Dockerfile*
|
||||||
|
**/node_modules
|
||||||
|
**/npm-debug.log
|
||||||
|
**/obj
|
||||||
|
**/secrets.dev.yaml
|
||||||
|
**/values.dev.yaml
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -396,3 +396,4 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
.idea/
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Accounts;
|
||||||
|
|
||||||
|
public class AuthenticateRequest
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonPropertyName("username_or_email")]
|
||||||
|
public required string UsernameOrEmail { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("password")]
|
||||||
|
public required string Password { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("remember_me")]
|
||||||
|
public bool RememberMe { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Accounts;
|
||||||
|
|
||||||
|
public class AuthenticateResponse
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonPropertyName("access_token")]
|
||||||
|
public required string AccessToken { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("refresh_token")]
|
||||||
|
public required string RefreshToken { get; init; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Accounts;
|
||||||
|
|
||||||
|
public class RegisterRequest
|
||||||
|
{
|
||||||
|
[JsonPropertyName("username")]
|
||||||
|
public required string Username { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("email")]
|
||||||
|
public required string Email { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("password")]
|
||||||
|
public required string Password { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using WatchIt.Database.Model.Account;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Accounts;
|
||||||
|
|
||||||
|
public class RegisterResponse
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public required long Id { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("username")]
|
||||||
|
public required string Username { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("email")]
|
||||||
|
public required string Email { get; init; }
|
||||||
|
|
||||||
|
[JsonPropertyName("creation_date")]
|
||||||
|
public required DateTime CreationDate { get; init; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
[SetsRequiredMembers]
|
||||||
|
public RegisterResponse(Account account)
|
||||||
|
{
|
||||||
|
Id = account.Id;
|
||||||
|
Username = account.Username;
|
||||||
|
Email = account.Email;
|
||||||
|
CreationDate = account.CreationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
12
WatchIt.Common/WatchIt.Common.Model/Genres/Genre.cs
Normal file
12
WatchIt.Common/WatchIt.Common.Model/Genres/Genre.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Genres;
|
||||||
|
|
||||||
|
public class Genre
|
||||||
|
{
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public required string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("description")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Genres;
|
||||||
|
|
||||||
|
public class GenreQueryParameters : QueryParameters<GenreResponse>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[FromQuery(Name = "name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "description")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
public override bool IsMeetingConditions(GenreResponse item) =>
|
||||||
|
(
|
||||||
|
TestString(item.Name, Name)
|
||||||
|
&&
|
||||||
|
TestString(item.Description, Description)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
20
WatchIt.Common/WatchIt.Common.Model/Genres/GenreRequest.cs
Normal file
20
WatchIt.Common/WatchIt.Common.Model/Genres/GenreRequest.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
namespace WatchIt.Common.Model.Genres;
|
||||||
|
|
||||||
|
public class GenreRequest : Genre
|
||||||
|
{
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
public Database.Model.Common.Genre CreateGenre() => new Database.Model.Common.Genre
|
||||||
|
{
|
||||||
|
Name = Name,
|
||||||
|
Description = Description,
|
||||||
|
};
|
||||||
|
|
||||||
|
public void UpdateGenre(Database.Model.Common.Genre genre)
|
||||||
|
{
|
||||||
|
genre.Name = Name;
|
||||||
|
genre.Description = Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
28
WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs
Normal file
28
WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Genres;
|
||||||
|
|
||||||
|
public class GenreResponse : Genre
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
[SetsRequiredMembers]
|
||||||
|
public GenreResponse(Database.Model.Common.Genre genre)
|
||||||
|
{
|
||||||
|
Id = genre.Id;
|
||||||
|
Name = genre.Name;
|
||||||
|
Description = genre.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
24
WatchIt.Common/WatchIt.Common.Model/Movies/Movie.cs
Normal file
24
WatchIt.Common/WatchIt.Common.Model/Movies/Movie.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Movies;
|
||||||
|
|
||||||
|
public class Movie
|
||||||
|
{
|
||||||
|
[JsonPropertyName("title")]
|
||||||
|
public required string Title { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("original_title")]
|
||||||
|
public string? OriginalTitle { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("description")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("release_date")]
|
||||||
|
public DateOnly? ReleaseDate { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("length")]
|
||||||
|
public short? Length { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("budget")]
|
||||||
|
public decimal? Budget { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Movies;
|
||||||
|
|
||||||
|
public class MovieQueryParameters : QueryParameters<MovieResponse>
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[FromQuery(Name = "title")]
|
||||||
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "original_title")]
|
||||||
|
public string? OriginalTitle { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "description")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "release_date")]
|
||||||
|
public DateOnly? ReleaseDate { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "release_date_from")]
|
||||||
|
public DateOnly? ReleaseDateFrom { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "release_date_to")]
|
||||||
|
public DateOnly? ReleaseDateTo { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "length")]
|
||||||
|
public short? Length { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "length_from")]
|
||||||
|
public short? LengthFrom { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "length_to")]
|
||||||
|
public short? LengthTo { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "budget")]
|
||||||
|
public decimal? Budget { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "budget_from")]
|
||||||
|
public decimal? BudgetFrom { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "budget_to")]
|
||||||
|
public decimal? BudgetTo { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
public override bool IsMeetingConditions(MovieResponse item) =>
|
||||||
|
(
|
||||||
|
TestString(item.Title, Title)
|
||||||
|
&&
|
||||||
|
TestString(item.OriginalTitle, OriginalTitle)
|
||||||
|
&&
|
||||||
|
TestString(item.Description, Description)
|
||||||
|
&&
|
||||||
|
TestComparable(item.ReleaseDate, ReleaseDate, ReleaseDateFrom, ReleaseDateTo)
|
||||||
|
&&
|
||||||
|
TestComparable(item.Length, Length, LengthFrom, LengthTo)
|
||||||
|
&&
|
||||||
|
TestComparable(item.Budget, Budget, BudgetFrom, BudgetTo)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
39
WatchIt.Common/WatchIt.Common.Model/Movies/MovieRequest.cs
Normal file
39
WatchIt.Common/WatchIt.Common.Model/Movies/MovieRequest.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Movies;
|
||||||
|
|
||||||
|
public class MovieRequest : Movie
|
||||||
|
{
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
public Media CreateMedia() => new Media
|
||||||
|
{
|
||||||
|
Title = Title,
|
||||||
|
OriginalTitle = OriginalTitle,
|
||||||
|
Description = Description,
|
||||||
|
ReleaseDate = ReleaseDate,
|
||||||
|
Length = Length,
|
||||||
|
};
|
||||||
|
|
||||||
|
public MediaMovie CreateMediaMovie(long id) => new MediaMovie
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Budget = Budget,
|
||||||
|
};
|
||||||
|
|
||||||
|
public void UpdateMedia(Media media)
|
||||||
|
{
|
||||||
|
media.Title = Title;
|
||||||
|
media.OriginalTitle = OriginalTitle;
|
||||||
|
media.Description = Description;
|
||||||
|
media.ReleaseDate = ReleaseDate;
|
||||||
|
media.Length = Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateMediaMovie(MediaMovie mediaMovie)
|
||||||
|
{
|
||||||
|
mediaMovie.Budget = Budget;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
31
WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs
Normal file
31
WatchIt.Common/WatchIt.Common.Model/Movies/MovieResponse.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model.Movies;
|
||||||
|
|
||||||
|
public class MovieResponse : Movie
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region CONSTRUCTORS
|
||||||
|
|
||||||
|
[SetsRequiredMembers]
|
||||||
|
public MovieResponse(MediaMovie mediaMovie)
|
||||||
|
{
|
||||||
|
Id = mediaMovie.Media.Id;
|
||||||
|
Title = mediaMovie.Media.Title;
|
||||||
|
OriginalTitle = mediaMovie.Media.OriginalTitle;
|
||||||
|
Description = mediaMovie.Media.Description;
|
||||||
|
ReleaseDate = mediaMovie.Media.ReleaseDate;
|
||||||
|
Length = mediaMovie.Media.Length;
|
||||||
|
Budget = mediaMovie.Budget;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
118
WatchIt.Common/WatchIt.Common.Model/QueryParameters.cs
Normal file
118
WatchIt.Common/WatchIt.Common.Model/QueryParameters.cs
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WatchIt.Common.Model;
|
||||||
|
|
||||||
|
public abstract class QueryParameters<T> where T : class
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
[FromQuery(Name = "order_by")]
|
||||||
|
public string? OrderBy { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "order")]
|
||||||
|
public string? Order { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "first")]
|
||||||
|
public int? First { get; set; }
|
||||||
|
|
||||||
|
[FromQuery(Name = "after")]
|
||||||
|
public int? After { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PUBLIC METHODS
|
||||||
|
|
||||||
|
public abstract bool IsMeetingConditions(T item);
|
||||||
|
|
||||||
|
public IEnumerable<T> PrepareData(IEnumerable<T> data)
|
||||||
|
{
|
||||||
|
data = data.Where(IsMeetingConditions);
|
||||||
|
|
||||||
|
if (OrderBy is not null)
|
||||||
|
{
|
||||||
|
PropertyInfo[] properties = typeof(T).GetProperties();
|
||||||
|
foreach (PropertyInfo property in properties)
|
||||||
|
{
|
||||||
|
JsonPropertyNameAttribute? attribute = property.GetCustomAttributes<JsonPropertyNameAttribute>(true).FirstOrDefault();
|
||||||
|
if (attribute is not null && attribute.Name == OrderBy)
|
||||||
|
{
|
||||||
|
if (Order == "asc")
|
||||||
|
{
|
||||||
|
data = data.OrderBy(property.GetValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = data.OrderByDescending(property.GetValue);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (After is not null)
|
||||||
|
{
|
||||||
|
data = data.Skip(After.Value);
|
||||||
|
}
|
||||||
|
if (First is not null)
|
||||||
|
{
|
||||||
|
data = data.Take(First.Value);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region PRIVATE METHODS
|
||||||
|
|
||||||
|
protected bool TestString(string? property, string? regexQuery) =>
|
||||||
|
(
|
||||||
|
string.IsNullOrEmpty(regexQuery)
|
||||||
|
||
|
||||||
|
(
|
||||||
|
!string.IsNullOrEmpty(property)
|
||||||
|
&&
|
||||||
|
new Regex(regexQuery).IsMatch(property)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
protected bool TestComparable(IComparable? property, IComparable? exact, IComparable? from, IComparable? to) =>
|
||||||
|
(
|
||||||
|
(
|
||||||
|
exact is null
|
||||||
|
||
|
||||||
|
(
|
||||||
|
property is not null
|
||||||
|
&&
|
||||||
|
property.CompareTo(exact) == 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
from is null
|
||||||
|
||
|
||||||
|
(
|
||||||
|
property is not null
|
||||||
|
&&
|
||||||
|
property.CompareTo(from) > 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
to is null
|
||||||
|
||
|
||||||
|
(
|
||||||
|
property is not null
|
||||||
|
&&
|
||||||
|
property.CompareTo(to) < 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model\WatchIt.Database.Model.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"Id": 1,
|
|
||||||
"Name": "Afghanistan"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Id": 2,
|
|
||||||
"Name": "Albania"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.DataSeeding
|
|
||||||
{
|
|
||||||
public static class DataReader
|
|
||||||
{
|
|
||||||
#region METHODS
|
|
||||||
|
|
||||||
public static IEnumerable<T> Read<T>() => Read<T>(typeof(T).Name);
|
|
||||||
public static IEnumerable<T> Read<T>(string filename)
|
|
||||||
{
|
|
||||||
string jsonFile = $"..\\WatchIt.Database\\WatchIt.Database.DataSeeding\\Data\\{filename}.json";
|
|
||||||
string dataString = File.ReadAllText(jsonFile);
|
|
||||||
IEnumerable<T> data = JsonConvert.DeserializeObject<IEnumerable<T>>(dataString);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Common;
|
|
||||||
using WatchIt.Database.Model.Media;
|
|
||||||
using WatchIt.Database.Model.Rating;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Account
|
|
||||||
{
|
|
||||||
public class Account : IEntity<Account>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
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 Guid? ProfilePictureId { get; set; }
|
|
||||||
public Guid? BackgroundPictureId { get; set; }
|
|
||||||
public byte[] Password { get; set; }
|
|
||||||
public string LeftSalt { get; set; }
|
|
||||||
public string RightSalt { get; set; }
|
|
||||||
public bool IsAdmin { get; set; } = false;
|
|
||||||
public DateTime CreationDate { get; set; }
|
|
||||||
public DateTime LastActive { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Gender Gender { get; set; }
|
|
||||||
public AccountProfilePicture? ProfilePicture { get; set; }
|
|
||||||
public MediaPhotoImage? BackgroundPicture { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<RatingMedia> RatingMedia { get; set; }
|
|
||||||
public IEnumerable<RatingPersonActorRole> RatingPersonActorRole { get; set; }
|
|
||||||
public IEnumerable<RatingPersonCreatorRole> RatingPersonCreatorRole { get; set; }
|
|
||||||
public IEnumerable<RatingMediaSeriesSeason> RatingMediaSeriesSeason { get; set; }
|
|
||||||
public IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<AccountRefreshToken> AccountRefreshTokens { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region METHODS
|
|
||||||
|
|
||||||
static void IEntity<Account>.Build(EntityTypeBuilder<Account> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Username)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Email)
|
|
||||||
.HasMaxLength(320)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Description)
|
|
||||||
.HasMaxLength(1000);
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Gender)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(x => x.GenderId);
|
|
||||||
builder.Property(x => x.GenderId);
|
|
||||||
|
|
||||||
builder.HasOne(x => x.ProfilePicture)
|
|
||||||
.WithOne(x => x.Account)
|
|
||||||
.HasForeignKey<Account>(e => e.ProfilePictureId);
|
|
||||||
builder.Property(x => x.ProfilePictureId);
|
|
||||||
|
|
||||||
builder.HasOne(x => x.BackgroundPicture)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(x => x.BackgroundPictureId);
|
|
||||||
builder.Property(x => x.BackgroundPictureId);
|
|
||||||
|
|
||||||
builder.Property(x => x.Password)
|
|
||||||
.HasMaxLength(1000)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.LeftSalt)
|
|
||||||
.HasMaxLength(20)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.RightSalt)
|
|
||||||
.HasMaxLength(20)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.IsAdmin)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
builder.Property(x => x.CreationDate)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
builder.Property(x => x.LastActive)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Account
|
|
||||||
{
|
|
||||||
public class AccountProfilePicture : IEntity<AccountProfilePicture>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public byte[] Image { get; set; }
|
|
||||||
public string MimeType { get; set; }
|
|
||||||
public DateTime UploadDate { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Account Account { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<AccountProfilePicture>.Build(EntityTypeBuilder<AccountProfilePicture> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Image)
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.MimeType)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.UploadDate)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.DataSeeding;
|
|
||||||
using WatchIt.Database.Model.Media;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Common
|
|
||||||
{
|
|
||||||
public class Country : IEntity<Country>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public short Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; }
|
|
||||||
public IEnumerable<Media.Media> MediaProduction { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<Country>.Build(EntityTypeBuilder<Country> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name)
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
// Navigation
|
|
||||||
builder.HasMany(x => x.MediaProduction)
|
|
||||||
.WithMany(x => x.ProductionCountries)
|
|
||||||
.UsingEntity<MediaProductionCountry>();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerable<Country> IEntity<Country>.InsertData() => DataReader.Read<Country>();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.DataSeeding;
|
|
||||||
using WatchIt.Database.Model.Person;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Common
|
|
||||||
{
|
|
||||||
public class Gender : IEntity<Gender>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public short Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<Gender>.Build(EntityTypeBuilder<Gender> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerable<Gender> IEntity<Gender>.InsertData() => DataReader.Read<Gender>();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.DataSeeding;
|
|
||||||
using WatchIt.Database.Model.Media;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Common
|
|
||||||
{
|
|
||||||
public class Genre : IEntity<Genre>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public short Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string? Description { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public IEnumerable<MediaGenre> MediaGenres { get; set; }
|
|
||||||
public IEnumerable<Media.Media> Media { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<Genre>.Build(EntityTypeBuilder<Genre> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name)
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Description)
|
|
||||||
.HasMaxLength(1000);
|
|
||||||
|
|
||||||
// Navigation
|
|
||||||
builder.HasMany(x => x.Media)
|
|
||||||
.WithMany(x => x.Genres)
|
|
||||||
.UsingEntity<MediaGenre>();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerable<Genre> IEntity<Genre>.InsertData() => DataReader.Read<Genre>();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
public static class EntityBuilder
|
|
||||||
{
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
public static void Build<T>(ModelBuilder builder) where T : class, IEntity<T> => Build<T>(builder.Entity<T>());
|
|
||||||
public static void Build<T>(EntityTypeBuilder<T> builder) where T : class, IEntity<T>
|
|
||||||
{
|
|
||||||
T.Build(builder);
|
|
||||||
builder.HasData(T.InsertData());
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
public interface IEntity<T> where T : class
|
|
||||||
{
|
|
||||||
#region METHODS
|
|
||||||
|
|
||||||
static abstract void Build(EntityTypeBuilder<T> builder);
|
|
||||||
static virtual IEnumerable<T> InsertData() => Array.Empty<T>();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Account;
|
|
||||||
using WatchIt.Database.Model.Common;
|
|
||||||
using WatchIt.Database.Model.Person;
|
|
||||||
using WatchIt.Database.Model.Rating;
|
|
||||||
using WatchIt.Database.Model.ViewCount;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
|
||||||
{
|
|
||||||
public class Media : IEntity<Media>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string? OriginalTitle { get; set; }
|
|
||||||
public string? Description { get; set; }
|
|
||||||
public DateTime? ReleaseDate { get; set; }
|
|
||||||
public TimeSpan? Length { get; set; }
|
|
||||||
public Guid? MediaPosterImageId { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public MediaPosterImage? MediaPosterImage { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<MediaPhotoImage> MediaPhotoImages { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<MediaGenre> MediaGenres { get; set; }
|
|
||||||
public IEnumerable<Genre> Genres { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; }
|
|
||||||
public IEnumerable<Country> ProductionCountries { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<PersonActorRole> PersonActorRoles { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<RatingMedia> RatingMedia { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<ViewCountMedia> ViewCountsMedia { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<Media>.Build(EntityTypeBuilder<Media> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Title)
|
|
||||||
.HasMaxLength(250)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.OriginalTitle)
|
|
||||||
.HasMaxLength(250);
|
|
||||||
|
|
||||||
builder.Property(x => x.Description)
|
|
||||||
.HasMaxLength(1000);
|
|
||||||
|
|
||||||
builder.Property(x => x.ReleaseDate);
|
|
||||||
|
|
||||||
builder.Property(x => x.Length);
|
|
||||||
|
|
||||||
builder.HasOne(x => x.MediaPosterImage)
|
|
||||||
.WithOne(x => x.Media)
|
|
||||||
.HasForeignKey<Media>(x => x.MediaPosterImageId);
|
|
||||||
builder.Property(x => x.MediaPosterImageId);
|
|
||||||
|
|
||||||
// Navigation
|
|
||||||
builder.HasMany(x => x.Genres)
|
|
||||||
.WithMany(x => x.Media)
|
|
||||||
.UsingEntity<MediaGenre>();
|
|
||||||
builder.HasMany(x => x.ProductionCountries)
|
|
||||||
.WithMany(x => x.MediaProduction)
|
|
||||||
.UsingEntity<MediaProductionCountry>();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Common;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
|
||||||
{
|
|
||||||
public class MediaGenre : IEntity<MediaGenre>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public short GenreId { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media Media { get; set; }
|
|
||||||
public Genre Genre { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaGenre>.Build(EntityTypeBuilder<MediaGenre> builder)
|
|
||||||
{
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.MediaGenres)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Genre)
|
|
||||||
.WithMany(x => x.MediaGenres)
|
|
||||||
.HasForeignKey(x => x.GenreId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.GenreId)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
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.Media
|
|
||||||
{
|
|
||||||
public class MediaMovie : IEntity<MediaMovie>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public long Id { get; set; }
|
|
||||||
public decimal? Budget { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media Media { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaMovie>.Build(EntityTypeBuilder<MediaMovie> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithOne()
|
|
||||||
.HasForeignKey<Media>(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Budget)
|
|
||||||
.HasColumnType("money");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
|
||||||
{
|
|
||||||
public class MediaPhotoImage : IEntity<MediaPhotoImage>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public byte[] Image { get; set; }
|
|
||||||
public string MimeType { get; set; }
|
|
||||||
public DateTime UploadDate { get; set; }
|
|
||||||
public bool IsMediaBackground { get; set; }
|
|
||||||
public bool IsUniversalBackground { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media Media { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaPhotoImage>.Build(EntityTypeBuilder<MediaPhotoImage> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.MediaPhotoImages)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Image)
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.MimeType)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.UploadDate)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
builder.Property(x => x.IsMediaBackground)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
builder.Property(x => x.IsUniversalBackground)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
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.Media
|
|
||||||
{
|
|
||||||
public class MediaPosterImage : IEntity<MediaPosterImage>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public byte[] Image { get; set; }
|
|
||||||
public string MimeType { get; set; }
|
|
||||||
public DateTime UploadDate { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media Media { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaPosterImage>.Build(EntityTypeBuilder<MediaPosterImage> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Image)
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.MimeType)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.UploadDate)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Common;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
|
||||||
{
|
|
||||||
public class MediaProductionCountry : IEntity<MediaProductionCountry>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public short CountryId { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media Media { get; set; }
|
|
||||||
public Country Country { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaProductionCountry>.Build(EntityTypeBuilder<MediaProductionCountry> builder)
|
|
||||||
{
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.MediaProductionCountries)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Country)
|
|
||||||
.WithMany(x => x.MediaProductionCountries)
|
|
||||||
.HasForeignKey(x => x.CountryId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.CountryId)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
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.Media
|
|
||||||
{
|
|
||||||
public class MediaSeries : IEntity<MediaSeries>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public long Id { get; set; }
|
|
||||||
public bool HasEnded { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media Media { get; set; }
|
|
||||||
public IEnumerable<MediaSeriesSeason> MediaSeriesSeasons { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaSeries>.Build(EntityTypeBuilder<MediaSeries> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithOne()
|
|
||||||
.HasForeignKey<Media>(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.HasEnded);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Rating;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
|
||||||
{
|
|
||||||
public class MediaSeriesEpisode : IEntity<MediaSeriesEpisode>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public Guid MediaSeriesSeasonId { get; set; }
|
|
||||||
public short Number { get; set; }
|
|
||||||
public string? Name { get; set; }
|
|
||||||
public bool IsSpecial { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public MediaSeriesSeason MediaSeriesSeason { get; set; }
|
|
||||||
public IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaSeriesEpisode>.Build(EntityTypeBuilder<MediaSeriesEpisode> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.MediaSeriesSeason)
|
|
||||||
.WithMany(x => x.MediaSeriesEpisodes)
|
|
||||||
.HasForeignKey(x => x.MediaSeriesSeasonId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaSeriesSeasonId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Number)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name);
|
|
||||||
|
|
||||||
builder.Property(x => x.IsSpecial)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Rating;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Media
|
|
||||||
{
|
|
||||||
public class MediaSeriesSeason : IEntity<MediaSeriesSeason>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long MediaSeriesId { get; set; }
|
|
||||||
public short Number { get; set; }
|
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public MediaSeries MediaSeries { get; set; }
|
|
||||||
public IEnumerable<MediaSeriesEpisode> MediaSeriesEpisodes { get; set; }
|
|
||||||
public IEnumerable<RatingMediaSeriesSeason> RatingMediaSeriesSeason { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<MediaSeriesSeason>.Build(EntityTypeBuilder<MediaSeriesSeason> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.MediaSeries)
|
|
||||||
.WithMany(x => x.MediaSeriesSeasons)
|
|
||||||
.HasForeignKey(x => x.MediaSeriesId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaSeriesId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Number)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Account;
|
|
||||||
using WatchIt.Database.Model.Common;
|
|
||||||
using WatchIt.Database.Model.ViewCount;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
|
||||||
{
|
|
||||||
public class Person : IEntity<Person>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string? FullName { get; set; }
|
|
||||||
public string? Description { get; set; }
|
|
||||||
public DateOnly? BirthDate { get; set; }
|
|
||||||
public DateOnly? DeathDate { get; set; }
|
|
||||||
public short GenderId { get; set; }
|
|
||||||
public Guid? PersonPhotoId { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Gender Gender { get; set; }
|
|
||||||
public PersonPhotoImage? PersonPhoto { get; set; }
|
|
||||||
public IEnumerable<PersonActorRole> PersonActorRoles { get; set; }
|
|
||||||
public IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; }
|
|
||||||
public IEnumerable<ViewCountPerson> ViewCountsPerson { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<Person>.Build(EntityTypeBuilder<Person> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name)
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.FullName)
|
|
||||||
.HasMaxLength(200);
|
|
||||||
|
|
||||||
builder.Property(x => x.Description)
|
|
||||||
.HasMaxLength(1000);
|
|
||||||
|
|
||||||
builder.Property(x => x.BirthDate);
|
|
||||||
|
|
||||||
builder.Property(x => x.DeathDate);
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Gender)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(x => x.GenderId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.GenderId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.PersonPhoto)
|
|
||||||
.WithOne(x => x.Person)
|
|
||||||
.HasForeignKey<Person>(e => e.PersonPhotoId);
|
|
||||||
builder.Property(x => x.PersonPhotoId);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Media;
|
|
||||||
using WatchIt.Database.Model.Rating;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
|
||||||
{
|
|
||||||
public class PersonActorRole : IEntity<PersonActorRole>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long PersonId { get; set; }
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public short PersonActorRoleTypeId { get; set; }
|
|
||||||
public string RoleName { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Person Person { get; set; }
|
|
||||||
public Media.Media Media { get; set; }
|
|
||||||
public PersonActorRoleType PersonActorRoleType { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<RatingPersonActorRole> RatingPersonActorRole { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<PersonActorRole>.Build(EntityTypeBuilder<PersonActorRole> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Person)
|
|
||||||
.WithMany(x => x.PersonActorRoles)
|
|
||||||
.HasForeignKey(x => x.PersonId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.PersonActorRoles)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.PersonActorRoleType)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(x => x.PersonActorRoleTypeId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonActorRoleTypeId)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.DataSeeding;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
|
||||||
{
|
|
||||||
public class PersonActorRoleType : IEntity<PersonActorRoleType>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public short Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<PersonActorRoleType>.Build(EntityTypeBuilder<PersonActorRoleType> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name)
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerable<PersonActorRoleType> IEntity<PersonActorRoleType>.InsertData() => DataReader.Read<PersonActorRoleType>();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Rating;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
|
||||||
{
|
|
||||||
public class PersonCreatorRole : IEntity<PersonCreatorRole>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long PersonId { get; set; }
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public short PersonCreatorRoleTypeId { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Person Person { get; set; }
|
|
||||||
public Media.Media Media { get; set; }
|
|
||||||
public PersonCreatorRoleType PersonCreatorRoleType { get; set; }
|
|
||||||
public IEnumerable<RatingPersonCreatorRole> RatingPersonCreatorRole { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<PersonCreatorRole>.Build(EntityTypeBuilder<PersonCreatorRole> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Person)
|
|
||||||
.WithMany(x => x.PersonCreatorRoles)
|
|
||||||
.HasForeignKey(x => x.PersonId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.PersonCreatorRoles)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.PersonCreatorRoleType)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(x => x.PersonCreatorRoleTypeId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonCreatorRoleTypeId)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.DataSeeding;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
|
||||||
{
|
|
||||||
public class PersonCreatorRoleType : IEntity<PersonCreatorRoleType>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public short Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<PersonCreatorRoleType>.Build(EntityTypeBuilder<PersonCreatorRoleType> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Name)
|
|
||||||
.HasMaxLength(100)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerable<PersonCreatorRoleType> IEntity<PersonCreatorRoleType>.InsertData() => DataReader.Read<PersonCreatorRoleType>();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Account;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Person
|
|
||||||
{
|
|
||||||
public class PersonPhotoImage : IEntity<PersonPhotoImage>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public byte[] Image { get; set; }
|
|
||||||
public string MimeType { get; set; }
|
|
||||||
public DateTime UploadDate { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Person Person { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<PersonPhotoImage>.Build(EntityTypeBuilder<PersonPhotoImage> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Image)
|
|
||||||
.HasMaxLength(-1)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.MimeType)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.UploadDate)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
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.Rating
|
|
||||||
{
|
|
||||||
public class RatingMedia : IEntity<RatingMedia>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public long AccountId { get; set; }
|
|
||||||
public short Rating { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media.Media Media { get; set; }
|
|
||||||
public Account.Account Account { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<RatingMedia>.Build(EntityTypeBuilder<RatingMedia> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.RatingMedia)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Account)
|
|
||||||
.WithMany(x => x.RatingMedia)
|
|
||||||
.HasForeignKey(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Rating)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Media;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Rating
|
|
||||||
{
|
|
||||||
public class RatingMediaSeriesEpisode : IEntity<RatingMediaSeriesEpisode>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public Guid MediaSeriesEpisodeId { get; set; }
|
|
||||||
public long AccountId { get; set; }
|
|
||||||
public short Rating { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public MediaSeriesEpisode MediaSeriesEpisode { get; set; }
|
|
||||||
public Account.Account Account { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<RatingMediaSeriesEpisode>.Build(EntityTypeBuilder<RatingMediaSeriesEpisode> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.MediaSeriesEpisode)
|
|
||||||
.WithMany(x => x.RatingMediaSeriesEpisode)
|
|
||||||
.HasForeignKey(x => x.MediaSeriesEpisodeId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaSeriesEpisodeId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Account)
|
|
||||||
.WithMany(x => x.RatingMediaSeriesEpisode)
|
|
||||||
.HasForeignKey(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Rating)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Media;
|
|
||||||
using WatchIt.Database.Model.Person;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Rating
|
|
||||||
{
|
|
||||||
public class RatingMediaSeriesSeason : IEntity<RatingMediaSeriesSeason>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public Guid MediaSeriesSeasonId { get; set; }
|
|
||||||
public long AccountId { get; set; }
|
|
||||||
public short Rating { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public MediaSeriesSeason MediaSeriesSeason { get; set; }
|
|
||||||
public Account.Account Account { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<RatingMediaSeriesSeason>.Build(EntityTypeBuilder<RatingMediaSeriesSeason> builder)
|
|
||||||
{
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.MediaSeriesSeason)
|
|
||||||
.WithMany(x => x.RatingMediaSeriesSeason)
|
|
||||||
.HasForeignKey(x => x.MediaSeriesSeasonId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaSeriesSeasonId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Account)
|
|
||||||
.WithMany(x => x.RatingMediaSeriesSeason)
|
|
||||||
.HasForeignKey(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Rating)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Person;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Rating
|
|
||||||
{
|
|
||||||
public class RatingPersonActorRole : IEntity<RatingPersonActorRole>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public Guid PersonActorRoleId { get; set; }
|
|
||||||
public long AccountId { get; set; }
|
|
||||||
public short Rating { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public PersonActorRole PersonActorRole { get; set; }
|
|
||||||
public Account.Account Account { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<RatingPersonActorRole>.Build(EntityTypeBuilder<RatingPersonActorRole> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("RatingsPersonActorRole");
|
|
||||||
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.PersonActorRole)
|
|
||||||
.WithMany(x => x.RatingPersonActorRole)
|
|
||||||
.HasForeignKey(x => x.PersonActorRoleId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonActorRoleId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Account)
|
|
||||||
.WithMany(x => x.RatingPersonActorRole)
|
|
||||||
.HasForeignKey(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Rating)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WatchIt.Database.Model.Person;
|
|
||||||
|
|
||||||
namespace WatchIt.Database.Model.Rating
|
|
||||||
{
|
|
||||||
public class RatingPersonCreatorRole : IEntity<RatingPersonCreatorRole>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public Guid PersonCreatorRoleId { get; set; }
|
|
||||||
public long AccountId { get; set; }
|
|
||||||
public short Rating { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public PersonCreatorRole PersonCreatorRole { get; set; }
|
|
||||||
public Account.Account Account { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<RatingPersonCreatorRole>.Build(EntityTypeBuilder<RatingPersonCreatorRole> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("RatingsPersonCreatorRole");
|
|
||||||
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.PersonCreatorRole)
|
|
||||||
.WithMany(x => x.RatingPersonCreatorRole)
|
|
||||||
.HasForeignKey(x => x.PersonCreatorRoleId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonCreatorRoleId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Account)
|
|
||||||
.WithMany(x => x.RatingPersonCreatorRole)
|
|
||||||
.HasForeignKey(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.AccountId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Rating)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
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.ViewCount
|
|
||||||
{
|
|
||||||
public class ViewCountMedia : IEntity<ViewCountMedia>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long MediaId { get; set; }
|
|
||||||
public DateOnly Date { get; set; }
|
|
||||||
public long ViewCount { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Media.Media Media { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<ViewCountMedia>.Build(EntityTypeBuilder<ViewCountMedia> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("ViewCountsMedia");
|
|
||||||
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Media)
|
|
||||||
.WithMany(x => x.ViewCountsMedia)
|
|
||||||
.HasForeignKey(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.MediaId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Date)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
builder.Property(x => x.ViewCount)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
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.ViewCount
|
|
||||||
{
|
|
||||||
public class ViewCountPerson : IEntity<ViewCountPerson>
|
|
||||||
{
|
|
||||||
#region PROPERTIES
|
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
public long PersonId { get; set; }
|
|
||||||
public DateOnly Date { get; set; }
|
|
||||||
public long ViewCount { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region NAVIGATION
|
|
||||||
|
|
||||||
public Person.Person Person { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region PUBLIC METHODS
|
|
||||||
|
|
||||||
static void IEntity<ViewCountPerson>.Build(EntityTypeBuilder<ViewCountPerson> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("ViewCountsPerson");
|
|
||||||
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.HasIndex(x => x.Id)
|
|
||||||
.IsUnique();
|
|
||||||
builder.Property(x => x.Id)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.HasOne(x => x.Person)
|
|
||||||
.WithMany(x => x.ViewCountsPerson)
|
|
||||||
.HasForeignKey(x => x.PersonId)
|
|
||||||
.IsRequired();
|
|
||||||
builder.Property(x => x.PersonId)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(x => x.Date)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValueSql("now()");
|
|
||||||
|
|
||||||
builder.Property(x => x.ViewCount)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Account;
|
||||||
|
|
||||||
|
public class AccountConfiguration : IEntityTypeConfiguration<Model.Account.Account>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Model.Account.Account> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Username)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Email)
|
||||||
|
.HasMaxLength(320)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Description)
|
||||||
|
.HasMaxLength(1000);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Gender)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.GenderId);
|
||||||
|
builder.Property(x => x.GenderId);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.ProfilePicture)
|
||||||
|
.WithOne(x => x.Account)
|
||||||
|
.HasForeignKey<Model.Account.Account>(e => e.ProfilePictureId);
|
||||||
|
builder.Property(x => x.ProfilePictureId);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.BackgroundPicture)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.BackgroundPictureId);
|
||||||
|
builder.Property(x => x.BackgroundPictureId);
|
||||||
|
|
||||||
|
builder.Property(x => x.Password)
|
||||||
|
.HasMaxLength(1000)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.LeftSalt)
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.RightSalt)
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.IsAdmin)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
|
||||||
|
builder.Property(x => x.CreationDate)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
builder.Property(x => x.LastActive)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Account;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Account;
|
||||||
|
|
||||||
|
public class AccountProfilePictureConfiguration : IEntityTypeConfiguration<AccountProfilePicture>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<AccountProfilePicture> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Image)
|
||||||
|
.HasMaxLength(-1)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.MimeType)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.UploadDate)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Account;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Account;
|
||||||
|
|
||||||
|
public class AccountRefreshTokenConfiguration : IEntityTypeConfiguration<AccountRefreshToken>
|
||||||
|
{
|
||||||
|
public void Configure(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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.Database.Model.Seeding;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Common;
|
||||||
|
|
||||||
|
public class CountryConfiguration : IEntityTypeConfiguration<Country>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Country> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.IsHistorical)
|
||||||
|
.HasDefaultValue(false)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
// Navigation
|
||||||
|
builder.HasMany(x => x.MediaProduction)
|
||||||
|
.WithMany(x => x.ProductionCountries)
|
||||||
|
.UsingEntity<MediaProductionCountry>();
|
||||||
|
|
||||||
|
// Data
|
||||||
|
builder.HasData(DataReader.Read<Country>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
using WatchIt.Database.Model.Seeding;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Common;
|
||||||
|
|
||||||
|
public class GenderConfiguration : IEntityTypeConfiguration<Gender>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Gender> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
// Data
|
||||||
|
builder.HasData(DataReader.Read<Gender>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.Database.Model.Seeding;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Common;
|
||||||
|
|
||||||
|
public class GenreConfiguration : IEntityTypeConfiguration<Genre>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Genre> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Description)
|
||||||
|
.HasMaxLength(1000);
|
||||||
|
|
||||||
|
// Navigation
|
||||||
|
builder.HasMany(x => x.Media)
|
||||||
|
.WithMany(x => x.Genres)
|
||||||
|
.UsingEntity<MediaGenre>();
|
||||||
|
|
||||||
|
// Data
|
||||||
|
builder.HasData(DataReader.Read<Genre>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaConfiguration : IEntityTypeConfiguration<Model.Media.Media>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Model.Media.Media> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Title)
|
||||||
|
.HasMaxLength(250)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.OriginalTitle)
|
||||||
|
.HasMaxLength(250);
|
||||||
|
|
||||||
|
builder.Property(x => x.Description)
|
||||||
|
.HasMaxLength(1000);
|
||||||
|
|
||||||
|
builder.Property(x => x.ReleaseDate);
|
||||||
|
|
||||||
|
builder.Property(x => x.Length);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaPosterImage)
|
||||||
|
.WithOne(x => x.Media)
|
||||||
|
.HasForeignKey<Model.Media.Media>(x => x.MediaPosterImageId);
|
||||||
|
builder.Property(x => x.MediaPosterImageId);
|
||||||
|
|
||||||
|
// Navigation
|
||||||
|
builder.HasMany(x => x.Genres)
|
||||||
|
.WithMany(x => x.Media)
|
||||||
|
.UsingEntity<MediaGenre>();
|
||||||
|
builder.HasMany(x => x.ProductionCountries)
|
||||||
|
.WithMany(x => x.MediaProduction)
|
||||||
|
.UsingEntity<MediaProductionCountry>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaGenreConfiguration : IEntityTypeConfiguration<MediaGenre>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaGenre> builder)
|
||||||
|
{
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.MediaGenres)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Genre)
|
||||||
|
.WithMany(x => x.MediaGenres)
|
||||||
|
.HasForeignKey(x => x.GenreId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.GenreId)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaMovieConfiguration : IEntityTypeConfiguration<MediaMovie>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaMovie> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithOne()
|
||||||
|
.HasForeignKey<MediaMovie>(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Budget)
|
||||||
|
.HasColumnType("money");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaPhotoImageConfiguration : IEntityTypeConfiguration<MediaPhotoImage>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaPhotoImage> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.MediaPhotoImages)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Image)
|
||||||
|
.HasMaxLength(-1)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.MimeType)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.UploadDate)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
builder.Property(x => x.IsMediaBackground)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
|
||||||
|
builder.Property(x => x.IsUniversalBackground)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaPosterImageConfiguration : IEntityTypeConfiguration<MediaPosterImage>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaPosterImage> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Image)
|
||||||
|
.HasMaxLength(-1)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.MimeType)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.UploadDate)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaProductionCountryConfiguration : IEntityTypeConfiguration<MediaProductionCountry>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaProductionCountry> builder)
|
||||||
|
{
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.MediaProductionCountries)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Country)
|
||||||
|
.WithMany(x => x.MediaProductionCountries)
|
||||||
|
.HasForeignKey(x => x.CountryId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.CountryId)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaSeriesConfiguration : IEntityTypeConfiguration<MediaSeries>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaSeries> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithOne()
|
||||||
|
.HasForeignKey<MediaSeries>(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.HasEnded)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaSeriesEpisodeConfiguration : IEntityTypeConfiguration<MediaSeriesEpisode>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaSeriesEpisode> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaSeriesSeason)
|
||||||
|
.WithMany(x => x.MediaSeriesEpisodes)
|
||||||
|
.HasForeignKey(x => x.MediaSeriesSeasonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaSeriesSeasonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Number)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name);
|
||||||
|
|
||||||
|
builder.Property(x => x.IsSpecial)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Media;
|
||||||
|
|
||||||
|
public class MediaSeriesSeasonConfiguration : IEntityTypeConfiguration<MediaSeriesSeason>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<MediaSeriesSeason> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaSeries)
|
||||||
|
.WithMany(x => x.MediaSeriesSeasons)
|
||||||
|
.HasForeignKey(x => x.MediaSeriesId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaSeriesId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Number)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Person;
|
||||||
|
|
||||||
|
public class PersonActorRoleConfiguration : IEntityTypeConfiguration<PersonActorRole>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PersonActorRole> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Person)
|
||||||
|
.WithMany(x => x.PersonActorRoles)
|
||||||
|
.HasForeignKey(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.PersonActorRoles)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonActorRoleType)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.PersonActorRoleTypeId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonActorRoleTypeId)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
using WatchIt.Database.Model.Seeding;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Person;
|
||||||
|
|
||||||
|
public class PersonActorRoleTypeConfiguration : IEntityTypeConfiguration<PersonActorRoleType>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PersonActorRoleType> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
// Data
|
||||||
|
builder.HasData(DataReader.Read<PersonActorRoleType>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Person;
|
||||||
|
|
||||||
|
public class PersonConfiguration : IEntityTypeConfiguration<Model.Person.Person>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Model.Person.Person> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.FullName)
|
||||||
|
.HasMaxLength(200);
|
||||||
|
|
||||||
|
builder.Property(x => x.Description)
|
||||||
|
.HasMaxLength(1000);
|
||||||
|
|
||||||
|
builder.Property(x => x.BirthDate);
|
||||||
|
|
||||||
|
builder.Property(x => x.DeathDate);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Gender)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.GenderId);
|
||||||
|
builder.Property(x => x.GenderId);
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonPhoto)
|
||||||
|
.WithOne(x => x.Person)
|
||||||
|
.HasForeignKey<Model.Person.Person>(e => e.PersonPhotoId);
|
||||||
|
builder.Property(x => x.PersonPhotoId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Person;
|
||||||
|
|
||||||
|
public class PersonCreatorRoleConfiguration : IEntityTypeConfiguration<PersonCreatorRole>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PersonCreatorRole> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Person)
|
||||||
|
.WithMany(x => x.PersonCreatorRoles)
|
||||||
|
.HasForeignKey(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.PersonCreatorRoles)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonCreatorRoleType)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.PersonCreatorRoleTypeId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonCreatorRoleTypeId)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
using WatchIt.Database.Model.Seeding;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Person;
|
||||||
|
|
||||||
|
public class PersonCreatorRoleTypeConfiguration : IEntityTypeConfiguration<PersonCreatorRoleType>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PersonCreatorRoleType> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Name)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
// Data
|
||||||
|
builder.HasData(DataReader.Read<PersonCreatorRoleType>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Person;
|
||||||
|
|
||||||
|
public class PersonPhotoImageConfiguration : IEntityTypeConfiguration<PersonPhotoImage>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<PersonPhotoImage> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Image)
|
||||||
|
.HasMaxLength(-1)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.MimeType)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.UploadDate)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Rating;
|
||||||
|
|
||||||
|
public class RatingMediaConfiguration : IEntityTypeConfiguration<RatingMedia>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<RatingMedia> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.RatingMedia)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingMedia)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Rating;
|
||||||
|
|
||||||
|
public class RatingMediaSeriesEpisodeConfiguration : IEntityTypeConfiguration<RatingMediaSeriesEpisode>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<RatingMediaSeriesEpisode> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaSeriesEpisode)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesEpisode)
|
||||||
|
.HasForeignKey(x => x.MediaSeriesEpisodeId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaSeriesEpisodeId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesEpisode)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Rating;
|
||||||
|
|
||||||
|
public class RatingMediaSeriesSeasonConfiguration : IEntityTypeConfiguration<RatingMediaSeriesSeason>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<RatingMediaSeriesSeason> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.MediaSeriesSeason)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesSeason)
|
||||||
|
.HasForeignKey(x => x.MediaSeriesSeasonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaSeriesSeasonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingMediaSeriesSeason)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Rating;
|
||||||
|
|
||||||
|
public class RatingPersonActorRoleConfiguration : IEntityTypeConfiguration<RatingPersonActorRole>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<RatingPersonActorRole> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("RatingsPersonActorRole");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonActorRole)
|
||||||
|
.WithMany(x => x.RatingPersonActorRole)
|
||||||
|
.HasForeignKey(x => x.PersonActorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonActorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingPersonActorRole)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.Rating;
|
||||||
|
|
||||||
|
public class RatingPersonCreatorRoleConfiguration : IEntityTypeConfiguration<RatingPersonCreatorRole>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<RatingPersonCreatorRole> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("RatingsPersonCreatorRole");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.PersonCreatorRole)
|
||||||
|
.WithMany(x => x.RatingPersonCreatorRole)
|
||||||
|
.HasForeignKey(x => x.PersonCreatorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonCreatorRoleId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Account)
|
||||||
|
.WithMany(x => x.RatingPersonCreatorRole)
|
||||||
|
.HasForeignKey(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.AccountId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Rating)
|
||||||
|
.IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.ViewCount;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.ViewCount;
|
||||||
|
|
||||||
|
public class ViewCountMediaConfiguration : IEntityTypeConfiguration<ViewCountMedia>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<ViewCountMedia> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("ViewCountsMedia");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Media)
|
||||||
|
.WithMany(x => x.ViewCountsMedia)
|
||||||
|
.HasForeignKey(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.MediaId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Date)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
builder.Property(x => x.ViewCount)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using WatchIt.Database.Model.ViewCount;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Configuration.ViewCount;
|
||||||
|
|
||||||
|
public class ViewCountPersonConfiguration : IEntityTypeConfiguration<ViewCountPerson>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<ViewCountPerson> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("ViewCountsPerson");
|
||||||
|
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
builder.HasIndex(x => x.Id)
|
||||||
|
.IsUnique();
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.HasOne(x => x.Person)
|
||||||
|
.WithMany(x => x.ViewCountsPerson)
|
||||||
|
.HasForeignKey(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(x => x.PersonId)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x => x.Date)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValueSql("now()");
|
||||||
|
|
||||||
|
builder.Property(x => x.ViewCount)
|
||||||
|
.IsRequired()
|
||||||
|
.HasDefaultValue(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WatchIt.Database.Model.Seeding\WatchIt.Database.Model.Seeding.csproj" />
|
||||||
|
<ProjectReference Include="..\WatchIt.Database.Model\WatchIt.Database.Model.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"Id": 1,
|
||||||
|
"Name": "Afghanistan",
|
||||||
|
"IsHistorical": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 2,
|
||||||
|
"Name": "Albania",
|
||||||
|
"IsHistorical": false
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Seeding;
|
||||||
|
|
||||||
|
public class DataReader
|
||||||
|
{
|
||||||
|
#region METHODS
|
||||||
|
|
||||||
|
public static IEnumerable<T> Read<T>() => Read<T>(typeof(T).Name);
|
||||||
|
public static IEnumerable<T> Read<T>(string filename)
|
||||||
|
{
|
||||||
|
string jsonFile = $@"..\..\WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model.Seeding\Data\{filename}.json";
|
||||||
|
string dataString = File.ReadAllText(jsonFile);
|
||||||
|
IEnumerable<T>? data = JsonSerializer.Deserialize<IEnumerable<T>>(dataString);
|
||||||
|
if (data is null)
|
||||||
|
{
|
||||||
|
throw new JsonException();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.3" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.3" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\WatchIt.Database.DataSeeding\WatchIt.Database.DataSeeding.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Account;
|
||||||
|
|
||||||
|
public class Account
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public long Id { get; set; }
|
||||||
|
public required string Username { get; set; }
|
||||||
|
public required string Email { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public short? GenderId { get; set; }
|
||||||
|
public Guid? ProfilePictureId { get; set; }
|
||||||
|
public Guid? BackgroundPictureId { get; set; }
|
||||||
|
public required byte[] Password { get; set; }
|
||||||
|
public required string LeftSalt { get; set; }
|
||||||
|
public required string RightSalt { get; set; }
|
||||||
|
public bool IsAdmin { get; set; } = false;
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
|
public DateTime LastActive { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Gender? Gender { get; set; }
|
||||||
|
public virtual AccountProfilePicture? ProfilePicture { get; set; }
|
||||||
|
public virtual MediaPhotoImage? BackgroundPicture { get; set; }
|
||||||
|
|
||||||
|
public virtual IEnumerable<RatingMedia> RatingMedia { get; set; } = new List<RatingMedia>();
|
||||||
|
public virtual IEnumerable<RatingPersonActorRole> RatingPersonActorRole { get; set; } = new List<RatingPersonActorRole>();
|
||||||
|
public virtual IEnumerable<RatingPersonCreatorRole> RatingPersonCreatorRole { get; set; } = new List<RatingPersonCreatorRole>();
|
||||||
|
public virtual IEnumerable<RatingMediaSeriesSeason> RatingMediaSeriesSeason { get; set; } = new List<RatingMediaSeriesSeason>();
|
||||||
|
public virtual IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; } = new List<RatingMediaSeriesEpisode>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<AccountRefreshToken> AccountRefreshTokens { get; set; } = new List<AccountRefreshToken>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
namespace WatchIt.Database.Model.Account;
|
||||||
|
|
||||||
|
public class AccountProfilePicture
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public required byte[] Image { get; set; }
|
||||||
|
public required string MimeType { get; set; }
|
||||||
|
public DateTime UploadDate { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Account Account { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
namespace WatchIt.Database.Model.Account;
|
||||||
|
|
||||||
|
public class AccountRefreshToken
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public required long AccountId { get; set; }
|
||||||
|
public required DateTime ExpirationDate { get; set; }
|
||||||
|
public required bool IsExtendable { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Account Account { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Common;
|
||||||
|
|
||||||
|
public class Country
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public short Id { get; set; }
|
||||||
|
public required string Name { get; set; }
|
||||||
|
public bool IsHistorical { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; } = new List<MediaProductionCountry>();
|
||||||
|
public virtual IEnumerable<Media.Media> MediaProduction { get; set; } = new List<Media.Media>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace WatchIt.Database.Model.Common;
|
||||||
|
|
||||||
|
public class Gender
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public short Id { get; set; }
|
||||||
|
public required string Name { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Common;
|
||||||
|
|
||||||
|
public class Genre
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public short Id { get; set; }
|
||||||
|
public required string Name { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual IEnumerable<MediaGenre> MediaGenres { get; set; } = new List<MediaGenre>();
|
||||||
|
public virtual IEnumerable<Media.Media> Media { get; set; } = new List<Media.Media>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
using WatchIt.Database.Model.Person;
|
||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
using WatchIt.Database.Model.ViewCount;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class Media
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public long Id { get; set; }
|
||||||
|
public required string Title { get; set; }
|
||||||
|
public string? OriginalTitle { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public DateOnly? ReleaseDate { get; set; }
|
||||||
|
public short? Length { get; set; }
|
||||||
|
public Guid? MediaPosterImageId { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual MediaPosterImage? MediaPosterImage { get; set; }
|
||||||
|
|
||||||
|
public virtual IEnumerable<MediaPhotoImage> MediaPhotoImages { get; set; } = new List<MediaPhotoImage>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<MediaGenre> MediaGenres { get; set; } = new List<MediaGenre>();
|
||||||
|
public virtual IEnumerable<Genre> Genres { get; set; } = new List<Genre>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<MediaProductionCountry> MediaProductionCountries { get; set; } = new List<MediaProductionCountry>();
|
||||||
|
public virtual IEnumerable<Country> ProductionCountries { get; set; } = new List<Country>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<PersonActorRole> PersonActorRoles { get; set; } = new List<PersonActorRole>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<PersonCreatorRole> PersonCreatorRoles { get; set; } = new List<PersonCreatorRole>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<RatingMedia> RatingMedia { get; set; } = new List<RatingMedia>();
|
||||||
|
|
||||||
|
public virtual IEnumerable<ViewCountMedia> ViewCountsMedia { get; set; } = new List<ViewCountMedia>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaGenre
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public required long MediaId { get; set; }
|
||||||
|
public required short GenreId { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Media Media { get; set; } = null!;
|
||||||
|
public virtual Genre Genre { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaMovie
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public long Id { get; set; }
|
||||||
|
public decimal? Budget { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Media Media { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaPhotoImage
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public required long MediaId { get; set; }
|
||||||
|
public required byte[] Image { get; set; }
|
||||||
|
public required string MimeType { get; set; }
|
||||||
|
public DateTime UploadDate { get; set; }
|
||||||
|
public bool IsMediaBackground { get; set; }
|
||||||
|
public bool IsUniversalBackground { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Media Media { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaPosterImage
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public required byte[] Image { get; set; }
|
||||||
|
public required string MimeType { get; set; }
|
||||||
|
public required DateTime UploadDate { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Media Media { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using WatchIt.Database.Model.Common;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaProductionCountry
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public required long MediaId { get; set; }
|
||||||
|
public required short CountryId { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Media Media { get; set; } = null!;
|
||||||
|
public virtual Country Country { get; set; } = null!;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaSeries
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public required long Id { get; set; }
|
||||||
|
public bool HasEnded { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual Media Media { get; set; } = null!;
|
||||||
|
public virtual IEnumerable<MediaSeriesSeason> MediaSeriesSeasons { get; set; } = new List<MediaSeriesSeason>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using WatchIt.Database.Model.Rating;
|
||||||
|
|
||||||
|
namespace WatchIt.Database.Model.Media;
|
||||||
|
|
||||||
|
public class MediaSeriesEpisode
|
||||||
|
{
|
||||||
|
#region PROPERTIES
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public required Guid MediaSeriesSeasonId { get; set; }
|
||||||
|
public required short Number { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public bool IsSpecial { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region NAVIGATION
|
||||||
|
|
||||||
|
public virtual MediaSeriesSeason MediaSeriesSeason { get; set; } = null!;
|
||||||
|
public virtual IEnumerable<RatingMediaSeriesEpisode> RatingMediaSeriesEpisode { get; set; } = new List<RatingMediaSeriesEpisode>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user