gemercheung 6 hónapja
szülő
commit
48f02e15ae

+ 2 - 0
packages/backend/src/modules/article/article.service.ts

@@ -97,6 +97,8 @@ export class ArticleService {
 
     const updateArticle = this.articleRepo.merge(article, updateArticleDto);
     // console.log('updateArticle', updateArticle);
+    delete updateArticle.userId;
+    delete updateArticle.user;
     await this.articleRepo.save(updateArticle);
     return true;
   }

+ 4 - 1
packages/backend/src/modules/category/category.service.ts

@@ -11,7 +11,7 @@ export class CategoryService {
     @InjectRepository(Category)
     private categoryRepo: Repository<Category>,
     private readonly sharedService: SharedService,
-  ) {}
+  ) { }
 
   async create(createCategoryDto: CreateCategoryDto) {
     const category = this.categoryRepo.create(createCategoryDto);
@@ -59,7 +59,10 @@ export class CategoryService {
   async update(id: number, updateCategoryDto: UpdateCategoryDto) {
     const category = await this.categoryRepo.findOne({ where: { id } });
     if (!category) throw new BadRequestException('权限不存在或者已删除');
+
     const updateCategory = this.categoryRepo.merge(category, updateCategoryDto);
+    delete updateCategory.userId;
+    delete updateCategory.user;
     console.log('updateCategory', updateCategory);
     await this.categoryRepo.save(updateCategory);
     return true;

+ 2 - 0
packages/backend/src/modules/menu/menu.service.ts

@@ -73,6 +73,8 @@ export class MenuService {
     const menu = await this.menuRepo.findOne({ where: { id } });
     if (!menu) throw new BadRequestException('权限不存在或者已删除');
     const updateMenu = this.menuRepo.merge(menu, updateMenuDto);
+    delete updateMenu.userId;
+    delete updateMenu.user;
     await this.menuRepo.save(updateMenu);
     return true;
   }