permeate uint for Ids throughout app

not sure I'll stick with this long-term yet, but works for now.

ref https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/601#issuecomment-396346202
This commit is contained in:
Collin M. Barrett 2018-06-11 15:38:51 -05:00
parent 180c08b6b7
commit 6b39894be9
31 changed files with 47 additions and 46 deletions

View file

@ -21,7 +21,8 @@ public ListsController(SeedService seedService, FilterListService filterListServ
[HttpGet]
[Route("{id}")]
public async Task<IActionResult> GetById(int id) => Json(await _filterListService.GetDetailsAsync(id));
//TODO: respond with appropriate exception if negative id queried
public async Task<IActionResult> GetById(int id) => Json(await _filterListService.GetDetailsAsync((uint)id));
[HttpGet("seed")]
public async Task<IActionResult> Seed() => Json(await SeedService.GetAllAsync<FilterList, FilterListSeedDto>());

View file

@ -4,7 +4,7 @@ namespace FilterLists.Data.Entities
{
public class BaseEntity
{
public int Id { get; set; }
public uint Id { get; set; }
public DateTime CreatedDateUtc { get; set; }
public DateTime ModifiedDateUtc { get; set; }
}

View file

@ -20,7 +20,7 @@ public class FilterList : BaseEntity
public string HomeUrl { get; set; }
public string IssuesUrl { get; set; }
public ICollection<FilterListLanguage> FilterListLanguages { get; set; }
public int? LicenseId { get; set; }
public uint? LicenseId { get; set; }
public License License { get; set; }
public ICollection<FilterListMaintainer> FilterListMaintainers { get; set; }
public ICollection<Merge> MergeFilterLists { get; set; }
@ -30,7 +30,7 @@ public class FilterList : BaseEntity
public DateTime? PublishedDate { get; set; }
public ICollection<Snapshot> Snapshots { get; set; }
public string SubmissionUrl { get; set; }
public int? SyntaxId { get; set; }
public uint? SyntaxId { get; set; }
public Syntax Syntax { get; set; }
public string ViewUrl { get; set; }
}

View file

@ -2,9 +2,9 @@
{
public class FilterListLanguage : BaseJunction
{
public int FilterListId { get; set; }
public uint FilterListId { get; set; }
public FilterList FilterList { get; set; }
public int LanguageId { get; set; }
public uint LanguageId { get; set; }
public Language Language { get; set; }
}
}

View file

@ -2,9 +2,9 @@
{
public class FilterListMaintainer : BaseJunction
{
public int FilterListId { get; set; }
public uint FilterListId { get; set; }
public FilterList FilterList { get; set; }
public int MaintainerId { get; set; }
public uint MaintainerId { get; set; }
public Maintainer Maintainer { get; set; }
}
}

View file

@ -2,9 +2,9 @@
{
public class Fork : BaseJunction
{
public int ForkFilterListId { get; set; }
public uint ForkFilterListId { get; set; }
public FilterList ForkFilterList { get; set; }
public int UpstreamFilterListId { get; set; }
public uint UpstreamFilterListId { get; set; }
public FilterList UpstreamFilterList { get; set; }
}
}

View file

@ -2,9 +2,9 @@
{
public class Merge : BaseJunction
{
public int MergeFilterListId { get; set; }
public uint MergeFilterListId { get; set; }
public FilterList MergeFilterList { get; set; }
public int UpstreamFilterListId { get; set; }
public uint UpstreamFilterListId { get; set; }
public FilterList UpstreamFilterList { get; set; }
}
}

View file

@ -5,11 +5,11 @@ namespace FilterLists.Data.Entities.Junctions
public class SnapshotRule : BaseJunction
{
public DateTime ModifiedDateUtc { get; set; }
public int AddedBySnapshotId { get; set; }
public uint AddedBySnapshotId { get; set; }
public Snapshot AddedBySnapshot { get; set; }
public int? RemovedBySnapshotId { get; set; }
public uint? RemovedBySnapshotId { get; set; }
public Snapshot RemovedBySnapshot { get; set; }
public int RuleId { get; set; }
public uint RuleId { get; set; }
public Rule Rule { get; set; }
}
}

View file

@ -2,9 +2,9 @@
{
public class SoftwareSyntax : BaseJunction
{
public int SoftwareId { get; set; }
public uint SoftwareId { get; set; }
public Software Software { get; set; }
public int SyntaxId { get; set; }
public uint SyntaxId { get; set; }
public Syntax Syntax { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Data.Entities
{
public class Snapshot : BaseEntity
{
public int FilterListId { get; set; }
public uint FilterListId { get; set; }
public FilterList FilterList { get; set; }
public string HttpStatusCode { get; set; }
public bool IsCompleted { get; set; }

View file

@ -31,7 +31,7 @@ public override void Configure(EntityTypeBuilder<FilterList> entityTypeBuilder)
entityTypeBuilder.Property(x => x.IssuesUrl)
.HasColumnType("TEXT");
entityTypeBuilder.Property(x => x.LicenseId)
.HasDefaultValue(5)
.HasDefaultValue((uint)5)
.IsRequired();
entityTypeBuilder.Property(x => x.Name)
.HasColumnType("VARCHAR(126)")

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<Rule> entityTypeBuilder)
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("rules");
entityTypeBuilder.Property(x => x.Id)
.HasColumnType("INT"/* UNSIGNED"*/);
.HasColumnType("INT UNSIGNED");
entityTypeBuilder.Ignore(x => x.ModifiedDateUtc);
entityTypeBuilder.Property(x => x.Raw)
.HasColumnType("VARCHAR(8192)")

View file

@ -11,7 +11,7 @@ public override void Configure(EntityTypeBuilder<Snapshot> entityTypeBuilder)
base.Configure(entityTypeBuilder);
entityTypeBuilder.ToTable("snapshots");
entityTypeBuilder.Property(x => x.Id)
.HasColumnType("MEDIUMINT"/* UNSIGNED"*/);
.HasColumnType("MEDIUMINT UNSIGNED");
entityTypeBuilder.Property(x => x.ModifiedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP()");
entityTypeBuilder.Property(x => x.HttpStatusCode)

View file

@ -57,7 +57,7 @@ private async Task<List<ListSummaryDto>> GetSummaryDtos()
.ToListAsync();
}
public async Task<ListDetailsDto> GetDetailsAsync(int id)
public async Task<ListDetailsDto> GetDetailsAsync(uint id)
{
var details = await DbContext.FilterLists.AsNoTracking()
.ProjectTo<ListDetailsDto>()

View file

@ -7,7 +7,7 @@ namespace FilterLists.Services.FilterList
[UsedImplicitly]
public class ListDetailsDto
{
public int Id { get; set; }
public uint Id { get; set; }
public DateTime AddedDate { get; set; }
public string ChatUrl { get; set; }
public string Description { get; set; }

View file

@ -6,7 +6,7 @@ namespace FilterLists.Services.FilterList
[UsedImplicitly]
public class ListMaintainerDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string EmailAddress { get; set; }
public string HomeUrl { get; set; }
public string Name { get; set; }

View file

@ -7,7 +7,7 @@ namespace FilterLists.Services.FilterList
[UsedImplicitly]
public class ListSummaryDto
{
public int Id { get; set; }
public uint Id { get; set; }
public DateTime AddedDate { get; set; }
public IEnumerable<ListLanguagesDto> Languages { get; set; }
public string Name { get; set; }

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.FilterList
[UsedImplicitly]
public class MaintainerAdditionalListsDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string Name { get; set; }
}
}

View file

@ -6,7 +6,7 @@ namespace FilterLists.Services.Seed.Models
[UsedImplicitly]
public class FilterListSeedDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string ChatUrl { get; set; }
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
@ -16,12 +16,12 @@ public class FilterListSeedDto
public string ForumUrl { get; set; }
public string HomeUrl { get; set; }
public string IssuesUrl { get; set; }
public int? LicenseId { get; set; }
public uint? LicenseId { get; set; }
public string Name { get; set; }
public string PolicyUrl { get; set; }
public DateTime? PublishedDate { get; set; }
public string SubmissionUrl { get; set; }
public int? SyntaxId { get; set; }
public uint? SyntaxId { get; set; }
public string ViewUrl { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models.Junctions
[UsedImplicitly]
public class FilterListLanguageSeedDto
{
public int FilterListId { get; set; }
public int LanguageId { get; set; }
public uint FilterListId { get; set; }
public uint LanguageId { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models.Junctions
[UsedImplicitly]
public class FilterListMaintainerSeedDto
{
public int FilterListId { get; set; }
public int MaintainerId { get; set; }
public uint FilterListId { get; set; }
public uint MaintainerId { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models.Junctions
[UsedImplicitly]
public class ForkSeedDto
{
public int ForkFilterListId { get; set; }
public int UpstreamFilterListId { get; set; }
public uint ForkFilterListId { get; set; }
public uint UpstreamFilterListId { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models.Junctions
[UsedImplicitly]
public class MergeSeedDto
{
public int MergeFilterListId { get; set; }
public int UpstreamFilterListId { get; set; }
public uint MergeFilterListId { get; set; }
public uint UpstreamFilterListId { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models.Junctions
[UsedImplicitly]
public class SoftwareSyntaxSeedDto
{
public int SoftwareId { get; set; }
public int SyntaxId { get; set; }
public uint SoftwareId { get; set; }
public uint SyntaxId { get; set; }
}
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models
[UsedImplicitly]
public class LanguageSeedDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string Iso6391 { get; set; }
public string Iso6392 { get; set; }
public string Iso6392B { get; set; }

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models
[UsedImplicitly]
public class LicenseSeedDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string DescriptionUrl { get; set; }
public string Name { get; set; }
public bool PermissiveAdaptation { get; set; }

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models
[UsedImplicitly]
public class MaintainerSeedDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string EmailAddress { get; set; }
public string HomeUrl { get; set; }
public string Name { get; set; }

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models
[UsedImplicitly]
public class SoftwareSeedDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string DownloadUrl { get; set; }
public string HomeUrl { get; set; }
public string Name { get; set; }

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Seed.Models
[UsedImplicitly]
public class SyntaxSeedDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string DefinitionUrl { get; set; }
public string Name { get; set; }
}

View file

@ -5,7 +5,7 @@ namespace FilterLists.Services.Snapshot
[UsedImplicitly]
public class FilterListViewUrlDto
{
public int Id { get; set; }
public uint Id { get; set; }
public string ViewUrl { get; set; }
}
}

View file

@ -13,7 +13,7 @@ namespace FilterLists.Services.Snapshot
public class SnapshotService : Service
{
//TODO: update algorithm to support non-standard list sizes and formats (#200, #201)
private readonly List<int> _ignoreLists = new List<int> {48, 149, 173, 185, 186, 187, 188, 189, 352};
private readonly List<uint> _ignoreLists = new List<uint> {48, 149, 173, 185, 186, 187, 188, 189, 352};
public SnapshotService(FilterListsDbContext dbContext) : base(dbContext)
{