From 68ffad06a6cfd2cd2015ab03fb82bf69629dd7ec Mon Sep 17 00:00:00 2001 From: ivar Date: Tue, 2 Dec 2025 22:38:23 +0100 Subject: Move off razor pages --- api/WhatApi/Endpoints/GetMapPageEndpoint.cs | 12 ++++++++++++ api/WhatApi/Endpoints/GetPlacesEndpoint.cs | 4 ++-- api/WhatApi/Endpoints/GetUploadPageEndpoint.cs | 12 ++++++++++++ api/WhatApi/Endpoints/UploadContentEndpoint.cs | 1 - 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 api/WhatApi/Endpoints/GetMapPageEndpoint.cs create mode 100644 api/WhatApi/Endpoints/GetUploadPageEndpoint.cs (limited to 'api/WhatApi/Endpoints') diff --git a/api/WhatApi/Endpoints/GetMapPageEndpoint.cs b/api/WhatApi/Endpoints/GetMapPageEndpoint.cs new file mode 100644 index 0000000..833a98c --- /dev/null +++ b/api/WhatApi/Endpoints/GetMapPageEndpoint.cs @@ -0,0 +1,12 @@ +using WhatApi.Templates; + +namespace WhatApi.Endpoints; + +public class GetMapPageEndpoint : BaseEndpoint +{ + + [HttpGet("~/map")] + public ActionResult GetMapPage() { + return Content(TemplateFulfiller.WebMapPage(), "text/html"); + } +} \ No newline at end of file diff --git a/api/WhatApi/Endpoints/GetPlacesEndpoint.cs b/api/WhatApi/Endpoints/GetPlacesEndpoint.cs index 8dbdff6..08068c8 100644 --- a/api/WhatApi/Endpoints/GetPlacesEndpoint.cs +++ b/api/WhatApi/Endpoints/GetPlacesEndpoint.cs @@ -12,7 +12,7 @@ public class GetPlacesEndpoint(Database db) : BaseEndpoint if (w > e) { resultingQuery = db.Places .FromSqlInterpolated($""" - SELECT * FROM "Place" + SELECT * FROM "place" WHERE ST_Intersects( "Location", ST_MakeEnvelope({w}, {s}, 180, {n}, {Constants.Wgs84SpatialReferenceId}) || ST_MakeEnvelope(-180, {n}, {e}, {n}, {Constants.Wgs84SpatialReferenceId}) @@ -21,7 +21,7 @@ public class GetPlacesEndpoint(Database db) : BaseEndpoint } else { resultingQuery = db.Places .FromSqlInterpolated($""" - SELECT * FROM "Place" + SELECT * FROM "place" WHERE ST_Intersects( "Location", ST_MakeEnvelope({w}, {s}, {e}, {n}, {Constants.Wgs84SpatialReferenceId}) diff --git a/api/WhatApi/Endpoints/GetUploadPageEndpoint.cs b/api/WhatApi/Endpoints/GetUploadPageEndpoint.cs new file mode 100644 index 0000000..ea14819 --- /dev/null +++ b/api/WhatApi/Endpoints/GetUploadPageEndpoint.cs @@ -0,0 +1,12 @@ +using WhatApi.Templates; + +namespace WhatApi.Endpoints; + +public class GetUploadPageEndpoint : BaseEndpoint +{ + + [HttpGet("~/upload")] + public ActionResult GetMapPage() { + return Content(TemplateFulfiller.WebUploadPage(), "text/html"); + } +} \ No newline at end of file diff --git a/api/WhatApi/Endpoints/UploadContentEndpoint.cs b/api/WhatApi/Endpoints/UploadContentEndpoint.cs index b114310..2c84252 100644 --- a/api/WhatApi/Endpoints/UploadContentEndpoint.cs +++ b/api/WhatApi/Endpoints/UploadContentEndpoint.cs @@ -1,4 +1,3 @@ - namespace WhatApi.Endpoints; public class UploadContentEndpoint(Database db) : BaseEndpoint -- cgit v1.3