Started working on the runtime engine for the activities
This commit is contained in:
parent
9a360feb7f
commit
aedae6b80c
10
e-suite.API.Common/e-suite.API.Common/CreateActivity.cs
Normal file
10
e-suite.API.Common/e-suite.API.Common/CreateActivity.cs
Normal 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; }
|
||||
}
|
||||
33
e-suite.API/eSuite.API/Controllers/ActivityController.cs
Normal file
33
e-suite.API/eSuite.API/Controllers/ActivityController.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
15
e-suite.Core/eSuite.Core/Enums/ActivityState.cs
Normal file
15
e-suite.Core/eSuite.Core/Enums/ActivityState.cs
Normal 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
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace e_suite.Workflow.Core.Enums;
|
||||
namespace eSuite.Core.Enums;
|
||||
|
||||
public enum TaskState
|
||||
{
|
||||
@ -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
|
||||
}
|
||||
@ -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; }
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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; } = [];
|
||||
}
|
||||
@ -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; } = [];
|
||||
}
|
||||
@ -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; }
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
DbSet<Contact> Contacts { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user