Added base structure
This commit is contained in:
8
MoonlightServers.ApiServer/Database/ServersContext.cs
Normal file
8
MoonlightServers.ApiServer/Database/ServersContext.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Moonlight.ApiServer.App.Helpers.Database;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Database;
|
||||
|
||||
public class ServersContext : DatabaseContext
|
||||
{
|
||||
public override string Prefix => "Servers";
|
||||
}
|
||||
51
MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj
Normal file
51
MoonlightServers.ApiServer/MoonlightServers.ApiServer.csproj
Normal file
@@ -0,0 +1,51 @@
|
||||
<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 Label="Moonlight Dependencies">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.7"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MoonCore" Version="1.5.3" />
|
||||
<PackageReference Include="MoonCore.Extended" Version="1.0.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Label="Shared references">
|
||||
<ProjectReference Include="..\MoonlightServers.DaemonShared\MoonlightServers.DaemonShared.csproj" />
|
||||
<ProjectReference Include="..\MoonlightServers.Shared\MoonlightServers.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Label="Reference moonlight builds">
|
||||
<Reference Include="Moonlight.ApiServer">
|
||||
<HintPath>..\..\Moonlight\Moonlight\ApiServer\bin\Debug\net8.0\Moonlight.ApiServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Moonlight.Shared">
|
||||
<HintPath>..\..\Moonlight\Moonlight\Shared\bin\Debug\net8.0\Moonlight.Shared.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Database\Entities\" />
|
||||
<Folder Include="Database\Migrations\" />
|
||||
<Folder Include="Helpers\" />
|
||||
<Folder Include="Http\Controllers\" />
|
||||
<Folder Include="Http\Hubs\" />
|
||||
<Folder Include="Http\Middleware\" />
|
||||
<Folder Include="Implementations\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
34
MoonlightServers.ApiServer/MoonlightServersPlugin.cs
Normal file
34
MoonlightServers.ApiServer/MoonlightServersPlugin.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoonCore.Extended.Helpers;
|
||||
using Moonlight.ApiServer.App.PluginApi;
|
||||
using MoonlightServers.ApiServer.Database;
|
||||
|
||||
namespace MoonlightServers.ApiServer;
|
||||
|
||||
public class MoonlightServersPlugin : MoonlightPlugin
|
||||
{
|
||||
public MoonlightServersPlugin(ILogger logger, PluginService pluginService) : base(logger, pluginService)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task OnLoaded()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override Task OnAppBuilding(WebApplicationBuilder builder, DatabaseHelper databaseHelper)
|
||||
{
|
||||
// Register database
|
||||
builder.Services.AddDbContext<ServersContext>();
|
||||
databaseHelper.AddDbContext<ServersContext>();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override Task OnAppConfiguring(WebApplication app)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user