blob: adadf011735b714e365c1b35b9e48577c79945ac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
using IOL.BookmarkThing.Server.Api.V1.Entries.Dtos;
namespace IOL.BookmarkThing.Server.Api.V1.Entries;
public class GetEntriesRoute : RouteBaseV1Sync.WithoutRequest.WithActionResult<List<EntryDto>>
{
private readonly AppDbContext _context;
public GetEntriesRoute(AppDbContext context) {
_context = context;
}
/// <summary>
/// Get all entries
/// </summary>
[ApiVersion(ApiSpecV1.VERSION_STRING)]
[HttpGet("~/v{version:apiVersion}/entries")]
public override ActionResult<List<EntryDto>> Handle() {
return Ok(_context.Entries.Where(c => c.UserId == LoggedInUser.Id).Select(c => new EntryDto(c)));
}
}
|