Skip to content

Commit da6500b

Browse files
committed
Migrate Web - Step 1
1 parent a59bf3f commit da6500b

File tree

59 files changed

+310
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+310
-174
lines changed

src/LinkDotNet.Blog.Domain/Entity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
public abstract class Entity
44
{
5-
public string? Id { get; set; }
5+
public string Id { get; set; } = string.Empty;
66
}

src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Repository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async Task DeleteBulkAsyncInBatchesAsync()
124124
var currentBatchIds = idList.Skip(batch * batchSize).Take(batchSize).ToList();
125125

126126
await blogDbContext.Set<TEntity>()
127-
.Where(s => currentBatchIds.Contains(s.Id!))
127+
.Where(s => currentBatchIds.Contains(s.Id))
128128
.ExecuteDeleteAsync();
129129

130130
LogDeleteBatch(batch + 1, (batch + 1) * batchSize);

src/LinkDotNet.Blog.Web/ApplicationConfiguration.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
using System.ComponentModel.DataAnnotations;
2+
13
namespace LinkDotNet.Blog.Web;
24

35
public sealed record ApplicationConfiguration
46
{
5-
public string BlogName { get; init; }
7+
public required string BlogName { get; init; }
68

7-
public string BlogBrandUrl { get; init; }
9+
public string? BlogBrandUrl { get; init; }
810

9-
public string ConnectionString { get; init; }
11+
public required string ConnectionString { get; init; }
1012

11-
public string DatabaseName { get; init; }
13+
public required string DatabaseName { get; init; }
1214

1315
public int BlogPostsPerPage { get; init; } = 10;
1416

@@ -20,17 +22,17 @@ public sealed record ApplicationConfiguration
2022

2123
public bool IsDisqusEnabled { get; set; }
2224

23-
public string KofiToken { get; init; }
25+
public string? KofiToken { get; init; }
2426

2527
public bool IsKofiEnabled => !string.IsNullOrEmpty(KofiToken);
2628

27-
public string GithubSponsorName { get; init; }
29+
public string? GithubSponsorName { get; init; }
2830

2931
public bool IsGithubSponsorAvailable => !string.IsNullOrEmpty(GithubSponsorName);
3032

3133
public bool ShowReadingIndicator { get; init; }
3234

33-
public string PatreonName { get; init; }
35+
public string? PatreonName { get; init; }
3436

3537
public bool IsPatreonEnabled => !string.IsNullOrEmpty(PatreonName);
3638

src/LinkDotNet.Blog.Web/Authentication/OpenIdConnect/AuthInformation.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ public sealed record AuthInformation
66

77
public const string AuthInformationSection = "Authentication";
88

9-
public string Provider { get; set; }
9+
public required string Provider { get; set; }
1010

11-
public string Domain { get; init; }
11+
public required string Domain { get; init; }
1212

13-
public string ClientId { get; init; }
13+
public required string ClientId { get; init; }
1414

15-
public string ClientSecret { get; init; }
15+
public required string ClientSecret { get; init; }
1616

1717
public string LogoutUri
1818
{

src/LinkDotNet.Blog.Web/Features/AboutMe/Components/Profile.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ OnYesPressed="DeleteItem"></ConfirmDialog>
5050
[Parameter]
5151
public bool ShowAdminActions { get; set; }
5252

53-
[Parameter]
54-
public ProfileInformation ProfileInformation { get; set; }
53+
[Parameter, EditorRequired]
54+
public required ProfileInformation ProfileInformation { get; set; }
5555

5656
private List<ProfileInformationEntry> profileInformationEntries = [];
57-
private ConfirmDialog Dialog { get; set; }
58-
private string currentDeleteKey;
59-
private ProfileInformationEntry currentDragItem;
57+
private ConfirmDialog Dialog { get; set; } = default!;
58+
private string? currentDeleteKey;
59+
private ProfileInformationEntry? currentDragItem;
6060

6161
protected override async Task OnInitializedAsync()
6262
{

src/LinkDotNet.Blog.Web/Features/AboutMe/Components/Skill/AddSkillDialog.razor

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public EventCallback<Skill> SkillAdded { get; set; }
3737

3838
private AddSkillModel model = new();
39-
private ModalDialog Dialog { get; set; }
39+
private ModalDialog Dialog { get; set; } = default!;
4040

4141
public void Open()
4242
{
@@ -46,9 +46,12 @@
4646

4747
private async Task CreateSkillItem()
4848
{
49+
ArgumentNullException.ThrowIfNull(model.Skill);
50+
ArgumentNullException.ThrowIfNull(model.Capability);
51+
4952
var skill = Skill.Create(model.Skill, model.ImageUrl, model.Capability, model.Proficiency);
5053
await SkillAdded.InvokeAsync(skill);
5154
model = new AddSkillModel();
5255
ToastService.ShowSuccess($"Created Skill {skill.Name} in capability {skill.Capability} with level {skill.ProficiencyLevel}");
5356
}
54-
}
57+
}

src/LinkDotNet.Blog.Web/Features/AboutMe/Components/Skill/AddSkillModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ namespace LinkDotNet.Blog.Web.Features.AboutMe.Components.Skill;
66
public sealed class AddSkillModel
77
{
88
[Required]
9-
public string Skill { get; set; }
9+
public string? Skill { get; set; }
1010

11-
public string ImageUrl { get; set; }
11+
public string? ImageUrl { get; set; }
1212

1313
[Required]
1414
public string Proficiency { get; set; } = ProficiencyLevel.Familiar.Key;
1515

1616
[Required]
17-
public string Capability { get; set; }
18-
}
17+
public string? Capability { get; set; }
18+
}

src/LinkDotNet.Blog.Web/Features/AboutMe/Components/Skill/SkillTable.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
[Parameter]
5959
public bool ShowAdminActions { get; set; }
6060

61-
private AddSkillDialog AddSkillDialog { get; set; }
61+
private AddSkillDialog AddSkillDialog { get; set; } = default!;
6262

6363
private List<Skill> skills = [];
6464

65-
private Skill currentDragItem;
65+
private Skill? currentDragItem;
6666

6767
protected override async Task OnInitializedAsync()
6868
{

src/LinkDotNet.Blog.Web/Features/AboutMe/Components/Skill/SkillTag.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
</span>
1616

1717
@code {
18-
[Parameter]
19-
public Skill Skill { get; set; }
18+
[Parameter, EditorRequired]
19+
public required Skill Skill { get; set; }
2020

2121
[Parameter]
2222
public bool ShowAdminActions { get; set; }
2323

2424
[Parameter]
2525
public EventCallback DeleteSkill { get; set; }
26-
}
26+
}

src/LinkDotNet.Blog.Web/Features/AboutMe/Components/Talk/AddTalkEntryDialog.razor

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
[Parameter]
3232
public EventCallback<Talk> TalkCreated { get; set; }
3333

34-
private ModalDialog Dialog { get; set; }
34+
private ModalDialog Dialog { get; set; } = default!;
35+
3536
private AddTalkEntryModel model = new();
3637

3738
public void Open()
@@ -42,6 +43,10 @@
4243

4344
private async Task CreateTalk()
4445
{
46+
ArgumentNullException.ThrowIfNull(model.PresentationTitle);
47+
ArgumentNullException.ThrowIfNull(model.Place);
48+
ArgumentNullException.ThrowIfNull(model.Description);
49+
4550
var talk = Talk.Create(model.PresentationTitle, model.Place, model.Description, model.PublishedDate);
4651
await TalkCreated.InvokeAsync(talk);
4752
model = new AddTalkEntryModel();

0 commit comments

Comments
 (0)