Gelöschte Prompts (deakitivert) erzeugen invalide RoutineSteps
This commit is contained in:
@@ -75,6 +75,7 @@ namespace BeWo.View.Detail.AI
|
||||
var step = new AiPromptbausteinRoutineStepDC();
|
||||
step.PromptReference = prompt.DataContract;
|
||||
step.ReferenceVersion = prompt.DataContract.Version.Value;
|
||||
step.IsValid = true;
|
||||
var step_vm = new AiPromptbausteinRoutineStepVM(step);
|
||||
|
||||
ViewModel.ViewModel.Steps.VMList.Add(step_vm);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.ServiceImplementations.Enhanced;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -49,12 +50,25 @@ namespace BeWo.Service.BusinessLogic
|
||||
}
|
||||
|
||||
public override void Deactivate(AiPromptbausteinFolderDC dc)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public void Deactivate(AiPromptbausteinFolderDC dc, AiPromptbausteinPromptLogic prompt_logic)
|
||||
{
|
||||
if(dc.SubFolders?.Any() ?? false)
|
||||
{
|
||||
foreach(var subfolder in dc.SubFolders)
|
||||
{
|
||||
Deactivate(subfolder);
|
||||
Deactivate(subfolder, prompt_logic);
|
||||
}
|
||||
}
|
||||
|
||||
if(dc.SubPrompts?.Any() ?? false)
|
||||
{
|
||||
foreach (var prompt in dc.SubPrompts)
|
||||
{
|
||||
prompt_logic.Deactivate(prompt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pDataContract.Position = pEntity.Position;
|
||||
pDataContract.PromptReference = MapperFactory.AiPromptbausteinPrompt.MapToNewDC(pEntity.PromptReference);
|
||||
pDataContract.ReferenceVersion = pEntity.ReferenceVersion;
|
||||
pDataContract.IsValid = (pEntity.IsActive == ActivationTypeId.Active);
|
||||
pDataContract.IsValid = (pEntity.PromptReference.IsActive == ActivationTypeId.Active);
|
||||
//&& (pDataContract.PromptReference.Creator == null
|
||||
// || pDataContract.PromptReference.Creator.EmployeeOid == CurrentUser.Oid
|
||||
// || pDataContract.PromptReference.IsPublic);
|
||||
|
||||
@@ -498,7 +498,6 @@ namespace BeWo.Service.Plugins
|
||||
else if (actionType == AiActionType.ServiceRecordDocumentation)
|
||||
{
|
||||
userRightType = UserRightType.AiModuleServiceRecordDocu;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
|
||||
=> GetRoutineLogic().Update(routine);
|
||||
|
||||
public void DeleteAiPromptbausteinFolder(AiPromptbausteinFolderDC folder)
|
||||
=> GetFolderLogic().Deactivate(folder);
|
||||
=> GetFolderLogic().Deactivate(folder, GetPromptLogic());
|
||||
|
||||
public void DeleteAiPromptbausteinPrompt(AiPromptbausteinPromptDC prompt)
|
||||
=> GetPromptLogic().Deactivate(prompt);
|
||||
|
||||
Reference in New Issue
Block a user