refactor(HomeController): ranme EnvelopeKey route as Envelope

This commit is contained in:
tekh 2025-09-04 23:38:11 +02:00
parent 1d605e9da3
commit 1e6c9ed40e
4 changed files with 14 additions and 14 deletions

View File

@ -22,6 +22,7 @@ using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Web.Controllers;
[Route("Envelope")]
public class HomeController : ViewControllerBase
{
[Obsolete("Use MediatR")]
@ -63,7 +64,7 @@ public class HomeController : ViewControllerBase
});
}
[HttpGet("EnvelopeKey/{envelopeReceiverId}")]
[HttpGet("{envelopeReceiverId}")]
[Obsolete("Use MediatR")]
public async Task<IActionResult> MainAsync([FromRoute] string envelopeReceiverId)
{
@ -107,7 +108,7 @@ public class HomeController : ViewControllerBase
}
}
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Locked")]
[HttpGet("{envelopeReceiverId}/Locked")]
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
public async Task<IActionResult> EnvelopeLocked([FromRoute] string envelopeReceiverId)
{
@ -294,7 +295,7 @@ public class HomeController : ViewControllerBase
}
#endregion
[HttpPost("EnvelopeKey/{envelopeReceiverId}/Locked")]
[HttpPost("{envelopeReceiverId}/Locked")]
[Obsolete("Use MediatR")]
public async Task<IActionResult> LogInEnvelope([FromRoute] string envelopeReceiverId, [FromForm] Auth auth)
{
@ -367,7 +368,7 @@ public class HomeController : ViewControllerBase
}
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")]
[HttpGet("{envelopeReceiverId}/Success")]
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId, CancellationToken cancel)
{
@ -381,7 +382,7 @@ public class HomeController : ViewControllerBase
var signed = await _mediator.IsSignedAsync(envelopeReceiverId, cancel);
if (signed)
return base.Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
return base.Redirect($"/Envelope/{envelopeReceiverId}/Locked");
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
ViewData["EnvelopeKey"] = envelopeReceiverId;
@ -401,7 +402,7 @@ public class HomeController : ViewControllerBase
}
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Rejected")]
[HttpGet("{envelopeReceiverId}/Rejected")]
[Obsolete("Use MediatR")]
public async Task<IActionResult> EnvelopeRejected(string envelopeReceiverId)
{
@ -413,7 +414,7 @@ public class HomeController : ViewControllerBase
{
return await _historyService.IsRejected(envelopeId: er.EnvelopeId)
? View(er)
: Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
: Redirect($"/Envelope/{envelopeReceiverId}/Locked");
},
Fail: IActionResult (messages, notices) =>
@ -429,7 +430,7 @@ public class HomeController : ViewControllerBase
}
}
[HttpGet("EnvelopeKey/{readOnlyKey}/ReadOnly")]
[HttpGet("{readOnlyKey}/ReadOnly")]
[Obsolete("Use MediatR")]
public async Task<IActionResult> EnvelopeReceiverReadOnly([FromRoute] string readOnlyKey)
{
@ -499,7 +500,7 @@ public class HomeController : ViewControllerBase
}
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("IsAuthenticated")]
[HttpGet("/IsAuthenticated")]
public IActionResult IsAuthenticated()
{
var envelopeUuid = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
@ -507,7 +508,7 @@ public class HomeController : ViewControllerBase
return Ok(new { EnvelopeUuid = envelopeUuid, ReceiverSignature = receiverSignature });
}
[HttpPost("lang/{culture}")]
[HttpPost("/lang/{culture}")]
public IActionResult SetLanguage([FromRoute] string culture)
{
try
@ -526,7 +527,7 @@ public class HomeController : ViewControllerBase
}
}
[HttpGet("lang")]
[HttpGet("/lang")]
public IActionResult GetLanguages() => Ok(_cultures.Languages);
public IActionResult Error404() => this.ViewError404();

View File

@ -1,5 +1,4 @@
using EnvelopeGenerator.Web.Models;
using Ganss.Xss;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using EnvelopeGenerator.Application.Resources;

View File

@ -10,7 +10,7 @@ class API {
}
static get REJECT_REDIR_URL() {
return `/envelopekey/${API.ENV_KEY}/rejected`;
return `/envelope/${API.ENV_KEY}/rejected`;
}
static get SHARE_URL() {

View File

@ -145,7 +145,7 @@ class App {
if (result == true) {
// Redirect to success page after saving to database
window.location.href = `/EnvelopeKey/${this.envelopeKey}/Success`
window.location.href = `/Envelope/${this.envelopeKey}/Success`
}
break;