mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(services): ♻ use init-only setters on immutable props
This commit is contained in:
parent
5b4bb6f8bc
commit
fc177fde3e
27 changed files with 133 additions and 133 deletions
|
|
@ -4,8 +4,8 @@ internal class GitOptions
|
|||
{
|
||||
public const string Key = "Git";
|
||||
|
||||
public string RepositoryPath { get; set; } = null!;
|
||||
public string UserName { get; set; } = null!;
|
||||
public string UserEmail { get; set; } = null!;
|
||||
public string RepositoryPath { get; init; } = null!;
|
||||
public string UserName { get; init; } = null!;
|
||||
public string UserEmail { get; init; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,36 +5,36 @@ namespace FilterLists.Directory.Api.Contracts.Models
|
|||
{
|
||||
public class ListDetailsVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public int? LicenseId { get; private set; }
|
||||
public IEnumerable<int>? SyntaxIds { get; private set; }
|
||||
public IEnumerable<string>? Iso6391s { get; private set; }
|
||||
public IEnumerable<int>? TagIds { get; private set; }
|
||||
public IEnumerable<ViewUrlVm>? ViewUrls { get; private set; }
|
||||
public Uri? HomeUrl { get; private set; }
|
||||
public Uri? OnionUrl { get; private set; }
|
||||
public Uri? PolicyUrl { get; private set; }
|
||||
public Uri? SubmissionUrl { get; private set; }
|
||||
public Uri? IssuesUrl { get; private set; }
|
||||
public Uri? ForumUrl { get; private set; }
|
||||
public Uri? ChatUrl { get; private set; }
|
||||
public string? EmailAddress { get; private set; }
|
||||
public Uri? DonateUrl { get; private set; }
|
||||
public IEnumerable<int>? MaintainerIds { get; private set; }
|
||||
public IEnumerable<int>? UpstreamFilterListIds { get; private set; }
|
||||
public IEnumerable<int>? ForkFilterListIds { get; private set; }
|
||||
public IEnumerable<int>? IncludedInFilterListIds { get; private set; }
|
||||
public IEnumerable<int>? IncludesFilterListIds { get; private set; }
|
||||
public IEnumerable<int>? DependencyFilterListIds { get; private set; }
|
||||
public IEnumerable<int>? DependentFilterListIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public int? LicenseId { get; init; }
|
||||
public IEnumerable<int>? SyntaxIds { get; init; }
|
||||
public IEnumerable<string>? Iso6391s { get; init; }
|
||||
public IEnumerable<int>? TagIds { get; init; }
|
||||
public IEnumerable<ViewUrlVm>? ViewUrls { get; init; }
|
||||
public Uri? HomeUrl { get; init; }
|
||||
public Uri? OnionUrl { get; init; }
|
||||
public Uri? PolicyUrl { get; init; }
|
||||
public Uri? SubmissionUrl { get; init; }
|
||||
public Uri? IssuesUrl { get; init; }
|
||||
public Uri? ForumUrl { get; init; }
|
||||
public Uri? ChatUrl { get; init; }
|
||||
public string? EmailAddress { get; init; }
|
||||
public Uri? DonateUrl { get; init; }
|
||||
public IEnumerable<int>? MaintainerIds { get; init; }
|
||||
public IEnumerable<int>? UpstreamFilterListIds { get; init; }
|
||||
public IEnumerable<int>? ForkFilterListIds { get; init; }
|
||||
public IEnumerable<int>? IncludedInFilterListIds { get; init; }
|
||||
public IEnumerable<int>? IncludesFilterListIds { get; init; }
|
||||
public IEnumerable<int>? DependencyFilterListIds { get; init; }
|
||||
public IEnumerable<int>? DependentFilterListIds { get; init; }
|
||||
|
||||
public class ViewUrlVm
|
||||
{
|
||||
public short SegmentNumber { get; private set; }
|
||||
public short Primariness { get; private set; }
|
||||
public Uri Url { get; private set; } = null!;
|
||||
public short SegmentNumber { get; init; }
|
||||
public short Primariness { get; init; }
|
||||
public Uri Url { get; init; } = null!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ namespace FilterLists.Directory.Api.Contracts.Models
|
|||
{
|
||||
public class ListVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public int? LicenseId { get; private set; }
|
||||
public IEnumerable<int>? SyntaxIds { get; private set; }
|
||||
public IEnumerable<string>? Iso6391s { get; private set; }
|
||||
public IEnumerable<int>? TagIds { get; private set; }
|
||||
public IEnumerable<int>? MaintainerIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public int? LicenseId { get; init; }
|
||||
public IEnumerable<int>? SyntaxIds { get; init; }
|
||||
public IEnumerable<string>? Iso6391s { get; init; }
|
||||
public IEnumerable<int>? TagIds { get; init; }
|
||||
public IEnumerable<int>? MaintainerIds { get; init; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ internal class ApiOptions
|
|||
{
|
||||
public const string Key = "Api";
|
||||
|
||||
public string DirectoryHost { get; set; } = null!;
|
||||
public string DirectoryHost { get; init; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ public LanguageVmProfile()
|
|||
|
||||
public class LanguageVm
|
||||
{
|
||||
public string Iso6391 { get; private set; } = null!;
|
||||
public string Name { get; private set; } = null!;
|
||||
public IEnumerable<int>? FilterListIds { get; private set; }
|
||||
public string Iso6391 { get; init; } = null!;
|
||||
public string Name { get; init; } = null!;
|
||||
public IEnumerable<int>? FilterListIds { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ public LicenseVmProfile()
|
|||
|
||||
public class LicenseVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public Uri? Url { get; private set; }
|
||||
public bool PermitsModification { get; private set; }
|
||||
public bool PermitsDistribution { get; private set; }
|
||||
public bool PermitsCommercialUse { get; private set; }
|
||||
public IEnumerable<int>? FilterListIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public Uri? Url { get; init; }
|
||||
public bool PermitsModification { get; init; }
|
||||
public bool PermitsDistribution { get; init; }
|
||||
public bool PermitsCommercialUse { get; init; }
|
||||
public IEnumerable<int>? FilterListIds { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ public MaintainerVmProfile()
|
|||
|
||||
public class MaintainerVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public Uri? Url { get; private set; }
|
||||
public string? EmailAddress { get; private set; }
|
||||
public string? TwitterHandle { get; private set; }
|
||||
public IEnumerable<int>? FilterListIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public Uri? Url { get; init; }
|
||||
public string? EmailAddress { get; init; }
|
||||
public string? TwitterHandle { get; init; }
|
||||
public IEnumerable<int>? FilterListIds { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ public SoftwareVmProfile()
|
|||
|
||||
public class SoftwareVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public Uri? HomeUrl { get; private set; }
|
||||
public Uri? DownloadUrl { get; private set; }
|
||||
public bool SupportsAbpUrlScheme { get; private set; }
|
||||
public IEnumerable<int>? SyntaxIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public Uri? HomeUrl { get; init; }
|
||||
public Uri? DownloadUrl { get; init; }
|
||||
public bool SupportsAbpUrlScheme { get; init; }
|
||||
public IEnumerable<int>? SyntaxIds { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ public SyntaxVmProfile()
|
|||
|
||||
public class SyntaxVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public Uri? Url { get; private set; }
|
||||
public IEnumerable<int>? FilterListIds { get; private set; }
|
||||
public IEnumerable<int>? SoftwareIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public Uri? Url { get; init; }
|
||||
public IEnumerable<int>? FilterListIds { get; init; }
|
||||
public IEnumerable<int>? SoftwareIds { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ public TagVmProfile()
|
|||
|
||||
public class TagVm
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public IEnumerable<int>? FilterListIds { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public IEnumerable<int>? FilterListIds { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Dependent
|
||||
{
|
||||
public int DependencyFilterListId { get; private set; }
|
||||
public int DependencyFilterListId { get; init; }
|
||||
public FilterList DependencyFilterList { get; } = null!;
|
||||
public int DependentFilterListId { get; private set; }
|
||||
public int DependentFilterListId { get; init; }
|
||||
public FilterList DependentFilterList { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,24 +7,24 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class FilterList
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public int? LicenseId { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public int? LicenseId { get; init; }
|
||||
public License? License { get; }
|
||||
public IReadOnlyCollection<FilterListSyntax> FilterListSyntaxes { get; } = new HashSet<FilterListSyntax>();
|
||||
public IReadOnlyCollection<FilterListLanguage> FilterListLanguages { get; } = new HashSet<FilterListLanguage>();
|
||||
public IReadOnlyCollection<FilterListTag> FilterListTags { get; } = new HashSet<FilterListTag>();
|
||||
public IReadOnlyCollection<FilterListViewUrl> ViewUrls { get; } = new HashSet<FilterListViewUrl>();
|
||||
public Uri? HomeUrl { get; private set; }
|
||||
public Uri? OnionUrl { get; private set; }
|
||||
public Uri? PolicyUrl { get; private set; }
|
||||
public Uri? SubmissionUrl { get; private set; }
|
||||
public Uri? IssuesUrl { get; private set; }
|
||||
public Uri? ForumUrl { get; private set; }
|
||||
public Uri? ChatUrl { get; private set; }
|
||||
public string? EmailAddress { get; private set; }
|
||||
public Uri? DonateUrl { get; private set; }
|
||||
public Uri? HomeUrl { get; init; }
|
||||
public Uri? OnionUrl { get; init; }
|
||||
public Uri? PolicyUrl { get; init; }
|
||||
public Uri? SubmissionUrl { get; init; }
|
||||
public Uri? IssuesUrl { get; init; }
|
||||
public Uri? ForumUrl { get; init; }
|
||||
public Uri? ChatUrl { get; init; }
|
||||
public string? EmailAddress { get; init; }
|
||||
public Uri? DonateUrl { get; init; }
|
||||
public IReadOnlyCollection<FilterListMaintainer> FilterListMaintainers { get; } = new HashSet<FilterListMaintainer>();
|
||||
public IReadOnlyCollection<Fork> UpstreamFilterLists { get; } = new HashSet<Fork>();
|
||||
public IReadOnlyCollection<Fork> ForkFilterLists { get; } = new HashSet<Fork>();
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class FilterListLanguage
|
||||
{
|
||||
public int FilterListId { get; private set; }
|
||||
public int FilterListId { get; init; }
|
||||
public FilterList FilterList { get; } = null!;
|
||||
public string Iso6391 { get; private set; } = null!;
|
||||
public string Iso6391 { get; init; } = null!;
|
||||
public Language Language { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class FilterListMaintainer
|
||||
{
|
||||
public int FilterListId { get; private set; }
|
||||
public int FilterListId { get; init; }
|
||||
public FilterList FilterList { get; } = null!;
|
||||
public int MaintainerId { get; private set; }
|
||||
public int MaintainerId { get; init; }
|
||||
public Maintainer Maintainer { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class FilterListSyntax
|
||||
{
|
||||
public int FilterListId { get; private set; }
|
||||
public int FilterListId { get; init; }
|
||||
public FilterList FilterList { get; } = null!;
|
||||
public int SyntaxId { get; private set; }
|
||||
public int SyntaxId { get; init; }
|
||||
public Syntax Syntax { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class FilterListTag
|
||||
{
|
||||
public int FilterListId { get; private set; }
|
||||
public int FilterListId { get; init; }
|
||||
public FilterList FilterList { get; } = null!;
|
||||
public int TagId { get; private set; }
|
||||
public int TagId { get; init; }
|
||||
public Tag Tag { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class FilterListViewUrl
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int FilterListId { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public int FilterListId { get; init; }
|
||||
public FilterList FilterList { get; } = null!;
|
||||
public short SegmentNumber { get; private set; }
|
||||
public short Primariness { get; private set; }
|
||||
public Uri Url { get; private set; } = null!;
|
||||
public short SegmentNumber { get; init; }
|
||||
public short Primariness { get; init; }
|
||||
public Uri Url { get; init; } = null!;
|
||||
}
|
||||
|
||||
internal class FilterListViewUrlConfiguration : IEntityTypeConfiguration<FilterListViewUrl>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Fork
|
||||
{
|
||||
public int UpstreamFilterListId { get; private set; }
|
||||
public int UpstreamFilterListId { get; init; }
|
||||
public FilterList UpstreamFilterList { get; } = null!;
|
||||
public int ForkFilterListId { get; private set; }
|
||||
public int ForkFilterListId { get; init; }
|
||||
public FilterList ForkFilterList { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Language
|
||||
{
|
||||
public string Iso6391 { get; private set; } = null!;
|
||||
public string Name { get; private set; } = null!;
|
||||
public string Iso6391 { get; init; } = null!;
|
||||
public string Name { get; init; } = null!;
|
||||
public IReadOnlyCollection<FilterListLanguage> FilterListLanguages { get; } = new HashSet<FilterListLanguage>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class License
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public Uri? Url { get; private set; }
|
||||
public bool PermitsModification { get; private set; }
|
||||
public bool PermitsDistribution { get; private set; }
|
||||
public bool PermitsCommercialUse { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public Uri? Url { get; init; }
|
||||
public bool PermitsModification { get; init; }
|
||||
public bool PermitsDistribution { get; init; }
|
||||
public bool PermitsCommercialUse { get; init; }
|
||||
public IReadOnlyCollection<FilterList> FilterLists { get; } = new HashSet<FilterList>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Maintainer
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public Uri? Url { get; private set; }
|
||||
public string? EmailAddress { get; private set; }
|
||||
public string? TwitterHandle { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public Uri? Url { get; init; }
|
||||
public string? EmailAddress { get; init; }
|
||||
public string? TwitterHandle { get; init; }
|
||||
public IReadOnlyCollection<FilterListMaintainer> FilterListMaintainers { get; } = new HashSet<FilterListMaintainer>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Merge
|
||||
{
|
||||
public int IncludedInFilterListId { get; private set; }
|
||||
public int IncludedInFilterListId { get; init; }
|
||||
public FilterList IncludedInFilterList { get; } = null!;
|
||||
public int IncludesFilterListId { get; private set; }
|
||||
public int IncludesFilterListId { get; init; }
|
||||
public FilterList IncludesFilterList { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Software
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public Uri? HomeUrl { get; private set; }
|
||||
public Uri? DownloadUrl { get; private set; }
|
||||
public bool SupportsAbpUrlScheme { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public Uri? HomeUrl { get; init; }
|
||||
public Uri? DownloadUrl { get; init; }
|
||||
public bool SupportsAbpUrlScheme { get; init; }
|
||||
public IReadOnlyCollection<SoftwareSyntax> SoftwareSyntaxes { get; } = new HashSet<SoftwareSyntax>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class SoftwareSyntax
|
||||
{
|
||||
public int SoftwareId { get; private set; }
|
||||
public int SoftwareId { get; init; }
|
||||
public Software Software { get; } = null!;
|
||||
public int SyntaxId { get; private set; }
|
||||
public int SyntaxId { get; init; }
|
||||
public Syntax Syntax { get; } = null!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Syntax
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public Uri? Url { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public Uri? Url { get; init; }
|
||||
public IReadOnlyCollection<FilterListSyntax> FilterListSyntaxes { get; } = new HashSet<FilterListSyntax>();
|
||||
public IReadOnlyCollection<SoftwareSyntax> SoftwareSyntaxes { get; } = new HashSet<SoftwareSyntax>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities
|
|||
{
|
||||
public class Tag
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = null!;
|
||||
public string? Description { get; private set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = null!;
|
||||
public string? Description { get; init; }
|
||||
public IReadOnlyCollection<FilterListTag> FilterListTags { get; } = new HashSet<FilterListTag>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ internal class ApplicationInsightsOptions
|
|||
{
|
||||
public const string Key = "ApplicationInsights";
|
||||
|
||||
public string ServerTelemetryChannelStoragePath { get; set; } = null!;
|
||||
public string ServerTelemetryChannelStoragePath { get; init; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue