summaryrefslogtreecommitdiffstats
path: root/src/server/Api/V1/Entries/GetEntriesRoute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Api/V1/Entries/GetEntriesRoute.cs')
-rw-r--r--src/server/Api/V1/Entries/GetEntriesRoute.cs21
1 files changed, 21 insertions, 0 deletions
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<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)));
+ }
+}