mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
extract model interfaces, fix launch url
applicationUrl in launchSettings.json no longer allows specifying default path per https://github.com/aspnet/Announcements/issues/226
This commit is contained in:
parent
e4aea30038
commit
791b744c05
16 changed files with 72 additions and 25 deletions
|
|
@ -6,7 +6,7 @@
|
|||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:49980/v1/lists"
|
||||
"applicationUrl": "http://localhost:49980/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,8 +29,7 @@ public void Configure(IApplicationBuilder app)
|
|||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
});
|
||||
app.UseMvc();
|
||||
}).UseMvc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Implementations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FilterLists.Data.Contexts
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Implementations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FilterLists.Data.Contexts
|
||||
|
|
|
|||
11
src/FilterLists.Data/Models/Contracts/IBaseEntity.cs
Normal file
11
src/FilterLists.Data/Models/Contracts/IBaseEntity.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface IBaseEntity
|
||||
{
|
||||
long Id { get; set; }
|
||||
DateTime AddedDateUtc { get; set; }
|
||||
DateTime? ModifiedDateUtc { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/FilterLists.Data/Models/Contracts/IList.cs
Normal file
21
src/FilterLists.Data/Models/Contracts/IList.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
|
||||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface IList
|
||||
{
|
||||
string Name { get; set; }
|
||||
string ViewUrl { get; set; }
|
||||
string HomeUrl { get; set; }
|
||||
string Description { get; set; }
|
||||
string DescriptionSourceUrl { get; set; }
|
||||
string Author { get; set; }
|
||||
string ForumUrl { get; set; }
|
||||
string IssuesUrl { get; set; }
|
||||
string Email { get; set; }
|
||||
string DonateUrl { get; set; }
|
||||
long Id { get; set; }
|
||||
DateTime AddedDateUtc { get; set; }
|
||||
DateTime? ModifiedDateUtc { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/FilterLists.Data/Models/Contracts/ITableCsv.cs
Normal file
13
src/FilterLists.Data/Models/Contracts/ITableCsv.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace FilterLists.Data.Models.Contracts
|
||||
{
|
||||
public interface ITableCsv
|
||||
{
|
||||
string Name { get; set; }
|
||||
string Url { get; set; }
|
||||
long Id { get; set; }
|
||||
DateTime AddedDateUtc { get; set; }
|
||||
DateTime? ModifiedDateUtc { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,11 @@
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Models
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
{
|
||||
public abstract class BaseEntity
|
||||
public abstract class BaseEntity : IBaseEntity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Models
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
{
|
||||
public class List : BaseEntity
|
||||
public class List : BaseEntity, IList
|
||||
{
|
||||
[MaxLength(126)]
|
||||
public string Name { get; set; }
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Models
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
{
|
||||
public class TableCsv : BaseEntity
|
||||
public class TableCsv : BaseEntity, ITableCsv
|
||||
{
|
||||
[Required]
|
||||
[MaxLength(126)]
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Repositories.Contracts
|
||||
{
|
||||
public interface IListRepository
|
||||
{
|
||||
IEnumerable<List> GetAll();
|
||||
List GetByName(string listName);
|
||||
IEnumerable<IList> GetAll();
|
||||
IList GetByName(string listName);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Repositories.Contracts
|
||||
{
|
||||
public interface ITableCsvRepository
|
||||
{
|
||||
IEnumerable<TableCsv> GetAll();
|
||||
IEnumerable<ITableCsv> GetAll();
|
||||
string GetUrlByName(string name);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FilterLists.Data.Contexts;
|
||||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using FilterLists.Data.Repositories.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Repositories.Implementations
|
||||
|
|
@ -15,12 +15,12 @@ public ListRepository(FilterListsDbContext filterListsDbContext)
|
|||
_filterListsDbContext = filterListsDbContext;
|
||||
}
|
||||
|
||||
public IEnumerable<List> GetAll()
|
||||
public IEnumerable<IList> GetAll()
|
||||
{
|
||||
return _filterListsDbContext.List.AsEnumerable();
|
||||
}
|
||||
|
||||
public List GetByName(string listName)
|
||||
public IList GetByName(string listName)
|
||||
{
|
||||
return _filterListsDbContext.List.First(x => x.Name == listName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FilterLists.Data.Contexts;
|
||||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using FilterLists.Data.Repositories.Contracts;
|
||||
|
||||
namespace FilterLists.Data.Repositories.Implementations
|
||||
|
|
@ -15,7 +15,7 @@ public TableCsvRepository(FilterListsDbContext filterListsDbContext)
|
|||
_filterListsDbContext = filterListsDbContext;
|
||||
}
|
||||
|
||||
public IEnumerable<TableCsv> GetAll()
|
||||
public IEnumerable<ITableCsv> GetAll()
|
||||
{
|
||||
return _filterListsDbContext.TableCsv.AsEnumerable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
|
||||
namespace FilterLists.Services.Contracts
|
||||
{
|
||||
public interface IListService
|
||||
{
|
||||
IEnumerable<List> GetAll();
|
||||
IEnumerable<IList> GetAll();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Data.Models;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using FilterLists.Data.Repositories.Contracts;
|
||||
using FilterLists.Services.Contracts;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ public ListService(IListRepository listRepository)
|
|||
_listRepository = listRepository;
|
||||
}
|
||||
|
||||
public IEnumerable<List> GetAll()
|
||||
public IEnumerable<IList> GetAll()
|
||||
{
|
||||
return _listRepository.GetAll();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue