initial add of Maintainer entity

This commit is contained in:
Collin M. Barrett 2017-10-26 14:05:18 -05:00
parent 23e55ab6b6
commit aaf01637ed
4 changed files with 62 additions and 16 deletions

View file

@ -1,10 +1,7 @@
using System;
namespace FilterLists.Data.Models.Contracts
namespace FilterLists.Data.Models.Contracts
{
public interface IFilterList
{
string Author { get; set; }
string Description { get; set; }
string DescriptionSourceUrl { get; set; }
string DonateUrl { get; set; }
@ -14,8 +11,5 @@ public interface IFilterList
string IssuesUrl { get; set; }
string Name { get; set; }
string ViewUrl { get; set; }
long Id { get; set; }
DateTime CreatedDateUtc { get; set; }
DateTime? ModifiedDateUtc { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace FilterLists.Data.Models.Contracts
{
public interface IMaintainer
{
string Name { get; set; }
string Email { get; set; }
string TwitterHandle { get; set; }
string HomeUrl { get; set; }
}
}

View file

@ -1,32 +1,37 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using FilterLists.Data.Models.Contracts;
namespace FilterLists.Data.Models.Implementations
{
public class FilterList : BaseEntity, IFilterList
{
[Description(@"The author (person or group) who maintains the list.")]
[MaxLength(126)]
public string Author { get; set; }
public long MaintainerId { 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.")]
[ForeignKey("MaintainerForeignKey")]
public 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.")]
[MaxLength(1022)]
public string Description { get; set; }
[Description(@"The URL to the list's documentation page from which the description was quoted if applicable.")]
[Url]
[MaxLength(2083)]
[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)]
public string DonateUrl { get; set; }
[Description(@"The email address of the list's maintainer(s) if publicly available.")]
[EmailAddress]
[MaxLength(126)]
[MinLength(7)]
public string Email { get; set; }
@ -37,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)]
@ -50,12 +56,14 @@ public class FilterList : BaseEntity, IFilterList
public string IssuesUrl { get; set; }
[Description(@"The name of the list as stated by the list maintainer(s) in title case.")]
[Required]
[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.")]
[Url]
[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)]
[MinLength(6)]
public string ViewUrl { get; set; }

View file

@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using FilterLists.Data.Models.Contracts;
namespace FilterLists.Data.Models.Implementations
{
public class Maintainer : BaseEntity, IMaintainer
{
public List<FilterList> FilterLists { get; set; }
[Description(@"The author (person or group) who maintains the list.")]
[Required]
[MaxLength(126)]
public string Name { get; set; }
[Description(@"The email address of the list's maintainer(s) if publicly available.")]
[EmailAddress]
[MaxLength(126)]
[MinLength(7)]
public string Email { get; set; }
[Description(@"The email address of the list's maintainer(s) if publicly available.")]
[MaxLength(126)]
public string TwitterHandle { 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.")]
[Url]
[MaxLength(2083)]
[MinLength(6)]
public string HomeUrl { get; set; }
}
}