Backend Services Split into separate projects for reference from other front ends

This commit is contained in:
daniel-c-harvey
2025-09-07 12:56:52 -04:00
parent a5b7ab041e
commit b16bcfc6cd
47 changed files with 153 additions and 114 deletions
+2 -1
View File
@@ -44,7 +44,8 @@
"Read(/F:\\Development\\DeepDrftHome\\DeepDrftModels\\DTOs/**)", "Read(/F:\\Development\\DeepDrftHome\\DeepDrftModels\\DTOs/**)",
"Read(/F:\\Development\\DeepDrftHome\\DeepDrftTests/**)", "Read(/F:\\Development\\DeepDrftHome\\DeepDrftTests/**)",
"Read(/F:\\Development\\DeepDrftHome\\DeepDrftTests/**)", "Read(/F:\\Development\\DeepDrftHome\\DeepDrftTests/**)",
"Read(/F:\\Development\\DeepDrftHome\\DeepDrftTests/**)" "Read(/F:\\Development\\DeepDrftHome\\DeepDrftTests/**)",
"Read(//f/Development/NetBlocks/**)"
], ],
"deny": [], "deny": [],
"ask": [] "ask": []
@@ -1,4 +1,4 @@
namespace DeepDrftContent.Constants; namespace DeepDrftContent.Services.Constants;
/// <summary> /// <summary>
/// Constants for FileDatabase vault names /// Constants for FileDatabase vault names
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DeepDrftModels\DeepDrftModels.csproj" />
</ItemGroup>
</Project>
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using IndexType = DeepDrftContent.FileDatabase.Services.IndexType; using IndexType = DeepDrftContent.Services.FileDatabase.Services.IndexType;
namespace DeepDrftContent.FileDatabase.Abstractions; namespace DeepDrftContent.Services.FileDatabase.Abstractions;
/// <summary> /// <summary>
/// Interface for creating index instances /// Interface for creating index instances
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
namespace DeepDrftContent.FileDatabase.Abstractions; namespace DeepDrftContent.Services.FileDatabase.Abstractions;
/// <summary> /// <summary>
/// Interface for registering media type factories /// Interface for registering media type factories
@@ -1,4 +1,4 @@
namespace DeepDrftContent.FileDatabase.Models; namespace DeepDrftContent.Services.FileDatabase.Models;
/// <summary> /// <summary>
/// Base interface for all index types - minimal contract /// Base interface for all index types - minimal contract
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace DeepDrftContent.FileDatabase.Models; namespace DeepDrftContent.Services.FileDatabase.Models;
/// <summary> /// <summary>
/// Base class for index data used in serialization /// Base class for index data used in serialization
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Abstractions; using DeepDrftContent.Services.FileDatabase.Abstractions;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
namespace DeepDrftContent.FileDatabase.Models; namespace DeepDrftContent.Services.FileDatabase.Models;
/// <summary> /// <summary>
/// Type mappings for media vault types - simple dictionary-based approach /// Type mappings for media vault types - simple dictionary-based approach
@@ -1,4 +1,4 @@
namespace DeepDrftContent.FileDatabase.Models; namespace DeepDrftContent.Services.FileDatabase.Models;
/// <summary> /// <summary>
/// Parameters for creating a FileBinary /// Parameters for creating a FileBinary
@@ -1,4 +1,4 @@
namespace DeepDrftContent.FileDatabase.Models; namespace DeepDrftContent.Services.FileDatabase.Models;
/// <summary> /// <summary>
/// Enum representing different types of media vaults /// Enum representing different types of media vaults
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace DeepDrftContent.FileDatabase.Models; namespace DeepDrftContent.Services.FileDatabase.Models;
/// <summary> /// <summary>
/// Base metadata for media entries /// Base metadata for media entries
@@ -1,8 +1,8 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
using IndexType = DeepDrftContent.FileDatabase.Services.IndexType; using IndexType = DeepDrftContent.Services.FileDatabase.Services.IndexType;
namespace DeepDrftContent.FileDatabase.Services; namespace DeepDrftContent.Services.FileDatabase.Services;
/// <summary> /// <summary>
/// Main file database class that orchestrates multiple media vaults /// Main file database class that orchestrates multiple media vaults
@@ -1,9 +1,9 @@
using DeepDrftContent.FileDatabase.Abstractions; using DeepDrftContent.Services.FileDatabase.Abstractions;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
using IndexType = DeepDrftContent.FileDatabase.Services.IndexType; using IndexType = DeepDrftContent.Services.FileDatabase.Services.IndexType;
namespace DeepDrftContent.FileDatabase.Services; namespace DeepDrftContent.Services.FileDatabase.Services;
/// <summary> /// <summary>
/// Factory service for creating and managing indexes /// Factory service for creating and managing indexes
@@ -1,8 +1,8 @@
using DeepDrftContent.FileDatabase.Abstractions; using DeepDrftContent.Services.FileDatabase.Abstractions;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
namespace DeepDrftContent.FileDatabase.Services; namespace DeepDrftContent.Services.FileDatabase.Services;
/// <summary> /// <summary>
/// Enum representing different types of indexes /// Enum representing different types of indexes
@@ -1,8 +1,8 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
namespace DeepDrftContent.FileDatabase.Services; namespace DeepDrftContent.Services.FileDatabase.Services;
/// <summary> /// <summary>
/// Abstract base class for media vaults that store and manage media files /// Abstract base class for media vaults that store and manage media files
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Abstractions; using DeepDrftContent.Services.FileDatabase.Abstractions;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
namespace DeepDrftContent.FileDatabase.Services; namespace DeepDrftContent.Services.FileDatabase.Services;
/// <summary> /// <summary>
/// Factory for creating media vaults /// Factory for creating media vaults
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Abstractions; using DeepDrftContent.Services.FileDatabase.Abstractions;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
namespace DeepDrftContent.FileDatabase.Services; namespace DeepDrftContent.Services.FileDatabase.Services;
/// <summary> /// <summary>
/// Simple dictionary-based registry for media type factories /// Simple dictionary-based registry for media type factories
@@ -1,7 +1,7 @@
using System.Text.Json; using System.Text.Json;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
namespace DeepDrftContent.FileDatabase.Utils; namespace DeepDrftContent.Services.FileDatabase.Utils;
/// <summary> /// <summary>
/// Utility class for file I/O operations, matching the TypeScript file utilities /// Utility class for file I/O operations, matching the TypeScript file utilities
@@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using System.Text.Json; using System.Text.Json;
namespace DeepDrftContent.FileDatabase.Utils; namespace DeepDrftContent.Services.FileDatabase.Utils;
/// <summary> /// <summary>
/// A map implementation that uses structural equality for keys by serializing them to JSON. /// A map implementation that uses structural equality for keys by serializing them to JSON.
@@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using System.Text.Json; using System.Text.Json;
namespace DeepDrftContent.FileDatabase.Utils; namespace DeepDrftContent.Services.FileDatabase.Utils;
/// <summary> /// <summary>
/// A set implementation that uses structural equality for values by serializing them to JSON. /// A set implementation that uses structural equality for values by serializing them to JSON.
@@ -1,6 +1,6 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
namespace DeepDrftContent.Processors; namespace DeepDrftContent.Services.Processors;
/// <summary> /// <summary>
/// Service for processing audio files and extracting metadata /// Service for processing audio files and extracting metadata
@@ -1,6 +1,6 @@
using DeepDrftContent.Constants; using DeepDrftContent.Services.Constants;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
using DeepDrftContent.Processors; using DeepDrftContent.Services.Processors;
using DeepDrftModels.Entities; using DeepDrftModels.Entities;
namespace DeepDrftContent.Services; namespace DeepDrftContent.Services;
@@ -52,7 +52,7 @@ public class TrackService
// Ensure tracks vault exists // Ensure tracks vault exists
if (!_fileDatabase.HasVault(VaultConstants.Tracks)) if (!_fileDatabase.HasVault(VaultConstants.Tracks))
{ {
await _fileDatabase.CreateVaultAsync(VaultConstants.Tracks, DeepDrftContent.FileDatabase.Models.MediaVaultType.Audio); await _fileDatabase.CreateVaultAsync(VaultConstants.Tracks, DeepDrftContent.Services.FileDatabase.Models.MediaVaultType.Audio);
} }
// Store the audio in FileDatabase // Store the audio in FileDatabase
@@ -86,9 +86,9 @@ public class TrackService
/// </summary> /// </summary>
/// <param name="trackId">Track ID (EntryKey)</param> /// <param name="trackId">Track ID (EntryKey)</param>
/// <returns>Audio binary or null if not found</returns> /// <returns>Audio binary or null if not found</returns>
public async Task<DeepDrftContent.FileDatabase.Models.AudioBinary?> GetAudioBinaryAsync(string trackId) public async Task<DeepDrftContent.Services.FileDatabase.Models.AudioBinary?> GetAudioBinaryAsync(string trackId)
{ {
return await _fileDatabase.LoadResourceAsync<DeepDrftContent.FileDatabase.Models.AudioBinary>(VaultConstants.Tracks, trackId); return await _fileDatabase.LoadResourceAsync<DeepDrftContent.Services.FileDatabase.Models.AudioBinary>(VaultConstants.Tracks, trackId);
} }
/// <summary> /// <summary>
@@ -106,7 +106,7 @@ public class TrackService
{ {
if (!_fileDatabase.HasVault(VaultConstants.Tracks)) if (!_fileDatabase.HasVault(VaultConstants.Tracks))
{ {
await _fileDatabase.CreateVaultAsync(VaultConstants.Tracks, DeepDrftContent.FileDatabase.Models.MediaVaultType.Audio); await _fileDatabase.CreateVaultAsync(VaultConstants.Tracks, DeepDrftContent.Services.FileDatabase.Models.MediaVaultType.Audio);
} }
} }
} }
@@ -1,5 +1,5 @@
using DeepDrftContent.Constants; using DeepDrftContent.Services.Constants;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.Middleware; using DeepDrftContent.Middleware;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@@ -9,9 +9,9 @@ namespace DeepDrftContent.Controllers;
[Route("api/[controller]")] [Route("api/[controller]")]
public class TrackController : ControllerBase public class TrackController : ControllerBase
{ {
private readonly FileDatabase.Services.FileDatabase _fileDatabase; private readonly DeepDrftContent.Services.FileDatabase.Services.FileDatabase _fileDatabase;
public TrackController(FileDatabase.Services.FileDatabase fileDatabase) public TrackController(DeepDrftContent.Services.FileDatabase.Services.FileDatabase fileDatabase)
{ {
_fileDatabase = fileDatabase; _fileDatabase = fileDatabase;
} }
+1
View File
@@ -12,6 +12,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DeepDrftModels\DeepDrftModels.csproj" /> <ProjectReference Include="..\DeepDrftModels\DeepDrftModels.csproj" />
<ProjectReference Include="..\DeepDrftContent.Services\DeepDrftContent.Services.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+1 -1
View File
@@ -1,5 +1,5 @@
using DeepDrftContent; using DeepDrftContent;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
using DeepDrftContent.Middleware; using DeepDrftContent.Middleware;
using DeepDrftContent.Models; using DeepDrftContent.Models;
using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.HttpOverrides;
+5 -5
View File
@@ -1,6 +1,6 @@
using DeepDrftContent.Constants; using DeepDrftContent.Services.Constants;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
using DeepDrftContent.Models; using DeepDrftContent.Models;
namespace DeepDrftContent namespace DeepDrftContent
@@ -14,13 +14,13 @@ namespace DeepDrftContent
var fileDatabaseSettings = builder.Configuration.GetSection(nameof(FileDatabaseSettings)).Get<FileDatabaseSettings>(); var fileDatabaseSettings = builder.Configuration.GetSection(nameof(FileDatabaseSettings)).Get<FileDatabaseSettings>();
if (fileDatabaseSettings is null) { throw new Exception("File database settings are not configured"); } if (fileDatabaseSettings is null) { throw new Exception("File database settings are not configured"); }
var fileDatabase = await FileDatabase.Services.FileDatabase.FromAsync(fileDatabaseSettings.VaultPath); var fileDatabase = await FileDatabase.FromAsync(fileDatabaseSettings.VaultPath);
if (fileDatabase is null) { throw new Exception("Unable to initialize file database"); } if (fileDatabase is null) { throw new Exception("Unable to initialize file database"); }
builder.Services.AddSingleton(fileDatabase); builder.Services.AddSingleton(fileDatabase);
await InitializeTrackVault(fileDatabase); await InitializeTrackVault(fileDatabase);
} }
private static async Task InitializeTrackVault(FileDatabase.Services.FileDatabase fileDatabase) private static async Task InitializeTrackVault(FileDatabase fileDatabase)
{ {
if (!fileDatabase.HasVault(VaultConstants.Tracks)) if (!fileDatabase.HasVault(VaultConstants.Tracks))
{ {
+28
View File
@@ -14,6 +14,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftTests", "DeepDrftTe
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftCli", "DeepDrftCli\DeepDrftCli.csproj", "{E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftCli", "DeepDrftCli\DeepDrftCli.csproj", "{E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftWeb.Services", "DeepDrftWeb.Services\DeepDrftWeb.Services.csproj", "{1D1CE905-DAD0-4E93-9B09-326E8EC05877}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftContent.Services", "DeepDrftContent.Services\DeepDrftContent.Services.csproj", "{4D025326-7F27-4C42-BE0F-92C1E64E0696}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -108,6 +112,30 @@ Global
{E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}.Release|x64.Build.0 = Release|Any CPU {E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}.Release|x64.Build.0 = Release|Any CPU
{E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}.Release|x86.ActiveCfg = Release|Any CPU {E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}.Release|x86.ActiveCfg = Release|Any CPU
{E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}.Release|x86.Build.0 = Release|Any CPU {E4C0ADD6-1264-47A5-98E1-0843AD14B7F9}.Release|x86.Build.0 = Release|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Debug|x64.ActiveCfg = Debug|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Debug|x64.Build.0 = Debug|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Debug|x86.ActiveCfg = Debug|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Debug|x86.Build.0 = Debug|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Release|Any CPU.Build.0 = Release|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Release|x64.ActiveCfg = Release|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Release|x64.Build.0 = Release|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Release|x86.ActiveCfg = Release|Any CPU
{1D1CE905-DAD0-4E93-9B09-326E8EC05877}.Release|x86.Build.0 = Release|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Debug|x64.ActiveCfg = Debug|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Debug|x64.Build.0 = Debug|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Debug|x86.Build.0 = Debug|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Release|Any CPU.Build.0 = Release|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Release|x64.ActiveCfg = Release|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Release|x64.Build.0 = Release|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Release|x86.ActiveCfg = Release|Any CPU
{4D025326-7F27-4C42-BE0F-92C1E64E0696}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
+1 -1
View File
@@ -21,7 +21,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DeepDrftContent\DeepDrftContent.csproj" /> <ProjectReference Include="..\DeepDrftContent.Services\DeepDrftContent.Services.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+2 -2
View File
@@ -1,5 +1,5 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
namespace DeepDrftTests; namespace DeepDrftTests;
+4 -4
View File
@@ -1,7 +1,7 @@
using DeepDrftContent.FileDatabase.Abstractions; using DeepDrftContent.Services.FileDatabase.Abstractions;
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
namespace DeepDrftTests; namespace DeepDrftTests;
+2 -2
View File
@@ -1,5 +1,5 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
namespace DeepDrftTests; namespace DeepDrftTests;
+3 -3
View File
@@ -1,6 +1,6 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
namespace DeepDrftTests; namespace DeepDrftTests;
+1 -1
View File
@@ -1,4 +1,4 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
namespace DeepDrftTests; namespace DeepDrftTests;
@@ -1,5 +1,5 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Services; using DeepDrftContent.Services.FileDatabase.Services;
namespace DeepDrftTests; namespace DeepDrftTests;
+1 -1
View File
@@ -1,4 +1,4 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
namespace DeepDrftTests; namespace DeepDrftTests;
+2 -2
View File
@@ -1,5 +1,5 @@
using DeepDrftContent.FileDatabase.Models; using DeepDrftContent.Services.FileDatabase.Models;
using DeepDrftContent.FileDatabase.Utils; using DeepDrftContent.Services.FileDatabase.Utils;
namespace DeepDrftTests; namespace DeepDrftTests;
@@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace DeepDrftWeb.Data.Configurations; namespace DeepDrftWeb.Services.Data.Configurations;
public class TrackConfiguration : IEntityTypeConfiguration<TrackEntity> public class TrackConfiguration : IEntityTypeConfiguration<TrackEntity>
{ {
@@ -1,8 +1,8 @@
using DeepDrftModels.Entities; using DeepDrftModels.Entities;
using DeepDrftWeb.Data.Configurations; using DeepDrftWeb.Services.Data.Configurations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace DeepDrftWeb.Data; namespace DeepDrftWeb.Services.Data;
public class DeepDrftContext : DbContext public class DeepDrftContext : DbContext
{ {
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DeepDrftModels\DeepDrftModels.csproj" />
</ItemGroup>
</Project>
@@ -1,8 +1,9 @@
using DeepDrftModels.Entities; using DeepDrftModels.Entities;
using DeepDrftModels.Models; using DeepDrftModels.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DeepDrftWeb.Services.Data;
namespace DeepDrftWeb.Data.Repositories; namespace DeepDrftWeb.Services.Repositories;
public class TrackRepository public class TrackRepository
{ {
@@ -1,7 +1,7 @@
using DeepDrftModels.Entities; using DeepDrftModels.Entities;
using DeepDrftModels.Models; using DeepDrftModels.Models;
using DeepDrftWeb.Data; using DeepDrftWeb.Services.Data;
using DeepDrftWeb.Data.Repositories; using DeepDrftWeb.Services.Repositories;
using NetBlocks.Models; using NetBlocks.Models;
namespace DeepDrftWeb.Services; namespace DeepDrftWeb.Services;
@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace DeepDrftWeb.Data;
public static class DeepDrftContextFactory
{
public class Factory : IDesignTimeDbContextFactory<DeepDrftContext>
{
public DeepDrftContext CreateDbContext(string[] args)
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true)
.Build();
var optionsBuilder = new DbContextOptionsBuilder<DeepDrftContext>();
optionsBuilder.UseSqlite(configuration.GetConnectionString("DefaultConnection"));
return new DeepDrftContext(optionsBuilder.Options);
}
}
}
+1
View File
@@ -21,6 +21,7 @@
</PackageReference> </PackageReference>
<ProjectReference Include="..\DeepDrftModels\DeepDrftModels.csproj" /> <ProjectReference Include="..\DeepDrftModels\DeepDrftModels.csproj" />
<ProjectReference Include="..\DeepDrftWeb.Client\DeepDrftWeb.Client.csproj" /> <ProjectReference Include="..\DeepDrftWeb.Client\DeepDrftWeb.Client.csproj" />
<ProjectReference Include="..\DeepDrftWeb.Services\DeepDrftWeb.Services.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.*" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.*" />
</ItemGroup> </ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using DeepDrftWeb.Data; using DeepDrftWeb.Services.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
@@ -1,6 +1,6 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using DeepDrftWeb.Data; using DeepDrftWeb.Services.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+2 -2
View File
@@ -1,5 +1,5 @@
using DeepDrftWeb.Data; using DeepDrftWeb.Services.Data;
using DeepDrftWeb.Data.Repositories; using DeepDrftWeb.Services.Repositories;
using DeepDrftWeb.Services; using DeepDrftWeb.Services;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;