Compare commits
2 Commits
e9616b18ee
...
839062db74
| Author | SHA1 | Date | |
|---|---|---|---|
| 839062db74 | |||
| a3531e9a3e |
@ -51,22 +51,6 @@ public class GetWorkflowTemplateVersion : IGeneralId
|
||||
public Guid Guid { get; set; }
|
||||
}
|
||||
|
||||
public class EditWorkflowTemplateVersion : IGeneralId
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public Guid Guid { get; set; }
|
||||
|
||||
public long Version { get; set; }
|
||||
|
||||
public GeneralIdRef? DomainId { get; set; }
|
||||
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
public string ActivityNameTemplate { get; set; } = String.Empty;
|
||||
|
||||
public List<TaskDefinition> Tasks { get; set; } = [];
|
||||
}
|
||||
|
||||
public class PatchWorkflowTemplateVersion
|
||||
{
|
||||
|
||||
@ -105,7 +89,7 @@ public interface IWorkflowTemplateManager
|
||||
|
||||
Task<PaginatedData<GetWorkflowTemplateVersion>> GetWorkflowTemplateVersionsAsync(Paging paging, CancellationToken cancellationToken);
|
||||
Task<GetWorkflowTemplateVersion?> GetWorkflowTemplateAsync(GeneralIdRef generalIdRef, CancellationToken cancellationToken);
|
||||
Task EditTemplateVersion(AuditUserDetails auditUserDetails, EditWorkflowTemplateVersion template, CancellationToken cancellationToken);
|
||||
Task EditTemplateVersion(AuditUserDetails auditUserDetails, GetWorkflowTemplateVersion template, CancellationToken cancellationToken);
|
||||
Task PatchTemplateVersion(AuditUserDetails auditUserDetails, IGeneralIdRef templateId, PatchWorkflowTemplateVersion patchTemplate, CancellationToken cancellationToken);
|
||||
Task PostTemplateVersion(AuditUserDetails auditUserDetails, CreateWorkflowTemplateVersion template, CancellationToken cancellationToken);
|
||||
Task DeleteTemplateVersion(AuditUserDetails auditUserDetails, IGeneralIdRef templateId, CancellationToken cancellationToken);
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
using e_suite.API.Common;
|
||||
using e_suite.API.Common.models;
|
||||
using e_suite.Database.Core.Tables.UserManager;
|
||||
using e_suite.Modules.SSOManager;
|
||||
using e_suite.Utilities.Pagination;
|
||||
using eSuite.API.Models;
|
||||
using eSuite.API.security;
|
||||
using eSuite.API.Utilities;
|
||||
using eSuite.Core.Miscellaneous;
|
||||
using eSuite.Core.Security;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace eSuite.API.Controllers;
|
||||
|
||||
@ -92,7 +87,7 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[AccessKey(SecurityAccess.EditWorkflowTemplate)]
|
||||
public async Task<IActionResult> EditTemplateVersion(EditWorkflowTemplateVersion template, CancellationToken cancellationToken = default!)
|
||||
public async Task<IActionResult> EditTemplateVersion(GetWorkflowTemplateVersion template, CancellationToken cancellationToken = default!)
|
||||
{
|
||||
await _workflowTemplateManager.EditTemplateVersion(AuditUserDetails, template, cancellationToken);
|
||||
return Ok();
|
||||
|
||||
@ -69,9 +69,18 @@ public class AuditEngineCore
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentValue = property.CurrentValue == null ? null : Convert.ChangeType(property.CurrentValue, property.CurrentValue!.GetType());
|
||||
var oldValue = property.OriginalValue == null ? null : Convert.ChangeType(property.OriginalValue, property.OriginalValue!.GetType());
|
||||
// Value converter + comparer
|
||||
var converter = property.Metadata.GetValueConverter(); //todo need a unit test for when a value converter is present on the table.
|
||||
var comparer = property.Metadata.GetValueComparer();
|
||||
|
||||
// Raw CLR values
|
||||
var currentClr = property.CurrentValue;
|
||||
var oldClr = property.OriginalValue;
|
||||
|
||||
// Convert to provider (JSON for Tasks)
|
||||
var currentValue = converter?.ConvertToProvider(currentClr) ?? currentClr;
|
||||
var oldValue = converter?.ConvertToProvider(oldClr) ?? oldClr;
|
||||
|
||||
var isSoftDelete =
|
||||
propertyInfo.CustomAttributes.SingleOrDefault(x =>
|
||||
x.AttributeType == typeof(AuditSoftDeleteAttribute));
|
||||
@ -96,9 +105,11 @@ public class AuditEngineCore
|
||||
var currentDisplayName = GetNewName(property) ?? GetEnumAsString(currentValue);
|
||||
var oldDisplayName = GetOldName(property) ?? GetEnumAsString(oldValue);
|
||||
|
||||
var valuesMatch = (currentValue == null && oldValue == null) ||
|
||||
(currentValue != null && currentValue.Equals(oldValue));
|
||||
|
||||
// Compare using EF’s own comparer if available
|
||||
var valuesMatch = comparer != null
|
||||
? comparer.Equals(currentClr, oldClr)
|
||||
: Equals(currentValue, oldValue);
|
||||
|
||||
if (isRedacted)
|
||||
{
|
||||
const string redacted = "<Redacted>";
|
||||
|
||||
@ -165,7 +165,9 @@ public class WorkflowTemplateRepository : RepositoryBase, IWorkflowTemplateRepos
|
||||
|
||||
public IQueryable<e_suite.Database.Core.Tables.Workflow.WorkflowVersion> GetWorkflowVersions()
|
||||
{
|
||||
return DatabaseDbContext.WorkflowVersions.Include( x => x.Domain);
|
||||
return DatabaseDbContext.WorkflowVersions
|
||||
.Include( x => x.Domain)
|
||||
.Include( x => x.Workflow);
|
||||
}
|
||||
|
||||
public async Task EditWorkflowVersionAsync(AuditUserDetails auditUserDetails, e_suite.Database.Core.Tables.Workflow.WorkflowVersion workflowVersion, CancellationToken cancellationToken)
|
||||
|
||||
@ -92,7 +92,7 @@ public class WorkflowTemplateManager : IWorkflowTemplateManager
|
||||
|
||||
public async Task EditTemplateVersion(
|
||||
AuditUserDetails auditUserDetails,
|
||||
EditWorkflowTemplateVersion template,
|
||||
GetWorkflowTemplateVersion template,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
@ -107,6 +107,7 @@ public class WorkflowTemplateManager : IWorkflowTemplateManager
|
||||
version.Deleted = false;
|
||||
version.Version = template.Version+1;
|
||||
version.Tasks = template.Tasks;
|
||||
version.Workflow.Name = template.WorkflowName;
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
@ -14,4 +14,4 @@ public class MilestoneTask : TaskBase
|
||||
// await base.OnActivateAsync();
|
||||
// TaskState = TaskState.ReadyToComplete;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user