Moved share permission parsing to jsonb implementation of ef core. Improved auth handling for shares
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using MoonCore.Extended.SingleDb;
|
||||
using Moonlight.ApiServer.Configuration;
|
||||
using MoonlightServers.ApiServer.Database.Entities;
|
||||
using MoonlightServers.ApiServer.Models;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Database;
|
||||
|
||||
@@ -30,4 +31,26 @@ public class ServersDataContext : DatabaseContext
|
||||
Database = configuration.Database.Database
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
#region Shares
|
||||
|
||||
modelBuilder.Ignore<ServerShareContent>();
|
||||
modelBuilder.Ignore<ServerSharePermission>();
|
||||
|
||||
modelBuilder.Entity<ServerShare>(builder =>
|
||||
{
|
||||
builder.OwnsOne(x => x.Content, navigationBuilder =>
|
||||
{
|
||||
navigationBuilder.ToJson();
|
||||
|
||||
navigationBuilder.OwnsMany(x => x.Permissions);
|
||||
});
|
||||
});
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user