Skip to content

Commit 2c9a87b

Browse files
committed
Expanding theme tab to customization tab. Started improving theme selection.
1 parent 03ea94b commit 2c9a87b

File tree

20 files changed

+1335
-294
lines changed

20 files changed

+1335
-294
lines changed

Moonlight.ApiServer/Database/CoreDataContext.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
using MoonCore.Extended.SingleDb;
44
using Moonlight.ApiServer.Configuration;
55
using Moonlight.ApiServer.Database.Entities;
6+
using Moonlight.ApiServer.Models;
67

78
namespace Moonlight.ApiServer.Database;
89

910
public class CoreDataContext : DatabaseContext
1011
{
1112
public override string Prefix { get; } = "Core";
12-
13+
1314
public DbSet<User> Users { get; set; }
1415
public DbSet<ApiKey> ApiKeys { get; set; }
15-
16+
public DbSet<Theme> Themes { get; set; }
17+
1618
public CoreDataContext(AppConfiguration configuration)
1719
{
1820
Options = new()
@@ -29,5 +31,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
2931
{
3032
base.OnModelCreating(modelBuilder);
3133
modelBuilder.OnHangfireModelCreating();
34+
35+
modelBuilder.Ignore<ApplicationTheme>();
36+
modelBuilder.Entity<Theme>()
37+
.OwnsOne(x => x.Content, builder =>
38+
{
39+
builder.ToJson();
40+
});
3241
}
3342
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Moonlight.ApiServer.Models;
2+
3+
namespace Moonlight.ApiServer.Database.Entities;
4+
5+
public class Theme
6+
{
7+
public int Id { get; set; }
8+
9+
public bool IsEnabled { get; set; }
10+
11+
public string Name { get; set; }
12+
public string Author { get; set; }
13+
public string Version { get; set; }
14+
15+
public string? UpdateUrl { get; set; }
16+
public string? DonateUrl { get; set; }
17+
18+
public ApplicationTheme Content { get; set; }
19+
}

0 commit comments

Comments
 (0)