bug fix and cleanup

This commit is contained in:
Collin M. Barrett 2017-10-26 17:31:10 -05:00
parent 80e4429c37
commit d935072dd4
8 changed files with 2916 additions and 2316 deletions

View file

@ -1,6 +1,7 @@
{
"FilterLists": [
{
"Languages": null,
"Description": "A sample list to filter out advertisements.",
"DescriptionSourceUrl": "https://mysample.list/advertisements",
"DonateUrl": "https://mysample.list/donate/",
@ -12,6 +13,7 @@
"ViewUrl": "https://mysample.list/list.txt"
},
{
"Languages": null,
"Description": "A sample list to filter out malware.",
"DescriptionSourceUrl": "https://mysample.list/malware",
"DonateUrl": "https://mysample.list/donate/",

View file

@ -6,6 +6,15 @@
"null"
],
"properties": {
"Languages": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Language"
}
},
"Description": {
"description": "A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.",
"type": [
@ -88,6 +97,7 @@
}
},
"required": [
"Languages",
"Description",
"DescriptionSourceUrl",
"DonateUrl",
@ -98,6 +108,65 @@
"Name",
"ViewUrl"
]
},
"Language": {
"type": [
"object",
"null"
],
"properties": {
"Iso6391": {
"type": [
"string",
"null"
]
},
"Iso6392": {
"type": [
"string",
"null"
]
},
"Iso6392B": {
"type": [
"string",
"null"
]
},
"Iso6392T": {
"type": [
"string",
"null"
]
},
"Iso6393": {
"type": [
"string",
"null"
]
},
"LocalName": {
"type": [
"string",
"null"
]
},
"Name": {
"type": [
"string",
"null"
]
}
},
"required": [
"Iso6391",
"Iso6392",
"Iso6392B",
"Iso6392T",
"Iso6393",
"LocalName",
"Name"
]
}
},
"type": "object",

File diff suppressed because it is too large Load diff

View file

@ -16,10 +16,10 @@ public FilterListsDbContext(DbContextOptions options)
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Maintainer>()
modelBuilder.Entity<FilterList>()
.Property(b => b.CreatedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP");
modelBuilder.Entity<FilterList>()
modelBuilder.Entity<Maintainer>()
.Property(b => b.CreatedDateUtc)
.HasDefaultValueSql("CURRENT_TIMESTAMP");
modelBuilder.Entity<Language>()

View file

@ -5,8 +5,8 @@ namespace FilterLists.Data.Contexts
{
public interface IFilterListsDbContext
{
DbSet<Maintainer> Maintainers { get; set; }
DbSet<FilterList> FilterLists { get; set; }
DbSet<Maintainer> Maintainers { get; set; }
DbSet<Language> Languages { get; set; }
}
}

View file

@ -8,7 +8,7 @@ namespace FilterLists.Data.Models.Implementations
{
public class FilterList : BaseEntity, IFilterList
{
public List<ILanguage> FilterLists { get; set; }
public List<Language> Languages { get; set; }
[JsonIgnore]
public virtual Maintainer Maintainer { get; set; }

View file

@ -7,7 +7,7 @@ namespace FilterLists.Data.Models.Implementations
{
public class Maintainer : BaseEntity, IMaintainer
{
public List<IFilterList> FilterLists { get; set; }
public List<FilterList> FilterLists { get; set; }
[Description(@"The email address of the list maintainer.")]
[EmailAddress]

View file

@ -17,12 +17,12 @@ public FilterListRepository(FilterListsDbContext filterListsDbContext)
public IEnumerable<IFilterList> GetAll()
{
return filterListsDbContext.FilterList.AsEnumerable();
return filterListsDbContext.FilterLists.AsEnumerable();
}
public IFilterList GetByName(string filterListName)
{
return filterListsDbContext.FilterList.First(x => x.Name == filterListName);
return filterListsDbContext.FilterLists.First(x => x.Name == filterListName);
}
}
}