From 88110f536f9c3843ecf5016122e101f8a424af77 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 22 Jan 2022 22:43:38 +0100 Subject: Initial commit --- src/server/Api/V1/Entries/GetEntriesRoute.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/server/Api/V1/Entries/GetEntriesRoute.cs (limited to 'src/server/Api/V1/Entries/GetEntriesRoute.cs') diff --git a/src/server/Api/V1/Entries/GetEntriesRoute.cs b/src/server/Api/V1/Entries/GetEntriesRoute.cs new file mode 100644 index 0000000..adadf01 --- /dev/null +++ b/src/server/Api/V1/Entries/GetEntriesRoute.cs @@ -0,0 +1,21 @@ +using IOL.BookmarkThing.Server.Api.V1.Entries.Dtos; + +namespace IOL.BookmarkThing.Server.Api.V1.Entries; + +public class GetEntriesRoute : RouteBaseV1Sync.WithoutRequest.WithActionResult> +{ + private readonly AppDbContext _context; + + public GetEntriesRoute(AppDbContext context) { + _context = context; + } + + /// + /// Get all entries + /// + [ApiVersion(ApiSpecV1.VERSION_STRING)] + [HttpGet("~/v{version:apiVersion}/entries")] + public override ActionResult> Handle() { + return Ok(_context.Entries.Where(c => c.UserId == LoggedInUser.Id).Select(c => new EntryDto(c))); + } +} -- cgit v1.3