Gelöschte Prompts (deakitivert) erzeugen invalide RoutineSteps

This commit is contained in:
2026-06-01 13:08:19 +02:00
parent 9f042b3b33
commit a0d06b16b5
5 changed files with 18 additions and 4 deletions

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -498,7 +498,6 @@ namespace BeWo.Service.Plugins
else if (actionType == AiActionType.ServiceRecordDocumentation)
{
userRightType = UserRightType.AiModuleServiceRecordDocu;
}
else
{

View File

@@ -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);