mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
simplify / cleanup entities
This commit is contained in:
parent
d935072dd4
commit
7995697920
17 changed files with 27 additions and 82 deletions
|
|
@ -30,10 +30,7 @@ public void Configure(IApplicationBuilder app)
|
|||
});
|
||||
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "FilterLists API V1");
|
||||
});
|
||||
app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "FilterLists API V1"); });
|
||||
|
||||
app.UseMvc();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FilterLists.Data.Models.Implementations;
|
||||
using FilterLists.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FilterLists.Data.Contexts
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FilterLists.Data.Models.Implementations;
|
||||
using FilterLists.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FilterLists.Data.Contexts
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public abstract class BaseEntity : IBaseEntity
|
||||
public abstract class BaseEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public class FilterList : BaseEntity, IFilterList
|
||||
public class FilterList : BaseEntity
|
||||
{
|
||||
public List<Language> Languages { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Maintainer Maintainer { get; set; }
|
||||
|
||||
[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.")]
|
||||
[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.")]
|
||||
[MaxLength(1022)]
|
||||
public string Description { get; set; }
|
||||
|
||||
|
|
@ -23,7 +23,8 @@ public class FilterList : BaseEntity, IFilterList
|
|||
[MinLength(6)]
|
||||
public string DescriptionSourceUrl { get; set; }
|
||||
|
||||
[Description(@"The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.")]
|
||||
[Description(
|
||||
@"The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.")]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
[MinLength(6)]
|
||||
|
|
@ -41,7 +42,8 @@ public class FilterList : BaseEntity, IFilterList
|
|||
[MinLength(6)]
|
||||
public string ForumUrl { get; set; }
|
||||
|
||||
[Description(@"The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.")]
|
||||
[Description(
|
||||
@"The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.")]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
[MinLength(6)]
|
||||
|
|
@ -58,7 +60,8 @@ public class FilterList : BaseEntity, IFilterList
|
|||
[MaxLength(126)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Description(@"The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.")]
|
||||
[Description(
|
||||
@"The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.")]
|
||||
[Required]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public class Language : BaseEntity, ILanguage
|
||||
public class Language : BaseEntity
|
||||
{
|
||||
public string Iso6391 { get; set; }
|
||||
public string Iso6392 { get; set; }
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public class Maintainer : BaseEntity, IMaintainer
|
||||
public class Maintainer : BaseEntity
|
||||
{
|
||||
public List<FilterList> FilterLists { get; set; }
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using FilterLists.Data.Models.Implementations;
|
||||
using FilterLists.Data.Entities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace FilterLists.Data.Json
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using FilterLists.Data.Models.Implementations;
|
||||
using FilterLists.Data.Entities;
|
||||
using Newtonsoft.Json.Schema.Generation;
|
||||
|
||||
namespace FilterLists.Data.Json
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface IBaseEntity
|
||||
{
|
||||
long Id { get; set; }
|
||||
DateTime CreatedDateUtc { get; set; }
|
||||
DateTime? ModifiedDateUtc { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface IFilterList
|
||||
{
|
||||
string Description { get; set; }
|
||||
string DescriptionSourceUrl { get; set; }
|
||||
string DonateUrl { get; set; }
|
||||
string Email { get; set; }
|
||||
string ForumUrl { get; set; }
|
||||
string HomeUrl { get; set; }
|
||||
string IssuesUrl { get; set; }
|
||||
string Name { get; set; }
|
||||
string ViewUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface ILanguage
|
||||
{
|
||||
string Iso6391 { get; set; }
|
||||
string Iso6392 { get; set; }
|
||||
string Iso6392B { get; set; }
|
||||
string Iso6392T { get; set; }
|
||||
string Iso6393 { get; set; }
|
||||
string LocalName { get; set; }
|
||||
string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface IMaintainer
|
||||
{
|
||||
string Email { get; set; }
|
||||
string HomeUrl { get; set; }
|
||||
string Name { get; set; }
|
||||
string TwitterHandle { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using FilterLists.Data.Entities;
|
||||
|
||||
namespace FilterLists.Data.Repositories.Contracts
|
||||
{
|
||||
public interface IFilterListRepository
|
||||
{
|
||||
IEnumerable<IFilterList> GetAll();
|
||||
IFilterList GetByName(string filterListName);
|
||||
IEnumerable<FilterList> GetAll();
|
||||
FilterList GetByName(string filterListName);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FilterLists.Data.Contexts;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using FilterLists.Data.Entities;
|
||||
using FilterLists.Data.Repositories.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Repositories.Implementations
|
||||
|
|
@ -15,12 +15,12 @@ public FilterListRepository(FilterListsDbContext filterListsDbContext)
|
|||
this.filterListsDbContext = filterListsDbContext;
|
||||
}
|
||||
|
||||
public IEnumerable<IFilterList> GetAll()
|
||||
public IEnumerable<FilterList> GetAll()
|
||||
{
|
||||
return filterListsDbContext.FilterLists.AsEnumerable();
|
||||
}
|
||||
|
||||
public IFilterList GetByName(string filterListName)
|
||||
public FilterList GetByName(string filterListName)
|
||||
{
|
||||
return filterListsDbContext.FilterLists.First(x => x.Name == filterListName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Services.Contracts
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using FilterLists.Data.Repositories.Contracts;
|
||||
using FilterLists.Services.Contracts;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue