Added node allocation ui

This commit is contained in:
Masu-Baumgartner
2024-09-02 14:42:06 +02:00
parent 45a3a76214
commit 30d912e412
7 changed files with 144 additions and 12 deletions

View File

@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using MoonCore.Extended.Abstractions;
using Moonlight.ApiServer.App.Helpers;
using MoonlightServers.ApiServer.Database.Entities;
using MoonlightServers.Shared.Http.Requests.Admin.Allocations;
using MoonlightServers.Shared.Http.Responses.Admin.Allocations;
namespace MoonlightServers.ApiServer.Http.Controllers.Admin.Nodes;
[ApiController]
[Route("admin/servers/nodes/{rootItem:int}/allocations")]
public class NodeAllocationsController : BaseSubCrudController<Node, Allocation, DetailAllocationResponse, CreateAllocationRequest, DetailAllocationResponse, UpdateAllocationRequest, DetailAllocationResponse>
{
public override Func<Node, List<Allocation>> Property => node => node.Allocations;
public NodeAllocationsController(DatabaseRepository<Allocation> itemRepository, DatabaseRepository<Node> rootItemRepository, IHttpContextAccessor contextAccessor) : base(itemRepository, rootItemRepository, contextAccessor)
{
PermissionPrefix = "admin.servers.nodes.allocations";
}
protected override IEnumerable<Node> IncludeRelations(IQueryable<Node> items)
=> items.Include(x => x.Allocations);
}