Add field "ExternalUserId" to table "WorkflowInstance" and change related classes
This commit is contained in:
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
@@ -7,5 +7,6 @@
|
|||||||
<add key="Elsa 3 Preview" value="https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json" />
|
<add key="Elsa 3 Preview" value="https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json" />
|
||||||
<add key="Webhooks Core Preview" value="https://f.feedz.io/sfmskywalker/webhooks-core/nuget/index.json" />
|
<add key="Webhooks Core Preview" value="https://f.feedz.io/sfmskywalker/webhooks-core/nuget/index.json" />
|
||||||
<add key="Windows Package source" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages" />
|
<add key="Windows Package source" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages" />
|
||||||
|
<add key="Local Package source" value="D:\MyNugetPackages" />
|
||||||
</packageSources>
|
</packageSources>
|
||||||
</configuration>
|
</configuration>
|
||||||
+2
@@ -12,6 +12,8 @@ public record WorkflowInstanceSummary
|
|||||||
/// <summary>The ID of the workflow instance.</summary>
|
/// <summary>The ID of the workflow instance.</summary>
|
||||||
public string Id { get; set; } = default!;
|
public string Id { get; set; } = default!;
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>The ID of the workflow definition.</summary>
|
/// <summary>The ID of the workflow definition.</summary>
|
||||||
public string DefinitionId { get; set; } = default!;
|
public string DefinitionId { get; set; } = default!;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ public class WorkflowState : Entity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string DefinitionId { get; set; } = default!;
|
public string DefinitionId { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// External user's ID.
|
||||||
|
/// </summary>
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The workflow definition version.
|
/// The workflow definition version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace Elsa.Dapper.Modules.Management.Records;
|
|||||||
internal class WorkflowInstanceRecord : Record
|
internal class WorkflowInstanceRecord : Record
|
||||||
{
|
{
|
||||||
public string DefinitionId { get; set; } = null!;
|
public string DefinitionId { get; set; } = null!;
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
public string DefinitionVersionId { get; set; } = null!;
|
public string DefinitionVersionId { get; set; } = null!;
|
||||||
public int Version { get; set; }
|
public int Version { get; set; }
|
||||||
public string WorkflowState { get; set; } = null!;
|
public string WorkflowState { get; set; } = null!;
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ internal class DapperWorkflowInstanceStore(Store<WorkflowInstanceRecord> store,
|
|||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = source.Id,
|
Id = source.Id,
|
||||||
|
ExternalUserId = source.ExternalUserId,
|
||||||
DefinitionId = source.DefinitionId,
|
DefinitionId = source.DefinitionId,
|
||||||
DefinitionVersionId = source.DefinitionVersionId,
|
DefinitionVersionId = source.DefinitionVersionId,
|
||||||
Version = source.Version,
|
Version = source.Version,
|
||||||
@@ -242,6 +243,7 @@ internal class DapperWorkflowInstanceStore(Store<WorkflowInstanceRecord> store,
|
|||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = source.Id,
|
Id = source.Id,
|
||||||
|
ExternalUserId = source.ExternalUserId,
|
||||||
DefinitionId = source.DefinitionId,
|
DefinitionId = source.DefinitionId,
|
||||||
DefinitionVersionId = source.DefinitionVersionId,
|
DefinitionVersionId = source.DefinitionVersionId,
|
||||||
Version = source.Version,
|
Version = source.Version,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Terms and Conditions of Use, Reproduction and Distribution are permitted only for Caspian Company.
|
||||||
|
|
||||||
|
Copyright [2025] Caspian Company
|
||||||
+235
@@ -0,0 +1,235 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Elsa.EntityFrameworkCore.Modules.Management;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ManagementElsaDbContext))]
|
||||||
|
[Migration("20250818170340_AddExternalUserId")]
|
||||||
|
partial class AddExternalUserId
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasDefaultSchema("Elsa")
|
||||||
|
.HasAnnotation("ProductVersion", "9.0.7")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<byte[]>("BinaryData")
|
||||||
|
.HasColumnType("varbinary(max)");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("CreatedAt")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<string>("Data")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("DefinitionId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLatest")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPublished")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsReadonly")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSystem")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("MaterializerContext")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("MaterializerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("StringData")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("TenantId")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ToolVersion")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool?>("UsableAsActivity")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("IsLatest")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_IsLatest");
|
||||||
|
|
||||||
|
b.HasIndex("IsPublished")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_IsPublished");
|
||||||
|
|
||||||
|
b.HasIndex("IsSystem")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_IsSystem");
|
||||||
|
|
||||||
|
b.HasIndex("Name")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_Name");
|
||||||
|
|
||||||
|
b.HasIndex("TenantId")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_TenantId");
|
||||||
|
|
||||||
|
b.HasIndex("UsableAsActivity")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity");
|
||||||
|
|
||||||
|
b.HasIndex("Version")
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_Version");
|
||||||
|
|
||||||
|
b.HasIndex("DefinitionId", "Version")
|
||||||
|
.IsUnique()
|
||||||
|
.HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version");
|
||||||
|
|
||||||
|
b.ToTable("WorkflowDefinitions", "Elsa");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("CorrelationId")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("CreatedAt")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<string>("Data")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("DataCompressionAlgorithm")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("DefinitionId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("DefinitionVersionId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<long?>("ExternalUserId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("FinishedAt")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<int>("IncidentCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("IsExecuting")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("IsSystem")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ParentWorkflowInstanceId")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("SubStatus")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("TenantId")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("UpdatedAt")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CorrelationId")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_CorrelationId");
|
||||||
|
|
||||||
|
b.HasIndex("CreatedAt")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_CreatedAt");
|
||||||
|
|
||||||
|
b.HasIndex("DefinitionId")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_DefinitionId");
|
||||||
|
|
||||||
|
b.HasIndex("FinishedAt")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_FinishedAt");
|
||||||
|
|
||||||
|
b.HasIndex("IsExecuting")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_IsExecuting");
|
||||||
|
|
||||||
|
b.HasIndex("IsSystem")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_IsSystem");
|
||||||
|
|
||||||
|
b.HasIndex("Name")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_Name");
|
||||||
|
|
||||||
|
b.HasIndex("Status")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_Status");
|
||||||
|
|
||||||
|
b.HasIndex("SubStatus")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_SubStatus");
|
||||||
|
|
||||||
|
b.HasIndex("TenantId")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_TenantId");
|
||||||
|
|
||||||
|
b.HasIndex("UpdatedAt")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_UpdatedAt");
|
||||||
|
|
||||||
|
b.HasIndex("Status", "DefinitionId")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId");
|
||||||
|
|
||||||
|
b.HasIndex("Status", "SubStatus")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_Status_SubStatus");
|
||||||
|
|
||||||
|
b.HasIndex("SubStatus", "DefinitionId")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId");
|
||||||
|
|
||||||
|
b.HasIndex("Status", "SubStatus", "DefinitionId", "Version")
|
||||||
|
.HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version");
|
||||||
|
|
||||||
|
b.ToTable("WorkflowInstances", "Elsa");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddExternalUserId : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<long>(
|
||||||
|
name: "ExternalUserId",
|
||||||
|
schema: "Elsa",
|
||||||
|
table: "WorkflowInstances",
|
||||||
|
type: "bigint",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ExternalUserId",
|
||||||
|
schema: "Elsa",
|
||||||
|
table: "WorkflowInstances");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-1
@@ -18,7 +18,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasDefaultSchema("Elsa")
|
.HasDefaultSchema("Elsa")
|
||||||
.HasAnnotation("ProductVersion", "8.0.12")
|
.HasAnnotation("ProductVersion", "9.0.7")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
@@ -139,6 +139,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<long?>("ExternalUserId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("FinishedAt")
|
b.Property<DateTimeOffset?>("FinishedAt")
|
||||||
.HasColumnType("datetimeoffset");
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dotnet ef migrations add AddExternalUserId --context ManagementElsaDbContext --project D:\CaspianProjects\Caspian.Elsa.Core\src\modules\Elsa.EntityFrameworkCore.SqlServer\Elsa.EntityFrameworkCore.SqlServer.csproj --output-dir Migrations\Management
|
||||||
|
Update-Database -Context ManagementElsaDbContext
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,35 @@
|
|||||||
|
# Caspian.NextBank.Workflow
|
||||||
|
|
||||||
|
Workflows for project "NextBankParsian"
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
```bash
|
||||||
|
dotnet add package Caspian.NextBank.Workflow
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
install-package Caspian.NextBank.Workflow
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage Example
|
||||||
|
In your Program.cs :
|
||||||
|
```csharp
|
||||||
|
builder.Services.AddMongoLogger<LogModel>(builder.Configuration);
|
||||||
|
|
||||||
|
builder.AddWorkflowServices("DefaultConnection");
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.UseMongoLogger<LogModel>();
|
||||||
|
|
||||||
|
app.UseWorkflow();
|
||||||
|
```
|
||||||
|
Then use service "WfService"
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Start new instance of every workflow
|
||||||
|
- Publish event and get next step information
|
||||||
|
- Get last status of workflow instance
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
### 1.0.0-alfa
|
||||||
|
- Initial prerelease
|
||||||
@@ -114,6 +114,7 @@ public class MassTransitWorkflowDispatcher(
|
|||||||
var workflowInstanceOptions = new WorkflowInstanceOptions
|
var workflowInstanceOptions = new WorkflowInstanceOptions
|
||||||
{
|
{
|
||||||
WorkflowInstanceId = request.WorkflowInstanceId,
|
WorkflowInstanceId = request.WorkflowInstanceId,
|
||||||
|
ExternalUserId = request.ExternalUserId,
|
||||||
Input = request.Input,
|
Input = request.Input,
|
||||||
Properties = request.Properties,
|
Properties = request.Properties,
|
||||||
CorrelationId = request.CorrelationId
|
CorrelationId = request.CorrelationId
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ internal static class ExpressionHelpers
|
|||||||
workflowInstance => new()
|
workflowInstance => new()
|
||||||
{
|
{
|
||||||
Id = workflowInstance.Id,
|
Id = workflowInstance.Id,
|
||||||
|
ExternalUserId = workflowInstance.ExternalUserId,
|
||||||
DefinitionId = workflowInstance.DefinitionId,
|
DefinitionId = workflowInstance.DefinitionId,
|
||||||
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
||||||
Version = workflowInstance.Version,
|
Version = workflowInstance.Version,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ internal class WorkflowInstanceMapper : ResponseMapper<WorkflowInstanceModel, Wo
|
|||||||
public override WorkflowInstanceModel FromEntity(WorkflowInstance e) => new()
|
public override WorkflowInstanceModel FromEntity(WorkflowInstance e) => new()
|
||||||
{
|
{
|
||||||
Id = e.Id,
|
Id = e.Id,
|
||||||
|
ExternalUserId = e.ExternalUserId,
|
||||||
DefinitionId = e.DefinitionId,
|
DefinitionId = e.DefinitionId,
|
||||||
DefinitionVersionId = e.DefinitionVersionId,
|
DefinitionVersionId = e.DefinitionVersionId,
|
||||||
Version = e.Version,
|
Version = e.Version,
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public class WorkflowInstanceModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Id { get; set; } = default!;
|
public string Id { get; set; } = default!;
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ID of the workflow definition.
|
/// The ID of the workflow definition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -258,6 +258,8 @@ public partial class WorkflowExecutionContext : IExecutionContext
|
|||||||
/// A unique ID of the execution context.
|
/// A unique ID of the execution context.
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IActivity Activity => Workflow;
|
public IActivity Activity => Workflow;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class WorkflowStateExtractor(ILogger<WorkflowStateExtractor> logger) : IW
|
|||||||
var state = new WorkflowState
|
var state = new WorkflowState
|
||||||
{
|
{
|
||||||
Id = workflowExecutionContext.Id,
|
Id = workflowExecutionContext.Id,
|
||||||
|
ExternalUserId = workflowExecutionContext.ExternalUserId,
|
||||||
DefinitionId = workflowExecutionContext.Workflow.Identity.DefinitionId,
|
DefinitionId = workflowExecutionContext.Workflow.Identity.DefinitionId,
|
||||||
DefinitionVersionId = workflowExecutionContext.Workflow.Identity.Id,
|
DefinitionVersionId = workflowExecutionContext.Workflow.Identity.Id,
|
||||||
DefinitionVersion = workflowExecutionContext.Workflow.Identity.Version,
|
DefinitionVersion = workflowExecutionContext.Workflow.Identity.Version,
|
||||||
@@ -47,6 +48,7 @@ public class WorkflowStateExtractor(ILogger<WorkflowStateExtractor> logger) : IW
|
|||||||
public async Task<WorkflowExecutionContext> ApplyAsync(WorkflowExecutionContext workflowExecutionContext, WorkflowState state)
|
public async Task<WorkflowExecutionContext> ApplyAsync(WorkflowExecutionContext workflowExecutionContext, WorkflowState state)
|
||||||
{
|
{
|
||||||
workflowExecutionContext.Id = state.Id;
|
workflowExecutionContext.Id = state.Id;
|
||||||
|
workflowExecutionContext.ExternalUserId = state.ExternalUserId;
|
||||||
workflowExecutionContext.CorrelationId = state.CorrelationId;
|
workflowExecutionContext.CorrelationId = state.CorrelationId;
|
||||||
workflowExecutionContext.Name = state.Name;
|
workflowExecutionContext.Name = state.Name;
|
||||||
workflowExecutionContext.ParentWorkflowInstanceId = state.ParentWorkflowInstanceId;
|
workflowExecutionContext.ParentWorkflowInstanceId = state.ParentWorkflowInstanceId;
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ public class WorkflowState
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// External user's ID.
|
||||||
|
/// </summary>
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The workflow definition ID.
|
/// The workflow definition ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ namespace Elsa.Workflows.Management.Entities;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class WorkflowInstance : Entity
|
public class WorkflowInstance : Entity
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// External user's id
|
||||||
|
/// </summary>
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ID of the workflow definition.
|
/// The ID of the workflow definition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ public class WorkflowInstanceFilter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Filter workflow instances by IDs.
|
/// Filter workflow instances by IDs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -130,6 +132,7 @@ public class WorkflowInstanceFilter
|
|||||||
var filter = this;
|
var filter = this;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(filter.Id)) query = query.Where(x => x.Id == filter.Id);
|
if (!string.IsNullOrWhiteSpace(filter.Id)) query = query.Where(x => x.Id == filter.Id);
|
||||||
|
if (filter.ExternalUserId.HasValue) query = query.Where(x => x.ExternalUserId == filter.ExternalUserId);
|
||||||
if (filter.Ids != null) query = query.Where(x => filter.Ids.Contains(x.Id));
|
if (filter.Ids != null) query = query.Where(x => filter.Ids.Contains(x.Id));
|
||||||
if (!string.IsNullOrWhiteSpace(filter.DefinitionId)) query = query.Where(x => x.DefinitionId == filter.DefinitionId);
|
if (!string.IsNullOrWhiteSpace(filter.DefinitionId)) query = query.Where(x => x.DefinitionId == filter.DefinitionId);
|
||||||
if (!string.IsNullOrWhiteSpace(filter.DefinitionVersionId)) query = query.Where(x => x.DefinitionVersionId == filter.DefinitionVersionId);
|
if (!string.IsNullOrWhiteSpace(filter.DefinitionVersionId)) query = query.Where(x => x.DefinitionVersionId == filter.DefinitionVersionId);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class WorkflowStateMapper
|
|||||||
public void Apply(WorkflowState source, WorkflowInstance target)
|
public void Apply(WorkflowState source, WorkflowInstance target)
|
||||||
{
|
{
|
||||||
target.Id = source.Id;
|
target.Id = source.Id;
|
||||||
|
target.ExternalUserId = source.ExternalUserId;
|
||||||
target.CreatedAt = source.CreatedAt;
|
target.CreatedAt = source.CreatedAt;
|
||||||
target.DefinitionId = source.DefinitionId;
|
target.DefinitionId = source.DefinitionId;
|
||||||
target.DefinitionVersionId = source.DefinitionVersionId;
|
target.DefinitionVersionId = source.DefinitionVersionId;
|
||||||
@@ -66,6 +67,7 @@ public class WorkflowStateMapper
|
|||||||
|
|
||||||
var workflowState = source.WorkflowState;
|
var workflowState = source.WorkflowState;
|
||||||
workflowState.Id = source.Id;
|
workflowState.Id = source.Id;
|
||||||
|
workflowState.ExternalUserId = source.ExternalUserId;
|
||||||
workflowState.CreatedAt = source.CreatedAt;
|
workflowState.CreatedAt = source.CreatedAt;
|
||||||
workflowState.DefinitionId = source.DefinitionId;
|
workflowState.DefinitionId = source.DefinitionId;
|
||||||
workflowState.DefinitionVersionId = source.DefinitionVersionId;
|
workflowState.DefinitionVersionId = source.DefinitionVersionId;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class WorkflowInstanceSummary
|
|||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = workflowInstance.Id,
|
Id = workflowInstance.Id,
|
||||||
|
ExternalUserId = workflowInstance.ExternalUserId,
|
||||||
DefinitionId = workflowInstance.DefinitionId,
|
DefinitionId = workflowInstance.DefinitionId,
|
||||||
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
||||||
Version = workflowInstance.Version,
|
Version = workflowInstance.Version,
|
||||||
@@ -36,6 +37,7 @@ public class WorkflowInstanceSummary
|
|||||||
public static Expression<Func<WorkflowInstance, WorkflowInstanceSummary>> FromInstanceExpression() => workflowInstance => new()
|
public static Expression<Func<WorkflowInstance, WorkflowInstanceSummary>> FromInstanceExpression() => workflowInstance => new()
|
||||||
{
|
{
|
||||||
Id = workflowInstance.Id,
|
Id = workflowInstance.Id,
|
||||||
|
ExternalUserId = workflowInstance.ExternalUserId,
|
||||||
DefinitionId = workflowInstance.DefinitionId,
|
DefinitionId = workflowInstance.DefinitionId,
|
||||||
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
||||||
Version = workflowInstance.Version,
|
Version = workflowInstance.Version,
|
||||||
@@ -53,6 +55,8 @@ public class WorkflowInstanceSummary
|
|||||||
/// <summary>The ID of the workflow instance.</summary>
|
/// <summary>The ID of the workflow instance.</summary>
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>The ID of the workflow definition.</summary>
|
/// <summary>The ID of the workflow definition.</summary>
|
||||||
public string DefinitionId { get; set; } = null!;
|
public string DefinitionId { get; set; } = null!;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ public class WorkflowInstanceOptions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? CorrelationId { get; set; }
|
public string? CorrelationId { get; set; }
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the workflow instance.
|
/// The name of the workflow instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class WorkflowInstanceFactory(IIdentityGenerator identityGenerator, ISyst
|
|||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = string.IsNullOrEmpty(options?.WorkflowInstanceId) ? identityGenerator.GenerateId() : options.WorkflowInstanceId,
|
Id = string.IsNullOrEmpty(options?.WorkflowInstanceId) ? identityGenerator.GenerateId() : options.WorkflowInstanceId,
|
||||||
|
ExternalUserId = options?.ExternalUserId,
|
||||||
DefinitionId = workflow.Identity.DefinitionId,
|
DefinitionId = workflow.Identity.DefinitionId,
|
||||||
DefinitionVersionId = workflow.Identity.Id,
|
DefinitionVersionId = workflow.Identity.Id,
|
||||||
DefinitionVersion = workflow.Identity.Version,
|
DefinitionVersion = workflow.Identity.Version,
|
||||||
@@ -40,6 +41,7 @@ public class WorkflowInstanceFactory(IIdentityGenerator identityGenerator, ISyst
|
|||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Id = workflowState.Id,
|
Id = workflowState.Id,
|
||||||
|
ExternalUserId = workflowState.ExternalUserId,
|
||||||
ParentWorkflowInstanceId = workflowState.ParentWorkflowInstanceId,
|
ParentWorkflowInstanceId = workflowState.ParentWorkflowInstanceId,
|
||||||
WorkflowState = workflowState,
|
WorkflowState = workflowState,
|
||||||
DefinitionId = workflowState.DefinitionId,
|
DefinitionId = workflowState.DefinitionId,
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class CreateWorkflowInstanceRequest
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? CorrelationId { get; set; }
|
public string? CorrelationId { get; set; }
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the workflow instance to be created.
|
/// The name of the workflow instance to be created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ public class DispatchTriggerWorkflowsRequest(string activityTypeName, object boo
|
|||||||
/// Any properties to attach to the workflow instance.
|
/// Any properties to attach to the workflow instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDictionary<string, object>? Properties { get; set; }
|
public IDictionary<string, object>? Properties { get; set; }
|
||||||
|
|
||||||
|
public long? ExternalUserId { get; set; }
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ public class LocalWorkflowClient(
|
|||||||
var options = new WorkflowInstanceOptions
|
var options = new WorkflowInstanceOptions
|
||||||
{
|
{
|
||||||
WorkflowInstanceId = WorkflowInstanceId,
|
WorkflowInstanceId = WorkflowInstanceId,
|
||||||
|
ExternalUserId = request.ExternalUserId,
|
||||||
CorrelationId = request.CorrelationId,
|
CorrelationId = request.CorrelationId,
|
||||||
Name = request.Name,
|
Name = request.Name,
|
||||||
ParentWorkflowInstanceId = request.ParentId,
|
ParentWorkflowInstanceId = request.ParentId,
|
||||||
@@ -153,6 +154,7 @@ public class LocalWorkflowClient(
|
|||||||
var options = new WorkflowInstanceOptions
|
var options = new WorkflowInstanceOptions
|
||||||
{
|
{
|
||||||
WorkflowInstanceId = WorkflowInstanceId,
|
WorkflowInstanceId = WorkflowInstanceId,
|
||||||
|
ExternalUserId = request.ExternalUserId,
|
||||||
CorrelationId = request.CorrelationId,
|
CorrelationId = request.CorrelationId,
|
||||||
Name = request.Name,
|
Name = request.Name,
|
||||||
ParentWorkflowInstanceId = request.ParentId,
|
ParentWorkflowInstanceId = request.ParentId,
|
||||||
|
|||||||
Reference in New Issue
Block a user