Updated to Labels-endpoints to ElsaEndpoint (#7205)

* Updated to ElsaEndpoint
ConfigurePermissions as others

* Removed unused constants

* Update src/modules/Elsa.Labels/Endpoints/Labels/Post/Endpoint.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ralf <Ralf@Careconnections.nl>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
RalfvandenBurg 2026-01-27 10:57:58 +01:00 committed by GitHub
parent b8228351ae
commit 72569702fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 21 additions and 99 deletions

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.Labels.Delete;
/// <summary>
/// Provides policy names accepted by the <see cref="Delete"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "DeleteLabel";
}

View file

@ -1,9 +1,10 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using FastEndpoints;
namespace Elsa.Labels.Endpoints.Labels.Delete;
public class Delete : Endpoint<Request>
public class Delete : ElsaEndpoint<Request>
{
private readonly ILabelStore _store;
@ -12,7 +13,7 @@ public class Delete : Endpoint<Request>
public override void Configure()
{
Delete("/labels/{id}");
Policies(Constants.PolicyName);
ConfigurePermissions("delete:labels");
}
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.Labels.Get;
/// <summary>
/// Provides policy names accepted by the <see cref="Get"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "GetLabel";
}

View file

@ -1,9 +1,10 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using FastEndpoints;
namespace Elsa.Labels.Endpoints.Labels.Get;
internal class Get : Endpoint<Request, Response, LabelMapper>
internal class Get : ElsaEndpoint<Request, Response, LabelMapper>
{
private readonly ILabelStore _store;
@ -15,7 +16,7 @@ internal class Get : Endpoint<Request, Response, LabelMapper>
public override void Configure()
{
Get("/labels/{id}");
Policies(Constants.PolicyName);
ConfigurePermissions("read:labels");
}
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.Labels.List;
/// <summary>
/// Provides policy names accepted by the <see cref="List"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "ListLabels";
}

View file

@ -1,9 +1,10 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using FastEndpoints;
namespace Elsa.Labels.Endpoints.Labels.List;
public class List : Endpoint<Request, Response, PageMapper>
public class List : ElsaEndpoint<Request, Response, PageMapper>
{
private readonly ILabelStore _store;
@ -15,7 +16,7 @@ public class List : Endpoint<Request, Response, PageMapper>
public override void Configure()
{
Get("/labels");
Policies(Constants.PolicyName);
ConfigurePermissions("read:labels");
}
public override async Task<Response> ExecuteAsync(Request request, CancellationToken cancellationToken)

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.Labels.Post;
/// <summary>
/// Provides policy names accepted by the <see cref="Post"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "CreateLabel";
}

View file

@ -1,3 +1,4 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using Elsa.Workflows;
using FastEndpoints;
@ -6,7 +7,7 @@ using JetBrains.Annotations;
namespace Elsa.Labels.Endpoints.Labels.Post;
[PublicAPI]
internal class Create : Endpoint<Request, Response, LabelMapper>
internal class Create : ElsaEndpoint<Request, Response, LabelMapper>
{
private readonly ILabelStore _store;
@ -18,7 +19,7 @@ internal class Create : Endpoint<Request, Response, LabelMapper>
public override void Configure()
{
Post("/labels");
Policies(Constants.PolicyName);
ConfigurePermissions("create:labels");
}
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.Labels.Update;
/// <summary>
/// Provides policy names accepted by the <see cref="Update"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "UpdateLabel";
}

View file

@ -1,3 +1,4 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using FastEndpoints;
using JetBrains.Annotations;
@ -5,12 +6,12 @@ using JetBrains.Annotations;
namespace Elsa.Labels.Endpoints.Labels.Update;
[PublicAPI]
internal class Update(ILabelStore store) : Endpoint<Request, Response, LabelMapper>
internal class Update(ILabelStore store) : ElsaEndpoint<Request, Response, LabelMapper>
{
public override void Configure()
{
Post("/labels/{id}");
Policies(Constants.PolicyName);
ConfigurePermissions("update:labels");
}
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.List;
/// <summary>
/// Provides policy names accepted by the <see cref="List"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "ListWorkflowDefinitionLabels";
}

View file

@ -1,14 +1,14 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using Elsa.Workflows.Management;
using Elsa.Workflows.Management.Filters;
using FastEndpoints;
using JetBrains.Annotations;
using Open.Linq.AsyncExtensions;
namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.List;
[PublicAPI]
internal class List : Endpoint<Request, Response>
internal class List : ElsaEndpoint<Request, Response>
{
private readonly IWorkflowDefinitionStore _workflowDefinitionStore;
private readonly IWorkflowDefinitionLabelStore _workflowDefinitionLabelStore;
@ -24,7 +24,7 @@ internal class List : Endpoint<Request, Response>
public override void Configure()
{
Get("/workflow-definitions/{id}/labels");
Policies(Constants.PolicyName);
ConfigurePermissions("read:workflow-definition-labels");
}
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)

View file

@ -1,12 +0,0 @@
namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.Update;
/// <summary>
/// Provides policy names accepted by the <see cref="Update"/> endpoint.
/// </summary>
public static class Constants
{
/// <summary>
/// The policy name accepted by this endpoint.
/// </summary>
public const string PolicyName = "UpdateWorkflowDefinitionLabels";
}

View file

@ -1,3 +1,4 @@
using Elsa.Abstractions;
using Elsa.Labels.Contracts;
using Elsa.Labels.Entities;
using Elsa.Workflows;
@ -11,7 +12,7 @@ using Open.Linq.AsyncExtensions;
namespace Elsa.Labels.Endpoints.WorkflowDefinitionLabels.Update;
[PublicAPI]
internal class Update : Endpoint<Request, Response>
internal class Update : ElsaEndpoint<Request, Response>
{
private readonly ILabelStore _labelStore;
private readonly IWorkflowDefinitionStore _workflowDefinitionStore;
@ -42,7 +43,7 @@ internal class Update : Endpoint<Request, Response>
public override void Configure()
{
Post("/workflow-definitions/{id}/labels");
Policies(Constants.PolicyName);
ConfigurePermissions("update:workflow-definition-labels");
}
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)