| | | 1 | | using ArturRios.Util.Http; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Heimdall.Shared.Messages; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Maps each message the audit-trail listing (UC-48) can return to its HTTP status code. Passed to |
| | | 7 | | /// the response resolver by <c>AuditController</c>. |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// AF-48b (a caller who is not a System Admin) has no entry: the endpoint's <c>RoleRequirement</c> |
| | | 11 | | /// answers 403 before the handler runs. |
| | | 12 | | /// </remarks> |
| | | 13 | | public static class AuditMessageMap |
| | | 14 | | { |
| | 4 | 15 | | public static readonly IReadOnlyDictionary<string, int> StatusCodes = |
| | 4 | 16 | | DataAccessMessageMap.CombinedWith(new Dictionary<string, int> |
| | 4 | 17 | | { |
| | 4 | 18 | | // UC-48 main flow and AF-48c — entries listed, an empty page included. |
| | 4 | 19 | | [AuditMessages.AuditLogRetrieved] = HttpStatusCodes.Ok, |
| | 4 | 20 | | // AF-48a — the date range runs backwards. |
| | 4 | 21 | | [AuditMessages.InvalidDateRange] = HttpStatusCodes.BadRequest, |
| | 4 | 22 | | // AF-48a (NFR-10) — the page is out of bounds or the action filter is longer than its column. |
| | 4 | 23 | | [PaginationMessages.InvalidPageNumber] = HttpStatusCodes.BadRequest, |
| | 4 | 24 | | [PaginationMessages.InvalidPageSize] = HttpStatusCodes.BadRequest, |
| | 4 | 25 | | [PaginationMessages.FilterTooLong] = HttpStatusCodes.BadRequest |
| | 4 | 26 | | }); |
| | | 27 | | } |