feat(data): rename *.Services projects, lift TrackEntity onto BlazorBlocks data layer, regenerate initial Postgres migration

DeepDrftWeb.Services → DeepDrftData; DeepDrftContent.Services → DeepDrftContent.Data.
TrackEntity:BaseEntity, TrackRepository:Repository<>, TrackManager:Manager<>+ITrackService.
Drops DeepDrftModels PagingParameters/PagedResult in favour of Models.Common.* from BlazorBlocks.
InitialCreate migration captures full schema including is_deleted index.
This commit is contained in:
Daniel Harvey
2026-05-18 22:22:09 -04:00
parent 130f1357ec
commit cd700dc758
82 changed files with 511 additions and 600 deletions
+15 -7
View File
@@ -1,13 +1,21 @@
namespace DeepDrftModels.DTOs;
using Models.Models;
public class TrackDto
namespace DeepDrftModels.DTOs;
// Inherits Id, CreatedAt, UpdatedAt from BaseModel (Cerebellum.BlazorBlocks.Models).
// BlazorBlocks's Manager<> generic constraint requires `new()` on the model type, which
// disqualifies `required` properties (the `new()` constraint and required members do not
// compose). EntryKey/TrackName/Artist therefore drop `required` here — the TrackEntity
// side remains required, and TrackConverter assigns every field on the round-trip so an
// empty default is never observable in production code paths.
public class TrackDto : BaseModel
{
public long Id { get; set; }
public required string EntryKey { get; set; }
public required string TrackName { get; set; }
public required string Artist { get; set; }
public string EntryKey { get; set; } = string.Empty;
public string TrackName { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
public string? Album { get; set; }
public string? Genre { get; set; }
public DateOnly? ReleaseDate { get; set; }
public string? ImagePath { get; set; }
}
public long? CreatedByUserId { get; set; }
}
+2 -1
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
@@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Cerebellum.NetBlocks" Version="10.3.30" />
<PackageReference Include="Cerebellum.BlazorBlocks.Models" Version="10.3.30" />
</ItemGroup>
</Project>
+8 -4
View File
@@ -1,8 +1,12 @@
namespace DeepDrftModels.Entities;
using Models.Entities;
public class TrackEntity
namespace DeepDrftModels.Entities;
// Inherits Id, CreatedAt, UpdatedAt, IsDeleted from BaseEntity (Cerebellum.BlazorBlocks.Models).
// BaseEntity ships the audit columns but does not declare IEntity itself, so subclasses
// declare it explicitly to satisfy the generic constraints on Repository<>/Manager<>/etc.
public class TrackEntity : BaseEntity, IEntity
{
public long Id { get; set; }
public required string EntryKey { get; set; }
public required string TrackName { get; set; }
public required string Artist { get; set; }
@@ -11,4 +15,4 @@ public class TrackEntity
public DateOnly? ReleaseDate { get; set; }
public string? ImagePath { get; set; }
public long? CreatedByUserId { get; set; }
}
}
-35
View File
@@ -1,35 +0,0 @@
namespace DeepDrftModels.Models;
public class PagedResult<T>
{
public IEnumerable<T> Items { get; set; } = new List<T>();
public int TotalCount { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
public int TotalPages => PageSize > 0 ? (int)Math.Ceiling((double)TotalCount / PageSize) : 0;
public bool HasNextPage => Page < TotalPages;
public bool HasPreviousPage => Page > 1;
public PagedResult()
{
}
public static PagedResult<T> From<TOther>(PagedResult<TOther> other, IEnumerable<T> items)
{
return new PagedResult<T>()
{
Items = items.ToList(),
Page = other.Page,
PageSize = other.PageSize,
TotalCount = other.TotalCount,
};
}
public PagedResult(IEnumerable<T> items, int totalCount, int page, int pageSize)
{
Items = items.ToList();
TotalCount = totalCount;
Page = page;
PageSize = pageSize;
}
}
-25
View File
@@ -1,25 +0,0 @@
using System.Linq.Expressions;
namespace DeepDrftModels.Models;
public class PagingParameters
{
private const int _maxPageSize = 100;
private int _pageSize = 20;
public int Page { get; set; } = 1;
public int PageSize
{
get => _pageSize;
set => _pageSize = value > _maxPageSize ? _maxPageSize : value;
}
}
public class PagingParameters<T> : PagingParameters
{
public Expression<Func<T, object>>? OrderBy { get; set; }
public bool IsDescending { get; set; } = false;
public int Skip => (Page - 1) * PageSize;
}