Skip to content

Feature/refactoring project structure #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/LinkDotNet.Blog.Web/App.razor
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@using LinkDotNet.Blog.Web.Features.Home.Components
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
<Found Context="routeData">
Expand Down
2 changes: 1 addition & 1 deletion src/LinkDotNet.Blog.Web/AppConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using LinkDotNet.Blog.Domain;
using LinkDotNet.Blog.Web.Shared.Services;
using LinkDotNet.Blog.Web.Features.ShowBlogPost.Components;

namespace LinkDotNet.Blog.Web;

Expand Down
2 changes: 1 addition & 1 deletion src/LinkDotNet.Blog.Web/AppConfigurationFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using LinkDotNet.Blog.Domain;
using LinkDotNet.Blog.Web.Shared.Services;
using LinkDotNet.Blog.Web.Features.ShowBlogPost.Components;
using Microsoft.Extensions.Configuration;

namespace LinkDotNet.Blog.Web;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/AboutMe"
@using LinkDotNet.Blog.Web.Shared.Skills
@using LinkDotNet.Blog.Web.Shared.Services
@using LinkDotNet.Blog.Web.Features.Services
@using LinkDotNet.Blog.Web.Features.AboutMe.Components
@inject AppConfiguration appConfiguration
@inject AuthenticationStateProvider authenticationStateProvider
@inject IUserRecordService userRecordService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Web.Features.Components
@inject IToastService toastService
<ModalDialog @ref="Dialog" Title="Add Skill">
<EditForm Model="@model" OnValidSubmit="CreateSkillItem">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using LinkDotNet.Blog.Domain;

namespace LinkDotNet.Blog.Web.Shared.Skills;
namespace LinkDotNet.Blog.Web.Features.AboutMe.Components;

public class AddSkillModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@using LinkDotNet.Blog.Web.Shared.Services
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@inherits MarkdownComponentBase
@using LinkDotNet.Blog.Web.Features.Components
@using LinkDotNet.Blog.Web.Features.Services
@inherits LinkDotNet.Blog.Web.Features.MarkdownComponentBase

@inject AppConfiguration appConfiguration
@inject IRepository<ProfileInformationEntry> repository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Web.Shared.Services
@inherits MarkdownComponentBase

<h3>@Title</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using LinkDotNet.Blog.Domain;

namespace LinkDotNet.Blog.Web.Shared.Admin;
namespace LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Components;

public class CreateNewModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ModalDialog @ref="FeatureDialog" Title="Additional Features">
@using LinkDotNet.Blog.Web.Features.Components
<ModalDialog @ref="FeatureDialog" Title="Additional Features">
<p>Here you will find a comprehensive list over feature you can use additional to classic markdown</p>
<p>Features marked with <i class="fas fa-flask"></i> are experimental and can change heavily, get removed or the usage changes.</p>
<p>Use with caution and check the changelog</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LinkDotNet.Blog.Web.Shared;
namespace LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Components;

public sealed class SelectionRange
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@using System.IO
@using LinkDotNet.Blog.Web.Shared.Services
@using LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Services
@inject IFileProcessor fileProcessor

<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@page "/create"
@attribute [Authorize]
@using LinkDotNet.Blog.Web.Shared.Admin
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Components
@inherits MarkdownComponentBase
@inject IRepository<BlogPost> blogPostRepository
@inject IToastService toastService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Forms;

namespace LinkDotNet.Blog.Web.Shared.Services;
namespace LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Services;

public class FileProcessor : IFileProcessor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Forms;

namespace LinkDotNet.Blog.Web.Shared.Services;
namespace LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Services;

public interface IFileProcessor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@page "/update/{blogPostId}"
@attribute [Authorize]
@using LinkDotNet.Blog.Web.Shared.Admin
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Components
@inherits MarkdownComponentBase
@inject IRepository<BlogPost> blogPostRepository
@inject IToastService toastService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="row mb-3">
@using LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services
<div class="row mb-3">
<div class="col-2">
<label for="startDate">Since</label>
<input type="date" class="form-control" id="startDate" @onchange="StartDateChanged"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/dashboard"
@using LinkDotNet.Blog.Web.Shared.Admin.Dashboard
@using LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services
@using LinkDotNet.Blog.Web.Features.Admin.Dashboard.Components
@inject IDashboardService dashboardService
@inject AppConfiguration appConfiguration
@attribute [Authorize]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LinkDotNet.Blog.Web.Pages.Admin;
namespace LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services;

public class DashboardData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
using LinkDotNet.Blog.Domain;
using LinkDotNet.Blog.Infrastructure.Persistence;

namespace LinkDotNet.Blog.Web.Pages.Admin;

public interface IDashboardService
{
Task<DashboardData> GetDashboardDataAsync();
}
namespace LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services;

public class DashboardService : IDashboardService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace LinkDotNet.Blog.Web.Shared.Admin.Dashboard;
namespace LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services;

public sealed class Filter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Threading.Tasks;

namespace LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services;

public interface IDashboardService
{
Task<DashboardData> GetDashboardDataAsync();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace LinkDotNet.Blog.Web.Shared.Admin.Dashboard;
namespace LinkDotNet.Blog.Web.Features.Admin.Dashboard.Services;

public record VisitCountPageData
{
Expand All @@ -9,4 +9,4 @@ public record VisitCountPageData
public int Likes { get; init; }

public int ClickCount { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@using LinkDotNet.Blog.Domain
@using System.Linq.Expressions
@using Microsoft.EntityFrameworkCore
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using System.Linq.Expressions
@using LinkDotNet.Blog.Infrastructure.Persistence.Sql
@using Microsoft.EntityFrameworkCore
@using LinkDotNet.Blog.Web.Features.Admin.Dashboard.Components
@inject BlogDbContext blogDbContext

<div class="card">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Threading.Tasks;

namespace LinkDotNet.Blog.Web.Shared.Services.Sitemap;
namespace LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services;

public interface ISitemapService
{
Task<SitemapUrlSet> CreateSitemapAsync();

Task SaveSitemapToFileAsync(SitemapUrlSet sitemap);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Threading.Tasks;

namespace LinkDotNet.Blog.Web.Shared.Services;
namespace LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services;

public interface IXmlFileWriter
{
Task WriteObjectToXmlFileAsync<T>(T objectToSave, string fileName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using LinkDotNet.Blog.Infrastructure.Persistence;
using Microsoft.AspNetCore.Components;

namespace LinkDotNet.Blog.Web.Shared.Services.Sitemap;
namespace LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services;

public class SitemapService : ISitemapService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Xml.Serialization;

namespace LinkDotNet.Blog.Web.Shared.Services.Sitemap;
namespace LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services;

[XmlRoot(ElementName = "url")]
public class SitemapUrl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace LinkDotNet.Blog.Web.Shared.Services.Sitemap;
namespace LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services;

[XmlRoot(ElementName = "urlset", Namespace = "http://www.sitemaps.org/schemas/sitemap/0.9")]
public class SitemapUrlSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Xml;
using System.Xml.Serialization;

namespace LinkDotNet.Blog.Web.Shared.Services;
namespace LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services;

public class XmlFileWriter : IXmlFileWriter
{
Expand All @@ -16,4 +16,4 @@ public async Task WriteObjectToXmlFileAsync<T>(T objectToSave, string fileName)
xmlWriter.Close();
file.Close();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/Sitemap"
@using LinkDotNet.Blog.Web.Shared.Services.Sitemap
@using LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services
@inject ISitemapService sitemapService
@attribute [Authorize]
<h3 xmlns="http://www.w3.org/1999/html">Sitemap</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@using System.Text.RegularExpressions
@using System.Web
@using LinkDotNet.Blog.Domain
@inherits MarkdownComponentBase
@inherits LinkDotNet.Blog.Web.Features.MarkdownComponentBase
<article>
<div class="blog-card @AltCssClass">
<div class="meta">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page
@model LinkDotNet.Blog.Web.Pages.ErrorModel
@model LinkDotNet.Blog.Web.Features.ErrorModel

<!DOCTYPE html>
<html>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace LinkDotNet.Blog.Web.Pages;
namespace LinkDotNet.Blog.Web.Features;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@using LinkDotNet.Blog.Domain
@inherits MarkdownComponentBase
@inherits LinkDotNet.Blog.Web.Features.MarkdownComponentBase

<div style="--profile-background: url(@Introduction.BackgroundUrl)" class="@IntroductionClass">
<div class="introduction-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
@page "/{page:int}"
@using Markdig
@using X.PagedList
@using LinkDotNet.Blog.Web.Shared.Services
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using LinkDotNet.Blog.Web.Features.Services
@using LinkDotNet.Blog.Web.Features.Home.Components
@inject IRepository<BlogPost> blogPostRepository
@inject AppConfiguration appConfiguration
@inject NavigationManager navigationManager
Expand Down
4 changes: 4 additions & 0 deletions src/LinkDotNet.Blog.Web/Features/Login.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@page
@model LinkDotNet.Blog.Web.Features.LoginModel
@{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using LinkDotNet.Blog.Web.Authentication;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace LinkDotNet.Blog.Web.Pages;
namespace LinkDotNet.Blog.Web.Features;

public partial class LoginModel : PageModel
{
Expand Down
4 changes: 4 additions & 0 deletions src/LinkDotNet.Blog.Web/Features/Logout.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@page
@model LinkDotNet.Blog.Web.Features.LogoutModel
@{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using LinkDotNet.Blog.Web.Authentication;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace LinkDotNet.Blog.Web.Pages;
namespace LinkDotNet.Blog.Web.Features;

public partial class LogoutModel : PageModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Markdig.Extensions.AutoIdentifiers;
using Microsoft.AspNetCore.Components;

namespace LinkDotNet.Blog.Web.Shared;
namespace LinkDotNet.Blog.Web.Features;

public abstract class MarkdownComponentBase : ComponentBase
{
Expand All @@ -23,4 +23,4 @@ protected static MarkupString RenderMarkupString(string content)

return (MarkupString)Markdown.ToHtml(content, MarkdownPipeline);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page "/search/{searchTerm}"
@using LinkDotNet.Blog.Web.Shared.Services
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using LinkDotNet.Blog.Web.Features.Services
@inject IRepository<BlogPost> blogPostRepository
@inject IUserRecordService userRecordService

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page "/searchByTag/{tag}"
@using LinkDotNet.Blog.Web.Shared.Services
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using LinkDotNet.Blog.Web.Features.Services
@inject IRepository<BlogPost> blogPostRepository
@inject IUserRecordService userRecordService

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace LinkDotNet.Blog.Web.Shared.Services;
namespace LinkDotNet.Blog.Web.Features.Services;

public interface ILocalStorageService
{
Expand Down
Loading