mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(dir): ♻ convert all surrogate keys to longs
This commit is contained in:
parent
c2c62efe69
commit
b01c932a6d
8 changed files with 22 additions and 33 deletions
|
|
@ -12,7 +12,7 @@ public static class CreateList
|
|||
public record Command(string Name,
|
||||
IEnumerable<FilterListViewUrl> ViewUrls,
|
||||
string? Description = default,
|
||||
int? LicenseId = default,
|
||||
long? LicenseId = default,
|
||||
Uri? HomeUrl = default,
|
||||
Uri? OnionUrl = default,
|
||||
Uri? PolicyUrl = default,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public ChangesVmProfile()
|
|||
|
||||
public record ChangesVm
|
||||
{
|
||||
public int Id { get; private init; }
|
||||
public long Id { get; private init; }
|
||||
public string? Reason { get; private init; }
|
||||
public DateTime SubmittedAt { get; private init; }
|
||||
public DateTime? ApprovedAt { get; private init; }
|
||||
|
|
@ -53,19 +53,12 @@ public record ChangesVm
|
|||
public JsonDocument? Before { get; private init; }
|
||||
public JsonDocument? After { get; private init; }
|
||||
public AggregateType AggregateType { get; private init; }
|
||||
public int? FilterListId { get; private init; }
|
||||
public FilterList? FilterList { get; }
|
||||
public string? LanguageIso6391 { get; private init; }
|
||||
public Language? Language { get; }
|
||||
public int? LicenseId { get; private init; }
|
||||
public License? License { get; }
|
||||
public int? MaintainerId { get; private init; }
|
||||
public Maintainer? Maintainer { get; }
|
||||
public int? SoftwareId { get; private init; }
|
||||
public Software? Software { get; }
|
||||
public int? SyntaxId { get; private init; }
|
||||
public Syntax? Syntax { get; }
|
||||
public int? TagId { get; private init; }
|
||||
public Tag? Tag { get; }
|
||||
public long? FilterListId { get; private init; }
|
||||
public long? LanguageId { get; private init; }
|
||||
public long? LicenseId { get; private init; }
|
||||
public long? MaintainerId { get; private init; }
|
||||
public long? SoftwareId { get; private init; }
|
||||
public long? SyntaxId { get; private init; }
|
||||
public long? TagId { get; private init; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ public virtual void Configure(EntityTypeBuilder<Change> builder)
|
|||
builder.ToTable($"{nr.RewriteName(nameof(Change))}s");
|
||||
builder.HasDiscriminator<AggregateType>(nr.RewriteName(nameof(Queries.Entities.Change.AggregateType)))
|
||||
.HasValue<FilterListChange>(AggregateType.FilterList);
|
||||
builder.Property<int>(nameof(Queries.Entities.Change.Id));
|
||||
builder.Property<long>(nameof(Queries.Entities.Change.Id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ internal class FilterListChangeTypeConfiguration : IEntityTypeConfiguration<Filt
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListChange> builder)
|
||||
{
|
||||
builder.Property<int>(nameof(Change.FilterListId));
|
||||
builder.Property<long>(nameof(Change.FilterListId));
|
||||
builder.Property(c => c.Before)
|
||||
.HasColumnType("jsonb");
|
||||
builder.Property(c => c.After)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ internal class FilterListTypeConfiguration : IEntityTypeConfiguration<FilterList
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterList> builder)
|
||||
{
|
||||
builder.Property<int>(nameof(Queries.Entities.FilterList.Id));
|
||||
builder.Property<long>(nameof(Queries.Entities.FilterList.Id));
|
||||
builder.HasMany(c => c.Changes)
|
||||
.WithOne()
|
||||
.HasForeignKey(nameof(Change.FilterListId));
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ public virtual void Configure(EntityTypeBuilder<FilterListViewUrl> builder)
|
|||
var nr = new SnakeCaseNameRewriter(CultureInfo.InvariantCulture);
|
||||
|
||||
builder.ToTable($"{nr.RewriteName(nameof(Queries.Entities.FilterListViewUrl))}s");
|
||||
builder.Property<int>(nameof(Queries.Entities.FilterListViewUrl.Id));
|
||||
builder.Property<long>(nameof(Queries.Entities.FilterListViewUrl.Id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ internal class LicenseTypeConfiguration : IEntityTypeConfiguration<License>
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<License> builder)
|
||||
{
|
||||
builder.Property<int>(nameof(Queries.Entities.License.Id));
|
||||
builder.Property<long>(nameof(Queries.Entities.License.Id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace FilterLists.Directory.Infrastructure.Persistence.Queries.Entities;
|
|||
|
||||
public record Change
|
||||
{
|
||||
public int Id { get; private init; }
|
||||
public long Id { get; private init; }
|
||||
public string? Reason { get; private init; }
|
||||
public DateTime SubmittedAt { get; private init; }
|
||||
public DateTime? ApprovedAt { get; private init; }
|
||||
|
|
@ -16,19 +16,19 @@ public record Change
|
|||
public JsonDocument? Before { get; private init; }
|
||||
public JsonDocument? After { get; private init; }
|
||||
public AggregateType AggregateType { get; private init; }
|
||||
public int? FilterListId { get; private init; }
|
||||
public long? FilterListId { get; private init; }
|
||||
public FilterList? FilterList { get; }
|
||||
public string? LanguageIso6391 { get; private init; }
|
||||
public long? LanguageId { get; private init; }
|
||||
public Language? Language { get; }
|
||||
public int? LicenseId { get; private init; }
|
||||
public long? LicenseId { get; private init; }
|
||||
public License? License { get; }
|
||||
public int? MaintainerId { get; private init; }
|
||||
public long? MaintainerId { get; private init; }
|
||||
public Maintainer? Maintainer { get; }
|
||||
public int? SoftwareId { get; private init; }
|
||||
public long? SoftwareId { get; private init; }
|
||||
public Software? Software { get; }
|
||||
public int? SyntaxId { get; private init; }
|
||||
public long? SyntaxId { get; private init; }
|
||||
public Syntax? Syntax { get; }
|
||||
public int? TagId { get; private init; }
|
||||
public long? TagId { get; private init; }
|
||||
public Tag? Tag { get; }
|
||||
}
|
||||
|
||||
|
|
@ -38,9 +38,5 @@ public virtual void Configure(EntityTypeBuilder<Change> builder)
|
|||
{
|
||||
builder.Property(c => c.SubmittedAt)
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
builder.HasOne(c => c.Language)
|
||||
.WithMany(l => l.Changes)
|
||||
.HasForeignKey(c => c.LanguageIso6391)
|
||||
.HasConstraintName("fk_changes_languages_language_iso6391");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue