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,
|
Block,
|
||||||
'findOneAndUpdate'
|
'findOneAndUpdate'
|
||||||
>,
|
>,
|
||||||
_criteria: TFilterQuery<Block>,
|
criteria: TFilterQuery<Block>,
|
||||||
_updates:
|
_updates:
|
||||||
| UpdateWithAggregationPipeline
|
| UpdateWithAggregationPipeline
|
||||||
| UpdateQuery<Document<Block, any, any>>,
|
| UpdateQuery<Document<Block, any, any>>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const updates: BlockUpdateDto = _updates?.['$set'];
|
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);
|
this.checkDeprecatedAttachmentUrl(updates);
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ const Diagrams = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleMoveButton = () => {
|
const handleMoveButton = () => {
|
||||||
const selectedEntities = engine?.getModel().getSelectedEntities();
|
const selectedEntities = engine?.getModel().getSelectedEntities().reverse();
|
||||||
const ids = selectedEntities?.map((model) => model.getID());
|
const ids = selectedEntities?.map((model) => model.getID());
|
||||||
|
|
||||||
if (ids && selectedEntities) {
|
if (ids && selectedEntities) {
|
||||||
@ -453,10 +453,22 @@ const Diagrams = () => {
|
|||||||
|
|
||||||
if (ids) {
|
if (ids) {
|
||||||
for (const blockId of 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({
|
await updateBlock({
|
||||||
id: blockId,
|
id: blockId,
|
||||||
params: {
|
params: {
|
||||||
category: newCategoryId,
|
category: newCategoryId,
|
||||||
|
nextBlocks: updatedNextBlocks,
|
||||||
|
attachedBlock: updatedAttachedBlock,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user