mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
feat: skills endpoint, stylistic changes
This commit is contained in:
26
WebApp/Endpoints/SkillsEndpoints.cs
Normal file
26
WebApp/Endpoints/SkillsEndpoints.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApp.Data;
|
||||
using WebApp.Mapping;
|
||||
|
||||
namespace WebApp.Endpoints;
|
||||
|
||||
public static class SkillsEndpoints
|
||||
{
|
||||
const string GetSkillEndpointName = "GetSkill";
|
||||
|
||||
public static RouteGroupBuilder MapSkillsEndpoints(this WebApplication app)
|
||||
{
|
||||
var group = app.MapGroup("api/skills").WithParameterValidation();
|
||||
|
||||
// GET /skills
|
||||
group.MapGet("/",
|
||||
async (ApplicationDbContext dbContext) =>
|
||||
await dbContext.Skills
|
||||
.OrderBy(Sk => Sk.SkillId)
|
||||
.Select(Sk => Sk.ToSkillSummaryDto()) // SkillSummaryDto
|
||||
.AsNoTracking()
|
||||
.ToListAsync());
|
||||
|
||||
return group;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user