From 58ef5833b3f77f321c587dd86448c888029016ce Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Thu, 22 Dec 2022 14:44:26 +0100 Subject: feat: Many things - Working Login/Logout - Groundwork for web components - Loading web-components with version tag - Load temporal-polyfill globally --- code/api/Endpoints/EndpointBase.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 code/api/Endpoints/EndpointBase.cs (limited to 'code/api/Endpoints/EndpointBase.cs') diff --git a/code/api/Endpoints/EndpointBase.cs b/code/api/Endpoints/EndpointBase.cs new file mode 100644 index 0000000..a16f40f --- /dev/null +++ b/code/api/Endpoints/EndpointBase.cs @@ -0,0 +1,24 @@ +namespace I2R.Storage.Api.Endpoints; + +[ApiController] +[Authorize] +public class EndpointBase : ControllerBase +{ + protected LoggedInUserModel LoggedInUser => new(User); + + [NonAction] + protected ActionResult KnownProblem(string title = default, string subtitle = default, Dictionary errors = default) { + return BadRequest(new KnownProblemModel { + Title = title, + Subtitle = subtitle, + Errors = errors, + TraceId = HttpContext.TraceIdentifier + }); + } + + [NonAction] + protected ActionResult KnownProblem(KnownProblemModel problem) { + problem.TraceId = HttpContext.TraceIdentifier; + return BadRequest(problem); + } +} \ No newline at end of file -- cgit v1.3