Commands: Create/Update/Delete/Publish/Disable/Test/Invoke
Queries: List/Detail/ExecutionLogs
DTOs: ScriptDto/ScriptExecutionLogDto + PagedResult
Endpoints (GET/POST/PUT/DELETE /scripts/*):
- GET /scripts scripts.read
- GET /scripts/{id} scripts.read
- POST /scripts scripts.create
- PUT /scripts/{id} scripts.update
- DELETE /scripts/{id} scripts.delete
- POST /scripts/{id}/publish scripts.publish
- POST /scripts/{id}/disable scripts.disable
- POST /scripts/{id}/test scripts.test
- GET /scripts/{id}/logs scripts.read
- POST /scripts/{name}/invoke scripts.run
Task T5 of scripting module refactor
15 lines
616 B
C#
15 lines
616 B
C#
using MediatR;
|
|
using Scripting.Application.Commands;
|
|
using Scripting.Application.DTOs;
|
|
using Scripting.Application.Services;
|
|
|
|
namespace Scripting.Application.Handlers;
|
|
|
|
/// <summary>按 Name 调用脚本处理器,委托执行服务(仅 Published 脚本可调用)。</summary>
|
|
public class InvokeScriptCommandHandler(IScriptExecutionService executionService)
|
|
: IRequestHandler<InvokeScriptCommand, ScriptExecutionResult>
|
|
{
|
|
public Task<ScriptExecutionResult> Handle(InvokeScriptCommand request, CancellationToken ct)
|
|
=> executionService.ExecuteByNameAsync(request.Name, request.InputJson, ct);
|
|
}
|