io zuordnung; signal liste mit eas; links; csv ausgabe
This commit is contained in:
1 parent
d27f00a398
commit
90393f8e4f
2 files changed
+11
No files matched your search
@@ -131,6 +131,11 @@ export class ComponentsService {
|
||||
|
||||
}
|
||||
|
||||
async removeSignalRef(compId: string, signalId: string): Promise<void> {
|
||||
await this.model.updateOne({ 'components._id': new Types.ObjectId(compId) },
|
||||
{ $pull: { 'components.$.signalIds': new Types.ObjectId(signalId) } }).exec();
|
||||
}
|
||||
|
||||
async createSignalRef(compId: string, signalId: string): Promise<ComponentOfUnitDto> {
|
||||
if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('Create Component id ist kein ObjectId')
|
||||
|
||||
@@ -155,6 +160,9 @@ export class ComponentsService {
|
||||
{
|
||||
id: component._id!.toString(),
|
||||
name: component.name,
|
||||
prefix: component.prefix,
|
||||
index: component.index,
|
||||
postfix: component.postfix,
|
||||
type: this.getComponentType(component.type.toString()),
|
||||
properties: component.properties
|
||||
}
|
||||
|
||||
@@ -157,6 +157,9 @@ export class SignalsService {
|
||||
const removedItem = await this.model.findByIdAndDelete(id, { returnDocument: 'after', runValidators: true });
|
||||
|
||||
if (!removedItem) throw new NotFoundException(`Signal ${id} nicht gefunden`);
|
||||
if (removedItem.componentId) {
|
||||
await this.componentService.removeSignalRef(removedItem.componentId.toString(), removedItem._id.toString());
|
||||
}
|
||||
return this.toDto(removedItem);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user