Refactor RecActionController and DeleteRecActionsCommand
Updated the `Invoke` method in `RecActionController` to use `cmd` as the route parameter instead of `profileId`, modifying the HTTP POST route to `invoke/{cmd}`.
Refactored the `Delete` method to accept a `DeleteRecActionsCommand` object (`cmd`) instead of `profileId`. Removed the hardcoded `ProfileId` assignment and passed the `cmd` object directly to `mediator.Send`.
Made the `ProfileId` property in `DeleteRecActionsCommand` required by removing its default value, enforcing explicit initialization. This improves validation and ensures flexibility for future enhancements.
These changes enhance the API's clarity, flexibility, and maintainability.
This commit is contained in:
@@ -8,7 +8,7 @@ namespace ReC.Application.RecActions.Commands;
|
||||
|
||||
public class DeleteRecActionsCommand : IRequest
|
||||
{
|
||||
public long ProfileId { get; init; } = 2;
|
||||
public required long ProfileId { get; init; }
|
||||
}
|
||||
|
||||
public class DeleteRecActionsCommandHandler(IRepository<RecAction> repo) : IRequestHandler<DeleteRecActionsCommand>
|
||||
|
||||
Reference in New Issue
Block a user