From 9c028c5e6671e1028039ecad12838b265f6ad7c6 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 1 Dec 2025 12:27:47 +0100 Subject: [PATCH] Make ActionId a required field across DTOs and entities Updated the `RecActionDto`, `RecAction`, and `InvokeRecActionCommandHandler` to enforce `ActionId` as a required field. This change improves data integrity by removing nullable `ActionId` properties and eliminates the need for null checks or null-forgiveness operators. --- src/ReC.Application/Common/Dto/RecActionDto.cs | 2 +- .../RecActions/Commands/InvokeRecActionCommand.cs | 2 +- src/ReC.Domain/Entities/RecAction.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ReC.Application/Common/Dto/RecActionDto.cs b/src/ReC.Application/Common/Dto/RecActionDto.cs index f636510..0cb5e74 100644 --- a/src/ReC.Application/Common/Dto/RecActionDto.cs +++ b/src/ReC.Application/Common/Dto/RecActionDto.cs @@ -2,7 +2,7 @@ public record RecActionDto { - public long? ActionId { get; init; } + public required long ActionId { get; init; } public long? ProfileId { get; init; } diff --git a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs index cb3a936..4738e72 100644 --- a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs +++ b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs @@ -61,7 +61,7 @@ public class InvokeRecActionCommandHandler( await sender.Send(new CreateOutResCommand { - ActionId = (long) request.ActionId!, + ActionId = request.ActionId, Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }), Body = resBody, AddedWho = config?["AddedWho"] diff --git a/src/ReC.Domain/Entities/RecAction.cs b/src/ReC.Domain/Entities/RecAction.cs index a145933..c0df82d 100644 --- a/src/ReC.Domain/Entities/RecAction.cs +++ b/src/ReC.Domain/Entities/RecAction.cs @@ -15,7 +15,7 @@ namespace ReC.Domain.Entities; public class RecAction { [Column("ACTION_ID")] - public long? ActionId { get; set; } + public required long ActionId { get; set; } [Column("PROFILE_ID")] public long? ProfileId { get; set; }