refactor(model): move BlogPost DTO from PostIt.Models to Yavsc.Blogspot

BlogPost is shared between the server (Yavsc.Server/Models/Blog/
BlogPost.cs is the EF entity) and any client that talks to the
blogs API. Keeping the client-side DTO in PostIt.Models made
sense when there was only one consumer; now that the
Yavsc.Api.Client project is about to host BlogApiClient alongside
CircleApiClient and BlogAclApiClient, the DTO has to live in a
layer both the client project and PostIt can reference without
inverting the dependency.

Yavsc.Abstract is the existing home for cross-tier interfaces
and DTOs (IBlogPost, IBlogPostPayLoad, IApplicationUser).
Yavsc.Blogspot is the sub-namespace already used by the
matching interface, so the new concrete class follows.

Why not move Circle and CircleAuthorizationToBlogPost at the
same time? Both depend on the concrete ApplicationUser class
(via the Owner and Target/Allowed navigation properties) which
lives in Yavsc.Server. Moving them would mean either dragging
ApplicationUser into the abstract layer (huge blast radius —
auth, billing, chat, etc.) or weakening the navigation
properties (breaks EF Core shaping). They're staying where
they are; the new Yavsc.Api.Client will get DTO counterparts
instead.

Updated call sites:
- 4 .cs files: replace 'using PostIt.Models;' with
  'using Yavsc.Blogspot;' where the file was actually using
  BlogPost. Files that only used SignaturePadData keep their
  'using PostIt.Models;' — that type stays put.
- 1 .axaml file: xmlns:models="using:PostIt.Models" ->
  xmlns:models="using:Yavsc.Blogspot" (one DataTemplate for
  the post list in MainPage).

Build + tests green (51/51).
This commit is contained in:
Paul Schneider 2026-08-17 23:45:45 +01:00
commit 0e95e28327
Signed by: notazof
GPG key ID: 1DD5D838E5343B06
7 changed files with 13 additions and 14 deletions

View file

@ -1,4 +1,4 @@
using PostIt.Models; using Yavsc.Blogspot;
using PostIt.Services; using PostIt.Services;
using PostIt.ViewModels; using PostIt.ViewModels;
using Yavsc.Models; using Yavsc.Models;

View file

@ -2,7 +2,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Headless.XUnit; using Avalonia.Headless.XUnit;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using PostIt.Models; using Yavsc.Blogspot;
using PostIt.Services; using PostIt.Services;
using PostIt.ViewModels; using PostIt.ViewModels;
using PostIt.Views; using PostIt.Views;

View file

@ -1,4 +1,4 @@
using PostIt.Models; using Yavsc.Blogspot;
using PostIt.Services; using PostIt.Services;
using PostIt.ViewModels; using PostIt.ViewModels;

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using PostIt.Models; using Yavsc.Blogspot;
namespace PostIt.Services; namespace PostIt.Services;

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using PostIt.Models; using Yavsc.Blogspot;
using PostIt.Services; using PostIt.Services;
namespace PostIt.ViewModels; namespace PostIt.ViewModels;

View file

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:PostIt.ViewModels" xmlns:vm="using:PostIt.ViewModels"
xmlns:models="using:PostIt.Models" xmlns:models="using:Yavsc.Blogspot"
xmlns:views="using:PostIt.Views" xmlns:views="using:PostIt.Views"
xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit" xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
mc:Ignorable="d" mc:Ignorable="d"

View file

@ -1,9 +1,8 @@
using System; using System;
using Yavsc.Abstract.Identity; using Yavsc.Abstract.Identity;
using Yavsc.Abstract.Identity.Security; using Yavsc.Abstract.Identity.Security;
using Yavsc.Blogspot;
namespace PostIt.Models; namespace Yavsc.Blogspot;
public class BlogPost : IBlogPost public class BlogPost : IBlogPost
{ {
@ -13,12 +12,12 @@ public class BlogPost : IBlogPost
public string Article { get; set ; } public string Article { get; set ; }
public string Photo { get; set ; } public string Photo { get; set ; }
public long Id { get; set ; } public long Id { get; set; }
public DateTime DateCreated { get; set ; } public DateTime DateCreated { get; set; }
public string UserCreated { get; set ; } public string UserCreated { get; set; }
public DateTime DateModified { get; set ; } public DateTime DateModified { get; set; }
public string UserModified { get; set ; } public string UserModified { get; set; }
public string Title { get; set ; } public string Title { get; set; }
public bool AuthorizeCircle(long circleId) public bool AuthorizeCircle(long circleId)
{ {