mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 04:53:41 +00:00
fix: resolve conflicts
This commit is contained in:
parent
ce20bb725a
commit
310d9e47aa
@ -89,12 +89,26 @@ export class BlockRepository extends BaseRepository<
|
||||
Block,
|
||||
'findOneAndUpdate'
|
||||
>,
|
||||
_criteria: TFilterQuery<Block>,
|
||||
criteria: TFilterQuery<Block>,
|
||||
_updates:
|
||||
| UpdateWithAggregationPipeline
|
||||
| UpdateQuery<Document<Block, any, any>>,
|
||||
): Promise<void> {
|
||||
const updates: BlockUpdateDto = _updates?.['$set'];
|
||||
if (updates?.category) {
|
||||
const movedBlockId = criteria._id;
|
||||
|
||||
// Find and update blocks that reference the moved block
|
||||
await this.model.updateMany(
|
||||
{ nextBlocks: movedBlockId },
|
||||
{ $pull: { nextBlocks: movedBlockId } },
|
||||
);
|
||||
|
||||
await this.model.updateMany(
|
||||
{ attachedBlock: movedBlockId },
|
||||
{ $set: { attachedBlock: null } },
|
||||
);
|
||||
}
|
||||
|
||||
this.checkDeprecatedAttachmentUrl(updates);
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ const Diagrams = () => {
|
||||
}
|
||||
};
|
||||
const handleMoveButton = () => {
|
||||
const selectedEntities = engine?.getModel().getSelectedEntities();
|
||||
const selectedEntities = engine?.getModel().getSelectedEntities().reverse();
|
||||
const ids = selectedEntities?.map((model) => model.getID());
|
||||
|
||||
if (ids && selectedEntities) {
|
||||
@ -453,10 +453,22 @@ const Diagrams = () => {
|
||||
|
||||
if (ids) {
|
||||
for (const blockId of ids) {
|
||||
const block = getBlockFromCache(blockId);
|
||||
const updatedNextBlocks = block?.nextBlocks?.filter((nextBlockId) =>
|
||||
ids.includes(nextBlockId),
|
||||
);
|
||||
const updatedAttachedBlock = ids.includes(
|
||||
block?.attachedBlock as string,
|
||||
)
|
||||
? block?.attachedBlock
|
||||
: null;
|
||||
|
||||
await updateBlock({
|
||||
id: blockId,
|
||||
params: {
|
||||
category: newCategoryId,
|
||||
nextBlocks: updatedNextBlocks,
|
||||
attachedBlock: updatedAttachedBlock,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user