feat: Added the new Movie 4k Request

radarr4k
tidusjar 3 years ago
parent 1c4db0ab69
commit 3f31100bd5

@ -16,5 +16,6 @@
public const string ReceivesNewsletter = nameof(ReceivesNewsletter);
public const string ManageOwnRequests = nameof(ManageOwnRequests);
public const string EditCustomPage = nameof(EditCustomPage);
public const string Request4KMovie = nameof(Request4KMovie);
}
}

@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Ombi.Store
{
internal static class MigrationHelper
{
public static void InsertRole(this MigrationBuilder mb, string role)
{
mb.Sql($@"
INSERT INTO AspnetRoles(Id, ConcurrencyStamp, Name, NormalizedName)
SELECT '{Guid.NewGuid()}','{Guid.NewGuid()}','{role}', '{role.ToUpper()}'
WHERE NOT EXISTS(SELECT 1 FROM AspnetRoles WHERE Name = '{role}');");
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Ombi.Helpers;
#nullable disable
namespace Ombi.Store.Migrations.OmbiMySql
{
public partial class Radarr4kRole : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertRole(OmbiRoles.Request4KMovie);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Ombi.Store.Context.MySql;
#nullable disable
namespace Ombi.Store.Migrations.OmbiMySql
{
[DbContext(typeof(OmbiMySqlContext))]
@ -14,8 +16,8 @@ namespace Ombi.Store.Migrations.OmbiMySql
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.1");
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
@ -40,7 +42,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
@ -63,7 +65,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
@ -86,7 +88,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
@ -108,7 +110,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
@ -123,7 +125,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
@ -142,7 +144,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Ombi.Store.Entities.Audit", b =>
@ -342,7 +344,7 @@ namespace Ombi.Store.Migrations.OmbiMySql
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b =>
@ -406,28 +408,6 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.ToTable("RequestQueue");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("RequestId")
.HasColumnType("int");
b.Property<int>("RequestType")
.HasColumnType("int");
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("RequestSubscription");
});
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
{
b.Property<int>("Id")
@ -815,6 +795,28 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.ToTable("TvRequests");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("RequestId")
.HasColumnType("int");
b.Property<int>("RequestType")
.HasColumnType("int");
b.Property<string>("UserId")
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("RequestSubscription");
});
modelBuilder.Entity("Ombi.Store.Entities.Tokens", b =>
{
b.Property<int>("Id")
@ -1052,15 +1054,6 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser")
@ -1145,6 +1138,15 @@ namespace Ombi.Store.Migrations.OmbiMySql
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.Tokens", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Ombi.Helpers;
#nullable disable
namespace Ombi.Store.Migrations.OmbiSqlite
{
public partial class Radarr4kRole : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertRole(OmbiRoles.Request4KMovie);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Ombi.Store.Context.Sqlite;
#nullable disable
namespace Ombi.Store.Migrations.OmbiSqlite
{
[DbContext(typeof(OmbiSqliteContext))]
@ -13,8 +15,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.1");
modelBuilder.HasAnnotation("ProductVersion", "6.0.0");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
@ -39,7 +40,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
@ -62,7 +63,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
@ -85,7 +86,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
@ -107,7 +108,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
@ -122,7 +123,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
@ -141,7 +142,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Ombi.Store.Entities.Audit", b =>
@ -341,7 +342,7 @@ namespace Ombi.Store.Migrations.OmbiSqlite
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b =>
@ -405,28 +406,6 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.ToTable("RequestQueue");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("RequestId")
.HasColumnType("INTEGER");
b.Property<int>("RequestType")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("RequestSubscription");
});
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
{
b.Property<int>("Id")
@ -814,6 +793,28 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.ToTable("TvRequests");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("RequestId")
.HasColumnType("INTEGER");
b.Property<int>("RequestType")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("RequestSubscription");
});
modelBuilder.Entity("Ombi.Store.Entities.Tokens", b =>
{
b.Property<int>("Id")
@ -1051,15 +1052,6 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser")
@ -1144,6 +1136,15 @@ namespace Ombi.Store.Migrations.OmbiSqlite
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("User");
});
modelBuilder.Entity("Ombi.Store.Entities.Tokens", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")

@ -46,57 +46,36 @@ namespace Ombi.Controllers.V1
[ApiController]
public class IdentityController : Controller
{
public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,
public IdentityController(OmbiUserManager user,
RoleManager<IdentityRole> rm,
IEmailProvider prov,
ISettingsService<EmailNotificationSettings> s,
ISettingsService<CustomizationSettings> c,
ISettingsService<OmbiSettings> ombiSettings,
IWelcomeEmail welcome,
IMovieRequestRepository m,
ITvRequestRepository t,
ILogger<IdentityController> l,
IPlexApi plexApi,
ISettingsService<PlexSettings> settings,
IRepository<RequestLog> requestLog,
IRepository<Issues> issues,
IRepository<IssueComments> issueComments,
IRepository<NotificationUserId> notificationRepository,
IRepository<RequestSubscription> subscriptionRepository,
ISettingsService<UserManagementSettings> umSettings,
IRepository<UserNotificationPreferences> notificationPreferences,
IRepository<UserQualityProfiles> userProfiles,
IMusicRequestRepository musicRepo,
IMovieRequestEngine movieRequestEngine,
ITvRequestEngine tvRequestEngine,
IMusicRequestEngine musicEngine,
IUserDeletionEngine deletionEngine,
IRequestLimitService requestLimitService,
ICacheService cacheService)
{
UserManager = user;
Mapper = mapper;
RoleManager = rm;
EmailProvider = prov;
EmailSettings = s;
CustomizationSettings = c;
WelcomeEmail = welcome;
MovieRepo = m;
MusicRepo = musicRepo;
TvRepo = t;
_log = l;
_plexApi = plexApi;
_plexSettings = settings;
_issuesRepository = issues;
_requestLogRepository = requestLog;
_issueCommentsRepository = issueComments;
OmbiSettings = ombiSettings;
_requestSubscriptionRepository = subscriptionRepository;
_notificationRepository = notificationRepository;
_userManagementSettings = umSettings;
TvRequestEngine = tvRequestEngine;
MovieRequestEngine = movieRequestEngine;
_userNotificationPreferences = notificationPreferences;
_userQualityProfiles = userProfiles;
MusicRequestEngine = musicEngine;
_deletionEngine = deletionEngine;
_requestLimitService = requestLimitService;
_cacheService = cacheService;
@ -108,27 +87,15 @@ namespace Ombi.Controllers.V1
private readonly ICacheService _cacheService;
private RoleManager<IdentityRole> RoleManager { get; }
private IMapper Mapper { get; }
private IEmailProvider EmailProvider { get; }
private ISettingsService<EmailNotificationSettings> EmailSettings { get; }
private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
private readonly ISettingsService<UserManagementSettings> _userManagementSettings;
private ISettingsService<OmbiSettings> OmbiSettings { get; }
private IWelcomeEmail WelcomeEmail { get; }
private IMovieRequestRepository MovieRepo { get; }
private ITvRequestRepository TvRepo { get; }
private IMovieRequestEngine MovieRequestEngine { get; }
private IMusicRequestEngine MusicRequestEngine { get; }
private ITvRequestEngine TvRequestEngine { get; }
private IMusicRequestRepository MusicRepo { get; }
private readonly ILogger<IdentityController> _log;
private readonly IPlexApi _plexApi;
private readonly ISettingsService<PlexSettings> _plexSettings;
private readonly IRepository<Issues> _issuesRepository;
private readonly IRepository<IssueComments> _issueCommentsRepository;
private readonly IRepository<RequestLog> _requestLogRepository;
private readonly IRepository<NotificationUserId> _notificationRepository;
private readonly IRepository<RequestSubscription> _requestSubscriptionRepository;
private readonly IRepository<UserNotificationPreferences> _userNotificationPreferences;
private readonly IRepository<UserQualityProfiles> _userQualityProfiles;
@ -258,6 +225,8 @@ namespace Ombi.Controllers.V1
await CreateRole(OmbiRoles.ReceivesNewsletter);
await CreateRole(OmbiRoles.ManageOwnRequests);
await CreateRole(OmbiRoles.EditCustomPage);
await CreateRole(OmbiRoles.EditCustomPage);
await CreateRole(OmbiRoles.Request4KMovie);
}
private async Task CreateRole(string role)

Loading…
Cancel
Save