mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Merge branch 'develop' into feature/splitoutsettingsdb
This commit is contained in:
commit
442b0ff90c
123 changed files with 3875 additions and 405 deletions
|
@ -20,6 +20,8 @@ namespace Ombi.Store.Context
|
|||
//DbSet<EmbyEpisode> EmbyEpisode { get; set; }
|
||||
DbSet<NotificationTemplates> NotificationTemplates { get; set; }
|
||||
DbSet<ApplicationConfiguration> ApplicationConfigurations { get; set; }
|
||||
DbSet<Votes> Votes { get; set; }
|
||||
void Seed();
|
||||
DbSet<Audit> Audit { get; set; }
|
||||
DbSet<MovieRequests> MovieRequests { get; set; }
|
||||
DbSet<AlbumRequest> AlbumRequests { get; set; }
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Ombi.Store.Context
|
|||
public DbSet<IssueComments> IssueComments { get; set; }
|
||||
public DbSet<RequestLog> RequestLogs { get; set; }
|
||||
public DbSet<RecentlyAddedLog> RecentlyAddedLogs { get; set; }
|
||||
public DbSet<Votes> Votes { get; set; }
|
||||
|
||||
|
||||
public DbSet<Audit> Audit { get; set; }
|
||||
|
@ -112,6 +113,16 @@ namespace Ombi.Store.Context
|
|||
SaveChanges();
|
||||
}
|
||||
|
||||
var manageOwnRequestsRole = Roles.Where(x => x.Name == OmbiRoles.ManageOwnRequests);
|
||||
if (!manageOwnRequestsRole.Any())
|
||||
{
|
||||
Roles.Add(new IdentityRole(OmbiRoles.ManageOwnRequests)
|
||||
{
|
||||
NormalizedName = OmbiRoles.ManageOwnRequests.ToUpper()
|
||||
});
|
||||
SaveChanges();
|
||||
}
|
||||
|
||||
// Make sure we have the API User
|
||||
var apiUserExists = Users.Any(x => x.UserName.Equals("Api", StringComparison.CurrentCultureIgnoreCase));
|
||||
if (!apiUserExists)
|
||||
|
|
25
src/Ombi.Store/Entities/Votes.cs
Normal file
25
src/Ombi.Store/Entities/Votes.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ombi.Store.Entities
|
||||
{
|
||||
[Table("Votes")]
|
||||
public class Votes : Entity
|
||||
{
|
||||
public int RequestId { get; set; }
|
||||
public VoteType VoteType { get; set; }
|
||||
public RequestType RequestType { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public OmbiUser User { get; set; }
|
||||
}
|
||||
|
||||
public enum VoteType
|
||||
{
|
||||
Upvote = 0,
|
||||
Downvote = 1
|
||||
}
|
||||
}
|
1182
src/Ombi.Store/Migrations/20180928201334_Votes.Designer.cs
generated
Normal file
1182
src/Ombi.Store/Migrations/20180928201334_Votes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
46
src/Ombi.Store/Migrations/20180928201334_Votes.cs
Normal file
46
src/Ombi.Store/Migrations/20180928201334_Votes.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
public partial class Votes : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Votes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
RequestId = table.Column<int>(nullable: false),
|
||||
VoteType = table.Column<int>(nullable: false),
|
||||
RequestType = table.Column<int>(nullable: false),
|
||||
UserId = table.Column<string>(nullable: true),
|
||||
Date = table.Column<DateTime>(nullable: false),
|
||||
Deleted = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Votes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Votes_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Votes_UserId",
|
||||
table: "Votes",
|
||||
column: "UserId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Votes");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -916,6 +916,30 @@ namespace Ombi.Store.Migrations
|
|||
b.ToTable("UserQualityProfiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Votes", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<DateTime>("Date");
|
||||
|
||||
b.Property<bool>("Deleted");
|
||||
|
||||
b.Property<int>("RequestId");
|
||||
|
||||
b.Property<int>("RequestType");
|
||||
|
||||
b.Property<string>("UserId");
|
||||
|
||||
b.Property<int>("VoteType");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Votes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
@ -1128,6 +1152,13 @@ namespace Ombi.Store.Migrations
|
|||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.Votes", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b =>
|
||||
{
|
||||
b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue