mirror of
https://github.com/fergalmoran/tvnoms.git
synced 2025-12-22 09:18:43 +00:00
Refactor to solve circular references
This commit is contained in:
@@ -2,14 +2,14 @@ using System.Security.Claims;
|
|||||||
using Humanizer;
|
using Humanizer;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Data.Models.Medias;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
using TvNoms.Server.Services.Data.Models.Users;
|
using TvNoms.Core.Models.Medias;
|
||||||
using TvNoms.Server.Services.Data.Models.Users.Accounts;
|
using TvNoms.Core.Models.Users;
|
||||||
using TvNoms.Server.Services.Data.Services;
|
using TvNoms.Core.Models.Users.Accounts;
|
||||||
using TvNoms.Server.Services.Identity;
|
using TvNoms.Core.Utilities;
|
||||||
using TvNoms.Server.Services.Utilities;
|
using TvNoms.Core.Utilities.Validation.Exceptions;
|
||||||
using TvNoms.Server.Services.Validation.Exceptions;
|
using TvNoms.Server.Services;
|
||||||
|
|
||||||
namespace TvNoms.Server.ApiService.Endpoints;
|
namespace TvNoms.Server.ApiService.Endpoints;
|
||||||
|
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ using Microsoft.AspNetCore.Authentication.Google;
|
|||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
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.ApiService.Shared;
|
||||||
using TvNoms.Server.Data;
|
using TvNoms.Server.Data;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Server.Data.Repositories;
|
||||||
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;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
var assemblies = AssemblyHelper.GetAssemblies().ToArray();
|
var assemblies = AssemblyHelper.GetAssemblies().ToArray();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using TvNoms.Server.Services.Utilities;
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.ApiService.Shared;
|
namespace TvNoms.Server.ApiService.Shared;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\TvNoms.Data\TvNoms.Data.csproj" />
|
||||||
|
<ProjectReference Include="..\TvNoms.Infrastructure\TvNoms.Infrastructure.csproj" />
|
||||||
<ProjectReference Include="..\TvNoms.ServiceDefaults\TvNoms.ServiceDefaults.csproj" />
|
<ProjectReference Include="..\TvNoms.ServiceDefaults\TvNoms.ServiceDefaults.csproj" />
|
||||||
<ProjectReference Include="..\TvNoms.Services\TvNoms.Services.csproj" />
|
<ProjectReference Include="..\TvNoms.Services\TvNoms.Services.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
namespace TvNoms.Server.Data.Models;
|
namespace TvNoms.Core.Entities;
|
||||||
|
|
||||||
public record Client : BaseEntity {
|
|
||||||
public Client() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class Client : BaseEntity {
|
||||||
public string ConnectionId { get; set; } = default!;
|
public string ConnectionId { get; set; } = default!;
|
||||||
|
|
||||||
public DateTimeOffset ConnectionTime { get; set; }
|
public DateTimeOffset ConnectionTime { get; set; }
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace TvNoms.Server.Data.Models;
|
namespace TvNoms.Core.Entities;
|
||||||
|
|
||||||
public interface IEntity {
|
public interface IEntity {
|
||||||
[Key]
|
public Guid Id { get; }
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public record BaseEntity : IEntity {
|
public class BaseEntity : IEntity {
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||||
@@ -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 string Name { get; set; } = default!;
|
||||||
|
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
5
src/tvnoms-server/TvNoms.Core/Entities/Movie.cs
Normal file
5
src/tvnoms-server/TvNoms.Core/Entities/Movie.cs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
namespace TvNoms.Core.Entities;
|
||||||
|
|
||||||
|
public class Movie() : BaseEntity {
|
||||||
|
public string Title { get; set; }
|
||||||
|
}
|
||||||
5
src/tvnoms-server/TvNoms.Core/Entities/Show.cs
Normal file
5
src/tvnoms-server/TvNoms.Core/Entities/Show.cs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
namespace TvNoms.Core.Entities;
|
||||||
|
|
||||||
|
public class Show : BaseEntity {
|
||||||
|
public string Title { get; set; }
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
namespace TvNoms.Server.Data.Models;
|
namespace TvNoms.Core.Entities;
|
||||||
|
|
||||||
public class User : IdentityUser<Guid>, IEntity {
|
public class User : IdentityUser<Guid>, IEntity {
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
@@ -20,10 +20,7 @@ public class User : IdentityUser<Guid>, IEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class UserRole : IdentityUserRole<Guid>, IEntity {
|
public class UserRole : IdentityUserRole<Guid>, IEntity {
|
||||||
public Guid Id { get; set; }
|
Guid IEntity.Id { get; }
|
||||||
|
|
||||||
public virtual User User { get; set; } = default!;
|
|
||||||
public virtual Role Role { get; set; } = default!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserSession : IEntity {
|
public class UserSession : IEntity {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using MediatR;
|
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 class UserSignedIn : INotification {
|
||||||
public UserSignedIn(User user) {
|
public UserSignedIn(User user) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using MediatR;
|
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 class UserSignedOut : INotification {
|
||||||
public UserSignedOut(User user) {
|
public UserSignedOut(User user) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using MediatR;
|
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 class UserSignedUp : INotification {
|
||||||
public UserSignedUp(User user) {
|
public UserSignedUp(User user) {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
|
namespace TvNoms.Core.Extensions.EmailSender;
|
||||||
|
|
||||||
public class EmailAccount {
|
public class EmailAccount {
|
||||||
public string Username { get; set; } = default!;
|
public string Username { get; set; } = default!;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
|
namespace TvNoms.Core.Extensions.EmailSender;
|
||||||
|
|
||||||
public class EmailAttachment {
|
public class EmailAttachment {
|
||||||
public string FileName { get; set; } = default!;
|
public string FileName { get; set; } = default!;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
|
namespace TvNoms.Core.Extensions.EmailSender;
|
||||||
|
|
||||||
public class EmailMessage {
|
public class EmailMessage {
|
||||||
public string Subject { get; set; } = default!;
|
public string Subject { get; set; } = default!;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace TvNoms.Core.Extensions.EmailSender;
|
||||||
|
|
||||||
|
public interface IEmailSender {
|
||||||
|
Task SendAsync(EmailMessage message, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Core.Extensions.Identity;
|
||||||
|
|
||||||
public interface IClientContext {
|
public interface IClientContext {
|
||||||
string? DeviceId { get; }
|
string? DeviceId { get; }
|
||||||
@@ -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 {
|
public interface IUserSessionFactory {
|
||||||
Task<UserSessionInfo> GenerateAsync(User user, CancellationToken cancellationToken = default);
|
Task<UserSessionInfo> GenerateAsync(User user, CancellationToken cancellationToken = default);
|
||||||
@@ -3,7 +3,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using DeviceId;
|
using DeviceId;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Core.Extensions.Identity;
|
||||||
|
|
||||||
public class TokenHelper {
|
public class TokenHelper {
|
||||||
public static string Secret => GenerateSHA256Hash(
|
public static string Secret => GenerateSHA256Hash(
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Core.Extensions.Identity;
|
||||||
|
|
||||||
public class UserSessionInfo {
|
public class UserSessionInfo {
|
||||||
public string AccessToken { get; set; } = default!;
|
public string AccessToken { get; set; } = default!;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Core.Extensions.Identity;
|
||||||
|
|
||||||
public class UserSessionOptions {
|
public class UserSessionOptions {
|
||||||
public string Secret { set; get; } = default!;
|
public string Secret { set; get; } = default!;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace TvNoms.Core.Extensions.SmsSender;
|
||||||
|
|
||||||
|
public interface ISmsSender {
|
||||||
|
Task SendAsync(string phoneNumber, string message, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.ViewRenderer.Razor;
|
namespace TvNoms.Core.Extensions.ViewRenderer;
|
||||||
|
|
||||||
public interface IViewRenderer {
|
public interface IViewRenderer {
|
||||||
Task<string> RenderAsync(string name, object? model = null, CancellationToken cancellationToken = default);
|
Task<string> RenderAsync(string name, object? model = null, CancellationToken cancellationToken = default);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Utilities;
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure.Storage;
|
namespace TvNoms.Core.FileStorage;
|
||||||
|
|
||||||
public class FileRuleOptions {
|
public class FileRuleOptions {
|
||||||
public IList<FileRule> Documents { get; set; } = new List<FileRule>();
|
public IList<FileRule> Documents { get; set; } = new List<FileRule>();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Storage;
|
namespace TvNoms.Core.FileStorage;
|
||||||
|
|
||||||
public interface IFileStorage {
|
public interface IFileStorage {
|
||||||
Task WriteAsync(string path, Stream content, CancellationToken cancellationToken = default);
|
Task WriteAsync(string path, Stream content, CancellationToken cancellationToken = default);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Medias;
|
namespace TvNoms.Core.Models.Medias;
|
||||||
|
|
||||||
public class DeleteMediaForm {
|
public class DeleteMediaForm {
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using AbstractProfile = AutoMapper.Profile;
|
using AbstractProfile = AutoMapper.Profile;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Medias;
|
namespace TvNoms.Core.Models.Medias;
|
||||||
|
|
||||||
public class MediaModel {
|
public class MediaModel {
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.Extensions.Options;
|
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 class UploadMediaChunkForm : UploadMediaContentForm {
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Infrastructure.Storage;
|
using TvNoms.Core.FileStorage;
|
||||||
using TvNoms.Server.Services.Validation;
|
using TvNoms.Core.Utilities.Validation;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Medias;
|
namespace TvNoms.Core.Models.Medias;
|
||||||
|
|
||||||
public class UploadMediaContentForm {
|
public class UploadMediaContentForm {
|
||||||
public string Name { get; set; } = default!;
|
public string Name { get; set; } = default!;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Data.Models.Users;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
using TvNoms.Server.Services.Data.Repositories;
|
using TvNoms.Core.FileStorage;
|
||||||
using TvNoms.Server.Services.Data.Utilities;
|
using TvNoms.Core.Models.Users;
|
||||||
using TvNoms.Server.Services.Identity;
|
using TvNoms.Core.Repositories;
|
||||||
using TvNoms.Server.Services.Infrastructure.Storage;
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models;
|
namespace TvNoms.Core.Models;
|
||||||
|
|
||||||
public interface IModelBuilder {
|
public interface IModelBuilder {
|
||||||
// User
|
// User
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
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 class ServiceCollectionExtensions {
|
||||||
public static IServiceCollection AddModelBuilder(this IServiceCollection services) {
|
public static IServiceCollection AddModelBuilder(this IServiceCollection services) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using FluentValidation;
|
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 class ChangePasswordForm {
|
||||||
public string CurrentPassword { get; set; } = default!;
|
public string CurrentPassword { get; set; } = default!;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Users.Accounts;
|
namespace TvNoms.Core.Models.Users.Accounts;
|
||||||
|
|
||||||
public class RefreshSessionForm {
|
public class RefreshSessionForm {
|
||||||
public string RefreshToken { get; set; } = default!;
|
public string RefreshToken { get; set; } = default!;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using FluentValidation;
|
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 class ResetPasswordForm {
|
||||||
public string Username { get; set; } = default!;
|
public string Username { get; set; } = default!;
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using FluentValidation;
|
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 class SendPasswordResetTokenForm {
|
||||||
public string Username { get; set; } = default!;
|
public string Username { get; set; } = default!;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using FluentValidation;
|
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 class SendUsernameTokenForm {
|
||||||
public string Username { get; set; } = default!;
|
public string Username { get; set; } = default!;
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using FluentValidation;
|
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 class SignInForm {
|
||||||
public string Username { get; set; } = default!;
|
public string Username { get; set; } = default!;
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Users.Accounts;
|
namespace TvNoms.Core.Models.Users.Accounts;
|
||||||
|
|
||||||
public class SignOutForm {
|
public class SignOutForm {
|
||||||
public string RefreshToken { get; set; } = default!;
|
public string RefreshToken { get; set; } = default!;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using FluentValidation;
|
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 class SignUpForm {
|
||||||
public string FirstName { get; set; } = default!;
|
public string FirstName { get; set; } = default!;
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using FluentValidation;
|
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 class SignUpWithForm {
|
||||||
public string FirstName { get; set; } = default!;
|
public string FirstName { get; set; } = default!;
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using FluentValidation;
|
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 class VerifyUsernameForm {
|
||||||
public string Username { get; set; } = default!;
|
public string Username { get; set; } = default!;
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Validation;
|
using TvNoms.Core.Utilities.Validation;
|
||||||
using AbstractProfile = AutoMapper.Profile;
|
using AbstractProfile = AutoMapper.Profile;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Users;
|
namespace TvNoms.Core.Models.Users;
|
||||||
|
|
||||||
public class EditUserForm {
|
public class EditUserForm {
|
||||||
public string UserName { get; set; } = default!;
|
public string UserName { get; set; } = default!;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Utilities;
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Users;
|
namespace TvNoms.Core.Models.Users;
|
||||||
|
|
||||||
public class UserCriteria {
|
public class UserCriteria {
|
||||||
public Guid[]? Id { get; set; }
|
public Guid[]? Id { get; set; }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using AbstractProfile = AutoMapper.Profile;
|
using AbstractProfile = AutoMapper.Profile;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Users;
|
namespace TvNoms.Core.Models.Users;
|
||||||
|
|
||||||
public class UserModel {
|
public class UserModel {
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Data.Models.Users;
|
namespace TvNoms.Core.Models.Users;
|
||||||
|
|
||||||
public class UserPageModel {
|
public class UserPageModel {
|
||||||
public long Offset { get; set; }
|
public long Offset { get; set; }
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Identity;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
using AbstractProfile = AutoMapper.Profile;
|
using AbstractProfile = AutoMapper.Profile;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Models.Users;
|
namespace TvNoms.Core.Models.Users;
|
||||||
|
|
||||||
public class UserWithSessionModel : UserModel {
|
public class UserWithSessionModel : UserModel {
|
||||||
public bool EmailConfirmed { get; set; }
|
public bool EmailConfirmed { get; set; }
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Linq.Expressions;
|
||||||
|
using TvNoms.Core.Entities;
|
||||||
|
|
||||||
|
namespace TvNoms.Core.Repositories;
|
||||||
|
|
||||||
|
public interface IClientRepository : IRepository<Client> {
|
||||||
|
Task DeactivateAsync(Client client, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
Task DeactivateManyAsync(Expression<Func<Client, bool>> predicate, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
Task DeactivateAllAsync(CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using TvNoms.Core.Entities;
|
||||||
|
|
||||||
|
namespace TvNoms.Core.Repositories;
|
||||||
|
|
||||||
|
public interface IMediaRepository : IRepository<Media> {
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Data.Utilities;
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Core.Repositories;
|
||||||
|
|
||||||
public interface IRepository<TEntity> where TEntity : class, IEntity {
|
public interface IRepository<TEntity> where TEntity : class, IEntity {
|
||||||
Task<TEntity> CreateAsync(TEntity entity, CancellationToken cancellationToken = default);
|
Task<TEntity> CreateAsync(TEntity entity, CancellationToken cancellationToken = default);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
using TvNoms.Core.Entities;
|
||||||
|
|
||||||
|
namespace TvNoms.Core.Repositories;
|
||||||
|
|
||||||
|
public interface IRoleRepository : IRepository<Role> {
|
||||||
|
Task<Role?> GetByNameAsync(string name, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Identity;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Core.Repositories;
|
||||||
|
|
||||||
public interface IUserRepository : IRepository<User> {
|
public interface IUserRepository : IRepository<User> {
|
||||||
Task AddLoginAsync(User user, UserLoginInfo login, CancellationToken cancellationToken = default);
|
Task AddLoginAsync(User user, UserLoginInfo login, CancellationToken cancellationToken = default);
|
||||||
44
src/tvnoms-server/TvNoms.Core/TvNoms.Core.csproj
Normal file
44
src/tvnoms-server/TvNoms.Core/TvNoms.Core.csproj
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="AutoMapper">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\automapper\13.0.1\lib\net6.0\AutoMapper.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="FluentValidation">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\fluentvalidation\11.9.0\lib\net8.0\FluentValidation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Humanizer">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\humanizer.core\2.14.1\lib\net6.0\Humanizer.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.AspNetCore.Authentication">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.dotnet\shared\Microsoft.AspNetCore.App\8.0.3\Microsoft.AspNetCore.Authentication.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Identity.Core">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.identity.core\8.0.3\lib\net8.0\Microsoft.Extensions.Identity.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Identity.Stores">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.identity.stores\8.0.3\lib\net8.0\Microsoft.Extensions.Identity.Stores.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Options">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.options\8.0.2\lib\net8.0\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Options">
|
||||||
|
<HintPath>..\..\..\..\..\..\home\fergalm\.nuget\packages\microsoft.extensions.options\8.0.2\lib\net8.0\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DeviceId" Version="6.6.0"/>
|
||||||
|
<PackageReference Include="libphonenumber-csharp" Version="8.13.32"/>
|
||||||
|
<PackageReference Include="MediatR" Version="12.2.0"/>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0"/>
|
||||||
|
<PackageReference Include="UAParser" Version="3.1.47"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class AssemblyHelper {
|
public static class AssemblyHelper {
|
||||||
public static IEnumerable<Assembly> GetAssemblies() {
|
public static IEnumerable<Assembly> GetAssemblies() {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Data.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public interface IPageable<T> : IEnumerable<T> {
|
public interface IPageable<T> : IEnumerable<T> {
|
||||||
long Offset { get; }
|
long Offset { get; }
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class MimeTypes {
|
public static class MimeTypes {
|
||||||
private const string DefaultFallbackMimeType = "application/octet-stream";
|
private const string DefaultFallbackMimeType = "application/octet-stream";
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public class Pageable<T> : IPageable<T> {
|
public class Pageable<T> : IPageable<T> {
|
||||||
public Pageable(long offset, int limit, long total, IEnumerable<T> items) {
|
public Pageable(long offset, int limit, long total, IEnumerable<T> items) {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class PredicateBuilder {
|
public static class PredicateBuilder {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Data.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class QueryableExtensions {
|
public static class QueryableExtensions {
|
||||||
public static IQueryable<T> LongSkip<T>(this IQueryable<T> items, long count)
|
public static IQueryable<T> LongSkip<T>(this IQueryable<T> items, long count)
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
namespace TvNoms.Server.Services.Utilities {
|
namespace TvNoms.Core.Utilities {
|
||||||
public static class ReflectionExtensions {
|
public static class ReflectionExtensions {
|
||||||
public static bool IsCompatibleWith(this Type type, Type otherType) {
|
public static bool IsCompatibleWith(this Type type, Type otherType) {
|
||||||
if (otherType.IsGenericTypeDefinition) {
|
return otherType.IsGenericTypeDefinition
|
||||||
return type.IsAssignableToGenericTypeDefinition(otherType);
|
? type.IsAssignableToGenericTypeDefinition(otherType)
|
||||||
}
|
: otherType.IsAssignableFrom(type);
|
||||||
|
|
||||||
return otherType.IsAssignableFrom(type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsAssignableToGenericTypeDefinition(this Type type, Type genericType) {
|
private static bool IsAssignableToGenericTypeDefinition(this Type type, Type genericType) {
|
||||||
@@ -2,7 +2,7 @@ using System.Globalization;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class Slugifier {
|
public static class Slugifier {
|
||||||
public static async Task<string> GenerateSlugAsync(string text, Func<string, Task<bool>> exists,
|
public static async Task<string> GenerateSlugAsync(string text, Func<string, Task<bool>> exists,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class StreamExtensions {
|
public static class StreamExtensions {
|
||||||
public static async Task<byte[]> ToByteArrayAsync(this Stream stream) {
|
public static async Task<byte[]> ToByteArrayAsync(this Stream stream) {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Data.Utilities;
|
namespace TvNoms.Core.Utilities;
|
||||||
|
|
||||||
public static class UriExtensions {
|
public static class UriExtensions {
|
||||||
public static Uri CombinePaths(this Uri uri, params string[] paths) {
|
public static Uri CombinePaths(this Uri uri, params string[] paths) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Validation.Exceptions;
|
namespace TvNoms.Core.Utilities.Validation.Exceptions;
|
||||||
|
|
||||||
public class BadRequestException : StatusCodeException {
|
public class BadRequestException : StatusCodeException {
|
||||||
private const int STATUS_CODE = 400;
|
private const int STATUS_CODE = 400;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Validation;
|
namespace TvNoms.Core.Utilities.Validation;
|
||||||
|
|
||||||
public static class ValidationExtensions {
|
public static class ValidationExtensions {
|
||||||
public static IRuleBuilderOptionsConditions<T, string> Username<T>(this IRuleBuilder<T, string> ruleBuilder) {
|
public static IRuleBuilderOptionsConditions<T, string> Username<T>(this IRuleBuilder<T, string> ruleBuilder) {
|
||||||
@@ -3,7 +3,7 @@ using System.Net.Mail;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using PhoneNumbers;
|
using PhoneNumbers;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Validation;
|
namespace TvNoms.Core.Utilities.Validation;
|
||||||
|
|
||||||
public static class ValidationHelper {
|
public static class ValidationHelper {
|
||||||
public static MailAddress ParseEmail(string value) {
|
public static MailAddress ParseEmail(string value) {
|
||||||
@@ -1,17 +1,31 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
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;
|
namespace TvNoms.Server.Data;
|
||||||
|
|
||||||
public class AppDbContext(IConfiguration configuration) : DbContext {
|
public class AppDbContext(IConfiguration configuration) :
|
||||||
|
IdentityDbContext<User, Role, Guid, IdentityUserClaim<Guid>,
|
||||||
|
UserRole, IdentityUserLogin<Guid>, IdentityRoleClaim<Guid>, IdentityUserToken<Guid>> {
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
|
||||||
optionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
|
optionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"));
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder builder) {
|
||||||
|
base.OnModelCreating(builder);
|
||||||
|
var assemblies = AssemblyHelper.GetAssemblies();
|
||||||
|
|
||||||
public DbSet<User> Users { get; set; }
|
builder.ApplyEntities(assemblies);
|
||||||
public DbSet<Client> Clients { get; set; }
|
builder.ApplyConfigurations(assemblies);
|
||||||
public DbSet<Show> Shows { get; set; }
|
}
|
||||||
public DbSet<Movie> Movies { get; set; }
|
|
||||||
public DbSet<Media> Media { get; set; }
|
// public DbSet<User> Users { get; set; }
|
||||||
|
// public DbSet<UserRole> UserRoles { get; set; }
|
||||||
|
// public DbSet<Client> Clients { get; set; }
|
||||||
|
// public DbSet<Show> Shows { get; set; }
|
||||||
|
// public DbSet<Movie> Movies { get; set; }
|
||||||
|
// public DbSet<Media> Media { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<Assembly> assemblies,
|
||||||
|
Func<Type, bool>? 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<Assembly> assemblies,
|
||||||
|
Func<Type, bool>? 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Server.Data.Extensions;
|
||||||
|
|
||||||
public static class IdentityExtensions {
|
public static class IdentityExtensions {
|
||||||
public static string GetMessage(this IEnumerable<IdentityError> errors) {
|
public static string GetMessage(this IEnumerable<IdentityError> errors) {
|
||||||
@@ -1,342 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
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
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
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<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("Active")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("ConnectionId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("ConnectionTime")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("DeviceId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("IpAddress")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserAgent")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid?>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Media", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("ContentType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int?>("Height")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Path")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<long>("Size")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("UpdatedAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int?>("Width")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Media");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Movie", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Movies");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Role", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Role");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Show", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Shows");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<bool>("Active")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<Guid?>("AvatarId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("Bio")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailRequired")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("FirstName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("LastActiveAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("LastName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Location")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberRequired")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("AvatarId");
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.UserRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("RoleId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid>("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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace TvNoms.Server.Data.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Initial : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Media",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Size = table.Column<long>(type: "bigint", nullable: false),
|
|
||||||
Path = table.Column<string>(type: "text", nullable: false),
|
|
||||||
ContentType = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Type = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
Width = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
Height = table.Column<int>(type: "integer", nullable: true),
|
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
DateUpdated = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
|
|
||||||
Title = table.Column<string>(type: "text", nullable: false),
|
|
||||||
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
DateUpdated = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: true),
|
|
||||||
NormalizedName = table.Column<string>(type: "text", nullable: true),
|
|
||||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Role", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Shows",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
Title = table.Column<string>(type: "text", nullable: false),
|
|
||||||
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
DateUpdated = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
|
|
||||||
FirstName = table.Column<string>(type: "text", nullable: false),
|
|
||||||
LastName = table.Column<string>(type: "text", nullable: false),
|
|
||||||
AvatarId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
||||||
Bio = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Location = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Active = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
LastActiveAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
EmailRequired = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
PhoneNumberRequired = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
UserName = table.Column<string>(type: "text", nullable: true),
|
|
||||||
NormalizedUserName = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Email = table.Column<string>(type: "text", nullable: true),
|
|
||||||
NormalizedEmail = table.Column<string>(type: "text", nullable: true),
|
|
||||||
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
PasswordHash = table.Column<string>(type: "text", nullable: true),
|
|
||||||
SecurityStamp = table.Column<string>(type: "text", nullable: true),
|
|
||||||
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
|
|
||||||
PhoneNumber = table.Column<string>(type: "text", nullable: true),
|
|
||||||
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
||||||
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
AccessFailedCount = table.Column<int>(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<Guid>(type: "uuid", nullable: false),
|
|
||||||
ConnectionId = table.Column<string>(type: "text", nullable: false),
|
|
||||||
ConnectionTime = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
IpAddress = table.Column<string>(type: "text", nullable: true),
|
|
||||||
DeviceId = table.Column<string>(type: "text", nullable: true),
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
||||||
UserAgent = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Active = table.Column<bool>(type: "boolean", nullable: false),
|
|
||||||
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
||||||
DateUpdated = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
|
|
||||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
RoleId = table.Column<Guid>(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");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
520
src/tvnoms-server/TvNoms.Data/Migrations/20240322193356_Initial.Designer.cs
generated
Normal file
520
src/tvnoms-server/TvNoms.Data/Migrations/20240322193356_Initial.Designer.cs
generated
Normal file
@@ -0,0 +1,520 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoleClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserLogins", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "LoginProvider", "Name");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.BaseEntity", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreated")
|
||||||
|
.ValueGeneratedOnAddOrUpdate()
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateUpdated")
|
||||||
|
.ValueGeneratedOnAddOrUpdate()
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Discriminator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(13)
|
||||||
|
.HasColumnType("character varying(13)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("BaseEntity");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("Discriminator").HasValue("BaseEntity");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<bool>("Active")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<Guid?>("AvatarId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("Bio")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailRequired")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("FirstName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("LastActiveAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Location")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberRequired")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("RoleId1")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("AccessTokenExpiresAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("AccessTokenHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("RefreshTokenExpiresAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("RefreshTokenHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("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<bool>("Active")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("ConnectionId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("ConnectionTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DeviceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("IpAddress")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("UserAgent")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid?>("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<string>("ContentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("Height")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Path")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Size")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("UpdatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("Width")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Media");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Movie", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Movie");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Show", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.ToTable("BaseEntity", t =>
|
||||||
|
{
|
||||||
|
t.Property("Title")
|
||||||
|
.HasColumnName("Show_Title");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Show");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.Role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.Media", "Avatar")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AvatarId");
|
||||||
|
|
||||||
|
b.Navigation("Avatar");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.Role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("TvNoms.Core.Entities.Role", null)
|
||||||
|
.WithMany("Users")
|
||||||
|
.HasForeignKey("RoleId1");
|
||||||
|
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany("Roles")
|
||||||
|
.HasForeignKey("UserId1");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Client", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", "User")
|
||||||
|
.WithMany("Clients")
|
||||||
|
.HasForeignKey("UserId");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Clients");
|
||||||
|
|
||||||
|
b.Navigation("Roles");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,353 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace TvNoms.Server.Data.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Initial : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetRoles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetRoleClaims",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||||
|
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||||
|
column: x => x.RoleId,
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetUserClaims",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ClaimType = table.Column<string>(type: "text", nullable: true),
|
||||||
|
ClaimValue = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetUserLogins",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||||
|
ProviderKey = table.Column<string>(type: "text", nullable: false),
|
||||||
|
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetUserRoles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
RoleId1 = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
UserId1 = table.Column<Guid>(type: "uuid", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
||||||
|
column: x => x.RoleId,
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AspNetUserRoles_AspNetRoles_RoleId1",
|
||||||
|
column: x => x.RoleId1,
|
||||||
|
principalTable: "AspNetRoles",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetUsers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
FirstName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
LastName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
AvatarId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
Bio = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Location = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Active = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
LastActiveAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||||
|
EmailRequired = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
PhoneNumberRequired = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
PasswordHash = table.Column<string>(type: "text", nullable: true),
|
||||||
|
SecurityStamp = table.Column<string>(type: "text", nullable: true),
|
||||||
|
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
|
||||||
|
PhoneNumber = table.Column<string>(type: "text", nullable: true),
|
||||||
|
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||||
|
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AspNetUserTokens",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
LoginProvider = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Value = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "BaseEntity",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
Discriminator = table.Column<string>(type: "character varying(13)", maxLength: 13, nullable: false),
|
||||||
|
ConnectionId = table.Column<string>(type: "text", nullable: true),
|
||||||
|
ConnectionTime = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||||
|
IpAddress = table.Column<string>(type: "text", nullable: true),
|
||||||
|
DeviceId = table.Column<string>(type: "text", nullable: true),
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
UserAgent = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Active = table.Column<bool>(type: "boolean", nullable: true),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Size = table.Column<long>(type: "bigint", nullable: true),
|
||||||
|
Path = table.Column<string>(type: "text", nullable: true),
|
||||||
|
ContentType = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Type = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
Width = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
Height = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||||
|
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||||
|
Title = table.Column<string>(type: "text", nullable: true),
|
||||||
|
Show_Title = table.Column<string>(type: "text", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_BaseEntity", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_BaseEntity_AspNetUsers_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserSession",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
AccessTokenHash = table.Column<string>(type: "text", nullable: false),
|
||||||
|
AccessTokenExpiresAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||||
|
RefreshTokenHash = table.Column<string>(type: "text", nullable: false),
|
||||||
|
RefreshTokenExpiresAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserSession", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserSession_AspNetUsers_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetRoleClaims_RoleId",
|
||||||
|
table: "AspNetRoleClaims",
|
||||||
|
column: "RoleId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "RoleNameIndex",
|
||||||
|
table: "AspNetRoles",
|
||||||
|
column: "NormalizedName",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUserClaims_UserId",
|
||||||
|
table: "AspNetUserClaims",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUserLogins_UserId",
|
||||||
|
table: "AspNetUserLogins",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUserRoles_RoleId",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "RoleId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUserRoles_RoleId1",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "RoleId1");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUserRoles_UserId1",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "UserId1");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "EmailIndex",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "NormalizedEmail");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUsers_AvatarId",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "AvatarId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "UserNameIndex",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "NormalizedUserName",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_BaseEntity_UserId",
|
||||||
|
table: "BaseEntity",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserSession_UserId",
|
||||||
|
table: "UserSession",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
||||||
|
table: "AspNetUserClaims",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
||||||
|
table: "AspNetUserLogins",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "UserId",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AspNetUserRoles_AspNetUsers_UserId1",
|
||||||
|
table: "AspNetUserRoles",
|
||||||
|
column: "UserId1",
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AspNetUsers_BaseEntity_AvatarId",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "AvatarId",
|
||||||
|
principalTable: "BaseEntity",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_BaseEntity_AspNetUsers_UserId",
|
||||||
|
table: "BaseEntity");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetRoleClaims");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetUserClaims");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetUserLogins");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetUserRoles");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetUserTokens");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserSession");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetRoles");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "BaseEntity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,99 +22,95 @@ namespace TvNoms.Server.Data.Migrations
|
|||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Client", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<bool>("Active")
|
b.HasKey("Id");
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("ConnectionId")
|
b.HasIndex("RoleId");
|
||||||
.IsRequired()
|
|
||||||
|
b.ToTable("AspNetRoleClaims", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("ConnectionTime")
|
b.Property<string>("ClaimValue")
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("DeviceId")
|
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("IpAddress")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserAgent")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid?>("UserId")
|
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("Clients");
|
b.ToTable("AspNetUserClaims", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Media", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<string>("LoginProvider")
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("ContentType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
b.Property<string>("ProviderKey")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
b.Property<string>("ProviderDisplayName")
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
.HasColumnType("text");
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
b.Property<Guid>("UserId")
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
.HasColumnType("uuid");
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int?>("Height")
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
.HasColumnType("integer");
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserLogins", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Path")
|
b.Property<string>("Value")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<long>("Size")
|
b.HasKey("UserId", "LoginProvider", "Name");
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("UpdatedAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int?>("Width")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Media");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Movie", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.BaseEntity", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@@ -128,59 +124,48 @@ namespace TvNoms.Server.Data.Migrations
|
|||||||
.ValueGeneratedOnAddOrUpdate()
|
.ValueGeneratedOnAddOrUpdate()
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("Title")
|
b.Property<string>("Discriminator")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasMaxLength(13)
|
||||||
|
.HasColumnType("character varying(13)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Movies");
|
b.ToTable("BaseEntity");
|
||||||
|
|
||||||
|
b.HasDiscriminator<string>("Discriminator").HasValue("BaseEntity");
|
||||||
|
|
||||||
|
b.UseTphMappingStrategy();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Role", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("text");
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
b.Property<string>("NormalizedName")
|
||||||
.HasColumnType("text");
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Role");
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("RoleNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoles", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Show", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateUpdated")
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Shows");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
|
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@@ -199,10 +184,12 @@ namespace TvNoms.Server.Data.Migrations
|
|||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("text");
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
b.Property<bool>("EmailConfirmed")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
@@ -231,10 +218,12 @@ namespace TvNoms.Server.Data.Migrations
|
|||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
b.Property<string>("NormalizedEmail")
|
||||||
.HasColumnType("text");
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
b.Property<string>("NormalizedUserName")
|
||||||
.HasColumnType("text");
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
b.Property<string>("PasswordHash")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
@@ -255,79 +244,268 @@ namespace TvNoms.Server.Data.Migrations
|
|||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasColumnType("text");
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("AvatarId");
|
b.HasIndex("AvatarId");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.HasIndex("NormalizedEmail")
|
||||||
|
.HasDatabaseName("EmailIndex");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedUserName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("UserNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUsers", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.UserRole", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("RoleId1")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid?>("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<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<Guid>("RoleId")
|
b.Property<DateTimeOffset>("AccessTokenExpiresAt")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("AccessTokenHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("RefreshTokenExpiresAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("RefreshTokenHash")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserSession");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Client", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
|
||||||
|
|
||||||
|
b.Property<bool>("Active")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("ConnectionId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("ConnectionTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DeviceId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("IpAddress")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("UserAgent")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid?>("UserId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("UserRole");
|
b.HasDiscriminator().HasValue("Client");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Client", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.Media", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TvNoms.Server.Data.Models.User", "User")
|
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
|
||||||
.WithMany("Clients")
|
|
||||||
.HasForeignKey("UserId");
|
|
||||||
|
|
||||||
b.Navigation("User");
|
b.Property<string>("ContentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("CreatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("Height")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Path")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Size")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("Type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("UpdatedAt")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("Width")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Media");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.Movie", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TvNoms.Server.Data.Models.Media", "Avatar")
|
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Movie");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Show", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("TvNoms.Core.Entities.BaseEntity");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.ToTable("BaseEntity", t =>
|
||||||
|
{
|
||||||
|
t.Property("Title")
|
||||||
|
.HasColumnName("Show_Title");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue("Show");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.Role", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.Media", "Avatar")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("AvatarId");
|
.HasForeignKey("AvatarId");
|
||||||
|
|
||||||
b.Navigation("Avatar");
|
b.Navigation("Avatar");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.UserRole", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.UserRole", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TvNoms.Server.Data.Models.Role", "Role")
|
b.HasOne("TvNoms.Core.Entities.Role", null)
|
||||||
.WithMany("Users")
|
.WithMany()
|
||||||
.HasForeignKey("RoleId")
|
.HasForeignKey("RoleId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("TvNoms.Server.Data.Models.User", "User")
|
b.HasOne("TvNoms.Core.Entities.Role", null)
|
||||||
.WithMany("Roles")
|
.WithMany("Users")
|
||||||
|
.HasForeignKey("RoleId1");
|
||||||
|
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
.HasForeignKey("UserId")
|
.HasForeignKey("UserId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("Role");
|
b.HasOne("TvNoms.Core.Entities.User", null)
|
||||||
|
.WithMany("Roles")
|
||||||
|
.HasForeignKey("UserId1");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.UserSession", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("User");
|
b.Navigation("User");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.Role", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.Client", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TvNoms.Core.Entities.User", "User")
|
||||||
|
.WithMany("Clients")
|
||||||
|
.HasForeignKey("UserId");
|
||||||
|
|
||||||
|
b.Navigation("User");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TvNoms.Core.Entities.Role", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Users");
|
b.Navigation("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TvNoms.Server.Data.Models.User", b =>
|
modelBuilder.Entity("TvNoms.Core.Entities.User", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Clients");
|
b.Navigation("Clients");
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace TvNoms.Server.Data.Models;
|
|
||||||
|
|
||||||
public record Movie(string Title) : BaseEntity;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace TvNoms.Server.Data.Models;
|
|
||||||
|
|
||||||
public record Show(string Title) : BaseEntity;
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using TvNoms.Server.Data;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Repositories;
|
||||||
using TvNoms.Server.Services.Data.Utilities;
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
public abstract class AppRepository<TEntity> : IRepository<TEntity> where TEntity : class, IEntity {
|
public abstract class AppRepository<TEntity> : IRepository<TEntity> where TEntity : class, IEntity {
|
||||||
protected readonly AppDbContext _dbContext;
|
protected readonly AppDbContext _dbContext;
|
||||||
@@ -1,17 +1,11 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using TvNoms.Server.Data;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Repositories;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
public interface IClientRepository : IRepository<Client> {
|
|
||||||
Task DeactivateAsync(Client client, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
Task DeactivateManyAsync(Expression<Func<Client, bool>> predicate, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
Task DeactivateAllAsync(CancellationToken cancellationToken = default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ClientRepository : AppRepository<Client>, IClientRepository {
|
public class ClientRepository : AppRepository<Client>, IClientRepository {
|
||||||
public ClientRepository(AppDbContext dbContext) : base(dbContext) {
|
public ClientRepository(AppDbContext dbContext) : base(dbContext) {
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using TvNoms.Core.Entities;
|
||||||
|
using TvNoms.Core.Repositories;
|
||||||
|
|
||||||
|
namespace TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class MediaRepository : AppRepository<Media>, IMediaRepository {
|
||||||
|
public MediaRepository(AppDbContext dbContext) : base(dbContext) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using TvNoms.Server.Data;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Repositories;
|
||||||
using TvNoms.Server.Services.Identity;
|
using TvNoms.Server.Data.Extensions;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
public interface IRoleRepository : IRepository<Role> {
|
|
||||||
Task<Role?> GetByNameAsync(string name, CancellationToken cancellationToken = default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RoleRepository : AppRepository<Role>, IRoleRepository {
|
public class RoleRepository : AppRepository<Role>, IRoleRepository {
|
||||||
private readonly RoleManager<Role> _roleManager;
|
private readonly RoleManager<Role> _roleManager;
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using TvNoms.Server.Services.Utilities;
|
using TvNoms.Core.Repositories;
|
||||||
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
public static class ServiceCollectionExtensions {
|
public static class ServiceCollectionExtensions {
|
||||||
public static IServiceCollection AddRepositories(this IServiceCollection services, IEnumerable<Assembly> assemblies) {
|
public static IServiceCollection AddRepositories(this IServiceCollection services, IEnumerable<Assembly> assemblies) {
|
||||||
@@ -2,13 +2,14 @@ using System.Security.Claims;
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using TvNoms.Server.Data;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
using TvNoms.Server.Services.Identity;
|
using TvNoms.Core.Repositories;
|
||||||
using TvNoms.Server.Services.Infrastructure;
|
using TvNoms.Core.Utilities;
|
||||||
using TvNoms.Server.Services.Validation;
|
using TvNoms.Core.Utilities.Validation;
|
||||||
|
using TvNoms.Server.Data.Extensions;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Data.Repositories;
|
namespace TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
public class UserRepository : AppRepository<User>, IUserRepository {
|
public class UserRepository : AppRepository<User>, IUserRepository {
|
||||||
private readonly UserManager<User> _userManager;
|
private readonly UserManager<User> _userManager;
|
||||||
@@ -17,4 +17,8 @@
|
|||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\TvNoms.Core\TvNoms.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ using System.Net;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Validation;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
|
using TvNoms.Core.Utilities.Validation;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Infrastructure.Identity;
|
||||||
|
|
||||||
public class ClientContext : IClientContext {
|
public class ClientContext : IClientContext {
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
@@ -5,9 +5,11 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using TvNoms.Server.Services.Data.Repositories;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
|
using TvNoms.Core.Repositories;
|
||||||
|
using TvNoms.Server.Data.Repositories;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Infrastructure.Identity;
|
||||||
|
|
||||||
public class ConfigureJwtBearerOptions : IConfigureNamedOptions<JwtBearerOptions> {
|
public class ConfigureJwtBearerOptions : IConfigureNamedOptions<JwtBearerOptions> {
|
||||||
private readonly IOptions<UserSessionOptions> _userSessionOptions;
|
private readonly IOptions<UserSessionOptions> _userSessionOptions;
|
||||||
@@ -2,10 +2,11 @@ using Microsoft.AspNetCore.Authentication;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Data.Services;
|
using TvNoms.Core.Extensions.Identity;
|
||||||
|
using TvNoms.Server.Services;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Infrastructure.Identity;
|
||||||
|
|
||||||
public static class ServiceCollectionExtensions {
|
public static class ServiceCollectionExtensions {
|
||||||
public static IServiceCollection AddWebAppCors(this IServiceCollection services) {
|
public static IServiceCollection AddWebAppCors(this IServiceCollection services) {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Infrastructure.Identity;
|
||||||
|
|
||||||
public class UserClaimsPrincipalFactory(
|
public class UserClaimsPrincipalFactory(
|
||||||
UserManager<User> userManager,
|
UserManager<User> userManager,
|
||||||
@@ -6,9 +6,10 @@ using Microsoft.AspNetCore.Identity;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
|
using TvNoms.Core.Extensions.Identity;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Identity;
|
namespace TvNoms.Infrastructure.Identity;
|
||||||
|
|
||||||
public class UserSessionFactory : IUserSessionFactory {
|
public class UserSessionFactory : IUserSessionFactory {
|
||||||
private readonly JwtBearerOptions _jwtBearerOptions;
|
private readonly JwtBearerOptions _jwtBearerOptions;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
|
namespace TvNoms.Infrastructure.Messaging.Email;
|
||||||
|
|
||||||
public class MailgunEmailOptions {
|
public class MailgunEmailOptions {
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
@@ -3,12 +3,9 @@ using System.Net.Http.Headers;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using TvNoms.Core.Extensions.EmailSender;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
|
namespace TvNoms.Infrastructure.Messaging.Email;
|
||||||
|
|
||||||
public interface IEmailSender {
|
|
||||||
Task SendAsync(EmailMessage message, CancellationToken cancellationToken = default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MailgunEmailSender(IOptions<MailgunEmailOptions> emailSettings, ILogger<MailgunEmailSender> logger)
|
public class MailgunEmailSender(IOptions<MailgunEmailOptions> emailSettings, ILogger<MailgunEmailSender> logger)
|
||||||
: IEmailSender {
|
: IEmailSender {
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using TvNoms.Core.Extensions.EmailSender;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.Email;
|
namespace TvNoms.Infrastructure.Messaging.Email;
|
||||||
|
|
||||||
public static class ServiceCollectionExtensions {
|
public static class ServiceCollectionExtensions {
|
||||||
public static IServiceCollection AddMailgunEmailSender(this IServiceCollection services,
|
public static IServiceCollection AddMailgunEmailSender(this IServiceCollection services,
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.SMS;
|
using TvNoms.Core.Extensions.SmsSender;
|
||||||
|
|
||||||
|
namespace TvNoms.Infrastructure.Messaging.SMS;
|
||||||
|
|
||||||
public class FakeSMSSender : ISmsSender {
|
public class FakeSMSSender : ISmsSender {
|
||||||
public Task SendAsync(string phoneNumber, string message, CancellationToken cancellationToken = default) {
|
public Task SendAsync(string phoneNumber, string message, CancellationToken cancellationToken = default) {
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using TvNoms.Core.Extensions.SmsSender;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure.Messaging.SMS;
|
namespace TvNoms.Infrastructure.Messaging.SMS;
|
||||||
|
|
||||||
public static class ServiceCollectionExtensions {
|
public static class ServiceCollectionExtensions {
|
||||||
public static IServiceCollection AddFakeSmsSender(this IServiceCollection services) {
|
public static IServiceCollection AddFakeSmsSender(this IServiceCollection services) {
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using TvNoms.Server.Services.Data.Utilities;
|
using TvNoms.Core.FileStorage;
|
||||||
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure.Storage;
|
namespace TvNoms.Infrastructure.Storage;
|
||||||
|
|
||||||
public class LocalFileStorage : IFileStorage {
|
public class LocalFileStorage : IFileStorage {
|
||||||
private readonly IOptions<LocalFileStorageOptions> _storageOptions;
|
private readonly IOptions<LocalFileStorageOptions> _storageOptions;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace TvNoms.Server.Services.Infrastructure.Storage;
|
namespace TvNoms.Infrastructure.Storage;
|
||||||
|
|
||||||
public class LocalFileStorageOptions {
|
public class LocalFileStorageOptions {
|
||||||
public string RootPath { get; set; } = default!;
|
public string RootPath { get; set; } = default!;
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using TvNoms.Server.Data.Models;
|
using TvNoms.Core.Entities;
|
||||||
using TvNoms.Server.Services.Utilities;
|
using TvNoms.Core.FileStorage;
|
||||||
|
using TvNoms.Core.Utilities;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.Infrastructure.Storage {
|
namespace TvNoms.Infrastructure.Storage {
|
||||||
public static class ServiceCollectionExtensions {
|
public static class ServiceCollectionExtensions {
|
||||||
public static IServiceCollection AddLocalFileStorage(this IServiceCollection services,
|
public static IServiceCollection AddLocalFileStorage(this IServiceCollection services,
|
||||||
Action<LocalFileStorageOptions> options) {
|
Action<LocalFileStorageOptions> options) {
|
||||||
@@ -20,43 +21,39 @@ namespace TvNoms.Server.Services.Infrastructure.Storage {
|
|||||||
|
|
||||||
public static IServiceCollection AddFileTypeOptions(this IServiceCollection services) {
|
public static IServiceCollection AddFileTypeOptions(this IServiceCollection services) {
|
||||||
services.Configure<FileRuleOptions>(options => {
|
services.Configure<FileRuleOptions>(options => {
|
||||||
options.Documents = new[] { ".doc", ".docx", ".rtf", ".pdf" }.Select(fileExtension => {
|
options.Documents = new[] { ".doc", ".docx", ".rtf", ".pdf" }.Select(fileExtension =>
|
||||||
return new FileRule {
|
new FileRule {
|
||||||
MediaType = MediaType.Document,
|
MediaType = MediaType.Document,
|
||||||
FileExtension = fileExtension,
|
FileExtension = fileExtension,
|
||||||
FileSize = 83886080L,
|
FileSize = 83886080L,
|
||||||
ContentType = MimeTypes.GetMimeType(fileExtension)
|
ContentType = MimeTypes.GetMimeType(fileExtension)
|
||||||
};
|
|
||||||
})
|
})
|
||||||
.ToArray(); // Document - 80MB
|
.ToArray(); // Document - 80MB
|
||||||
|
|
||||||
options.Images = new[] { ".jpg", ".jpeg", ".png" }.Select(fileExtension => {
|
options.Images = new[] { ".jpg", ".jpeg", ".png" }.Select(fileExtension =>
|
||||||
return new FileRule {
|
new FileRule {
|
||||||
MediaType = MediaType.Image,
|
MediaType = MediaType.Image,
|
||||||
FileExtension = fileExtension,
|
FileExtension = fileExtension,
|
||||||
FileSize = 5242880L,
|
FileSize = 5242880L,
|
||||||
ContentType = MimeTypes.GetMimeType(fileExtension)
|
ContentType = MimeTypes.GetMimeType(fileExtension)
|
||||||
};
|
|
||||||
})
|
})
|
||||||
.ToArray(); // Image - 5MB
|
.ToArray(); // Image - 5MB
|
||||||
|
|
||||||
options.Videos = new[] { ".mp4", ".webm", ".swf", ".flv" }.Select(fileExtension => {
|
options.Videos = new[] { ".mp4", ".webm", ".swf", ".flv" }.Select(fileExtension =>
|
||||||
return new FileRule {
|
new FileRule {
|
||||||
MediaType = MediaType.Video,
|
MediaType = MediaType.Video,
|
||||||
FileExtension = fileExtension,
|
FileExtension = fileExtension,
|
||||||
FileSize = 524288000L,
|
FileSize = 524288000L,
|
||||||
ContentType = MimeTypes.GetMimeType(fileExtension)
|
ContentType = MimeTypes.GetMimeType(fileExtension)
|
||||||
};
|
|
||||||
})
|
})
|
||||||
.ToArray(); // Video - 500MB
|
.ToArray(); // Video - 500MB
|
||||||
|
|
||||||
options.Audios = new[] { ".mp3", ".ogg", ".wav" }.Select(fileExtension => {
|
options.Audios = new[] { ".mp3", ".ogg", ".wav" }.Select(fileExtension =>
|
||||||
return new FileRule {
|
new FileRule {
|
||||||
MediaType = MediaType.Audio,
|
MediaType = MediaType.Audio,
|
||||||
FileExtension = fileExtension,
|
FileExtension = fileExtension,
|
||||||
FileSize = 83886080L,
|
FileSize = 83886080L,
|
||||||
ContentType = MimeTypes.GetMimeType(fileExtension)
|
ContentType = MimeTypes.GetMimeType(fileExtension)
|
||||||
};
|
|
||||||
})
|
})
|
||||||
.ToArray(); // Audio - 80MB
|
.ToArray(); // Audio - 80MB
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MailKit" Version="4.1.0"/>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\TvNoms.Core\TvNoms.Core.csproj"/>
|
||||||
|
<ProjectReference Include="..\TvNoms.Data\TvNoms.Data.csproj"/>
|
||||||
|
<ProjectReference Include="..\TvNoms.Services\TvNoms.Services.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -8,8 +8,9 @@ using Microsoft.AspNetCore.Mvc.Rendering;
|
|||||||
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
|
using TvNoms.Core.Extensions.ViewRenderer;
|
||||||
|
|
||||||
namespace TvNoms.Server.Services.ViewRenderer.Razor;
|
namespace TvNoms.Infrastructure.ViewRenderer.Razor;
|
||||||
|
|
||||||
public class RazorViewRenderer : IViewRenderer {
|
public class RazorViewRenderer : IViewRenderer {
|
||||||
private readonly IRazorViewEngine _viewEngine;
|
private readonly IRazorViewEngine _viewEngine;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
namespace TvNoms.Infrastructure.ViewRenderer.Razor;
|
||||||
|
|
||||||
|
public static class RazorViewRendererConstants {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
namespace TvNoms.Infrastructure.ViewRenderer.Razor;
|
||||||
|
|
||||||
|
public class RazorViewRendererOptions {
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user