fix(EnvelopeController): remove envelopeKey route parameter
This commit is contained in:
parent
77070a8cfc
commit
1d605e9da3
@ -66,6 +66,22 @@ public static class Extensions
|
|||||||
var q = new ReadEnvelopeReceiverQuery() { Key = key };
|
var q = new ReadEnvelopeReceiverQuery() { Key = key };
|
||||||
return mediator.Send(q, cancel).Then(envRcvs => envRcvs.FirstOrDefault());
|
return mediator.Send(q, cancel).Then(envRcvs => envRcvs.FirstOrDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediator"></param>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <param name="signature"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task<EnvelopeReceiverDto?> ReadEnvelopeReceiverAsync(this IMediator mediator, string uuid, string signature, CancellationToken cancel = default)
|
||||||
|
{
|
||||||
|
var q = new ReadEnvelopeReceiverQuery();
|
||||||
|
q.Envelope.Uuid = uuid;
|
||||||
|
q.Receiver.Signature = signature;
|
||||||
|
return mediator.Send(q, cancel).Then(envRcvs => envRcvs.FirstOrDefault());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -8,10 +8,10 @@ public record EnvelopeQueryBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Die eindeutige Kennung des Umschlags.
|
/// Die eindeutige Kennung des Umschlags.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual int? Id { get; init; }
|
public virtual int? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Die universell eindeutige Kennung des Umschlags.
|
/// Die universell eindeutige Kennung des Umschlags.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string? Uuid { get; init; }
|
public virtual string? Uuid { get; set; }
|
||||||
}
|
}
|
||||||
@ -41,8 +41,8 @@ public class EnvelopeController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("{envelopeKey}")]
|
[HttpPost]
|
||||||
public async Task<IActionResult> CreateOrUpdate([FromRoute] string envelopeKey, [FromBody] ExpandoObject annotations, CancellationToken cancel = default)
|
public async Task<IActionResult> CreateOrUpdate([FromBody] ExpandoObject annotations, CancellationToken cancel = default)
|
||||||
{
|
{
|
||||||
// get claims
|
// get claims
|
||||||
var signature = User.GetAuthReceiverSignature();
|
var signature = User.GetAuthReceiverSignature();
|
||||||
@ -58,11 +58,12 @@ public class EnvelopeController : ControllerBase
|
|||||||
if (await _mediator.IsSignedAsync(uuid, signature, cancel))
|
if (await _mediator.IsSignedAsync(uuid, signature, cancel))
|
||||||
return Problem(statusCode: 403);
|
return Problem(statusCode: 403);
|
||||||
|
|
||||||
var notification = await _mediator.ReadEnvelopeReceiverAsync(envelopeKey, cancel)
|
var docSignedNotification = await _mediator
|
||||||
|
.ReadEnvelopeReceiverAsync(uuid, signature, cancel)
|
||||||
.ToDocSignedNotification(annotations)
|
.ToDocSignedNotification(annotations)
|
||||||
?? throw new NotFoundException("Envelope receiver is not found.");
|
?? throw new NotFoundException("Envelope receiver is not found.");
|
||||||
|
|
||||||
await _mediator.Publish(notification, cancel);
|
await _mediator.Publish(docSignedNotification, cancel);
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -272,7 +272,7 @@ class App {
|
|||||||
|
|
||||||
// Export annotation data and save to database
|
// Export annotation data and save to database
|
||||||
try {
|
try {
|
||||||
const res = await postEnvelope(this.envelopeKey, await iJSON);
|
const res = await postEnvelope(await iJSON);
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
if (res.status === 403) {
|
if (res.status === 403) {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const csrfToken = { 'X-XSRF-TOKEN': document.getElementsByName('__RequestVerific
|
|||||||
* @param {any} envelopeKey
|
* @param {any} envelopeKey
|
||||||
* @param {any} annotations
|
* @param {any} annotations
|
||||||
*/
|
*/
|
||||||
function postEnvelope(envelopeKey, annotations) {
|
function postEnvelope(annotations) {
|
||||||
const token = csrfToken
|
const token = csrfToken
|
||||||
const options = {
|
const options = {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
@ -20,7 +20,7 @@ function postEnvelope(envelopeKey, annotations) {
|
|||||||
body: JSON.stringify(annotations)
|
body: JSON.stringify(annotations)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(`/api/envelope/${envelopeKey}`, options)
|
return fetch(`/api/envelope`, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setLangAsync(language, flagCode) {
|
async function setLangAsync(language, flagCode) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user