Add order by version API and update client
This commit is contained in:
parent
5d956c9b1e
commit
fdf71a4141
17
src/clients/Elsa.Api.Client/Models/OrderDirection.cs
Normal file
17
src/clients/Elsa.Api.Client/Models/OrderDirection.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
namespace Elsa.Api.Client.Models;
|
||||
|
||||
/// <summary>
|
||||
/// The order direction.
|
||||
/// </summary>
|
||||
public enum OrderDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Ascending order.
|
||||
/// </summary>
|
||||
Ascending,
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Descending
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
using Elsa.Api.Client.Models;
|
||||
using Refit;
|
||||
|
||||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
||||
|
|
@ -34,4 +35,14 @@ public class ListWorkflowDefinitionsRequest
|
|||
/// </summary>
|
||||
[AliasAs("label")]
|
||||
public string[]? Labels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The field to order by.
|
||||
/// </summary>
|
||||
public OrderByWorkflowDefinition? OrderBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The order direction.
|
||||
/// </summary>
|
||||
public OrderDirection? OrderDirection { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the order by options for workflow definitions.
|
||||
/// </summary>
|
||||
public enum OrderByWorkflowDefinition
|
||||
{
|
||||
/// <summary>
|
||||
/// Order by the date the workflow definition was created.
|
||||
/// </summary>
|
||||
Created,
|
||||
|
||||
/// <summary>
|
||||
/// Order by the name of the workflow definition.
|
||||
/// </summary>
|
||||
Name,
|
||||
|
||||
/// <summary>
|
||||
/// Order by the version of the workflow definition.
|
||||
/// </summary>
|
||||
Version
|
||||
}
|
||||
|
|
@ -74,8 +74,18 @@ internal class List : ElsaEndpoint<Request, Response>
|
|||
Direction = direction
|
||||
};
|
||||
|
||||
return await _store.FindSummariesAsync<string>(filter, order, pageArgs, cancellationToken);
|
||||
return await _store.FindSummariesAsync(filter, order, pageArgs, cancellationToken);
|
||||
}
|
||||
case OrderByWorkflowDefinition.Version:
|
||||
{
|
||||
var order = new WorkflowDefinitionOrder<int>
|
||||
{
|
||||
KeySelector = p => p.Version,
|
||||
Direction = direction
|
||||
};
|
||||
|
||||
return await _store.FindSummariesAsync(filter, order, pageArgs, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,5 +13,10 @@ public enum OrderByWorkflowDefinition
|
|||
/// <summary>
|
||||
/// Order by the name of the workflow definition.
|
||||
/// </summary>
|
||||
Name
|
||||
Name,
|
||||
|
||||
/// <summary>
|
||||
/// Order by the version of the workflow definition.
|
||||
/// </summary>
|
||||
Version
|
||||
}
|
||||
Loading…
Reference in a new issue