Skip to content

Commit

Permalink
feat: make parentId nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
stae1102 committed Mar 10, 2024
1 parent 4d67d3f commit 97617f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/categories/category.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class Category extends CoreEntity {

@ApiProperty({ description: 'Category Parent ID', example: 1, type: Number })
@Column({ type: 'int', nullable: true })
parentId?: number;
parentId?: number | null;

@ManyToOne(() => User, (user) => user.categories, {
onDelete: 'CASCADE',
Expand Down
2 changes: 1 addition & 1 deletion src/categories/category.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CategoryRepository extends Repository<Category> {
}

async createOne(
category: Category & { parentId?: number },
category: Category & { parentId?: number | null },
entityManager?: EntityManager,
): Promise<Category> {
return entityManager ? entityManager?.save(category) : this.save(category);
Expand Down

0 comments on commit 97617f1

Please sign in to comment.