Skip to content

Commit 472866d

Browse files
Refactor and improve code readability and organization (#2317)
- Added braces to lambda in `ContentMessageHandler.cs` for better readability. - Removed unnecessary `Microsoft.EntityFrameworkCore` using directive in `FluentCmsDbContext.cs`. - Adjusted class declaration formatting in `PluginRepository.cs`. - Improved spacing and alignment in `SettingsRepository.cs` property initialization. - Reordered `using` directives in `UserRepository.cs` for better organization. - Updated `global using` directives in `_GlobalUsings.cs` for proper dependencies and organization.
1 parent 30a08d8 commit 472866d

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/Backend/FluentCMS.Services/MessageHandlers/ContentMessageHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public async Task Handle(Message<SiteTemplate> notification, CancellationToken c
2323
}
2424
else if (field.Type == "multiple-file" && value is IEnumerable<string> filePaths)
2525
{
26-
processedData[field.Name] = filePaths.Select(filePath => {
26+
processedData[field.Name] = filePaths.Select(filePath =>
27+
{
2728
return GetFileIdByPath(site, filePath, cancellationToken);
2829
});
2930
}

src/Backend/Repositories/FluentCMS.Repositories.EFCore/FluentCmsDbContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.AspNetCore.Identity;
2-
using Microsoft.EntityFrameworkCore;
32
using System.Text.Json;
43

54
namespace FluentCMS.Repositories.EFCore;

src/Backend/Repositories/FluentCMS.Repositories.EFCore/Repositories/PluginRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace FluentCMS.Repositories.EFCore;
22

3-
public class PluginRepository(FluentCmsDbContext dbContext,IMapper mapper, IApiExecutionContext apiExecutionContext) : SiteAssociatedRepository<Plugin, PluginModel>(dbContext, mapper, apiExecutionContext), IPluginRepository
3+
public class PluginRepository(FluentCmsDbContext dbContext, IMapper mapper, IApiExecutionContext apiExecutionContext) : SiteAssociatedRepository<Plugin, PluginModel>(dbContext, mapper, apiExecutionContext), IPluginRepository
44
{
55
public async Task<IEnumerable<Plugin>> GetByPageId(Guid pageId, CancellationToken cancellationToken = default)
66
{

src/Backend/Repositories/FluentCMS.Repositories.EFCore/Repositories/SettingsRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public async Task<IEnumerable<Settings>> GetByIds(IEnumerable<Guid> entityIds, C
3232
Id = entityId,
3333
CreatedAt = DateTime.UtcNow,
3434
CreatedBy = apiExecutionContext.Username,
35-
Values = settings.Where(x => !string.IsNullOrEmpty(x.Value)).Select(x=> new SettingValuesModel
35+
Values = settings.Where(x => !string.IsNullOrEmpty(x.Value)).Select(x => new SettingValuesModel
3636
{
3737
Id = Guid.NewGuid(),
3838
Key = x.Key,
3939
Value = x.Value,
4040
SettingId = entityId
41-
} ).ToList()
41+
}).ToList()
4242
};
4343

4444
dbContext.Settings.Add(newDbSettings);

src/Backend/Repositories/FluentCMS.Repositories.EFCore/Repositories/UserRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.Security.Claims;
2-
using AutoMapper.QueryableExtensions;
1+
using AutoMapper.QueryableExtensions;
2+
using System.Security.Claims;
33

44
namespace FluentCMS.Repositories.EFCore;
55

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
global using FluentCMS.Entities;
1+
global using AutoMapper;
2+
global using FluentCMS.Entities;
23
global using FluentCMS.Repositories.Abstractions;
4+
global using FluentCMS.Repositories.EFCore.DbModels;
35
global using Microsoft.EntityFrameworkCore;
46
global using System;
57
global using System.Collections.Generic;
8+
global using System.ComponentModel.DataAnnotations.Schema;
69
global using System.Linq;
710
global using System.Threading;
811
global using System.Threading.Tasks;
9-
global using System.ComponentModel.DataAnnotations.Schema;
10-
global using FluentCMS.Repositories.EFCore.DbModels;
11-
global using AutoMapper;

0 commit comments

Comments
 (0)