From 8ef34d014bf6d45d54223cf505b4c868f10f31e0 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 24 Feb 2024 14:52:43 +0000 Subject: [PATCH] refactor: rename BlogUserService to UserService --- .../Controllers/Blog/BlogApiController.cs | 7 ++++--- OliverBooth/Data/Blog/BlogContext.cs | 7 ------- .../Blog/Configuration/UserConfiguration.cs | 1 + OliverBooth/Data/{Blog => Web}/IUser.cs | 2 +- OliverBooth/Data/{Blog => Web}/User.cs | 3 ++- OliverBooth/Data/Web/WebContext.cs | 7 +++++++ OliverBooth/Pages/Blog/Admin/Index.cshtml.cs | 2 +- OliverBooth/Program.cs | 2 +- OliverBooth/Services/BlogPostService.cs | 11 ++++++----- OliverBooth/Services/ISessionService.cs | 2 +- .../{IBlogUserService.cs => IUserService.cs} | 4 ++-- OliverBooth/Services/SessionService.cs | 4 ++-- .../{BlogUserService.cs => UserService.cs} | 18 +++++++++--------- 13 files changed, 37 insertions(+), 33 deletions(-) rename OliverBooth/Data/{Blog => Web}/IUser.cs (98%) rename OliverBooth/Data/{Blog => Web}/User.cs (97%) rename OliverBooth/Services/{IBlogUserService.cs => IUserService.cs} (95%) rename OliverBooth/Services/{BlogUserService.cs => UserService.cs} (65%) diff --git a/OliverBooth/Controllers/Blog/BlogApiController.cs b/OliverBooth/Controllers/Blog/BlogApiController.cs index 21eb070..c5ab926 100644 --- a/OliverBooth/Controllers/Blog/BlogApiController.cs +++ b/OliverBooth/Controllers/Blog/BlogApiController.cs @@ -1,6 +1,7 @@ using Humanizer; using Microsoft.AspNetCore.Mvc; using OliverBooth.Data.Blog; +using OliverBooth.Data.Web; using OliverBooth.Services; namespace OliverBooth.Controllers.Blog; @@ -14,14 +15,14 @@ namespace OliverBooth.Controllers.Blog; public sealed class BlogApiController : ControllerBase { private readonly IBlogPostService _blogPostService; - private readonly IBlogUserService _userService; + private readonly IUserService _userService; /// /// Initializes a new instance of the class. /// /// The . - /// The . - public BlogApiController(IBlogPostService blogPostService, IBlogUserService userService) + /// The . + public BlogApiController(IBlogPostService blogPostService, IUserService userService) { _blogPostService = blogPostService; _userService = userService; diff --git a/OliverBooth/Data/Blog/BlogContext.cs b/OliverBooth/Data/Blog/BlogContext.cs index 3f37b46..2d4b937 100644 --- a/OliverBooth/Data/Blog/BlogContext.cs +++ b/OliverBooth/Data/Blog/BlogContext.cs @@ -31,12 +31,6 @@ internal sealed class BlogContext : DbContext /// The collection of sessions. public DbSet Sessions { get; private set; } = null!; - /// - /// Gets the collection of users in the database. - /// - /// The collection of users. - public DbSet Users { get; private set; } = null!; - /// protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { @@ -50,6 +44,5 @@ internal sealed class BlogContext : DbContext { modelBuilder.ApplyConfiguration(new BlogPostConfiguration()); modelBuilder.ApplyConfiguration(new SessionConfiguration()); - modelBuilder.ApplyConfiguration(new UserConfiguration()); } } diff --git a/OliverBooth/Data/Blog/Configuration/UserConfiguration.cs b/OliverBooth/Data/Blog/Configuration/UserConfiguration.cs index 7c16adf..47abe5c 100644 --- a/OliverBooth/Data/Blog/Configuration/UserConfiguration.cs +++ b/OliverBooth/Data/Blog/Configuration/UserConfiguration.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; +using OliverBooth.Data.Web; namespace OliverBooth.Data.Blog.Configuration; diff --git a/OliverBooth/Data/Blog/IUser.cs b/OliverBooth/Data/Web/IUser.cs similarity index 98% rename from OliverBooth/Data/Blog/IUser.cs rename to OliverBooth/Data/Web/IUser.cs index 6fdedd6..e021546 100644 --- a/OliverBooth/Data/Blog/IUser.cs +++ b/OliverBooth/Data/Web/IUser.cs @@ -1,4 +1,4 @@ -namespace OliverBooth.Data.Blog; +namespace OliverBooth.Data.Web; /// /// Represents a user which can log in to the blog. diff --git a/OliverBooth/Data/Blog/User.cs b/OliverBooth/Data/Web/User.cs similarity index 97% rename from OliverBooth/Data/Blog/User.cs rename to OliverBooth/Data/Web/User.cs index 987e2e7..867935d 100644 --- a/OliverBooth/Data/Blog/User.cs +++ b/OliverBooth/Data/Web/User.cs @@ -2,8 +2,9 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Security.Cryptography; using System.Text; using Cysharp.Text; +using OliverBooth.Data.Blog; -namespace OliverBooth.Data.Blog; +namespace OliverBooth.Data.Web; /// /// Represents a user. diff --git a/OliverBooth/Data/Web/WebContext.cs b/OliverBooth/Data/Web/WebContext.cs index d5b74e4..4d54ea3 100644 --- a/OliverBooth/Data/Web/WebContext.cs +++ b/OliverBooth/Data/Web/WebContext.cs @@ -55,6 +55,12 @@ internal sealed class WebContext : DbContext /// The collection of templates. public DbSet