diff --git a/src/tvnoms-server/TvNoms.ApiService/Endpoints/UserEndpoints.cs b/src/tvnoms-server/TvNoms.ApiService/Endpoints/UserEndpoints.cs
index fbec241..90d83cb 100644
--- a/src/tvnoms-server/TvNoms.ApiService/Endpoints/UserEndpoints.cs
+++ b/src/tvnoms-server/TvNoms.ApiService/Endpoints/UserEndpoints.cs
@@ -2,14 +2,14 @@ using System.Security.Claims;
using Humanizer;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Data.Models.Medias;
-using TvNoms.Server.Services.Data.Models.Users;
-using TvNoms.Server.Services.Data.Models.Users.Accounts;
-using TvNoms.Server.Services.Data.Services;
-using TvNoms.Server.Services.Identity;
-using TvNoms.Server.Services.Utilities;
-using TvNoms.Server.Services.Validation.Exceptions;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Extensions.Identity;
+using TvNoms.Core.Models.Medias;
+using TvNoms.Core.Models.Users;
+using TvNoms.Core.Models.Users.Accounts;
+using TvNoms.Core.Utilities;
+using TvNoms.Core.Utilities.Validation.Exceptions;
+using TvNoms.Server.Services;
namespace TvNoms.Server.ApiService.Endpoints;
diff --git a/src/tvnoms-server/TvNoms.ApiService/Program.cs b/src/tvnoms-server/TvNoms.ApiService/Program.cs
index f654a95..469c2a9 100644
--- a/src/tvnoms-server/TvNoms.ApiService/Program.cs
+++ b/src/tvnoms-server/TvNoms.ApiService/Program.cs
@@ -5,18 +5,18 @@ using Microsoft.AspNetCore.Authentication.Google;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
+using server.ServiceDefaults;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Models;
+using TvNoms.Core.Utilities;
+using TvNoms.Infrastructure.Identity;
+using TvNoms.Infrastructure.Messaging.Email;
+using TvNoms.Infrastructure.Messaging.SMS;
+using TvNoms.Infrastructure.Storage;
+using TvNoms.Infrastructure.ViewRenderer.Razor;
using TvNoms.Server.ApiService.Shared;
using TvNoms.Server.Data;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Data.Models;
-using TvNoms.Server.Services.Data.Repositories;
-using TvNoms.Server.Services.Identity;
-using TvNoms.Server.Services.Infrastructure.Messaging;
-using TvNoms.Server.Services.Infrastructure.Messaging.Email;
-using TvNoms.Server.Services.Infrastructure.Messaging.SMS;
-using TvNoms.Server.Services.Infrastructure.Storage;
-using TvNoms.Server.Services.Utilities;
-using TvNoms.Server.Services.ViewRenderer.Razor;
+using TvNoms.Server.Data.Repositories;
var builder = WebApplication.CreateBuilder(args);
var assemblies = AssemblyHelper.GetAssemblies().ToArray();
diff --git a/src/tvnoms-server/TvNoms.ApiService/Shared/EndpointRouteBuilderExtensions.cs b/src/tvnoms-server/TvNoms.ApiService/Shared/EndpointRouteBuilderExtensions.cs
index 9906004..cbd48c2 100644
--- a/src/tvnoms-server/TvNoms.ApiService/Shared/EndpointRouteBuilderExtensions.cs
+++ b/src/tvnoms-server/TvNoms.ApiService/Shared/EndpointRouteBuilderExtensions.cs
@@ -1,4 +1,4 @@
-using TvNoms.Server.Services.Utilities;
+using TvNoms.Core.Utilities;
namespace TvNoms.Server.ApiService.Shared;
diff --git a/src/tvnoms-server/TvNoms.ApiService/TvNoms.ApiService.csproj b/src/tvnoms-server/TvNoms.ApiService/TvNoms.ApiService.csproj
index dff7864..610b96e 100644
--- a/src/tvnoms-server/TvNoms.ApiService/TvNoms.ApiService.csproj
+++ b/src/tvnoms-server/TvNoms.ApiService/TvNoms.ApiService.csproj
@@ -9,6 +9,8 @@
+
+
diff --git a/src/tvnoms-server/TvNoms.Data/Models/Client.cs b/src/tvnoms-server/TvNoms.Core/Entities/Client.cs
similarity index 77%
rename from src/tvnoms-server/TvNoms.Data/Models/Client.cs
rename to src/tvnoms-server/TvNoms.Core/Entities/Client.cs
index 9486561..18ed204 100644
--- a/src/tvnoms-server/TvNoms.Data/Models/Client.cs
+++ b/src/tvnoms-server/TvNoms.Core/Entities/Client.cs
@@ -1,9 +1,6 @@
-namespace TvNoms.Server.Data.Models;
-
-public record Client : BaseEntity {
- public Client() {
- }
+namespace TvNoms.Core.Entities;
+public class Client : BaseEntity {
public string ConnectionId { get; set; } = default!;
public DateTimeOffset ConnectionTime { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Data/Models/IEntity.cs b/src/tvnoms-server/TvNoms.Core/Entities/IEntity.cs
similarity index 80%
rename from src/tvnoms-server/TvNoms.Data/Models/IEntity.cs
rename to src/tvnoms-server/TvNoms.Core/Entities/IEntity.cs
index 56c5049..854754f 100644
--- a/src/tvnoms-server/TvNoms.Data/Models/IEntity.cs
+++ b/src/tvnoms-server/TvNoms.Core/Entities/IEntity.cs
@@ -1,15 +1,15 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-namespace TvNoms.Server.Data.Models;
+namespace TvNoms.Core.Entities;
public interface IEntity {
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public Guid Id { get; set; }
+ public Guid Id { get; }
}
-public record BaseEntity : IEntity {
+public class BaseEntity : IEntity {
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
diff --git a/src/tvnoms-server/TvNoms.Data/Models/Media.cs b/src/tvnoms-server/TvNoms.Core/Entities/Media.cs
similarity index 86%
rename from src/tvnoms-server/TvNoms.Data/Models/Media.cs
rename to src/tvnoms-server/TvNoms.Core/Entities/Media.cs
index a97e285..2bc4c01 100644
--- a/src/tvnoms-server/TvNoms.Data/Models/Media.cs
+++ b/src/tvnoms-server/TvNoms.Core/Entities/Media.cs
@@ -1,6 +1,6 @@
-namespace TvNoms.Server.Data.Models;
+namespace TvNoms.Core.Entities;
-public record Media : BaseEntity {
+public class Media : BaseEntity {
public string Name { get; set; } = default!;
public long Size { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Core/Entities/Movie.cs b/src/tvnoms-server/TvNoms.Core/Entities/Movie.cs
new file mode 100644
index 0000000..3d3a81f
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Entities/Movie.cs
@@ -0,0 +1,5 @@
+namespace TvNoms.Core.Entities;
+
+public class Movie() : BaseEntity {
+ public string Title { get; set; }
+}
diff --git a/src/tvnoms-server/TvNoms.Core/Entities/Show.cs b/src/tvnoms-server/TvNoms.Core/Entities/Show.cs
new file mode 100644
index 0000000..0c9b8f7
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Entities/Show.cs
@@ -0,0 +1,5 @@
+namespace TvNoms.Core.Entities;
+
+public class Show : BaseEntity {
+ public string Title { get; set; }
+}
diff --git a/src/tvnoms-server/TvNoms.Data/Models/User.cs b/src/tvnoms-server/TvNoms.Core/Entities/User.cs
similarity index 89%
rename from src/tvnoms-server/TvNoms.Data/Models/User.cs
rename to src/tvnoms-server/TvNoms.Core/Entities/User.cs
index a69de26..6042ab7 100644
--- a/src/tvnoms-server/TvNoms.Data/Models/User.cs
+++ b/src/tvnoms-server/TvNoms.Core/Entities/User.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Identity;
-namespace TvNoms.Server.Data.Models;
+namespace TvNoms.Core.Entities;
public class User : IdentityUser, IEntity {
public string FirstName { get; set; }
@@ -20,10 +20,7 @@ public class User : IdentityUser, IEntity {
}
public class UserRole : IdentityUserRole, IEntity {
- public Guid Id { get; set; }
-
- public virtual User User { get; set; } = default!;
- public virtual Role Role { get; set; } = default!;
+ Guid IEntity.Id { get; }
}
public class UserSession : IEntity {
diff --git a/src/tvnoms-server/TvNoms.Services/Events/UserSignedIn.cs b/src/tvnoms-server/TvNoms.Core/Events/UserSignedIn.cs
similarity index 67%
rename from src/tvnoms-server/TvNoms.Services/Events/UserSignedIn.cs
rename to src/tvnoms-server/TvNoms.Core/Events/UserSignedIn.cs
index 72d184c..0e60528 100644
--- a/src/tvnoms-server/TvNoms.Services/Events/UserSignedIn.cs
+++ b/src/tvnoms-server/TvNoms.Core/Events/UserSignedIn.cs
@@ -1,7 +1,7 @@
using MediatR;
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
-namespace TvNoms.Server.Services.Events;
+namespace TvNoms.Core.Events;
public class UserSignedIn : INotification {
public UserSignedIn(User user) {
diff --git a/src/tvnoms-server/TvNoms.Services/Events/UserSignedOut.cs b/src/tvnoms-server/TvNoms.Core/Events/UserSignedOut.cs
similarity index 67%
rename from src/tvnoms-server/TvNoms.Services/Events/UserSignedOut.cs
rename to src/tvnoms-server/TvNoms.Core/Events/UserSignedOut.cs
index 8c84a2e..dbc7206 100644
--- a/src/tvnoms-server/TvNoms.Services/Events/UserSignedOut.cs
+++ b/src/tvnoms-server/TvNoms.Core/Events/UserSignedOut.cs
@@ -1,7 +1,7 @@
using MediatR;
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
-namespace TvNoms.Server.Services.Events;
+namespace TvNoms.Core.Events;
public class UserSignedOut : INotification {
public UserSignedOut(User user) {
diff --git a/src/tvnoms-server/TvNoms.Services/Events/UserSignedUp.cs b/src/tvnoms-server/TvNoms.Core/Events/UserSignedUp.cs
similarity index 67%
rename from src/tvnoms-server/TvNoms.Services/Events/UserSignedUp.cs
rename to src/tvnoms-server/TvNoms.Core/Events/UserSignedUp.cs
index 42f4ef6..e461725 100644
--- a/src/tvnoms-server/TvNoms.Services/Events/UserSignedUp.cs
+++ b/src/tvnoms-server/TvNoms.Core/Events/UserSignedUp.cs
@@ -1,7 +1,7 @@
using MediatR;
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
-namespace TvNoms.Server.Services.Events;
+namespace TvNoms.Core.Events;
public class UserSignedUp : INotification {
public UserSignedUp(User user) {
diff --git a/src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailAccount.cs b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailAccount.cs
similarity index 78%
rename from src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailAccount.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailAccount.cs
index 94051ee..1f81adb 100644
--- a/src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailAccount.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailAccount.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
+namespace TvNoms.Core.Extensions.EmailSender;
public class EmailAccount {
public string Username { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailAttachment.cs b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailAttachment.cs
similarity index 74%
rename from src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailAttachment.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailAttachment.cs
index 7f2aa66..70a5c00 100644
--- a/src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailAttachment.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailAttachment.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
+namespace TvNoms.Core.Extensions.EmailSender;
public class EmailAttachment {
public string FileName { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailMessage.cs b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailMessage.cs
similarity index 81%
rename from src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailMessage.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailMessage.cs
index f797852..ae98c74 100644
--- a/src/tvnoms-server/TvNoms.Services/Infrastructure/Messaging/Email/EmailMessage.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/EmailMessage.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
+namespace TvNoms.Core.Extensions.EmailSender;
public class EmailMessage {
public string Subject { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/IEmailSender.cs b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/IEmailSender.cs
new file mode 100644
index 0000000..e551745
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/EmailSender/IEmailSender.cs
@@ -0,0 +1,5 @@
+namespace TvNoms.Core.Extensions.EmailSender;
+
+public interface IEmailSender {
+ Task SendAsync(EmailMessage message, CancellationToken cancellationToken = default);
+}
diff --git a/src/tvnoms-server/TvNoms.Services/Identity/IClientContext.cs b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/IClientContext.cs
similarity index 82%
rename from src/tvnoms-server/TvNoms.Services/Identity/IClientContext.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/Identity/IClientContext.cs
index d4efcf5..c43af75 100644
--- a/src/tvnoms-server/TvNoms.Services/Identity/IClientContext.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/IClientContext.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Identity;
+namespace TvNoms.Core.Extensions.Identity;
public interface IClientContext {
string? DeviceId { get; }
diff --git a/src/tvnoms-server/TvNoms.Services/Identity/IUserSessionFactory.cs b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/IUserSessionFactory.cs
similarity index 82%
rename from src/tvnoms-server/TvNoms.Services/Identity/IUserSessionFactory.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/Identity/IUserSessionFactory.cs
index 753b1cd..37be57d 100644
--- a/src/tvnoms-server/TvNoms.Services/Identity/IUserSessionFactory.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/IUserSessionFactory.cs
@@ -1,6 +1,6 @@
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
-namespace TvNoms.Server.Services.Identity;
+namespace TvNoms.Core.Extensions.Identity;
public interface IUserSessionFactory {
Task GenerateAsync(User user, CancellationToken cancellationToken = default);
diff --git a/src/tvnoms-server/TvNoms.Services/Identity/TokenHelper.cs b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/TokenHelper.cs
similarity index 98%
rename from src/tvnoms-server/TvNoms.Services/Identity/TokenHelper.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/Identity/TokenHelper.cs
index 9253015..c08f0df 100644
--- a/src/tvnoms-server/TvNoms.Services/Identity/TokenHelper.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/TokenHelper.cs
@@ -3,7 +3,7 @@ using System.Security.Cryptography;
using System.Text;
using DeviceId;
-namespace TvNoms.Server.Services.Identity;
+namespace TvNoms.Core.Extensions.Identity;
public class TokenHelper {
public static string Secret => GenerateSHA256Hash(
diff --git a/src/tvnoms-server/TvNoms.Services/Identity/UserSessionInfo.cs b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/UserSessionInfo.cs
similarity index 90%
rename from src/tvnoms-server/TvNoms.Services/Identity/UserSessionInfo.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/Identity/UserSessionInfo.cs
index 24cd615..dbb1345 100644
--- a/src/tvnoms-server/TvNoms.Services/Identity/UserSessionInfo.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/UserSessionInfo.cs
@@ -1,6 +1,6 @@
using System.Security.Claims;
-namespace TvNoms.Server.Services.Identity;
+namespace TvNoms.Core.Extensions.Identity;
public class UserSessionInfo {
public string AccessToken { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Identity/UserSessionOptions.cs b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/UserSessionOptions.cs
similarity index 94%
rename from src/tvnoms-server/TvNoms.Services/Identity/UserSessionOptions.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/Identity/UserSessionOptions.cs
index c4a4e00..fa0ba80 100644
--- a/src/tvnoms-server/TvNoms.Services/Identity/UserSessionOptions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/Identity/UserSessionOptions.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Identity;
+namespace TvNoms.Core.Extensions.Identity;
public class UserSessionOptions {
public string Secret { set; get; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Core/Extensions/SmsSender/ISmsSender.cs b/src/tvnoms-server/TvNoms.Core/Extensions/SmsSender/ISmsSender.cs
new file mode 100644
index 0000000..7da8190
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/SmsSender/ISmsSender.cs
@@ -0,0 +1,5 @@
+namespace TvNoms.Core.Extensions.SmsSender;
+
+public interface ISmsSender {
+ Task SendAsync(string phoneNumber, string message, CancellationToken cancellationToken = default);
+}
diff --git a/src/tvnoms-server/TvNoms.Services/ViewRenderer/Razor/IViewRenderer.cs b/src/tvnoms-server/TvNoms.Core/Extensions/ViewRenderer/IViewRenderer.cs
similarity index 73%
rename from src/tvnoms-server/TvNoms.Services/ViewRenderer/Razor/IViewRenderer.cs
rename to src/tvnoms-server/TvNoms.Core/Extensions/ViewRenderer/IViewRenderer.cs
index f214c54..19cd560 100644
--- a/src/tvnoms-server/TvNoms.Services/ViewRenderer/Razor/IViewRenderer.cs
+++ b/src/tvnoms-server/TvNoms.Core/Extensions/ViewRenderer/IViewRenderer.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.ViewRenderer.Razor;
+namespace TvNoms.Core.Extensions.ViewRenderer;
public interface IViewRenderer {
Task RenderAsync(string name, object? model = null, CancellationToken cancellationToken = default);
diff --git a/src/tvnoms-server/TvNoms.Services/Infrastructure/Storage/FileRuleOptions.cs b/src/tvnoms-server/TvNoms.Core/FileStorage/FileRuleOptions.cs
similarity index 93%
rename from src/tvnoms-server/TvNoms.Services/Infrastructure/Storage/FileRuleOptions.cs
rename to src/tvnoms-server/TvNoms.Core/FileStorage/FileRuleOptions.cs
index 5f90750..6bede8a 100644
--- a/src/tvnoms-server/TvNoms.Services/Infrastructure/Storage/FileRuleOptions.cs
+++ b/src/tvnoms-server/TvNoms.Core/FileStorage/FileRuleOptions.cs
@@ -1,7 +1,7 @@
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Utilities;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Utilities;
-namespace TvNoms.Server.Services.Infrastructure.Storage;
+namespace TvNoms.Core.FileStorage;
public class FileRuleOptions {
public IList Documents { get; set; } = new List();
diff --git a/src/tvnoms-server/TvNoms.Services/Infrastructure/Storage/IFileStorage.cs b/src/tvnoms-server/TvNoms.Core/FileStorage/IFileStorage.cs
similarity index 92%
rename from src/tvnoms-server/TvNoms.Services/Infrastructure/Storage/IFileStorage.cs
rename to src/tvnoms-server/TvNoms.Core/FileStorage/IFileStorage.cs
index eefa4bb..6903311 100644
--- a/src/tvnoms-server/TvNoms.Services/Infrastructure/Storage/IFileStorage.cs
+++ b/src/tvnoms-server/TvNoms.Core/FileStorage/IFileStorage.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Infrastructure.Storage;
+namespace TvNoms.Core.FileStorage;
public interface IFileStorage {
Task WriteAsync(string path, Stream content, CancellationToken cancellationToken = default);
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/DeleteMediaForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Medias/DeleteMediaForm.cs
similarity index 80%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Medias/DeleteMediaForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Medias/DeleteMediaForm.cs
index 51316db..b59591b 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/DeleteMediaForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Medias/DeleteMediaForm.cs
@@ -1,6 +1,6 @@
using FluentValidation;
-namespace TvNoms.Server.Services.Data.Models.Medias;
+namespace TvNoms.Core.Models.Medias;
public class DeleteMediaForm {
public long Id { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/MediaModel.cs b/src/tvnoms-server/TvNoms.Core/Models/Medias/MediaModel.cs
similarity index 89%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Medias/MediaModel.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Medias/MediaModel.cs
index 08458bf..314b1bd 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/MediaModel.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Medias/MediaModel.cs
@@ -1,7 +1,7 @@
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
using AbstractProfile = AutoMapper.Profile;
-namespace TvNoms.Server.Services.Data.Models.Medias;
+namespace TvNoms.Core.Models.Medias;
public class MediaModel {
public long Id { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/UploadMediaChunkForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Medias/UploadMediaChunkForm.cs
similarity index 78%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Medias/UploadMediaChunkForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Medias/UploadMediaChunkForm.cs
index 1552ee3..d3f3ea6 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/UploadMediaChunkForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Medias/UploadMediaChunkForm.cs
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Options;
-using TvNoms.Server.Services.Infrastructure.Storage;
+using TvNoms.Core.FileStorage;
-namespace TvNoms.Server.Services.Data.Models.Medias;
+namespace TvNoms.Core.Models.Medias;
public class UploadMediaChunkForm : UploadMediaContentForm {
public Guid Id { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/UploadMediaContentForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Medias/UploadMediaContentForm.cs
similarity index 91%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Medias/UploadMediaContentForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Medias/UploadMediaContentForm.cs
index 3ebb46c..d03dba7 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Medias/UploadMediaContentForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Medias/UploadMediaContentForm.cs
@@ -1,11 +1,11 @@
using FluentValidation;
using Humanizer;
using Microsoft.Extensions.Options;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Infrastructure.Storage;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Entities;
+using TvNoms.Core.FileStorage;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Medias;
+namespace TvNoms.Core.Models.Medias;
public class UploadMediaContentForm {
public string Name { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/ModelBuilder.cs b/src/tvnoms-server/TvNoms.Core/Models/ModelBuilder.cs
similarity index 91%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/ModelBuilder.cs
rename to src/tvnoms-server/TvNoms.Core/Models/ModelBuilder.cs
index 82b9e1d..5dad34b 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/ModelBuilder.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/ModelBuilder.cs
@@ -1,13 +1,13 @@
using AutoMapper;
using Humanizer;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Data.Models.Users;
-using TvNoms.Server.Services.Data.Repositories;
-using TvNoms.Server.Services.Data.Utilities;
-using TvNoms.Server.Services.Identity;
-using TvNoms.Server.Services.Infrastructure.Storage;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Extensions.Identity;
+using TvNoms.Core.FileStorage;
+using TvNoms.Core.Models.Users;
+using TvNoms.Core.Repositories;
+using TvNoms.Core.Utilities;
-namespace TvNoms.Server.Services.Data.Models;
+namespace TvNoms.Core.Models;
public interface IModelBuilder {
// User
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/ServiceCollectionExtensions.cs b/src/tvnoms-server/TvNoms.Core/Models/ServiceCollectionExtensions.cs
similarity index 95%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/ServiceCollectionExtensions.cs
rename to src/tvnoms-server/TvNoms.Core/Models/ServiceCollectionExtensions.cs
index 8f4a915..520e1d5 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/ServiceCollectionExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/ServiceCollectionExtensions.cs
@@ -2,9 +2,9 @@
using FluentValidation;
using Humanizer;
using Microsoft.Extensions.DependencyInjection;
-using TvNoms.Server.Services.Utilities;
+using TvNoms.Core.Utilities;
-namespace TvNoms.Server.Services.Data.Models;
+namespace TvNoms.Core.Models;
public static class ServiceCollectionExtensions {
public static IServiceCollection AddModelBuilder(this IServiceCollection services) {
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/ChangePasswordForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/ChangePasswordForm.cs
similarity index 84%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/ChangePasswordForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/ChangePasswordForm.cs
index 32b5ef3..9100a99 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/ChangePasswordForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/ChangePasswordForm.cs
@@ -1,7 +1,7 @@
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts;
+namespace TvNoms.Core.Models.Users.Accounts;
public class ChangePasswordForm {
public string CurrentPassword { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/RefreshSessionForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/RefreshSessionForm.cs
similarity index 82%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/RefreshSessionForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/RefreshSessionForm.cs
index f510b6d..7f05a98 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/RefreshSessionForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/RefreshSessionForm.cs
@@ -1,6 +1,6 @@
using FluentValidation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts;
+namespace TvNoms.Core.Models.Users.Accounts;
public class RefreshSessionForm {
public string RefreshToken { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/ResetPasswordForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/ResetPasswordForm.cs
similarity index 86%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/ResetPasswordForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/ResetPasswordForm.cs
index aa550d7..0c90a19 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/ResetPasswordForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/ResetPasswordForm.cs
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts {
+namespace TvNoms.Core.Models.Users.Accounts {
public class ResetPasswordForm {
public string Username { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SendPasswordResetTokenForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SendPasswordResetTokenForm.cs
similarity index 81%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SendPasswordResetTokenForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SendPasswordResetTokenForm.cs
index 1746d11..7f1e624 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SendPasswordResetTokenForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SendPasswordResetTokenForm.cs
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts;
+namespace TvNoms.Core.Models.Users.Accounts;
public class SendPasswordResetTokenForm {
public string Username { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SendUsernameTokenForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SendUsernameTokenForm.cs
similarity index 81%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SendUsernameTokenForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SendUsernameTokenForm.cs
index 1025917..3f56bbc 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SendUsernameTokenForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SendUsernameTokenForm.cs
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts {
+namespace TvNoms.Core.Models.Users.Accounts {
public class SendUsernameTokenForm {
public string Username { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignInForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignInForm.cs
similarity index 83%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignInForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignInForm.cs
index f748896..07bda8a 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignInForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignInForm.cs
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts {
+namespace TvNoms.Core.Models.Users.Accounts {
public class SignInForm {
public string Username { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignOutForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignOutForm.cs
similarity index 81%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignOutForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignOutForm.cs
index 35303e9..cd05e97 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignOutForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignOutForm.cs
@@ -1,6 +1,6 @@
using FluentValidation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts;
+namespace TvNoms.Core.Models.Users.Accounts;
public class SignOutForm {
public string RefreshToken { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignUpForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignUpForm.cs
similarity index 87%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignUpForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignUpForm.cs
index 052a518..06ba981 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignUpForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignUpForm.cs
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts {
+namespace TvNoms.Core.Models.Users.Accounts {
public class SignUpForm {
public string FirstName { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignUpWithForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignUpWithForm.cs
similarity index 89%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignUpWithForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignUpWithForm.cs
index d07d0f3..4f8c2fd 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/SignUpWithForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/SignUpWithForm.cs
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts {
+namespace TvNoms.Core.Models.Users.Accounts {
public class SignUpWithForm {
public string FirstName { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/VerifyUsernameForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/VerifyUsernameForm.cs
similarity index 81%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/VerifyUsernameForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/VerifyUsernameForm.cs
index 89cf61f..9dfe863 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/Accounts/VerifyUsernameForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/Accounts/VerifyUsernameForm.cs
@@ -1,7 +1,7 @@
using FluentValidation;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Utilities.Validation;
-namespace TvNoms.Server.Services.Data.Models.Users.Accounts {
+namespace TvNoms.Core.Models.Users.Accounts {
public class VerifyUsernameForm {
public string Username { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/EditUserForm.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/EditUserForm.cs
similarity index 89%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/EditUserForm.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/EditUserForm.cs
index 06d1d8e..b942919 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/EditUserForm.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/EditUserForm.cs
@@ -1,9 +1,9 @@
using FluentValidation;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Validation;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Utilities.Validation;
using AbstractProfile = AutoMapper.Profile;
-namespace TvNoms.Server.Services.Data.Models.Users;
+namespace TvNoms.Core.Models.Users;
public class EditUserForm {
public string UserName { get; set; } = default!;
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserCriteria.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/UserCriteria.cs
similarity index 82%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserCriteria.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/UserCriteria.cs
index b034c6b..efcbab0 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserCriteria.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/UserCriteria.cs
@@ -1,8 +1,8 @@
using System.Linq.Expressions;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Utilities;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Utilities;
-namespace TvNoms.Server.Services.Data.Models.Users;
+namespace TvNoms.Core.Models.Users;
public class UserCriteria {
public Guid[]? Id { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserModel.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/UserModel.cs
similarity index 90%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserModel.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/UserModel.cs
index 4485664..8bc5e39 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserModel.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/UserModel.cs
@@ -1,7 +1,7 @@
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
using AbstractProfile = AutoMapper.Profile;
-namespace TvNoms.Server.Services.Data.Models.Users;
+namespace TvNoms.Core.Models.Users;
public class UserModel {
public long Id { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserPageModel.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/UserPageModel.cs
similarity index 83%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserPageModel.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/UserPageModel.cs
index 11ba849..c39916c 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserPageModel.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/UserPageModel.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Data.Models.Users;
+namespace TvNoms.Core.Models.Users;
public class UserPageModel {
public long Offset { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserWithSessionModel.cs b/src/tvnoms-server/TvNoms.Core/Models/Users/UserWithSessionModel.cs
similarity index 80%
rename from src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserWithSessionModel.cs
rename to src/tvnoms-server/TvNoms.Core/Models/Users/UserWithSessionModel.cs
index 404521a..203f85d 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Models/Users/UserWithSessionModel.cs
+++ b/src/tvnoms-server/TvNoms.Core/Models/Users/UserWithSessionModel.cs
@@ -1,8 +1,8 @@
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Identity;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Extensions.Identity;
using AbstractProfile = AutoMapper.Profile;
-namespace TvNoms.Server.Services.Data.Models.Users;
+namespace TvNoms.Core.Models.Users;
public class UserWithSessionModel : UserModel {
public bool EmailConfirmed { get; set; }
diff --git a/src/tvnoms-server/TvNoms.Core/Repositories/IClientRepository.cs b/src/tvnoms-server/TvNoms.Core/Repositories/IClientRepository.cs
new file mode 100644
index 0000000..b5f4777
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Repositories/IClientRepository.cs
@@ -0,0 +1,12 @@
+using System.Linq.Expressions;
+using TvNoms.Core.Entities;
+
+namespace TvNoms.Core.Repositories;
+
+public interface IClientRepository : IRepository {
+ Task DeactivateAsync(Client client, CancellationToken cancellationToken = default);
+
+ Task DeactivateManyAsync(Expression> predicate, CancellationToken cancellationToken = default);
+
+ Task DeactivateAllAsync(CancellationToken cancellationToken = default);
+}
diff --git a/src/tvnoms-server/TvNoms.Core/Repositories/IMediaRepository.cs b/src/tvnoms-server/TvNoms.Core/Repositories/IMediaRepository.cs
new file mode 100644
index 0000000..c899941
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Repositories/IMediaRepository.cs
@@ -0,0 +1,6 @@
+using TvNoms.Core.Entities;
+
+namespace TvNoms.Core.Repositories;
+
+public interface IMediaRepository : IRepository {
+}
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Repositories/IRepository.cs b/src/tvnoms-server/TvNoms.Core/Repositories/IRepository.cs
similarity index 95%
rename from src/tvnoms-server/TvNoms.Services/Data/Repositories/IRepository.cs
rename to src/tvnoms-server/TvNoms.Core/Repositories/IRepository.cs
index 32c194f..9753687 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Repositories/IRepository.cs
+++ b/src/tvnoms-server/TvNoms.Core/Repositories/IRepository.cs
@@ -1,8 +1,8 @@
using System.Linq.Expressions;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Data.Utilities;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Utilities;
-namespace TvNoms.Server.Services.Data.Repositories;
+namespace TvNoms.Core.Repositories;
public interface IRepository where TEntity : class, IEntity {
Task CreateAsync(TEntity entity, CancellationToken cancellationToken = default);
diff --git a/src/tvnoms-server/TvNoms.Core/Repositories/IRoleRepository.cs b/src/tvnoms-server/TvNoms.Core/Repositories/IRoleRepository.cs
new file mode 100644
index 0000000..b1f549a
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/Repositories/IRoleRepository.cs
@@ -0,0 +1,7 @@
+using TvNoms.Core.Entities;
+
+namespace TvNoms.Core.Repositories;
+
+public interface IRoleRepository : IRepository {
+ Task GetByNameAsync(string name, CancellationToken cancellationToken = default);
+}
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Repositories/IUserRepository.cs b/src/tvnoms-server/TvNoms.Core/Repositories/IUserRepository.cs
similarity index 97%
rename from src/tvnoms-server/TvNoms.Services/Data/Repositories/IUserRepository.cs
rename to src/tvnoms-server/TvNoms.Core/Repositories/IUserRepository.cs
index 0013824..4ac042b 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Repositories/IUserRepository.cs
+++ b/src/tvnoms-server/TvNoms.Core/Repositories/IUserRepository.cs
@@ -1,9 +1,9 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Identity;
-using TvNoms.Server.Data.Models;
-using TvNoms.Server.Services.Identity;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Extensions.Identity;
-namespace TvNoms.Server.Services.Data.Repositories;
+namespace TvNoms.Core.Repositories;
public interface IUserRepository : IRepository {
Task AddLoginAsync(User user, UserLoginInfo login, CancellationToken cancellationToken = default);
diff --git a/src/tvnoms-server/TvNoms.Core/TvNoms.Core.csproj b/src/tvnoms-server/TvNoms.Core/TvNoms.Core.csproj
new file mode 100644
index 0000000..353f083
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Core/TvNoms.Core.csproj
@@ -0,0 +1,44 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\automapper\13.0.1\lib\net6.0\AutoMapper.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\fluentvalidation\11.9.0\lib\net8.0\FluentValidation.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\humanizer.core\2.14.1\lib\net6.0\Humanizer.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.dotnet\shared\Microsoft.AspNetCore.App\8.0.3\Microsoft.AspNetCore.Authentication.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.identity.core\8.0.3\lib\net8.0\Microsoft.Extensions.Identity.Core.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.identity.stores\8.0.3\lib\net8.0\Microsoft.Extensions.Identity.Stores.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.options\8.0.2\lib\net8.0\Microsoft.Extensions.Options.dll
+
+
+ ..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.options\8.0.2\lib\net8.0\Microsoft.Extensions.Options.dll
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/tvnoms-server/TvNoms.Services/Utilities/AssemblyHelper.cs b/src/tvnoms-server/TvNoms.Core/Utilities/AssemblyHelper.cs
similarity index 98%
rename from src/tvnoms-server/TvNoms.Services/Utilities/AssemblyHelper.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/AssemblyHelper.cs
index 377bbc7..472435b 100644
--- a/src/tvnoms-server/TvNoms.Services/Utilities/AssemblyHelper.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/AssemblyHelper.cs
@@ -1,6 +1,6 @@
using System.Reflection;
-namespace TvNoms.Server.Services.Utilities;
+namespace TvNoms.Core.Utilities;
public static class AssemblyHelper {
public static IEnumerable GetAssemblies() {
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Utilities/IPageable.cs b/src/tvnoms-server/TvNoms.Core/Utilities/IPageable.cs
similarity index 77%
rename from src/tvnoms-server/TvNoms.Services/Data/Utilities/IPageable.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/IPageable.cs
index 2283262..793f71b 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Utilities/IPageable.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/IPageable.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Data.Utilities;
+namespace TvNoms.Core.Utilities;
public interface IPageable : IEnumerable {
long Offset { get; }
diff --git a/src/tvnoms-server/TvNoms.Services/Utilities/MimeTypes.cs b/src/tvnoms-server/TvNoms.Core/Utilities/MimeTypes.cs
similarity index 99%
rename from src/tvnoms-server/TvNoms.Services/Utilities/MimeTypes.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/MimeTypes.cs
index 09c398b..6a3b014 100644
--- a/src/tvnoms-server/TvNoms.Services/Utilities/MimeTypes.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/MimeTypes.cs
@@ -1,6 +1,6 @@
using System.Diagnostics.CodeAnalysis;
-namespace TvNoms.Server.Services.Utilities;
+namespace TvNoms.Core.Utilities;
public static class MimeTypes {
private const string DefaultFallbackMimeType = "application/octet-stream";
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Utilities/Pageable.cs b/src/tvnoms-server/TvNoms.Core/Utilities/Pageable.cs
similarity index 93%
rename from src/tvnoms-server/TvNoms.Services/Data/Utilities/Pageable.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/Pageable.cs
index fb90f47..23ec66a 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Utilities/Pageable.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/Pageable.cs
@@ -1,6 +1,6 @@
using System.Collections;
-namespace TvNoms.Server.Services.Data.Utilities;
+namespace TvNoms.Core.Utilities;
public class Pageable : IPageable {
public Pageable(long offset, int limit, long total, IEnumerable items) {
diff --git a/src/tvnoms-server/TvNoms.Services/Utilities/PredicateBuilder.cs b/src/tvnoms-server/TvNoms.Core/Utilities/PredicateBuilder.cs
similarity index 98%
rename from src/tvnoms-server/TvNoms.Services/Utilities/PredicateBuilder.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/PredicateBuilder.cs
index 2089bc3..1c059b8 100644
--- a/src/tvnoms-server/TvNoms.Services/Utilities/PredicateBuilder.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/PredicateBuilder.cs
@@ -1,6 +1,6 @@
using System.Linq.Expressions;
-namespace TvNoms.Server.Services.Utilities;
+namespace TvNoms.Core.Utilities;
public static class PredicateBuilder {
///
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Utilities/QueryableExtensions.cs b/src/tvnoms-server/TvNoms.Core/Utilities/QueryableExtensions.cs
similarity index 91%
rename from src/tvnoms-server/TvNoms.Services/Data/Utilities/QueryableExtensions.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/QueryableExtensions.cs
index 8eff864..6b7006c 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Utilities/QueryableExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/QueryableExtensions.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Data.Utilities;
+namespace TvNoms.Core.Utilities;
public static class QueryableExtensions {
public static IQueryable LongSkip(this IQueryable items, long count)
diff --git a/src/tvnoms-server/TvNoms.Services/Utilities/ReflectionExtensions.cs b/src/tvnoms-server/TvNoms.Core/Utilities/ReflectionExtensions.cs
similarity index 80%
rename from src/tvnoms-server/TvNoms.Services/Utilities/ReflectionExtensions.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/ReflectionExtensions.cs
index 271c76e..25988d3 100644
--- a/src/tvnoms-server/TvNoms.Services/Utilities/ReflectionExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/ReflectionExtensions.cs
@@ -1,11 +1,9 @@
-namespace TvNoms.Server.Services.Utilities {
+namespace TvNoms.Core.Utilities {
public static class ReflectionExtensions {
public static bool IsCompatibleWith(this Type type, Type otherType) {
- if (otherType.IsGenericTypeDefinition) {
- return type.IsAssignableToGenericTypeDefinition(otherType);
- }
-
- return otherType.IsAssignableFrom(type);
+ return otherType.IsGenericTypeDefinition
+ ? type.IsAssignableToGenericTypeDefinition(otherType)
+ : otherType.IsAssignableFrom(type);
}
private static bool IsAssignableToGenericTypeDefinition(this Type type, Type genericType) {
diff --git a/src/tvnoms-server/TvNoms.Services/Infrastructure/Slugifier.cs b/src/tvnoms-server/TvNoms.Core/Utilities/Slugifier.cs
similarity index 97%
rename from src/tvnoms-server/TvNoms.Services/Infrastructure/Slugifier.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/Slugifier.cs
index 91c5d03..1f9dd31 100644
--- a/src/tvnoms-server/TvNoms.Services/Infrastructure/Slugifier.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/Slugifier.cs
@@ -2,7 +2,7 @@ using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
-namespace TvNoms.Server.Services.Infrastructure;
+namespace TvNoms.Core.Utilities;
public static class Slugifier {
public static async Task GenerateSlugAsync(string text, Func> exists,
diff --git a/src/tvnoms-server/TvNoms.Services/Utilities/StreamExtensions.cs b/src/tvnoms-server/TvNoms.Core/Utilities/StreamExtensions.cs
similarity index 96%
rename from src/tvnoms-server/TvNoms.Services/Utilities/StreamExtensions.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/StreamExtensions.cs
index ec51feb..efc81e6 100644
--- a/src/tvnoms-server/TvNoms.Services/Utilities/StreamExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/StreamExtensions.cs
@@ -1,6 +1,6 @@
using System.Text;
-namespace TvNoms.Server.Services.Utilities;
+namespace TvNoms.Core.Utilities;
public static class StreamExtensions {
public static async Task ToByteArrayAsync(this Stream stream) {
diff --git a/src/tvnoms-server/TvNoms.Services/Data/Utilities/UriExtensions.cs b/src/tvnoms-server/TvNoms.Core/Utilities/UriExtensions.cs
similarity index 86%
rename from src/tvnoms-server/TvNoms.Services/Data/Utilities/UriExtensions.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/UriExtensions.cs
index 462a07c..c2f6419 100644
--- a/src/tvnoms-server/TvNoms.Services/Data/Utilities/UriExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/UriExtensions.cs
@@ -1,4 +1,4 @@
-namespace TvNoms.Server.Services.Data.Utilities;
+namespace TvNoms.Core.Utilities;
public static class UriExtensions {
public static Uri CombinePaths(this Uri uri, params string[] paths) {
diff --git a/src/tvnoms-server/TvNoms.Services/Validation/Exceptions/StatusCodeException.cs b/src/tvnoms-server/TvNoms.Core/Utilities/Validation/Exceptions/StatusCodeException.cs
similarity index 99%
rename from src/tvnoms-server/TvNoms.Services/Validation/Exceptions/StatusCodeException.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/Validation/Exceptions/StatusCodeException.cs
index 3709b5c..8cd8ff5 100644
--- a/src/tvnoms-server/TvNoms.Services/Validation/Exceptions/StatusCodeException.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/Validation/Exceptions/StatusCodeException.cs
@@ -1,7 +1,7 @@
using System.Runtime.CompilerServices;
using Humanizer;
-namespace TvNoms.Server.Services.Validation.Exceptions;
+namespace TvNoms.Core.Utilities.Validation.Exceptions;
public class BadRequestException : StatusCodeException {
private const int STATUS_CODE = 400;
diff --git a/src/tvnoms-server/TvNoms.Services/Validation/ValidationExtensions.cs b/src/tvnoms-server/TvNoms.Core/Utilities/Validation/ValidationExtensions.cs
similarity index 98%
rename from src/tvnoms-server/TvNoms.Services/Validation/ValidationExtensions.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/Validation/ValidationExtensions.cs
index e03c4cf..a9c621a 100644
--- a/src/tvnoms-server/TvNoms.Services/Validation/ValidationExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/Validation/ValidationExtensions.cs
@@ -1,7 +1,7 @@
using FluentValidation;
using FluentValidation.Results;
-namespace TvNoms.Server.Services.Validation;
+namespace TvNoms.Core.Utilities.Validation;
public static class ValidationExtensions {
public static IRuleBuilderOptionsConditions Username(this IRuleBuilder ruleBuilder) {
diff --git a/src/tvnoms-server/TvNoms.Services/Validation/ValidationHelper.cs b/src/tvnoms-server/TvNoms.Core/Utilities/Validation/ValidationHelper.cs
similarity index 98%
rename from src/tvnoms-server/TvNoms.Services/Validation/ValidationHelper.cs
rename to src/tvnoms-server/TvNoms.Core/Utilities/Validation/ValidationHelper.cs
index c2d1842..2ccc03f 100644
--- a/src/tvnoms-server/TvNoms.Services/Validation/ValidationHelper.cs
+++ b/src/tvnoms-server/TvNoms.Core/Utilities/Validation/ValidationHelper.cs
@@ -3,7 +3,7 @@ using System.Net.Mail;
using System.Text.RegularExpressions;
using PhoneNumbers;
-namespace TvNoms.Server.Services.Validation;
+namespace TvNoms.Core.Utilities.Validation;
public static class ValidationHelper {
public static MailAddress ParseEmail(string value) {
diff --git a/src/tvnoms-server/TvNoms.Data/AppDbContext.cs b/src/tvnoms-server/TvNoms.Data/AppDbContext.cs
index 1de7c23..4074668 100644
--- a/src/tvnoms-server/TvNoms.Data/AppDbContext.cs
+++ b/src/tvnoms-server/TvNoms.Data/AppDbContext.cs
@@ -1,17 +1,31 @@
-using Microsoft.EntityFrameworkCore;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
-using TvNoms.Server.Data.Models;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Utilities;
+using TvNoms.Server.Data.Extensions;
namespace TvNoms.Server.Data;
-public class AppDbContext(IConfiguration configuration) : DbContext {
+public class AppDbContext(IConfiguration configuration) :
+ IdentityDbContext,
+ UserRole, IdentityUserLogin, IdentityRoleClaim, IdentityUserToken> {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
optionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
+ protected override void OnModelCreating(ModelBuilder builder) {
+ base.OnModelCreating(builder);
+ var assemblies = AssemblyHelper.GetAssemblies();
- public DbSet Users { get; set; }
- public DbSet Clients { get; set; }
- public DbSet Shows { get; set; }
- public DbSet Movies { get; set; }
- public DbSet Media { get; set; }
+ builder.ApplyEntities(assemblies);
+ builder.ApplyConfigurations(assemblies);
+ }
+
+ // public DbSet Users { get; set; }
+// public DbSet UserRoles { get; set; }
+// public DbSet Clients { get; set; }
+// public DbSet Shows { get; set; }
+// public DbSet Movies { get; set; }
+// public DbSet Media { get; set; }
}
diff --git a/src/tvnoms-server/TvNoms.Data/Extensions/DbContextExtensions.cs b/src/tvnoms-server/TvNoms.Data/Extensions/DbContextExtensions.cs
new file mode 100644
index 0000000..304eef4
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Data/Extensions/DbContextExtensions.cs
@@ -0,0 +1,57 @@
+using System.Reflection;
+using Microsoft.EntityFrameworkCore;
+using TvNoms.Core.Entities;
+using TvNoms.Core.Utilities;
+
+namespace TvNoms.Server.Data.Extensions;
+
+public static class DbContextExtensions {
+ public static ModelBuilder ApplyEntities(this ModelBuilder modelBuilder, IEnumerable assemblies,
+ Func? predicate = null) {
+ var entityTypes = assemblies.SelectMany(_ => _.DefinedTypes).Select(_ => _.AsType())
+ .Where(type => type.IsClass && !type.IsAbstract && !type.IsGenericType &&
+ type.IsCompatibleWith(typeof(IEntity)) && (predicate?.Invoke(type) ?? true));
+
+ foreach (var entityType in entityTypes) {
+ modelBuilder.Entity(entityType);
+ }
+
+ return modelBuilder;
+ }
+
+ public static ModelBuilder ApplyConfigurations(this ModelBuilder modelBuilder, IEnumerable assemblies,
+ Func? predicate = null) {
+ var entityTypeConfigurationTypes = assemblies.SelectMany(_ => _.DefinedTypes).Select(_ => _.AsType())
+ .Where(type => type.IsClass && !type.IsAbstract && !type.IsGenericType &&
+ type.IsCompatibleWith(typeof(IEntityTypeConfiguration<>)) && (predicate?.Invoke(type) ?? true));
+
+ var applyEntityConfigurationMethod = typeof(ModelBuilder)
+ .GetMethods()
+ .Single(
+ e => e.Name == nameof(ModelBuilder.ApplyConfiguration)
+ && e.ContainsGenericParameters
+ && e.GetParameters().SingleOrDefault()?.ParameterType.GetGenericTypeDefinition()
+ == typeof(IEntityTypeConfiguration<>));
+
+ foreach (var entityTypeConfigurationType in entityTypeConfigurationTypes) {
+ // Only accept types that contain a parameterless constructor, are not abstract and satisfy a predicate if it was used.
+ if (entityTypeConfigurationType.GetConstructor(Type.EmptyTypes) == null
+ || (!predicate?.Invoke(entityTypeConfigurationType) ?? false)) {
+ continue;
+ }
+
+ foreach (var @interface in entityTypeConfigurationType.GetInterfaces()) {
+ if (!@interface.IsGenericType) {
+ continue;
+ }
+
+ if (@interface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>)) {
+ var target = applyEntityConfigurationMethod.MakeGenericMethod(@interface.GenericTypeArguments[0]);
+ target.Invoke(modelBuilder, new[] { Activator.CreateInstance(entityTypeConfigurationType) });
+ }
+ }
+ }
+
+ return modelBuilder;
+ }
+}
diff --git a/src/tvnoms-server/TvNoms.Services/Identity/IdentityExtensions.cs b/src/tvnoms-server/TvNoms.Data/Extensions/IdentityExtensions.cs
similarity index 87%
rename from src/tvnoms-server/TvNoms.Services/Identity/IdentityExtensions.cs
rename to src/tvnoms-server/TvNoms.Data/Extensions/IdentityExtensions.cs
index 658a82b..4d0ff2c 100644
--- a/src/tvnoms-server/TvNoms.Services/Identity/IdentityExtensions.cs
+++ b/src/tvnoms-server/TvNoms.Data/Extensions/IdentityExtensions.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Identity;
-namespace TvNoms.Server.Services.Identity;
+namespace TvNoms.Server.Data.Extensions;
public static class IdentityExtensions {
public static string GetMessage(this IEnumerable errors) {
diff --git a/src/tvnoms-server/TvNoms.Data/Migrations/20240322175607_Initial.Designer.cs b/src/tvnoms-server/TvNoms.Data/Migrations/20240322175607_Initial.Designer.cs
deleted file mode 100644
index 90be0cd..0000000
--- a/src/tvnoms-server/TvNoms.Data/Migrations/20240322175607_Initial.Designer.cs
+++ /dev/null
@@ -1,342 +0,0 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-using TvNoms.Server.Data;
-
-#nullable disable
-
-namespace TvNoms.Server.Data.Migrations
-{
- [DbContext(typeof(AppDbContext))]
- [Migration("20240322175607_Initial")]
- partial class Initial
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.3")
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Client", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("Active")
- .HasColumnType("boolean");
-
- b.Property("ConnectionId")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("ConnectionTime")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateCreated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateUpdated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("DeviceId")
- .HasColumnType("text");
-
- b.Property("IpAddress")
- .HasColumnType("text");
-
- b.Property("UserAgent")
- .HasColumnType("text");
-
- b.Property("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("Clients");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Media", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("ContentType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateCreated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateUpdated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("Height")
- .HasColumnType("integer");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("Path")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("Size")
- .HasColumnType("bigint");
-
- b.Property("Type")
- .HasColumnType("integer");
-
- b.Property("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Width")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("Media");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Movie", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateUpdated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("Title")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Movies");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Role", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property("Name")
- .HasColumnType("text");
-
- b.Property("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Role");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Show", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("DateCreated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("DateUpdated")
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("timestamp with time zone");
-
- b.Property("Title")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("Shows");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property("Active")
- .HasColumnType("boolean");
-
- b.Property("AvatarId")
- .HasColumnType("uuid");
-
- b.Property("Bio")
- .HasColumnType("text");
-
- b.Property("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property("Email")
- .HasColumnType("text");
-
- b.Property("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property("EmailRequired")
- .HasColumnType("boolean");
-
- b.Property("FirstName")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("LastActiveAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("LastName")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("Location")
- .HasColumnType("text");
-
- b.Property("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property("PasswordHash")
- .HasColumnType("text");
-
- b.Property("PhoneNumber")
- .HasColumnType("text");
-
- b.Property("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property("PhoneNumberRequired")
- .HasColumnType("boolean");
-
- b.Property("SecurityStamp")
- .HasColumnType("text");
-
- b.Property("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("AvatarId");
-
- b.ToTable("Users");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.UserRole", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("RoleId")
- .HasColumnType("uuid");
-
- b.Property("UserId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("RoleId");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserRole");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Client", b =>
- {
- b.HasOne("TvNoms.Server.Data.Models.User", "User")
- .WithMany("Clients")
- .HasForeignKey("UserId");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
- {
- b.HasOne("TvNoms.Server.Data.Models.Media", "Avatar")
- .WithMany()
- .HasForeignKey("AvatarId");
-
- b.Navigation("Avatar");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.UserRole", b =>
- {
- b.HasOne("TvNoms.Server.Data.Models.Role", "Role")
- .WithMany("Users")
- .HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("TvNoms.Server.Data.Models.User", "User")
- .WithMany("Roles")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Role");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.Role", b =>
- {
- b.Navigation("Users");
- });
-
- modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
- {
- b.Navigation("Clients");
-
- b.Navigation("Roles");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/src/tvnoms-server/TvNoms.Data/Migrations/20240322175607_Initial.cs b/src/tvnoms-server/TvNoms.Data/Migrations/20240322175607_Initial.cs
deleted file mode 100644
index f274f70..0000000
--- a/src/tvnoms-server/TvNoms.Data/Migrations/20240322175607_Initial.cs
+++ /dev/null
@@ -1,213 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace TvNoms.Server.Data.Migrations
-{
- ///
- public partial class Initial : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Media",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- Name = table.Column(type: "text", nullable: false),
- Size = table.Column(type: "bigint", nullable: false),
- Path = table.Column(type: "text", nullable: false),
- ContentType = table.Column(type: "text", nullable: false),
- Type = table.Column(type: "integer", nullable: false),
- Width = table.Column(type: "integer", nullable: true),
- Height = table.Column(type: "integer", nullable: true),
- CreatedAt = table.Column(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false),
- DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
- DateUpdated = table.Column(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Media", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Movies",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- Title = table.Column(type: "text", nullable: false),
- DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
- DateUpdated = table.Column(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Movies", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Role",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- Name = table.Column(type: "text", nullable: true),
- NormalizedName = table.Column(type: "text", nullable: true),
- ConcurrencyStamp = table.Column(type: "text", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Role", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Shows",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- Title = table.Column(type: "text", nullable: false),
- DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
- DateUpdated = table.Column(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Shows", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Users",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- FirstName = table.Column(type: "text", nullable: false),
- LastName = table.Column(type: "text", nullable: false),
- AvatarId = table.Column(type: "uuid", nullable: true),
- Bio = table.Column(type: "text", nullable: true),
- Location = table.Column(type: "text", nullable: true),
- Active = table.Column(type: "boolean", nullable: false),
- LastActiveAt = table.Column(type: "timestamp with time zone", nullable: false),
- EmailRequired = table.Column(type: "boolean", nullable: false),
- PhoneNumberRequired = table.Column(type: "boolean", nullable: false),
- UserName = table.Column(type: "text", nullable: true),
- NormalizedUserName = table.Column(type: "text", nullable: true),
- Email = table.Column(type: "text", nullable: true),
- NormalizedEmail = table.Column(type: "text", nullable: true),
- EmailConfirmed = table.Column(type: "boolean", nullable: false),
- PasswordHash = table.Column(type: "text", nullable: true),
- SecurityStamp = table.Column(type: "text", nullable: true),
- ConcurrencyStamp = table.Column(type: "text", nullable: true),
- PhoneNumber = table.Column(type: "text", nullable: true),
- PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false),
- TwoFactorEnabled = table.Column(type: "boolean", nullable: false),
- LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true),
- LockoutEnabled = table.Column(type: "boolean", nullable: false),
- AccessFailedCount = table.Column(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Users", x => x.Id);
- table.ForeignKey(
- name: "FK_Users_Media_AvatarId",
- column: x => x.AvatarId,
- principalTable: "Media",
- principalColumn: "Id");
- });
-
- migrationBuilder.CreateTable(
- name: "Clients",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- ConnectionId = table.Column(type: "text", nullable: false),
- ConnectionTime = table.Column(type: "timestamp with time zone", nullable: false),
- IpAddress = table.Column(type: "text", nullable: true),
- DeviceId = table.Column(type: "text", nullable: true),
- UserId = table.Column(type: "uuid", nullable: true),
- UserAgent = table.Column(type: "text", nullable: true),
- Active = table.Column(type: "boolean", nullable: false),
- DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
- DateUpdated = table.Column(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Clients", x => x.Id);
- table.ForeignKey(
- name: "FK_Clients_Users_UserId",
- column: x => x.UserId,
- principalTable: "Users",
- principalColumn: "Id");
- });
-
- migrationBuilder.CreateTable(
- name: "UserRole",
- columns: table => new
- {
- Id = table.Column(type: "uuid", nullable: false),
- UserId = table.Column(type: "uuid", nullable: false),
- RoleId = table.Column(type: "uuid", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserRole", x => x.Id);
- table.ForeignKey(
- name: "FK_UserRole_Role_RoleId",
- column: x => x.RoleId,
- principalTable: "Role",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserRole_Users_UserId",
- column: x => x.UserId,
- principalTable: "Users",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_Clients_UserId",
- table: "Clients",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserRole_RoleId",
- table: "UserRole",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserRole_UserId",
- table: "UserRole",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Users_AvatarId",
- table: "Users",
- column: "AvatarId");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Clients");
-
- migrationBuilder.DropTable(
- name: "Movies");
-
- migrationBuilder.DropTable(
- name: "Shows");
-
- migrationBuilder.DropTable(
- name: "UserRole");
-
- migrationBuilder.DropTable(
- name: "Role");
-
- migrationBuilder.DropTable(
- name: "Users");
-
- migrationBuilder.DropTable(
- name: "Media");
- }
- }
-}
diff --git a/src/tvnoms-server/TvNoms.Data/Migrations/20240322193356_Initial.Designer.cs b/src/tvnoms-server/TvNoms.Data/Migrations/20240322193356_Initial.Designer.cs
new file mode 100644
index 0000000..d23e2b8
--- /dev/null
+++ b/src/tvnoms-server/TvNoms.Data/Migrations/20240322193356_Initial.Designer.cs
@@ -0,0 +1,520 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using TvNoms.Server.Data;
+
+#nullable disable
+
+namespace TvNoms.Server.Data.Migrations
+{
+ [DbContext(typeof(AppDbContext))]
+ [Migration("20240322193356_Initial")]
+ partial class Initial
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("RoleId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("ProviderKey")
+ .HasColumnType("text");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.BaseEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("DateCreated")
+ .ValueGeneratedOnAddOrUpdate()
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateUpdated")
+ .ValueGeneratedOnAddOrUpdate()
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Discriminator")
+ .IsRequired()
+ .HasMaxLength(13)
+ .HasColumnType("character varying(13)");
+
+ b.HasKey("Id");
+
+ b.ToTable("BaseEntity");
+
+ b.HasDiscriminator("Discriminator").HasValue("BaseEntity");
+
+ b.UseTphMappingStrategy();
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("integer");
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("AvatarId")
+ .HasColumnType("uuid");
+
+ b.Property("Bio")
+ .HasColumnType("text");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("Email")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("boolean");
+
+ b.Property("EmailRequired")
+ .HasColumnType("boolean");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("LastActiveAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Location")
+ .HasColumnType("text");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("text");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("text");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("boolean");
+
+ b.Property("PhoneNumberRequired")
+ .HasColumnType("boolean");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("text");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AvatarId");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("RoleId")
+ .HasColumnType("uuid");
+
+ b.Property("RoleId1")
+ .HasColumnType("uuid");
+
+ b.Property("UserId1")
+ .HasColumnType("uuid");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.HasIndex("RoleId1");
+
+ b.HasIndex("UserId1");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("AccessTokenExpiresAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("AccessTokenHash")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("RefreshTokenExpiresAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("RefreshTokenHash")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserSession");
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.Client", b =>
+ {
+ b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("ConnectionId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ConnectionTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DeviceId")
+ .HasColumnType("text");
+
+ b.Property("IpAddress")
+ .HasColumnType("text");
+
+ b.Property("UserAgent")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasIndex("UserId");
+
+ b.HasDiscriminator().HasValue("Client");
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.Media", b =>
+ {
+ b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
+
+ b.Property("ContentType")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Height")
+ .HasColumnType("integer");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Path")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Size")
+ .HasColumnType("bigint");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Width")
+ .HasColumnType("integer");
+
+ b.HasDiscriminator().HasValue("Media");
+ });
+
+ modelBuilder.Entity("TvNoms.Core.Entities.Movie", b =>
+ {
+ b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
+
+ b.Property