finish seed endpoints

This commit is contained in:
Collin M. Barrett 2018-01-25 10:54:22 -06:00
parent b4316cb6d1
commit fbbaa5c64c
25 changed files with 7315 additions and 7092 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,22 @@
[
{
"ForkFilterListId": 7,
"UpstreamFilterListId": 9
"forkFilterListId": 7,
"upstreamFilterListId": 9
},
{
"ForkFilterListId": 8,
"UpstreamFilterListId": 9
"forkFilterListId": 8,
"upstreamFilterListId": 9
},
{
"ForkFilterListId": 16,
"UpstreamFilterListId": 59
"forkFilterListId": 16,
"upstreamFilterListId": 59
},
{
"ForkFilterListId": 16,
"UpstreamFilterListId": 99
"forkFilterListId": 16,
"upstreamFilterListId": 99
},
{
"ForkFilterListId": 16,
"UpstreamFilterListId": 278
"forkFilterListId": 16,
"upstreamFilterListId": 278
}
]

File diff suppressed because it is too large Load diff

View file

@ -1,79 +1,79 @@
[
{
"Id": 1,
"DescriptionUrl": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
"Name": "CC BY-NC-ND 4.0",
"PermissiveAdaptation": 0,
"PermissiveCommercial": 0
"id": 1,
"descriptionUrl": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
"name": "CC BY-NC-ND 4.0",
"permissiveAdaptation": false,
"permissiveCommercial": false
},
{
"Id": 2,
"DescriptionUrl": "https://opensource.org/licenses/MIT",
"Name": "The MIT License",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 1
"id": 2,
"descriptionUrl": "https://opensource.org/licenses/MIT",
"name": "The MIT License",
"permissiveAdaptation": true,
"permissiveCommercial": true
},
{
"Id": 3,
"DescriptionUrl": null,
"Name": "Restricted (General)",
"PermissiveAdaptation": 0,
"PermissiveCommercial": 0
"id": 3,
"descriptionUrl": null,
"name": "Restricted (General)",
"permissiveAdaptation": false,
"permissiveCommercial": false
},
{
"Id": 4,
"DescriptionUrl": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"Name": "GPLv3",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 1
"id": 4,
"descriptionUrl": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"name": "GPLv3",
"permissiveAdaptation": true,
"permissiveCommercial": true
},
{
"Id": 5,
"DescriptionUrl": "https://en.wikipedia.org/wiki/All_rights_reserved",
"Name": "All Rights Reserved (Default)",
"PermissiveAdaptation": 0,
"PermissiveCommercial": 0
"id": 5,
"descriptionUrl": "https://en.wikipedia.org/wiki/All_rights_reserved",
"name": "All Rights Reserved (Default)",
"permissiveAdaptation": false,
"permissiveCommercial": false
},
{
"Id": 6,
"DescriptionUrl": "https://creativecommons.org/licenses/by-nc-sa/3.0/",
"Name": "CC BY-NC-SA 3.0",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 0
"id": 6,
"descriptionUrl": "https://creativecommons.org/licenses/by-nc-sa/3.0/",
"name": "CC BY-NC-SA 3.0",
"permissiveAdaptation": true,
"permissiveCommercial": false
},
{
"Id": 7,
"DescriptionUrl": null,
"Name": "Permissive (General)",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 1
"id": 7,
"descriptionUrl": null,
"name": "Permissive (General)",
"permissiveAdaptation": true,
"permissiveCommercial": true
},
{
"Id": 8,
"DescriptionUrl": "https://creativecommons.org/licenses/by-sa/4.0/",
"Name": "CC BY-SA 4.0",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 1
"id": 8,
"descriptionUrl": "https://creativecommons.org/licenses/by-sa/4.0/",
"name": "CC BY-SA 4.0",
"permissiveAdaptation": true,
"permissiveCommercial": true
},
{
"Id": 9,
"DescriptionUrl": "https://creativecommons.org/licenses/by-nc-sa/4.0/",
"Name": "CC BY-NC-SA 4.0",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 0
"id": 9,
"descriptionUrl": "https://creativecommons.org/licenses/by-nc-sa/4.0/",
"name": "CC BY-NC-SA 4.0",
"permissiveAdaptation": true,
"permissiveCommercial": false
},
{
"Id": 10,
"DescriptionUrl": "https://opensource.org/licenses/BSD-3-Clause",
"Name": "BSD-3-Clause",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 1
"id": 10,
"descriptionUrl": "https://opensource.org/licenses/BSD-3-Clause",
"name": "BSD-3-Clause",
"permissiveAdaptation": true,
"permissiveCommercial": true
},
{
"Id": 11,
"DescriptionUrl": "https://unlicense.org/",
"Name": "The Unlicense",
"PermissiveAdaptation": 1,
"PermissiveCommercial": 1
"id": 11,
"descriptionUrl": "https://unlicense.org/",
"name": "The Unlicense",
"permissiveAdaptation": true,
"permissiveCommercial": true
}
]

View file

@ -1,163 +1,163 @@
[
{
"Id": 2,
"HomeUrl": null,
"Name": "AppliliZ",
"TwitterHandle": null,
"EmailAddress": null
"id": 2,
"emailAddress": null,
"homeUrl": null,
"name": "AppliliZ",
"twitterHandle": null
},
{
"Id": 3,
"HomeUrl": "https://bradconte.com/",
"Name": "Brad Conte",
"TwitterHandle": "bradconte",
"EmailAddress": null
"id": 3,
"emailAddress": null,
"homeUrl": "https://bradconte.com/",
"name": "Brad Conte",
"twitterHandle": "bradconte"
},
{
"Id": 4,
"HomeUrl": "https://forum.xda-developers.com/member.php?u=4877037",
"Name": "BSDgeek_Jake",
"TwitterHandle": null,
"EmailAddress": null
"id": 4,
"emailAddress": null,
"homeUrl": "https://forum.xda-developers.com/member.php?u=4877037",
"name": "BSDgeek_Jake",
"twitterHandle": null
},
{
"Id": 5,
"HomeUrl": "https://www.michaeltrimm.com/",
"Name": "Michael Trimm",
"TwitterHandle": null,
"EmailAddress": null
"id": 5,
"emailAddress": null,
"homeUrl": "https://www.michaeltrimm.com/",
"name": "Michael Trimm",
"twitterHandle": null
},
{
"Id": 6,
"HomeUrl": "https://eyeo.com/",
"Name": "eyeo GmbH",
"TwitterHandle": "eyeo",
"EmailAddress": "info@eyeo.com"
"id": 6,
"emailAddress": "info@eyeo.com",
"homeUrl": "https://eyeo.com/",
"name": "eyeo GmbH",
"twitterHandle": "eyeo"
},
{
"Id": 7,
"HomeUrl": "https://easylist.to/",
"Name": "The EasyList Authors",
"TwitterHandle": null,
"EmailAddress": null
"id": 7,
"emailAddress": null,
"homeUrl": "https://easylist.to/",
"name": "The EasyList Authors",
"twitterHandle": null
},
{
"Id": 8,
"HomeUrl": "https://github.com/mayve",
"Name": "mayve",
"TwitterHandle": null,
"EmailAddress": null
"id": 8,
"emailAddress": null,
"homeUrl": "https://github.com/mayve",
"name": "mayve",
"twitterHandle": null
},
{
"Id": 9,
"HomeUrl": "http://joxeankoret.com/",
"Name": "Joxean Koret",
"TwitterHandle": null,
"EmailAddress": "admin@oxeankoret.com"
"id": 9,
"emailAddress": "admin@oxeankoret.com",
"homeUrl": "http://joxeankoret.com/",
"name": "Joxean Koret",
"twitterHandle": null
},
{
"Id": 10,
"HomeUrl": "https://www.malwaredomainlist.com/",
"Name": "Malware Domain List Community",
"TwitterHandle": "_MDL_",
"EmailAddress": null
"id": 10,
"emailAddress": null,
"homeUrl": "https://www.malwaredomainlist.com/",
"name": "Malware Domain List Community",
"twitterHandle": "_MDL_"
},
{
"Id": 11,
"HomeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=542",
"Name": "Lian",
"TwitterHandle": null,
"EmailAddress": null
"id": 11,
"emailAddress": null,
"homeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=542",
"name": "Lian",
"twitterHandle": null
},
{
"Id": 12,
"HomeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=2266",
"Name": "Crits",
"TwitterHandle": null,
"EmailAddress": null
"id": 12,
"emailAddress": null,
"homeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=2266",
"name": "Crits",
"twitterHandle": null
},
{
"Id": 13,
"HomeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=1260",
"Name": "smed79",
"TwitterHandle": null,
"EmailAddress": null
"id": 13,
"emailAddress": null,
"homeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=1260",
"name": "smed79",
"twitterHandle": null
},
{
"Id": 14,
"HomeUrl": "https://www.fanboy.co.nz/",
"Name": "fanboy",
"TwitterHandle": null,
"EmailAddress": null
"id": 14,
"emailAddress": null,
"homeUrl": "https://www.fanboy.co.nz/",
"name": "fanboy",
"twitterHandle": null
},
{
"Id": 15,
"HomeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=333",
"Name": "MonztA",
"TwitterHandle": null,
"EmailAddress": null
"id": 15,
"emailAddress": null,
"homeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=333",
"name": "MonztA",
"twitterHandle": null
},
{
"Id": 16,
"HomeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=1488",
"Name": "Famlam",
"TwitterHandle": null,
"EmailAddress": null
"id": 16,
"emailAddress": null,
"homeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=1488",
"name": "Famlam",
"twitterHandle": null
},
{
"Id": 17,
"HomeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=1400",
"Name": "Khrin",
"TwitterHandle": null,
"EmailAddress": null
"id": 17,
"emailAddress": null,
"homeUrl": "https://forums.lanik.us/memberlist.php?mode=viewprofile&u=1400",
"name": "Khrin",
"twitterHandle": null
},
{
"Id": 18,
"HomeUrl": "https://github.com/SlowMemory",
"Name": "SlowMemory",
"TwitterHandle": null,
"EmailAddress": null
"id": 18,
"emailAddress": null,
"homeUrl": "https://github.com/SlowMemory",
"name": "SlowMemory",
"twitterHandle": null
},
{
"Id": 19,
"HomeUrl": "https://www.blogger.com/profile/09662737599549871224",
"Name": "MVPS HOSTS Maintainer",
"TwitterHandle": null,
"EmailAddress": null
"id": 19,
"emailAddress": null,
"homeUrl": "https://www.blogger.com/profile/09662737599549871224",
"name": "MVPS HOSTS Maintainer",
"twitterHandle": null
},
{
"Id": 20,
"HomeUrl": "https://github.com/taylr",
"Name": "Matt Taylor",
"TwitterHandle": null,
"EmailAddress": null
"id": 20,
"emailAddress": null,
"homeUrl": "https://github.com/taylr",
"name": "Matt Taylor",
"twitterHandle": null
},
{
"Id": 21,
"HomeUrl": "https://github.com/hoshsadiq/adblock-nocoin-list",
"Name": "Hosh",
"TwitterHandle": null,
"EmailAddress": null
"id": 21,
"emailAddress": null,
"homeUrl": "https://github.com/hoshsadiq/adblock-nocoin-list",
"name": "Hosh",
"twitterHandle": null
},
{
"Id": 22,
"HomeUrl": "https://github.com/DandelionSprout",
"Name": "Imre Kristoffer Eilertsen",
"TwitterHandle": null,
"EmailAddress": null
"id": 22,
"emailAddress": null,
"homeUrl": "https://github.com/DandelionSprout",
"name": "Imre Kristoffer Eilertsen",
"twitterHandle": null
},
{
"Id": 23,
"HomeUrl": "https://abuse.ch/",
"Name": "abuse.ch",
"TwitterHandle": "abuse_ch",
"EmailAddress": "contactme@abuse.ch"
"id": 23,
"emailAddress": "contactme@abuse.ch",
"homeUrl": "https://abuse.ch/",
"name": "abuse.ch",
"twitterHandle": "abuse_ch"
},
{
"Id": 24,
"HomeUrl": "https://github.com/metaphoricgiraffe",
"Name": "metaphoricgiraffe",
"TwitterHandle": null,
"EmailAddress": null
"id": 24,
"emailAddress": null,
"homeUrl": "https://github.com/metaphoricgiraffe",
"name": "metaphoricgiraffe",
"twitterHandle": null
}
]

View file

@ -1,94 +1,94 @@
[
{
"MergeFilterListId": 11,
"UpstreamFilterListId": 12
"mergeFilterListId": 11,
"upstreamFilterListId": 12
},
{
"MergeFilterListId": 13,
"UpstreamFilterListId": 12
"mergeFilterListId": 13,
"upstreamFilterListId": 12
},
{
"MergeFilterListId": 13,
"UpstreamFilterListId": 14
"mergeFilterListId": 13,
"upstreamFilterListId": 14
},
{
"MergeFilterListId": 21,
"UpstreamFilterListId": 23
"mergeFilterListId": 21,
"upstreamFilterListId": 23
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 24
"mergeFilterListId": 22,
"upstreamFilterListId": 24
},
{
"MergeFilterListId": 120,
"UpstreamFilterListId": 25
"mergeFilterListId": 120,
"upstreamFilterListId": 25
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 26
"mergeFilterListId": 22,
"upstreamFilterListId": 26
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 37
"mergeFilterListId": 22,
"upstreamFilterListId": 37
},
{
"MergeFilterListId": 21,
"UpstreamFilterListId": 75
"mergeFilterListId": 21,
"upstreamFilterListId": 75
},
{
"MergeFilterListId": 120,
"UpstreamFilterListId": 76
"mergeFilterListId": 120,
"upstreamFilterListId": 76
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 77
"mergeFilterListId": 22,
"upstreamFilterListId": 77
},
{
"MergeFilterListId": 21,
"UpstreamFilterListId": 121
"mergeFilterListId": 21,
"upstreamFilterListId": 121
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 122
"mergeFilterListId": 22,
"upstreamFilterListId": 122
},
{
"MergeFilterListId": 21,
"UpstreamFilterListId": 123
"mergeFilterListId": 21,
"upstreamFilterListId": 123
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 124
"mergeFilterListId": 22,
"upstreamFilterListId": 124
},
{
"MergeFilterListId": 21,
"UpstreamFilterListId": 125
"mergeFilterListId": 21,
"upstreamFilterListId": 125
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 126
"mergeFilterListId": 22,
"upstreamFilterListId": 126
},
{
"MergeFilterListId": 120,
"UpstreamFilterListId": 127
"mergeFilterListId": 120,
"upstreamFilterListId": 127
},
{
"MergeFilterListId": 120,
"UpstreamFilterListId": 128
"mergeFilterListId": 120,
"upstreamFilterListId": 128
},
{
"MergeFilterListId": 22,
"UpstreamFilterListId": 129
"mergeFilterListId": 22,
"upstreamFilterListId": 129
},
{
"MergeFilterListId": 21,
"UpstreamFilterListId": 130
"mergeFilterListId": 21,
"upstreamFilterListId": 130
},
{
"MergeFilterListId": 11,
"UpstreamFilterListId": 301
"mergeFilterListId": 11,
"upstreamFilterListId": 301
},
{
"MergeFilterListId": 13,
"UpstreamFilterListId": 301
"mergeFilterListId": 13,
"upstreamFilterListId": 301
}
]

View file

@ -1,20 +1,20 @@
[
{
"Id": 1,
"DownloadUrl": "https://github.com/gorhill/uBlock#installation",
"HomeUrl": "https://github.com/gorhill/uBlock",
"Name": "uBlock Origin"
"id": 1,
"downloadUrl": "https://github.com/gorhill/uBlock#installation",
"homeUrl": "https://github.com/gorhill/uBlock",
"name": "uBlock Origin"
},
{
"Id": 2,
"DownloadUrl": "https://adblockplus.org/",
"HomeUrl": "https://adblockplus.org/",
"Name": "Adblock Plus"
"id": 2,
"downloadUrl": "https://adblockplus.org/",
"homeUrl": "https://adblockplus.org/",
"name": "Adblock Plus"
},
{
"Id": 3,
"DownloadUrl": "https://adguard.com/en/download.html",
"HomeUrl": "https://adguard.com/",
"Name": "AdGuard"
"id": 3,
"downloadUrl": "https://adguard.com/en/download.html",
"homeUrl": "https://adguard.com/",
"name": "AdGuard"
}
]

View file

@ -8,6 +8,7 @@ namespace FilterLists.Api.V1.Controllers
[ResponseCache(CacheProfileName = "Long-Lived")]
public class BaseController : Controller
{
protected const int MemoryCacheSlidingExpirationSeconds = 30;
protected readonly IMemoryCache MemoryCache;
protected BaseController(IMemoryCache memoryCache)

View file

@ -1,72 +0,0 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class EntityController : BaseController
{
protected readonly SeedService SeedService;
protected EntityController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
SeedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
var controllerName = ControllerContext.RouteData.Values["controller"].ToString();
return await GetSeed(controllerName);
}
private async Task<IActionResult> GetSeed(string controllerName)
{
switch (controllerName)
{
case "lists":
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
return Json(await SeedService.GetAll<FilterList, FilterListSeedDto>());
});
case "languages":
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
return Json(await SeedService.GetAll<Language, LanguageSeedDto>());
});
case "licenses":
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
return Json(await SeedService.GetAll<License, LicenseSeedDto>());
});
case "maintainers":
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
return Json(await SeedService.GetAll<Maintainer, MaintainerSeedDto>());
});
case "software":
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
return Json(await SeedService.GetAll<Software, SoftwareSeedDto>());
});
case "syntaxes":
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
return Json(await SeedService.GetAll<Syntax, SyntaxSeedDto>());
});
default:
return await Task.FromResult(NotFound());
}
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities.Junctions;
using FilterLists.Services.Models.Seed.Junctions;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class ForksController : BaseController
{
private readonly SeedService seedService;
public ForksController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<Fork, ForkSeedDto>());
});
}
}
}

View file

@ -1,12 +1,30 @@
using FilterLists.Services.Services;
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class LanguagesController : EntityController
public class LanguagesController : BaseController
{
public LanguagesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache, seedService)
private readonly SeedService seedService;
public LanguagesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<Language, LanguageSeedDto>());
});
}
}
}

View file

@ -1,12 +1,30 @@
using FilterLists.Services.Services;
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class LicensesController : EntityController
public class LicensesController : BaseController
{
public LicensesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache, seedService)
private readonly SeedService seedService;
public LicensesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<License, LicenseSeedDto>());
});
}
}
}

View file

@ -1,18 +1,22 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class ListsController : EntityController
public class ListsController : BaseController
{
private readonly FilterListService filterListService;
private readonly SeedService seedService;
public ListsController(IMemoryCache memoryCache, SeedService seedService, FilterListService filterListService) :
base(memoryCache, seedService)
base(memoryCache)
{
this.seedService = seedService;
this.filterListService = filterListService;
}
@ -21,9 +25,19 @@ public async Task<IActionResult> Index()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(3);
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await filterListService.GetAllSummaries());
});
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<FilterList, FilterListSeedDto>());
});
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities.Junctions;
using FilterLists.Services.Models.Seed.Junctions;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class ListsLanguagesController : BaseController
{
private readonly SeedService seedService;
public ListsLanguagesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<FilterListLanguage, FilterListLanguageSeedDto>());
});
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities.Junctions;
using FilterLists.Services.Models.Seed.Junctions;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class ListsMaintainersController : BaseController
{
private readonly SeedService seedService;
public ListsMaintainersController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<FilterListMaintainer, FilterListMaintainerSeedDto>());
});
}
}
}

View file

@ -1,12 +1,30 @@
using FilterLists.Services.Services;
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class MaintainersController : EntityController
public class MaintainersController : BaseController
{
public MaintainersController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache, seedService)
private readonly SeedService seedService;
public MaintainersController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<Maintainer, MaintainerSeedDto>());
});
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities.Junctions;
using FilterLists.Services.Models.Seed.Junctions;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class MergesController : BaseController
{
private readonly SeedService seedService;
public MergesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<Merge, MergeSeedDto>());
});
}
}
}

View file

@ -1,12 +1,30 @@
using FilterLists.Services.Services;
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class SoftwareController : EntityController
public class SoftwareController : BaseController
{
public SoftwareController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache, seedService)
private readonly SeedService seedService;
public SoftwareController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<Software, SoftwareSeedDto>());
});
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities.Junctions;
using FilterLists.Services.Models.Seed.Junctions;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class SoftwareSyntaxesController : BaseController
{
private readonly SeedService seedService;
public SoftwareSyntaxesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<SoftwareSyntax, SoftwareSyntaxSeedDto>());
});
}
}
}

View file

@ -1,12 +1,30 @@
using FilterLists.Services.Services;
using System;
using System.Threading.Tasks;
using FilterLists.Data.Entities;
using FilterLists.Services.Models.Seed;
using FilterLists.Services.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
namespace FilterLists.Api.V1.Controllers
{
public class SyntaxesController : EntityController
public class SyntaxesController : BaseController
{
public SyntaxesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache, seedService)
private readonly SeedService seedService;
public SyntaxesController(IMemoryCache memoryCache, SeedService seedService) : base(memoryCache)
{
this.seedService = seedService;
}
[HttpGet]
public async Task<IActionResult> Seed()
{
return await MemoryCache.GetOrCreateAsync(CacheKeys.Entry, async entry =>
{
entry.SlidingExpiration = TimeSpan.FromSeconds(MemoryCacheSlidingExpirationSeconds);
return Json(await seedService.GetAll<Syntax, SyntaxSeedDto>());
});
}
}
}

View file

@ -0,0 +1,8 @@
namespace FilterLists.Services.Models.Seed.Junctions
{
public class FilterListLanguageSeedDto
{
public int FilterListId { get; set; }
public int LanguageId { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace FilterLists.Services.Models.Seed.Junctions
{
public class FilterListMaintainerSeedDto
{
public int FilterListId { get; set; }
public int MaintainerId { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace FilterLists.Services.Models.Seed.Junctions
{
public class ForkSeedDto
{
public int ForkFilterListId { get; set; }
public int UpstreamFilterListId { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace FilterLists.Services.Models.Seed.Junctions
{
public class MergeSeedDto
{
public int MergeFilterListId { get; set; }
public int UpstreamFilterListId { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace FilterLists.Services.Models.Seed.Junctions
{
public class SoftwareSyntaxSeedDto
{
public int SoftwareId { get; set; }
public int SyntaxId { get; set; }
}
}