diff --git a/src/_dto/anlagen/components.ts b/src/_dto/anlagen/components.ts index ce7ce53..3a087ed 100644 --- a/src/_dto/anlagen/components.ts +++ b/src/_dto/anlagen/components.ts @@ -1,3 +1,5 @@ +import { SignalCreateDto } from "./signals"; + export enum ComponentTypes { UNKNOWN = "unknown", ANTRIEB = "Antrieb", @@ -9,6 +11,7 @@ export enum ComponentTypes { DREHZALHL = "Drehzahl", VORORT = "Vorortbedienung", UEBERWACHUNG = "Überwachung", + FUELLSTAND = "Fuellstand", } @@ -24,7 +27,6 @@ export class ComponentResponseDto { postfix?: string; index?:number; type!: ComponentTypes; - signalIds!: string[]; properties?: Record; } @@ -34,7 +36,6 @@ export class ComponentUpdateDto { postfix?: string; index?:number; type?: ComponentTypes; - signalIds?: string[]; properties?: Record; } @@ -44,6 +45,5 @@ export class ComponentCreateDto { postfix?: string; index?:number; type!: ComponentTypes; - signalIds?: string[]; properties?: Record; } \ No newline at end of file diff --git a/src/_dto/anlagen/units.ts b/src/_dto/anlagen/units.ts index f7587d4..da06769 100644 --- a/src/_dto/anlagen/units.ts +++ b/src/_dto/anlagen/units.ts @@ -7,6 +7,7 @@ export enum UnitTypeDto { BRECHER = 'Brecher', WEICHE = 'Weiche', SIEB = 'Sieb', + ANTRIEB = 'Antrieb', } @@ -19,6 +20,7 @@ export class UnitResponseDto { anlageId?: string; bmk?: string; prefix?: string; + postfix?: string; info?: string; type!: UnitTypeDto; groupId!: string; @@ -28,20 +30,22 @@ export class UnitResponseDto { export class UnitCreateDto { name!: string; anlageId?: string; - bmk!: string; - prefix!: string; - info!: string; + bmk?: string; + prefix?: string; + postfix?: string; + info?: string; type!: UnitTypeDto; - groupId!: string; - components!: ComponentResponseDto[]; + groupId?: string; + components?: ComponentResponseDto[]; } export class UnitUpdateBaseDto { name?: string; anlageId?: string; - bmk!: string; - prefix!: string; - info!: string; + bmk?: string; + prefix?: string; + postfix?: string; + info?: string; type?: UnitTypeDto; groupId?: string; diff --git a/src/_dto/draw.dto.ts b/src/_dto/draw.dto.ts index aef1180..66fdae5 100644 --- a/src/_dto/draw.dto.ts +++ b/src/_dto/draw.dto.ts @@ -12,6 +12,7 @@ export class DrawDto { px_width!:number; offset_x!:number; offset_y!:number; + xaml?:string } diff --git a/src/_schemas/anlagen/component.ts b/src/_schemas/anlagen/component.ts index d8e937d..b6203db 100644 --- a/src/_schemas/anlagen/component.ts +++ b/src/_schemas/anlagen/component.ts @@ -23,11 +23,6 @@ export class Component { @Prop({ required: true }) type!: string; - @Prop({ - type: [{ type: Types.ObjectId, ref: 'Signal' }], - default: [], - }) - signalIds!: Types.ObjectId[]; @Prop({ type: Object }) properties?: Record; diff --git a/src/_schemas/anlagen/groups.ts b/src/_schemas/anlagen/groups.ts index fb98c16..1f44474 100644 --- a/src/_schemas/anlagen/groups.ts +++ b/src/_schemas/anlagen/groups.ts @@ -5,6 +5,8 @@ export type GroupDocument = HydratedDocument; @Schema({ timestamps: true }) export class Group { + @Prop({ required: true }) + anlageId!: Types.ObjectId; @Prop({ required: true }) name!: string; diff --git a/src/_schemas/anlagen/units.ts b/src/_schemas/anlagen/units.ts index a4e1c8b..a2b41bc 100644 --- a/src/_schemas/anlagen/units.ts +++ b/src/_schemas/anlagen/units.ts @@ -15,8 +15,8 @@ export class Unit { @Prop({ required: true }) name!: string; - @Prop({ required: false }) - anlageId?: string; + @Prop({ required: true }) + anlageId!: Types.ObjectId; @Prop() bmk?: string; @@ -24,6 +24,9 @@ export class Unit { @Prop() prefix?: string; + @Prop() + postfix?: string; + @Prop() info?: string; @@ -34,8 +37,8 @@ export class Unit { }) type!: UnitTypeDto; - @Prop({ type: Types.ObjectId, ref: 'Group', required: true, index: true, }) - groupId!: Types.ObjectId; + @Prop({ type: Types.ObjectId, ref: 'Group', index: true, }) + groupId?: Types.ObjectId; @Prop({ type: [ComponentSchema], diff --git a/src/anlagen/anlagen.module.ts b/src/anlagen/anlagen.module.ts index 3519797..a2aee54 100644 --- a/src/anlagen/anlagen.module.ts +++ b/src/anlagen/anlagen.module.ts @@ -7,7 +7,13 @@ import { VisualizationsModule } from './visualizations/visualizations.module'; import { ComponentsModule } from './components/components.module'; @Module({ - imports: [GroupsModule, UnitsModule, SignalsModule, IosModule, VisualizationsModule, ComponentsModule], + imports: [ + GroupsModule, + UnitsModule, + SignalsModule, + IosModule, + VisualizationsModule, + ComponentsModule], }) export class AnlagenModule {} diff --git a/src/anlagen/components/components.controller.ts b/src/anlagen/components/components.controller.ts index 97c2b03..ada0712 100644 --- a/src/anlagen/components/components.controller.ts +++ b/src/anlagen/components/components.controller.ts @@ -1,5 +1,6 @@ -import { Controller, Get, Param } from '@nestjs/common'; +import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'; import { ComponentsService } from './components.service'; +import { ComponentCreateDto, ComponentUpdateDto } from 'src/_dto/anlagen/components'; @Controller('rk2/components') export class ComponentsController { @@ -10,4 +11,25 @@ export class ComponentsController { return this.service.findOne(id); } + @Post(':compId') + create(@Param('compId') compId: string, @Body() dto: ComponentCreateDto) { + console.log(dto) + return this.service.create(compId, dto); + } + + @Patch(':compId') + update(@Param('compId') compId: string, @Body() dto: ComponentUpdateDto) { + console.log(dto) + return this.service.update(compId, dto); + } + + @Delete(':compId') + remove(@Param('compId') compId: string) { + return this.service.delete(compId); + } + + @Delete(':compId/deleteProp/:propName') + deleteProp(@Param('compId') compId: string,@Param('propName') propName: string) { + return this.service.deletePropertie(compId,propName); + } } diff --git a/src/anlagen/components/components.module.ts b/src/anlagen/components/components.module.ts index 19e955b..e8333ce 100644 --- a/src/anlagen/components/components.module.ts +++ b/src/anlagen/components/components.module.ts @@ -1,13 +1,18 @@ -import { Module } from '@nestjs/common'; +import { forwardRef, Module } from '@nestjs/common'; import { ComponentsService } from './components.service'; import { ComponentsController } from './components.controller'; import { MongooseModule } from '@nestjs/mongoose'; import { Unit, UnitSchema } from 'src/_schemas/anlagen/units'; +import { SignalsModule } from '../signals/signals.module'; @Module({ controllers: [ComponentsController], providers: [ComponentsService], - imports: [MongooseModule.forFeature([{ name: Unit.name, schema: UnitSchema }], "anlagen")], - + imports: [ + MongooseModule.forFeature([{ name: Unit.name, schema: UnitSchema }], "anlagen"), + forwardRef(() => SignalsModule) + ], + exports: [ComponentsService] }) export class ComponentsModule { } + \ No newline at end of file diff --git a/src/anlagen/components/components.service.ts b/src/anlagen/components/components.service.ts index 983a103..14b62cc 100644 --- a/src/anlagen/components/components.service.ts +++ b/src/anlagen/components/components.service.ts @@ -1,23 +1,28 @@ -import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common'; +import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model, Types } from 'mongoose'; -import { ComponentOfUnitDto, ComponentResponseDto, ComponentTypes } from 'src/_dto/anlagen/components'; -import { UnitResponseDto } from 'src/_dto/anlagen/units'; +import { ComponentCreateDto, ComponentOfUnitDto, ComponentResponseDto, ComponentTypes, ComponentUpdateDto } from 'src/_dto/anlagen/components'; import { Component } from 'src/_schemas/anlagen/component'; import { Unit } from 'src/_schemas/anlagen/units'; +import { SignalsService } from '../signals/signals.service'; @Injectable() export class ComponentsService { - constructor(@InjectModel(Unit.name, "anlagen") private model: Model) { } - + constructor( + @InjectModel(Unit.name, "anlagen") private model: Model, + @Inject(forwardRef(() => SignalsService)) + private readonly signalsService: SignalsService, + ) { } + //------------------------------------------------------------------------- //--- Find BY component id + //------------------------------------------------------------------------- async findOne(id: string): Promise { - if(!Types.ObjectId.isValid(id)) throw new NotFoundException('id ist kein ObjectId') - - + if (!Types.ObjectId.isValid(id)) throw new NotFoundException('id ist kein ObjectId') + + const item = await this.model.findOne({ 'components._id': id }).exec(); - + if (!item) throw new NotFoundException(`Keine Unit mit der Componenten Id: ${id} gefunden`) let comp = item.components.find((c) => c._id?.toString() === id); @@ -28,6 +33,119 @@ export class ComponentsService { }; } + //------------------------------------------------------------------------- + // Create Component + //------------------------------------------------------------------------- + async create(unitId: string, dto: ComponentCreateDto): Promise { + if (!Types.ObjectId.isValid(unitId)) throw new NotFoundException('id ist kein ObjectId') + + const componentId = new Types.ObjectId(); + + const create = { + _id: componentId, + ...dto, + name: dto.name ? dto.name : "unbenannt", + type: dto.type ? dto.type : ComponentTypes.UNKNOWN + } + + const item = await this.model.findByIdAndUpdate(unitId, + { $push: { components: create } }, + { returnDocument: 'after' }).exec(); + + if (!item) throw new NotFoundException(`After Push component: Keine Unit mit der Componenten Id: ${unitId} gefunden`) + + const newComp = await this.findOne(componentId.toString()) + if (!newComp || !newComp.component) throw new NotFoundException(`Componente wurde nicht erzeugt UnitId: ${unitId}`) + + + + return newComp.component + + } + + async delete(compId: string): Promise { + if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('id ist kein ObjectId') + + + const item = await this.model.findOneAndUpdate({ 'components._id': compId }, + { + $pull: { + components: { _id: compId } + } + }, + { returnDocument: 'after' }).exec(); + + + if (!item) throw new NotFoundException(`Keine Unit mit der Componenten Id: ${compId} gefunden`) + let delSigResult = await this.signalsService.removeSignalsOfComponent(compId); + console.log(item._id,delSigResult) + return item + + } + + async update(compId: string, dto: ComponentUpdateDto): Promise { + if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('id ist kein ObjectId') + + + const update: Record = {}; + if (dto.name !== undefined) { update['components.$.name'] = dto.name }; + if (dto.postfix !== undefined) { update['components.$.postfix'] = dto.postfix }; + if (dto.prefix !== undefined) { update['components.$.prefix'] = dto.prefix }; + if (dto.index !== undefined) { update['components.$.index'] = dto.index }; + + if (dto.properties) { + for (const [key, value] of Object.entries(dto.properties)) { + update[`components.$.properties.${key}`] = value; + } + } + + console.log(update); + const item = await this.model.findOneAndUpdate({ 'components._id': compId }, + { $set: update }, + { returnDocument: 'after' }).exec(); + + + + + return item + + } + + async deletePropertie(compId: string, propertieName: string): Promise { + if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('id ist kein ObjectId') + + const deleteProp: Record = {}; + deleteProp[`components.$.properties.${propertieName}`] = ''; + + + const item = await this.model.findOneAndUpdate( + { 'components._id': compId }, + { + $unset: deleteProp + }, + { returnDocument: 'after' } + ).exec();; + + + return item + + } + + async createSignalRef(compId: string, signalId: string): Promise { + if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('Create Component id ist kein ObjectId') + + + const item = await this.model.findOneAndUpdate({ 'components._id': compId }, + { $addToSet: { 'components.$.signalIds': new Types.ObjectId(signalId) } }, + { returnDocument: 'after' }).exec(); + + + if (!item) throw new NotFoundException(`Keine Unit mit der Componenten Id: ${compId} gefunden`) + let retValue = this.findOne(compId) + + + return retValue; + } toDto(component: Component): ComponentResponseDto { @@ -38,7 +156,6 @@ export class ComponentsService { id: component._id!.toString(), name: component.name, type: this.getComponentType(component.type.toString()), - signalIds: component.signalIds.map((signal) => signal.toString()), properties: component.properties } diff --git a/src/anlagen/groups/groups.controller.ts b/src/anlagen/groups/groups.controller.ts index 8c0b6a2..6085a01 100644 --- a/src/anlagen/groups/groups.controller.ts +++ b/src/anlagen/groups/groups.controller.ts @@ -35,6 +35,7 @@ export class GroupsController { @Delete(':id') remove(@Param('id') id: string) { + console.log('Delete Group') return this.service.remove(id); } } diff --git a/src/anlagen/groups/groups.module.ts b/src/anlagen/groups/groups.module.ts index 3a133b7..1514182 100644 --- a/src/anlagen/groups/groups.module.ts +++ b/src/anlagen/groups/groups.module.ts @@ -3,9 +3,13 @@ import { GroupsController } from './groups.controller'; import { GroupsService } from './groups.service'; import { MongooseModule } from '@nestjs/mongoose'; import { Group, GroupSchema } from 'src/_schemas/anlagen/groups'; +import { AnlageModule } from 'src/rk-anlagen/anlage/anlage.module'; @Module({ - imports: [MongooseModule.forFeature([{ name: Group.name, schema: GroupSchema }],"anlagen")], + imports: [ + MongooseModule.forFeature([{ name: Group.name, schema: GroupSchema }],"anlagen"), + AnlageModule + ], controllers: [GroupsController], providers: [GroupsService] }) diff --git a/src/anlagen/groups/groups.service.ts b/src/anlagen/groups/groups.service.ts index 6bdb945..273da73 100644 --- a/src/anlagen/groups/groups.service.ts +++ b/src/anlagen/groups/groups.service.ts @@ -3,14 +3,18 @@ import { InjectModel } from '@nestjs/mongoose'; import { Model, Types } from 'mongoose'; import { GroupCreateDto, GroupResponseDto, GroupUpdateDto } from 'src/_dto/anlagen/groups'; import { Group, GroupDocument } from 'src/_schemas/anlagen/groups'; +import { AnlageService } from 'src/rk-anlagen/anlage/anlage.service'; @Injectable() export class GroupsService { - constructor(@InjectModel(Group.name,"anlagen") private model: Model) { } + constructor( + @InjectModel(Group.name,"anlagen") private model: Model, + private readonly anlageService: AnlageService) { } async findAll(): Promise { - const responsData = await this.model.find().exec(); + let anlageId = (await this.anlageService.getSelected()).id; + const responsData = await this.model.find({anlageId:new Types.ObjectId(anlageId)}).exec(); return responsData.map((item) => this.toDto(item)); } @@ -28,14 +32,16 @@ export class GroupsService { } async create(dto: GroupCreateDto):Promise { - const newItem = new this.model(this.toDocument(dto)); + let anlageId = (await this.anlageService.getSelected()).id; + const newItem = new this.model(this.toDocument(anlageId,dto)); const result = await newItem.save(); return this.toDto(result); } async update(id: string, dto: GroupUpdateDto) { - let update = this.toDocument(dto); + let anlageId = (await this.anlageService.getSelected()).id; + let update = this.toDocument(anlageId,dto); console.log(update); const changedItem = await this.model.findByIdAndUpdate(id, { $set: { @@ -68,9 +74,10 @@ export class GroupsService { } } - toDocument(dto: GroupCreateDto|GroupUpdateDto) { + toDocument(anlageid:string,dto: GroupCreateDto|GroupUpdateDto) { return { name: dto.name, + anlageId: new Types.ObjectId(anlageid), container: dto.container, nr: dto.nr, parentId: dto.parentId ? new Types.ObjectId(dto.parentId) : null diff --git a/src/anlagen/signals/signals.module.ts b/src/anlagen/signals/signals.module.ts index 574da76..98aec21 100644 --- a/src/anlagen/signals/signals.module.ts +++ b/src/anlagen/signals/signals.module.ts @@ -1,16 +1,19 @@ -import { Module } from '@nestjs/common'; +import { forwardRef, Module } from '@nestjs/common'; import { SignalsService } from './signals.service'; import { SignalsController } from './signals.controller'; import { MongooseModule } from '@nestjs/mongoose'; import { Signal, SignalSchema } from 'src/_schemas/anlagen/singnals'; import { AnlageModule } from 'src/rk-anlagen/anlage/anlage.module'; +import { ComponentsModule } from '../components/components.module'; @Module({ imports: [ MongooseModule.forFeature([{ name: Signal.name, schema: SignalSchema }], "anlagen"), - AnlageModule + AnlageModule, + forwardRef(() =>ComponentsModule) ], providers: [SignalsService], - controllers: [SignalsController] + controllers: [SignalsController], + exports:[SignalsService] }) export class SignalsModule { } diff --git a/src/anlagen/signals/signals.service.ts b/src/anlagen/signals/signals.service.ts index a10adf5..05ac2ed 100644 --- a/src/anlagen/signals/signals.service.ts +++ b/src/anlagen/signals/signals.service.ts @@ -1,15 +1,18 @@ -import { Injectable, NotFoundException } from '@nestjs/common'; +import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model, Types } from 'mongoose'; import { SignalCreateDto, SignalResponseDto, SignalUpdateDto } from 'src/_dto/anlagen/signals'; import { Signal, SignalDocument } from 'src/_schemas/anlagen/singnals'; import { AnlageService } from 'src/rk-anlagen/anlage/anlage.service'; +import { ComponentsService } from '../components/components.service'; @Injectable() export class SignalsService { constructor( @InjectModel(Signal.name, "anlagen") private model: Model, - private readonly anlageService: AnlageService + private readonly anlageService: AnlageService, + @Inject(forwardRef(() => ComponentsService)) + private readonly componentService: ComponentsService, ) { } async findAll(): Promise { @@ -24,8 +27,8 @@ export class SignalsService { return this.toDto(item); } - async findByComponent(componentId:string): Promise { - const responsData = await this.model.find({componentId:new Types.ObjectId(componentId)}).exec(); + async findByComponent(componentId: string): Promise { + const responsData = await this.model.find({ componentId: new Types.ObjectId(componentId) }).exec(); return responsData.map((item) => this.toDto(item)); } @@ -33,13 +36,16 @@ export class SignalsService { async create(dto: SignalCreateDto): Promise { let currentAnlage = await this.anlageService.getSelected(); - - if(!currentAnlage) throw new NotFoundException('Es ist keine Anlage ausgewählt'); + + if (!currentAnlage) throw new NotFoundException('Es ist keine Anlage ausgewählt'); - const newItem = new this.model(this.toDocument(dto,currentAnlage.id)); - + const newItem = new this.model(this.toDocument(dto, currentAnlage.id)); const result = await newItem.save(); + + // Id in Componente anlagen + if (dto.componentId) + this.componentService.createSignalRef(dto.componentId?.toString(), newItem._id.toString()) return this.toDto(result); } @@ -47,9 +53,9 @@ export class SignalsService { async update(id: string, dto: SignalUpdateDto) { let currentAnlage = await this.anlageService.getSelected(); let anlage = dto.anlageId ? dto.anlageId : currentAnlage.id; - if(!anlage) throw new NotFoundException('Anlage Id muss gesetzt sein') - - let update = this.toDocument(dto,anlage); + if (!anlage) throw new NotFoundException('Anlage Id muss gesetzt sein') + + let update = this.toDocument(dto, anlage); console.log(update); const changedItem = await this.model.findByIdAndUpdate(id, { $set: { @@ -70,6 +76,13 @@ export class SignalsService { return this.toDto(removedItem); } + async removeSignalsOfComponent(compId: string) { + const removedItem = await this.model.deleteMany({ componentId: new Types.ObjectId(compId) }); + + + return removedItem; + } + toDto(dbData: SignalDocument): SignalResponseDto { @@ -84,7 +97,7 @@ export class SignalsService { } } - toDocument(dto: SignalCreateDto | SignalUpdateDto,anlage:string) { + toDocument(dto: SignalCreateDto | SignalUpdateDto, anlage: string) { return { anlageId: new Types.ObjectId(anlage), name: dto.name, diff --git a/src/anlagen/units/units.controller.ts b/src/anlagen/units/units.controller.ts index 927eb16..7c015a3 100644 --- a/src/anlagen/units/units.controller.ts +++ b/src/anlagen/units/units.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'; import { UnitsService } from './units.service'; import { UnitCreateDto, UnitUpdateBaseDto } from 'src/_dto/anlagen/units'; -import { ComponentCreateDto, ComponentUpdateDto } from 'src/_dto/anlagen/components'; + @Controller('rk2/units') @@ -31,18 +31,10 @@ export class UnitsController { @Patch(':id') update(@Param('id') id: string, @Body() dto: UnitUpdateBaseDto) { + return this.service.update(id, dto); } - - @Patch(':id/component/:compId') - updateComp(@Param('id') id: string,@Param('compId') compId: string, @Body() dto: ComponentUpdateDto) { - return this.service.updateComponent(id,compId, dto); - } - @Patch(':id/addComponent') - updateUnitAddComp(@Param('id') id: string, @Body() dto: ComponentCreateDto) { - return this.service.addComponent(id,dto); - } @Delete(':id') remove(@Param('id') id: string) { diff --git a/src/anlagen/units/units.service.ts b/src/anlagen/units/units.service.ts index 4d23632..5d3e555 100644 --- a/src/anlagen/units/units.service.ts +++ b/src/anlagen/units/units.service.ts @@ -16,17 +16,13 @@ export class UnitsService { async findAllExp(): Promise { let currentAnlage = await this.anlageService.getSelected(); - - - let items = await this.model.aggregate(Unit_query_get(currentAnlage.id)); - - return items; } //--- Find ALL async findAll(): Promise { + const responsData = await this.model.find().exec(); return responsData.map((item) => this.toDto(item)); @@ -42,39 +38,39 @@ export class UnitsService { //--- Create new Unit async create(dto: UnitCreateDto): Promise { - let { components, ...base } = dto; - components = components.map((c) => ({ name: c.name, signalIds: c.signalIds, type: c.type, properties: c.properties, id: c.id == "" ? undefined : c.id })) - let cComponents = components.map((c) => this.handleComponents(c)); - console.log(base); - const newItem = new this.model({ ...base, components: cComponents }); + let anlageId = dto.anlageId ? new Types.ObjectId(dto.anlageId) : new Types.ObjectId((await this.anlageService.getSelected()).id); + + let { components,groupId, ...base } = dto; + let newGroupId = groupId != undefined && Types.ObjectId.isValid(groupId) ? new Types.ObjectId(groupId) : undefined +// components = components ? components.map((c) => ({ name: c.name, type: c.type, properties: c.properties, id: c.id == "" ? undefined : c.id })):undefined +// let cComponents = components.map((c) => this.handleComponents(c)); + + const newItem = new this.model({ ...base, groupId:newGroupId, anlageId:anlageId }); const result = await newItem.save(); return this.toDto(result); } //--- Update a Unit async update(id: string, dto: UnitUpdateBaseDto) { + let anlageId = dto.anlageId && Types.ObjectId.isValid(dto.anlageId) ? new Types.ObjectId(dto.anlageId) : new Types.ObjectId((await this.anlageService.getSelected()).id); let update = { + ...( { anlageId: anlageId }), ...(dto.name !== undefined && { name: dto.name }), - ...(dto.groupId !== undefined && { groupId: dto.groupId }), + ...(dto.groupId !== undefined && Types.ObjectId.isValid(dto.groupId) && { groupId: new Types.ObjectId(dto.groupId) }), + ...(dto.prefix !== undefined && { prefix: dto.prefix }), + ...(dto.postfix !== undefined && { postfix: dto.postfix }), + ...(dto.bmk !== undefined && { bmk: dto.bmk }), ...(dto.type !== undefined && { type: dto.type.toString() }), - ...(dto.components !== undefined && { components: dto.components.map((c) => this.handleComponents(c)) }), + ...(dto.components !== undefined ? { components: dto.components.map((c) => this.handleComponents(c)) } : { components: [] }), } - console.log(update.components); - const changedItem = await this.model.findByIdAndUpdate({ _id: id }, { - $set: { - ...update, + const item = await this.model.findByIdAndUpdate({ _id: id }, { $set: { ...update } }, { returnDocument: 'after', runValidators: true }); + + if (!item) throw new NotFoundException('The updated Unit are not found'); - } - } - , { returnDocument: 'after', runValidators: true }); - - - const newUnit = await this.findOne(id); - if (!newUnit) throw new NotFoundException('The updated Unit are not found'); - - return newUnit; + return this.toDto(item); + } //--- Remove @@ -86,63 +82,8 @@ export class UnitsService { } - //--- Update Components of a Unit - async updateComponent(unitId: string, componentId: string, dto: ComponentUpdateDto) { - - const unit = await this.model - .findOneAndUpdate( - { - _id: unitId, - 'components._id': componentId, - }, - { - $set: { - 'components.$.name': dto.name, - 'components.$.type': dto.type, - 'components.$.properties': dto.properties, - 'components.$.signalIds': dto.signalIds, - }, - }, - { - new: true, - after: true, - }, - ) - .exec(); - - if (!unit) { - throw new NotFoundException( - `Unit oder Component nicht gefunden`, - ); - } - - return unit; - } - - //--- Update Components of a Unit - async addComponent(unitId: string, dto: ComponentCreateDto) { - let currentUnit = await this.model.findById(unitId).exec(); - if (!currentUnit) throw new NotFoundException('Unit id ncht gefunden'); - - let signale = dto.signalIds ? dto.signalIds.map((s) => new Types.ObjectId(s)) : []; - let pros = { ...dto.properties }; - currentUnit.components = [...currentUnit.components, { - name: dto.name, - signalIds: [...signale], //dto.signalIds ? dto.signalIds.map((s)=>new ObjectId(s)): [], - type: dto.type, - properties: { ...pros } - }] - const unit = await this.model.findOneAndUpdate({ _id: unitId }, currentUnit, { new: true, runValidators: true, }).exec(); - - if (!unit) { - throw new NotFoundException( - `Unit oder Component nicht gefunden`, - ); - } - return unit; - } toDto(dbData: Unit): UnitResponseDto { @@ -151,8 +92,10 @@ export class UnitsService { { id: c._id!.toString(), name: c.name, + index: c.index, + prefix: c.prefix, + postfix: c.postfix, type: this.getComponentType(c.type.toString()), - signalIds: c.signalIds.map((signal) => signal.toString()), properties: c.properties })) @@ -161,17 +104,15 @@ export class UnitsService { name: dbData.name, bmk: dbData.bmk, prefix: dbData.prefix, + postfix: dbData.postfix, info: dbData.info, - anlageId: dbData.anlageId, + anlageId: dbData.anlageId ? dbData.anlageId.toString() : '', type: dbData.type, - groupId: dbData.groupId.toString(), + groupId: dbData.groupId ? dbData.groupId.toString() : '', components: comop } } - getToUpdateComponents(currentDbComp: Component[], updateComp: ComponentResponseDto[]) { - - } getComponentType(name: string) { let retValue = Object.values(ComponentTypes).find((c) => c === name) @@ -184,7 +125,6 @@ export class UnitsService { _id: new Types.ObjectId(compDto.id), name: compDto.name, type: compDto.type?.toString(), - signalIds: compDto.signalIds.map((s) => new Types.ObjectId(s)), properties: { ...compDto.properties } } } @@ -207,21 +147,20 @@ export class UnitsService { return comps.map((c) => ({ name: c.name, type: c.type?.toString(), - signalIds: c.signalIds ? c.signalIds.map((s) => new Types.ObjectId(s)) : [], properties: { ...c.properties } })); } handleComponents(component: ComponentResponseDto): Component { - let { id, name, signalIds, type, properties } = component; + let { id, name, type, properties,postfix,prefix,index } = component; const cid = (id && Types.ObjectId.isValid(id)) ? new Types.ObjectId(id) : undefined; - const cSignalIds = signalIds ? this.handleSignals(signalIds) : []; + const cProperties = properties ? this.handleProperties(properties) : {}; const cName = name; - const cType = type; + - return { name: cName, type: cType, signalIds: cSignalIds, properties: cProperties, _id: cid } + return { name: cName,postfix,prefix,index, type, properties: cProperties, _id: cid } } diff --git a/src/draw/draw.controller.ts b/src/draw/draw.controller.ts index c3871c4..baf29d0 100644 --- a/src/draw/draw.controller.ts +++ b/src/draw/draw.controller.ts @@ -20,6 +20,11 @@ export class DrawController { } */ + @Get('anlageDurmin') + getAnlageDurmin(@Query() optionen: DrawShapeOptionenDto): DrawDto { + return this.service.getAnlageDurmin() as DrawDto; + } + @Get('graphic') getGraphic(@Query() optionen: DrawShapeOptionenDto): DrawDto { return this.service.gurtfoerderer(optionen) as DrawDto; diff --git a/src/draw/draw.module.ts b/src/draw/draw.module.ts index 626bb5b..598469e 100644 --- a/src/draw/draw.module.ts +++ b/src/draw/draw.module.ts @@ -20,6 +20,7 @@ import { DrawVentil } from 'src/graphics/elements/drawVentil'; import { DrawWasserZufuhr } from 'src/graphics/elements/drawWasserZufuhr'; import { DrawBehaelterMulti } from 'src/graphics/elements/drawBehaelterMulti'; import { DrawMotor } from 'src/graphics/elements/drawMotor'; +import { DrawAnlageDurmin } from 'src/graphics/elements/drawAnlageDurmin2'; @Module({ imports: [], @@ -44,7 +45,8 @@ import { DrawMotor } from 'src/graphics/elements/drawMotor'; DrawVentil, DrawWasserZufuhr, DrawBehaelterMulti, - DrawMotor + DrawMotor, + DrawAnlageDurmin ], exports: [DrawService] }) diff --git a/src/draw/draw.service.ts b/src/draw/draw.service.ts index 52c560a..cb91bdf 100644 --- a/src/draw/draw.service.ts +++ b/src/draw/draw.service.ts @@ -21,6 +21,7 @@ import { DrawVentil } from 'src/graphics/elements/drawVentil'; import { DrawWasserZufuhr } from 'src/graphics/elements/drawWasserZufuhr'; import { DrawBehaelterMulti } from 'src/graphics/elements/drawBehaelterMulti'; import { DrawMotor } from 'src/graphics/elements/drawMotor'; +import { DrawAnlageDurmin } from 'src/graphics/elements/drawAnlageDurmin2'; @Injectable() export class DrawService { @@ -44,12 +45,15 @@ export class DrawService { private readonly buildWasserZufuhr: DrawWasserZufuhr, private readonly buildBehaelterMulti: DrawBehaelterMulti, private readonly buildMotor: DrawMotor, + private readonly buildAnlageDurmin: DrawAnlageDurmin, ) { } - + getAnlageDurmin(){ + return this.buildAnlageDurmin.getDrawObject({}) + } sieb(options?: DrawShapeOptionenDto, rawSvg?: boolean) { if (rawSvg) return this.buildSieb.getSvg(options); diff --git a/src/graphics/elements/drawAnlageDurmin2.ts b/src/graphics/elements/drawAnlageDurmin2.ts new file mode 100644 index 0000000..56d8e98 --- /dev/null +++ b/src/graphics/elements/drawAnlageDurmin2.ts @@ -0,0 +1,336 @@ +import { PathCommand } from "../lib/types/path.types"; +import { DrawLine } from '../lib/drawLine' +import { DrawPath } from '../lib/drawPath' +import { DrawGroup } from '../lib/drawGroup' +import { DrawEllipse } from "../lib/drawEllipse"; + +import { cal_rotation_dim } from '../lib/drawFunktions' +import { Injectable } from "@nestjs/common"; +import { DrawDto, DrawShapeOptionenDto } from "src/_dto/draw.dto"; +import { DrawHeader } from "../lib/drawHeader"; + +interface Para { + scale?: number, +} + + + +@Injectable() +export class DrawAnlageDurmin { + + obj_height = 1100; + obj_width = 1700; + + + + constructor() { + + } + + createSiloSued(data: { length: number, height: number, wand: number, posX: number, posY: number }) { + let { height, length, posX, posY, wand } = data; + + const pSilo: PathCommand[] = [ + { type: "M", x: posX, y: posY }, + { relative: true, type: "V", y: height }, // -- + { relative: true, type: "H", x: length }, // -- + { relative: true, type: "V", y: -height }, // T + { relative: true, type: "H", x: -wand }, // -- + { relative: true, type: "V", y: height - wand }, // + { relative: true, type: "H", x: -(length - (wand * 2)) }, // -- + { relative: true, type: "V", y: -(height - wand) }, // + { type: "Z" } + ]; + + return pSilo; + } + + createSiloNord(data: { length: number, height: number, wand: number, posX: number, posY: number }) { + let { height, length, posX, posY, wand } = data; + + const pSilo: PathCommand[] = [ + { type: "M", x: posX, y: posY }, + { relative: true, type: "V", y: height }, // -- + { relative: true, type: "H", x: wand }, // -- + { relative: true, type: "V", y: -(height - wand) }, // T + { relative: true, type: "H", x: length - (wand * 2) }, // innen oben + { relative: true, type: "V", y: height - wand }, // + { relative: true, type: "H", x: wand }, // -- + { relative: true, type: "V", y: -height }, // + { type: "Z" } + ]; + + return pSilo; + } + + createSiloWest(data: { length: number, height: number, wand: number, posX: number, posY: number }) { + let { height, length, posX, posY, wand } = data; + + const pSilo: PathCommand[] = [ + { type: "M", x: posX, y: posY }, + { relative: true, type: "V", y: length }, // -- + { relative: true, type: "H", x: height }, // -- + { relative: true, type: "V", y: -wand }, // T + { relative: true, type: "H", x: -(height - wand) }, // innen oben + { relative: true, type: "V", y: -(length - 2 * wand) }, // + { relative: true, type: "H", x: height - wand }, // -- + { relative: true, type: "V", y: -wand }, // + { type: "Z" } + ]; + + return pSilo; + } + + createFahrschine(data: { length: number, height: number, abstand: number, posX: number, posY: number, nordSued: boolean }) { + let { height, length, posX, posY, abstand, nordSued } = data; + if (nordSued) { + height = data.length; + length = data.height; + } + const pSchine1: PathCommand[] = [ + { type: "M", x: posX, y: posY }, + { relative: true, type: "V", y: height }, // -- + { relative: true, type: "H", x: length }, // -- + { relative: true, type: "V", y: -height }, // T + { type: "Z" } + ]; + + let abstand_x = nordSued ? abstand : 0; + let abstand_y = nordSued ? 0 : abstand; + const pSchine2: PathCommand[] = [ + { type: "M", x: posX + abstand_x, y: posY + abstand_y }, + { relative: true, type: "V", y: height }, // -- + { relative: true, type: "H", x: length }, // -- + { relative: true, type: "V", y: -height }, // T + { type: "Z" } + ]; + return [pSchine1, pSchine2]; + } + + createBand(data: { width: number, height: number, posX: number, posY: number, nordSued: boolean }) { + let { height, width, posX, posY, nordSued } = data; + + if (nordSued) { + height = data.width; + width = data.height; + } + + const pBand1: PathCommand[] = [ + { type: "M", x: 0, y: 0 }, + { relative: true, type: "V", y: height }, // -- + { relative: true, type: "H", x: width }, // -- + { relative: true, type: "V", y: -height }, // T + { type: "Z" } + ]; + + let offsetX = nordSued ? 10 : 0; + let offsetY = nordSued ? 0 : 10; + let belt2Pos = {width:width-offsetX,height:height-offsetY} + + const pBand2: PathCommand[] = [ + { type: "M", x: offsetX/2, y: offsetY/2 }, + { relative: true, type: "V", y: belt2Pos.height }, // -- + { relative: true, type: "H", x: belt2Pos.width }, // -- + { relative: true, type: "V", y: -belt2Pos.height }, // T + { type: "Z" } + ]; + + let boxWidth = nordSued ? width : 10; + let boxHeight = nordSued ? 10: height; + + let boxValues = {width:boxWidth,height:boxHeight} + const pBandBoxStart: PathCommand[] = [ + { type: "M", x: 0, y: 0 }, + { relative: true, type: "V", y: boxValues.height }, // -- + { relative: true, type: "H", x: boxValues.width }, // -- + { relative: true, type: "V", y: -boxValues.height }, // T + { type: "Z" } + ]; + + const group = new DrawGroup({}); + group.setAtrr({ translate_y: posY, translate_x: posX }) + + const belt1 = new DrawPath(pBand1); + belt1.setAtrr({fill:"#404040", stroke:"#404040"}) + + const belt2 = new DrawPath(pBand2); + belt2.setAtrr({fill:"#808080", stroke:"#808080"}) + + const beltBoxStart = new DrawPath(pBandBoxStart); + beltBoxStart.setAtrr({fill:"#101010", stroke:"#101010"}) + + group.add(beltBoxStart) + group.add(belt2) + group.add(belt1) + + return group; + } + + create(optionen?: DrawShapeOptionenDto): DrawGroup { + + let color = "#000000"; + + + const silo_h = 196; + const silo_b = 196; + const silo_wand = 8; + + const posSiloSued = 1700 - 300; + + + const siloWestPos = { x: 200, y: 100 } + const siloSuedPos = { x: 700, y: siloWestPos.y + (silo_b*3) + (silo_b/2) - (silo_h/2) } + const siloNordPos = { x: 700, y: siloWestPos.y + (silo_b*1) + (silo_b/2) - (silo_h/2) } + + + + const obj_h = this.obj_height; + const obj_w = this.obj_width; + + + + const groupInhalt = new DrawGroup({}); + const group1 = new DrawGroup({}); + + + // Silo Süd + let silo_posX = siloSuedPos.x; + let silo_posY = siloSuedPos.y; + + const zBa2S1 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa2S2 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa2S3 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa2S4 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa2S5 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + zBa2S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa2S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa2S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa2S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa2S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + + // Schiene + let [pBa1Schiene1, pBa1Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloSuedPos.x - 30, posY: siloSuedPos.y + (silo_h/2) - 25, nordSued: false }); + const zBa1Schine1 = new DrawPath(pBa1Schiene1); + const zBa1Schine2 = new DrawPath(pBa1Schiene2); + + + // Silo Nord + silo_posX = siloNordPos.x; + silo_posY = siloNordPos.y; + + const zBa1S1 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa1S2 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa1S3 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa1S4 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posX += silo_b - silo_wand; + const zBa1S5 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + zBa1S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa1S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa1S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa1S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa1S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + + // Schiene + let [pBa2Schiene1, pBa2Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloNordPos.x - 30, posY: siloNordPos.y + (silo_h/2) - 25, nordSued: false }); + const zBa2Schine1 = new DrawPath(pBa2Schiene1); + const zBa2Schine2 = new DrawPath(pBa2Schiene2); + + // Silo West + silo_posX = siloWestPos.x; + silo_posY = siloWestPos.y; + + const zBa3S1 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posY += silo_b - silo_wand; + const zBa3S2 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posY += silo_b - silo_wand; + const zBa3S3 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posY += silo_b - silo_wand; + const zBa3S4 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + silo_posY += silo_b - silo_wand; + const zBa3S5 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand })); + zBa3S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa3S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa3S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa3S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + zBa3S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" }) + + // Schiene + let [pBa3Schiene1, pBa3Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloWestPos.x + (silo_h/2) - 25, posY: siloWestPos.y - 30, nordSued: true }); + const zBa3Schine1 = new DrawPath(pBa3Schiene1); + const zBa3Schine2 = new DrawPath(pBa3Schiene2); + + this.obj_height = obj_h //+ 30; + this.obj_width = obj_w; + + group1.add(this.createBand({posX:600,posY:200,width:100,height:40,nordSued:false})) + group1.add(this.createBand({posX:500,posY:100,width:100,height:40,nordSued:true})) + group1.add(zBa1Schine1); + group1.add(zBa1Schine2); + group1.add(zBa1S1); + group1.add(zBa1S2); + group1.add(zBa1S3); + group1.add(zBa1S4); + group1.add(zBa1S5); + + group1.add(zBa2Schine1); + group1.add(zBa2Schine2); + group1.add(zBa2S1); + group1.add(zBa2S2); + group1.add(zBa2S3); + group1.add(zBa2S4); + group1.add(zBa2S5); + + + group1.add(zBa3Schine1); + group1.add(zBa3Schine2); + group1.add(zBa3S1); + group1.add(zBa3S2); + group1.add(zBa3S3); + group1.add(zBa3S4); + group1.add(zBa3S5); + + groupInhalt.add(group1) + + groupInhalt.setAtrr({ translate_y: 11, translate_x: 11 }) + return groupInhalt; + + } + + getDrawObject(optionen?: DrawShapeOptionenDto): DrawDto { + const groupSvg = this.create(optionen) + const getXaml = true; + const svg = groupSvg.getChildString(!getXaml, 0) + const xaml = groupSvg.getChildString(getXaml, 0) + return { + name: "anlageDurmin", + height: this.obj_height, + length: this.obj_width, + px_height: this.obj_height, + px_width: this.obj_width, + raster: 1, + scale: 1, + offset_x: 0, + offset_y: 0, + svg, + xaml + } + } + + getSvg(optionen?: DrawShapeOptionenDto): string { + const groupSvg = this.create(optionen) + const xaml = optionen && optionen.xaml ? true : false; + const header = new DrawHeader({ lenght: this.obj_width, height: this.obj_height }); + header.add(groupSvg); + + return header.getChildString(xaml, 0); + + } +} + diff --git a/src/graphics/lib/drawGroup.ts b/src/graphics/lib/drawGroup.ts index f223af7..444342f 100644 --- a/src/graphics/lib/drawGroup.ts +++ b/src/graphics/lib/drawGroup.ts @@ -56,13 +56,14 @@ export class DrawGroup extends DrawContainer { let translate_x = this.attributes.get('translate_x') as number; let translate_y = this.attributes.get('translate_y') as number; let transformStr = "" + let rotateString = ""; if (translate_x || translate_y) { let x = translate_x ? translate_x : 0; let y = translate_y ? translate_y : 0; transformStr = `translate(${x} ${y}) ` + rotateString = `transform="${transformStr}"` } - let rotateString = ""; if (rotate) { rotateString = `transform="${transformStr}rotate(${rotate.winkel} ${rotate.posX} ${rotate.posY})"` } diff --git a/src/graphics/lib/types/path.types.ts b/src/graphics/lib/types/path.types.ts index f8aa8e2..29f0f75 100644 --- a/src/graphics/lib/types/path.types.ts +++ b/src/graphics/lib/types/path.types.ts @@ -22,13 +22,13 @@ export interface LineToCommand extends PathBaseCommand { /** Horizontal Line-To */ export interface HorizontalLineToCommand extends PathBaseCommand { - type: "H"; + type: "H" | "h"; x: number; } /** Vertical Line-To */ export interface VerticalLineToCommand extends PathBaseCommand { - type: "V"; + type: "V" | "v"; y: number; } diff --git a/test/anlagen/component.http b/test/anlagen/component.http index 9a908e7..e8ac996 100644 --- a/test/anlagen/component.http +++ b/test/anlagen/component.http @@ -1,4 +1,38 @@ +### Units +GET http://localhost:3000/rk2/units/6a8c116adbe08c3d75e3aefd + ### Get By Ids -GET http://localhost:3000/rk2/components/6a901cc6939c157328d3e3e7 +GET http://localhost:3000/rk2/components/6a9687c9115d604d8f1f05ce +### Add Component +### Create +POST http://localhost:3000/rk2/components/6a8c116adbe08c3d75e3aefd +Content-Type: application/json + +{ + "name":"ES1", + "type":"Endschalter", + "properties":{"name2":"kind2"} + +} + +### Delete Component +### Delete +DELETE http://localhost:3000/rk2/components/6a9687c9115d604d8f1f05ce + +### Delete Propertie +### Create +DELETE http://localhost:3000/rk2/components/6a968b22b46fd50d5cbe7bcc/deleteProp/name2 + + +### Change Component +PATCH http://localhost:3000/rk2/components/6a968b22b46fd50d5cbe7bcc +Content-Type: application/json + +{ + "name":"ES2", + "type":"Endschalter", + "properties":{"name2":"kind2"} + +} \ No newline at end of file diff --git a/test/draw.http b/test/draw.http index 1b73528..317de4a 100644 --- a/test/draw.http +++ b/test/draw.http @@ -1,6 +1,10 @@ ### Anlage 1659 --> 6995c44ebb286cf2c27da0d8 ### Test Group --> 6996c2cf14624b2583af43e9 + +### Get All +GET http://localhost:3000/draw/anlageDurmin + ### Get All GET http://localhost:3000/draw/ellipse