fix(repository): ensure category update check before processing blocks

This commit is contained in:
medchedli 2025-05-28 15:44:01 +01:00
parent 4692339bea
commit e671f0ab24

View File

@ -131,8 +131,9 @@ export class BlockRepository extends BaseRepository<
criteria: TFilterQuery<Block>,
updates: UpdateQuery<Document<Block, any, any>>,
): Promise<void> {
const categoryId: string = updates.$set.category;
if (categoryId) {
// Only proceed if category is being updated
if (updates.$set?.category) {
const categoryId: string = updates.$set.category;
const movedBlocks = await this.find(criteria);
if (movedBlocks.length) {