Compare commits
3 Commits
b3dfdd1e5c
...
29bc0cf8b5
| Author | SHA1 | Date | |
|---|---|---|---|
| 29bc0cf8b5 | |||
| c8b264cef6 | |||
| 078525d85d |
@@ -13,14 +13,14 @@ public class RecActionController(IMediator mediator) : ControllerBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invokes a batch of RecActions for a given profile.
|
/// Invokes a batch of RecActions for a given profile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command">The command containing the profile ID.</param>
|
/// <param name="profileId">The identifier of the profile whose RecActions should be invoked.</param>
|
||||||
/// <param name="cancel">A token to cancel the operation.</param>
|
/// <param name="cancel">A token to cancel the operation.</param>
|
||||||
/// <returns>An HTTP 202 Accepted response indicating the process has been started.</returns>
|
/// <returns>An HTTP 202 Accepted response indicating the process has been started.</returns>
|
||||||
[HttpPost("invoke/{command}")]
|
[HttpPost("invoke/{profileId}")]
|
||||||
[ProducesResponseType(StatusCodes.Status202Accepted)]
|
[ProducesResponseType(StatusCodes.Status202Accepted)]
|
||||||
public async Task<IActionResult> Invoke([FromRoute] InvokeBatchRecActionViewsCommand command, CancellationToken cancel)
|
public async Task<IActionResult> Invoke([FromRoute] long profileId, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
await mediator.Send(command, cancel);
|
await mediator.Send(new InvokeBatchRecActionViewsCommand { ProfileId = profileId }, cancel);
|
||||||
return Accepted();
|
return Accepted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,59 +14,59 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
|||||||
.WithMessage("ENTITY must be one of: ACTION, ENDPOINT, ENDPOINT_AUTH, ENDPOINT_PARAMS, PROFILE, RESULT.");
|
.WithMessage("ENTITY must be one of: ACTION, ENDPOINT, ENDPOINT_AUTH, ENDPOINT_PARAMS, PROFILE, RESULT.");
|
||||||
|
|
||||||
// ACTION validation
|
// ACTION validation
|
||||||
When(x => x.Entity == "ACTION", () =>
|
When(x => x.Action != null, () =>
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Action.ProfileId)
|
RuleFor(x => x.Action!.ProfileId)
|
||||||
.NotNull()
|
.NotNull()
|
||||||
.WithMessage("ACTION requires ActionProfileId (maps to @pACTION_PROFILE_ID).");
|
.WithMessage("ACTION requires ActionProfileId (maps to @pACTION_PROFILE_ID).");
|
||||||
|
|
||||||
RuleFor(x => x.Action.EndpointId)
|
RuleFor(x => x.Action!.EndpointId)
|
||||||
.NotNull()
|
.NotNull()
|
||||||
.WithMessage("ACTION requires ActionEndpointId (maps to @pACTION_ENDPOINT_ID).");
|
.WithMessage("ACTION requires ActionEndpointId (maps to @pACTION_ENDPOINT_ID).");
|
||||||
});
|
});
|
||||||
|
|
||||||
// ENDPOINT validation
|
// ENDPOINT validation
|
||||||
When(x => x.Entity == "ENDPOINT", () =>
|
When(x => x.Endpoint != null, () =>
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Endpoint.Uri)
|
RuleFor(x => x.Endpoint!.Uri)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("ENDPOINT requires EndpointUri (maps to @pENDPOINT_URI).")
|
.WithMessage("ENDPOINT requires EndpointUri (maps to @pENDPOINT_URI).")
|
||||||
.MaximumLength(2000);
|
.MaximumLength(2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
// PROFILE validation
|
// PROFILE validation
|
||||||
When(x => x.Entity == "PROFILE", () =>
|
When(x => x.Profile != null, () =>
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Profile.Name)
|
RuleFor(x => x.Profile!.Name)
|
||||||
.NotEmpty()
|
.NotEmpty()
|
||||||
.WithMessage("PROFILE requires ProfileName (maps to @pPROFILE_NAME).")
|
.WithMessage("PROFILE requires ProfileName (maps to @pPROFILE_NAME).")
|
||||||
.MaximumLength(50);
|
.MaximumLength(50);
|
||||||
|
|
||||||
RuleFor(x => x.Profile.Mandantor)
|
RuleFor(x => x.Profile!.Mandantor)
|
||||||
.MaximumLength(50)
|
.MaximumLength(50)
|
||||||
.When(x => x.Profile.Mandantor != null);
|
.When(x => x.Profile!.Mandantor != null);
|
||||||
|
|
||||||
RuleFor(x => x.Profile.Description)
|
RuleFor(x => x.Profile!.Description)
|
||||||
.MaximumLength(250)
|
.MaximumLength(250)
|
||||||
.When(x => x.Profile.Description != null);
|
.When(x => x.Profile!.Description != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
// RESULT validation
|
// RESULT validation
|
||||||
When(x => x.Entity == "RESULT", () =>
|
When(x => x.Result != null, () =>
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Result.ActionId)
|
RuleFor(x => x.Result!.ActionId)
|
||||||
.NotNull()
|
.NotNull()
|
||||||
.WithMessage("RESULT requires ResultActionId (maps to @pRESULT_ACTION_ID).");
|
.WithMessage("RESULT requires ResultActionId (maps to @pRESULT_ACTION_ID).");
|
||||||
|
|
||||||
RuleFor(x => x.Result.StatusId)
|
RuleFor(x => x.Result!)
|
||||||
.NotNull()
|
.Must(r => r.StatusId != null || r.Info != null || r.Error != null)
|
||||||
.WithMessage("RESULT requires ResultStatusId (maps to @pRESULT_STATUS_ID).");
|
.WithMessage("RESULT requires at least one of: StatusId, Info, or Error.");
|
||||||
});
|
});
|
||||||
|
|
||||||
// ENDPOINT_PARAMS validation
|
// ENDPOINT_PARAMS validation
|
||||||
When(x => x.Entity == "ENDPOINT_PARAMS", () =>
|
When(x => x.EndpointParams != null, () =>
|
||||||
{
|
{
|
||||||
RuleFor(x => x.EndpointParams.GroupId)
|
RuleFor(x => x.EndpointParams!.GroupId)
|
||||||
.NotNull()
|
.NotNull()
|
||||||
.WithMessage("ENDPOINT_PARAMS requires EndpointParamsGroupId (maps to @pENDPOINT_PARAMS_GROUP_ID).");
|
.WithMessage("ENDPOINT_PARAMS requires EndpointParamsGroupId (maps to @pENDPOINT_PARAMS_GROUP_ID).");
|
||||||
});
|
});
|
||||||
@@ -76,12 +76,12 @@ public class InsertObjectProcedureValidator : AbstractValidator<InsertObjectProc
|
|||||||
.MaximumLength(50)
|
.MaximumLength(50)
|
||||||
.When(x => x.AddedWho != null);
|
.When(x => x.AddedWho != null);
|
||||||
|
|
||||||
RuleFor(x => x.Endpoint.Description)
|
RuleFor(x => x.Endpoint!.Description)
|
||||||
.MaximumLength(250)
|
.MaximumLength(250)
|
||||||
.When(x => x.Endpoint.Description != null);
|
.When(x => x.Endpoint is { Description: not null });
|
||||||
|
|
||||||
RuleFor(x => x.EndpointAuth.Description)
|
RuleFor(x => x.EndpointAuth!.Description)
|
||||||
.MaximumLength(250)
|
.MaximumLength(250)
|
||||||
.When(x => x.EndpointAuth.Description != null);
|
.When(x => x.EndpointAuth is { Description: not null });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user