< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Command.Input.UpdatePersonCommand
Assembly: ArturRios.Heimdall.Command
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Command/Input/UpdatePersonCommand.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 51
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 8
Fully covered methods: 8
Total methods: 8
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_Name()100%11100%
get_Email()100%11100%
get_RoleId()100%11100%
get_CurrentPassword()100%11100%
get_TwoFactorCode()100%11100%
get_ActingPersonId()100%11100%
get_ActingRole()100%11100%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Command/Input/UpdatePersonCommand.cs

#LineLine coverage
 1using System.Text.Json.Serialization;
 2using ArturRios.Heimdall.Shared.Security;
 3using ArturRios.Mediator.Command;
 4
 5namespace ArturRios.Heimdall.Command.Input;
 6
 7/// <summary>
 8///     Intent to update a person's name, email, and — for a System Admin — role (UC-08). The person
 9///     is addressed by <see cref="Id" />, assigned from the route. PUT semantics: <see cref="Name" />
 10///     and <see cref="Email" /> are replaced. <see cref="RoleId" /> is optional; <c>null</c> leaves
 11///     the role unchanged, which is what every non-System-Admin caller sends. A caller changing their
 12///     own email also proves they are the account holder with <see cref="CurrentPassword" />, and
 13///     <see cref="TwoFactorCode" /> when their second factor is active (FR-PE-14).
 14///     <see cref="ActingPersonId" />/<see cref="ActingRole" /> are set by the controller from the
 15///     authenticated caller and are never bound from the body. All three are <c>[JsonIgnore]</c>, so
 16///     they are not deserialized from the body and do not appear in the request schema.
 17/// </summary>
 18public class UpdatePersonCommand : BaseCommand, IActorScoped
 19{
 20    /// <summary>Public identifier of the person to update (assigned from the route).</summary>
 21    [JsonIgnore]
 23022    public Guid Id { get; set; }
 23
 24    /// <summary>New full name. Required, max 200 characters.</summary>
 45525    public string Name { get; set; } = string.Empty;
 26
 27    /// <summary>New email address. Required; changing it clears <c>EmailVerified</c> (UC-08 step 4).</summary>
 65428    public string Email { get; set; } = string.Empty;
 29
 30    /// <summary>New role value (see <c>Roles</c>), or <c>null</c> to leave the role unchanged.</summary>
 26531    public int? RoleId { get; set; }
 32
 33    /// <summary>
 34    ///     The caller's current password. Required only when the caller changes their own email
 35    ///     (FR-PE-14); ignored otherwise, so an administrator updating someone else sends none.
 36    /// </summary>
 26437    public string? CurrentPassword { get; set; }
 38
 39    /// <summary>
 40    ///     A current second factor — an authenticator-app or email code, or an unused recovery code —
 41    ///     required beside <see cref="CurrentPassword" /> when the caller changes their own email and
 42    ///     their two-factor authentication is active (FR-PE-14); ignored otherwise.
 43    /// </summary>
 9944    public string? TwoFactorCode { get; set; }
 45
 46    [JsonIgnore]
 43647    public Guid ActingPersonId { get; set; }
 48
 49    [JsonIgnore]
 27850    public int ActingRole { get; set; }
 51}