|
@@ -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;
|