TekH 7a84726a3b Refactor constant imports and enhance safety checks
Updated constant imports from static to regular usage across multiple controllers.
Improved null safety in `DebugEnvelopes.cshtml` by ensuring the `Receivers` property is not null before access.
Modified authorization attribute in `DocumentController.cs` to directly reference `Domain.Constants.ReceiverRole.FullyAuth`.
2025-09-01 11:31:39 +02:00

47 lines
1.6 KiB
Plaintext

@using EnvelopeGenerator.CommonServices;
@using EnvelopeGenerator.Domain.Entities;
@using EnvelopeGenerator.Domain.Constants;
@{
ViewData["Title"] = "Debug";
}
@functions {
string encodeEnvelopeKey(Envelope envelope)
{
var receiver = envelope.Receivers!.First();
return Helpers.EncodeEnvelopeReceiverId(envelope.Uuid, receiver.Receiver!.Signature);
}
IEnumerable<IGrouping<EnvelopeStatus, Envelope>> groupEnvelopes(List<Envelope> envelopes)
{
return envelopes.GroupBy(item => (EnvelopeStatus) item.Status).OrderBy(item => item.Key);
}
}
<div class="container">
<section>
@foreach (IGrouping<EnvelopeStatus, Envelope> group in groupEnvelopes((List<Envelope>)@Model))
{
<section>
<h2>@group.Key.ToString() @group.Count()</h2>
<details>
<summary>Show envelopes</summary>
@foreach (Envelope envelope in @group)
{
<section>
<article class="envelope">
<strong><a href="/EnvelopeKey/@encodeEnvelopeKey(envelope)">@envelope.Title</a></strong>
<div><strong>Ersteller</strong> @envelope.User.Email</div>
<div><strong>Datum</strong> @envelope.AddedWhen</div>
</article>
</section>
}
</details>
<hr />
</section>
}
</section>
</div>