Add MonitorPanel.DataAccess

This commit is contained in:
2026-07-08 03:13:21 +03:00
parent 7c4d557dc4
commit 08aa1bbf90
8 changed files with 106 additions and 0 deletions
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace MonitorPanel.DataAccess.Entities;
public class ServerEntity
{
public Guid Id { get; set; }
public string Name { get; set; } = null!;
public bool IsHttps { get; set; }
[Required]
public string Address { get; set; } = null!;
string? Path { get; set; }
[Required]
public int Port { get; set; }
}
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MonitorPanel.Core\MonitorPanel.Core.csproj" />
</ItemGroup>
</Project>
@@ -0,0 +1,8 @@
using Microsoft.EntityFrameworkCore;
using MonitorPanel.DataAccess.Entities;
namespace MonitorPanel.DataAccess;
public class MonitorPanelDbContext(DbContextOptions<MonitorPanelDbContext> options) : DbContext(options)
{
public DbSet<ServerEntity> Servers => Set<ServerEntity>();
}
@@ -0,0 +1,31 @@
using MonitorPanel.Core.Abstractions;
using MonitorPanel.Core.Models;
namespace MonitorPanel.DataAccess.Repositories;
public class ServersRepository : IServersRepository
{
public Task AddServerAsync(Server server)
{
throw new NotImplementedException();
}
public Task DeleteServerAsync(Guid id)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Server>> GetAllServersAsync()
{
throw new NotImplementedException();
}
public Task<Server?> GetServerByIdAsync(Guid id)
{
throw new NotImplementedException();
}
public Task UpdateServerAsync(Guid id, Server server)
{
throw new NotImplementedException();
}
}