< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Shared.Messages.ApplicationMessageMap
Assembly: ArturRios.Heimdall.Shared
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Shared/Messages/ApplicationMessageMap.cs
Line coverage
100%
Covered lines: 42
Uncovered lines: 0
Coverable lines: 42
Total lines: 53
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Shared/Messages/ApplicationMessageMap.cs

#LineLine coverage
 1using ArturRios.Util.Http;
 2
 3namespace ArturRios.Heimdall.Shared.Messages;
 4
 5/// <summary>
 6///     Maps each <see cref="ApplicationMessages" /> value to its HTTP status code, following the
 7///     UC-16 – UC-20 flows. Passed to the response resolver.
 8/// </summary>
 9public static class ApplicationMessageMap
 10{
 411    public static readonly IReadOnlyDictionary<string, int> StatusCodes =
 412        DataAccessMessageMap.CombinedWith(new Dictionary<string, int>
 413        {
 414            // UC-16 main flow — application created.
 415            [ApplicationMessages.ApplicationCreatedSuccessfully] = HttpStatusCodes.Created,
 416            // AF-16a — scope not found.
 417            [ApplicationMessages.ScopeNotFound] = HttpStatusCodes.NotFound,
 418            // AF-16e — the acting Scope Admin does not own the target scope; AF-16c — a Scope Admin
 419            // named someone else as owner.
 420            [ApplicationMessages.NotScopeOwner] = HttpStatusCodes.Forbidden,
 421            [ApplicationMessages.CannotSetAnotherOwner] = HttpStatusCodes.Forbidden,
 422            // AF-16b — the owner is not tied to the scope.
 423            [ApplicationMessages.OwnerNotValidForScope] = HttpStatusCodes.BadRequest,
 424            // AF-16d — invalid input.
 425            [ApplicationMessages.NameRequired] = HttpStatusCodes.BadRequest,
 426            [ApplicationMessages.NameTooLong] = HttpStatusCodes.BadRequest,
 427            [ApplicationMessages.OwnerRequired] = HttpStatusCodes.BadRequest,
 428            // UC-17 main flow — application(s) retrieved.
 429            [ApplicationMessages.ApplicationRetrievedSuccessfully] = HttpStatusCodes.Ok,
 430            [ApplicationMessages.ApplicationsRetrievedSuccessfully] = HttpStatusCodes.Ok,
 431            // AF-17a — application not found. The listing's own 404 reuses ScopeNotFound above.
 432            [ApplicationMessages.ApplicationNotFound] = HttpStatusCodes.NotFound,
 433            // AF-17b — caller may not view the application. The listing's 403 reuses NotScopeOwner.
 434            [ApplicationMessages.NotAuthorizedToViewApplication] = HttpStatusCodes.Forbidden,
 435            // UC-18 main flow — application updated.
 436            [ApplicationMessages.ApplicationUpdatedSuccessfully] = HttpStatusCodes.Ok,
 437            // AF-18c — caller may not update the application. AF-18a reuses ApplicationNotFound above,
 438            // AF-18b reuses OwnerNotValidForScope, and UC-18's input validation reuses the UC-16 messages.
 439            [ApplicationMessages.NotAuthorizedToUpdateApplication] = HttpStatusCodes.Forbidden,
 440            // UC-19 main flow — application logically deleted. AF-19b answers with the same 200, so the
 441            // response's AlreadyDeleted flag is what tells the two paths apart.
 442            [ApplicationMessages.ApplicationDeletedSuccessfully] = HttpStatusCodes.Ok,
 443            // AF-19c — caller may not delete the application. AF-19a reuses ApplicationNotFound above.
 444            [ApplicationMessages.NotAuthorizedToDeleteApplication] = HttpStatusCodes.Forbidden,
 445            // UC-20 main flow — application hard deleted. AF-20a reuses ApplicationNotFound above, and
 446            // UC-20's only other refusals are the framework's: 403 from [RoleRequirement], 401 unauthenticated.
 447            [ApplicationMessages.ApplicationHardDeletedSuccessfully] = HttpStatusCodes.Ok,
 448            // UC-17 listing (NFR-10) — invalid pagination or an over-length name filter.
 449            [PaginationMessages.InvalidPageNumber] = HttpStatusCodes.BadRequest,
 450            [PaginationMessages.InvalidPageSize] = HttpStatusCodes.BadRequest,
 451            [PaginationMessages.FilterTooLong] = HttpStatusCodes.BadRequest
 452        });
 53}

Methods/Properties

.cctor()