Compare commits

...

2 Commits

Author SHA1 Message Date
5c7daea1a3 Nuget Updated 2026-03-03 20:41:31 +00:00
aedae6b80c Started working on the runtime engine for the activities 2026-03-03 20:28:07 +00:00
14 changed files with 196 additions and 13 deletions

View File

@ -0,0 +1,10 @@
using eSuite.Core.Miscellaneous;
namespace e_suite.API.Common;
public class CreateActivity
{
public GeneralIdRef WorkflowTemplateVersionId { get; set; }
public string ActivityName { get; set; }
}

View File

@ -0,0 +1,33 @@
using e_suite.API.Common;
using eSuite.API.security;
using eSuite.API.Utilities;
using eSuite.Core.Security;
using Microsoft.AspNetCore.Mvc;
namespace eSuite.API.Controllers;
[Route("api/[controller]")]
[ApiController]
public class ActivityController : ESuiteControllerBase
{
/// <summary>
/// Create a new workflow template
/// </summary>
/// <remarks>Create a new user for e-suite. The minimum information needed is the email address, which forms the account user name. Once created the user will get an e-mail asking them to confirm the account.</remarks>
/// <param name="userRegistration">Contains the details that need to be supplied to create the user.</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[Route("create")]
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ProblemDetails))]
[AccessKey(SecurityAccess.AddWorkflowTemplate)]
public async Task<IActionResult> CreateWorkflowTemplateVersion(
[FromBody] CreateActivity template,
CancellationToken cancellationToken = default!
)
{
//await _workflowTemplateManager.PostTemplateVersion(AuditUserDetails, template, cancellationToken);
return Ok();
}
}

View File

@ -0,0 +1,15 @@
using System.ComponentModel;
namespace eSuite.Core.Enums;
public enum ActivityState
{
[Description("The activity is ready to start")]
Pending,
[Description("The activity has been cancelled")]
Cancelled,
[Description("The activity is currently active for processing")]
Active,
[Description("Processing of this activity has finished")]
Completed
}

View File

@ -1,6 +1,6 @@
using System.ComponentModel;
namespace e_suite.Workflow.Core.Enums;
namespace eSuite.Core.Enums;
public enum TaskState
{

View File

@ -249,4 +249,7 @@ public enum SecurityAccess
[Display(Name = "EditWorkflowTemplate", Description = "Delete Workflow Templates", GroupName = "Workflow Templates")]
DeleteWorkflowTemplate = 76,
[Display(Name = "CreateActivity", Description = "Create an activity based on a Workflow Template", GroupName = "Activities")]
CreateActivity = 77
}

View File

@ -1,4 +1,5 @@
using e_suite.Database.Core.Helpers;
using e_suite.Database.Core.Tables.Activity;
using e_suite.Database.Core.Tables.Contacts;
using e_suite.Database.Core.Tables.CustomFields;
using e_suite.Database.Core.Tables.Diagnostics;
@ -72,4 +73,6 @@ public class EsuiteDatabaseDbContext : SunDatabaseEntityContext, IEsuiteDatabase
public DbSet<ExternalKey> ExternalKeys { get; set; }
public DbSet<Workflow> Workflows { get; set; }
public DbSet<WorkflowVersion> WorkflowVersions { get; set; }
public DbSet<Activity> Activities { get; set; }
public DbSet<ActivityTask> ActivityTasks { get; set; }
}

View File

@ -1,4 +1,5 @@
using e_suite.Database.Audit.Tables.Audit;
using e_suite.Database.Core.Tables.Activity;
using e_suite.Database.Core.Tables.Contacts;
using e_suite.Database.Core.Tables.CustomFields;
using e_suite.Database.Core.Tables.Diagnostics;
@ -15,7 +16,7 @@ using e_suite.Database.Core.Tables.Workflow;
namespace e_suite.Database.Core;
public interface IEsuiteDatabaseDbContext : IAudit, ISentinel, IUserManager, IDiagnostics, ISequences, ICustomFields, IForm, IGlossaries, IPrinter, IContact, IMail, IDomain, IMiscellaneous, IWorkflowManager
public interface IEsuiteDatabaseDbContext : IAudit, ISentinel, IUserManager, IDiagnostics, ISequences, ICustomFields, IForm, IGlossaries, IPrinter, IContact, IMail, IDomain, IMiscellaneous, IWorkflowManager, IActivity
{
IQueryable Set(Type entityType);
}

View File

@ -0,0 +1,45 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using e_suite.Database.Audit.Attributes;
using e_suite.Database.Core.Models;
using e_suite.Database.Core.Tables.Workflow;
using eSuite.Core.Enums;
using Microsoft.EntityFrameworkCore;
namespace e_suite.Database.Core.Tables.Activity;
[DisplayName("Activity")]
[Table("Activities", Schema = "Activity")]
[Index(nameof(Name), IsUnique = true)]
[Index(nameof(Guid), IsUnique = true)]
public class Activity : IGeneralId, ISoftDeletable
{
[Key]
public long Id { get; set; }
public Guid Guid { get; set; }
[AuditName]
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public long WorkflowVersionId { get; set; }
[Required]
public ActivityState ActivityState { get; set; } = ActivityState.Pending;
[AuditSoftDelete(true)]
[Required]
[DefaultValue(false)]
public bool Deleted { get; set; }
[AuditLastUpdated]
public DateTimeOffset LastUpdated { get; set; }
[ForeignKey(nameof(WorkflowVersionId))]
public virtual WorkflowVersion WorkflowVersion { get; set; } = null!;
public ICollection<ActivityTask> Tasks { get; set; } = [];
}

View File

@ -0,0 +1,66 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using e_suite.Database.Audit.Attributes;
using e_suite.Database.Core.Models;
using eSuite.Core.Enums;
using Microsoft.EntityFrameworkCore;
namespace e_suite.Database.Core.Tables.Activity;
[DisplayName("Activity")]
[Table("ActivityTasks", Schema = "Activity")]
[Index(nameof(Guid), IsUnique = true)]
[Index(nameof(ActivityId), nameof(ActivityOrdinal), IsUnique = true)]
public class ActivityTask : IGeneralId, ISoftDeletable
{
[Key]
public long Id { get; set; }
public Guid Guid { get; set; }
public long? ParentId { get; set; }
public long ActivityId { get; set; }
public long ActivityOrdinal { get; set; }
/// <summary>
/// This is the guid of the task from the workflow template
/// </summary>
[Required]
public Guid TaskGuid { get; set; }
[AuditName]
[Required]
public string TaskName { get; set; }
public ActivityState ActivityState { get; set; } = ActivityState.Pending;
/// <summary>
/// Contains the date and time when the task was changed from Pending to Active
/// </summary>
public DateTimeOffset? StartDateTime { get; set; }
/// <summary>
/// Contains the date and time when the task was changed from Active to Completed
/// </summary>
public DateTimeOffset? FinishDateTime { get; set; }
[AuditSoftDelete(true)]
[Required]
[DefaultValue(false)]
public bool Deleted { get; set; }
[AuditLastUpdated]
public DateTimeOffset LastUpdated { get; set; }
[ForeignKey(nameof(ActivityId))]
public virtual Activity Activity { get; set; } = null!;
[ForeignKey(nameof(ParentId))]
public virtual ActivityTask ParentTask { get; set; } = null!;
public ICollection<ActivityTask> Tasks { get; set; } = [];
}

View File

@ -0,0 +1,9 @@
using Microsoft.EntityFrameworkCore;
namespace e_suite.Database.Core.Tables.Activity;
public interface IActivity : IDatabaseCore
{
DbSet<Activity> Activities { get; set; }
DbSet<ActivityTask> ActivityTasks { get; set; }
}

View File

@ -1,9 +1,8 @@
using Microsoft.EntityFrameworkCore;
namespace e_suite.Database.Core.Tables.Contacts
namespace e_suite.Database.Core.Tables.Contacts;
public interface IContact : IDatabaseCore
{
public interface IContact : IDatabaseCore
{
DbSet<Contact> Contacts { get; set; }
}
}
DbSet<Contact> Contacts { get; set; }
}

View File

@ -1,6 +1,5 @@
using e_suite.Database.Audit.Attributes;
using e_suite.Database.Core.Models;
using e_suite.Database.Core.Tables.Forms;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

View File

@ -7,9 +7,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit" Version="4.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="6.1.0" />
</ItemGroup>

View File

@ -6,12 +6,12 @@ public enum WorkflowState
{
[Description("The workflow has not yet started")]
Pending,
[Description("The workflow has been cancelled abd wukk bit be processed")]
[Description("The workflow has been cancelled")]
Cancelled,
[Description("The workflow is currently active for user/system interaction and processing")]
Active,
[Description("The active portion of the workflow has finished and the workflow is ready to complete")]
ReadyToComplete,
[Description("Processing of this item has finished the ")]
[Description("Processing of this item has finished")]
Completed
}