add base subscriber

This commit is contained in:
2025-06-04 22:50:04 +08:00
parent 4991b83641
commit a92ad374e1
4 changed files with 22 additions and 8 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ export class PostEntity extends BaseEntity {
type: PostBodyType;
@Expose()
@Column({ comment: '发布时间', type: 'varchar', nullable: true })
@Column({ comment: '发布时间', type: 'timestamp', nullable: true })
publishedAt?: Date | null;
@Expose()
@@ -19,6 +19,10 @@ export class CategoryService extends BaseService<CategoryEntity, CategoryReposit
return this.repository.findTrees();
}
async detail(id: string) {
return this.repository.findOneOrFail({ where: { id }, relations: ['parent', 'children'] });
}
async create(data: CreateCategoryDto) {
const item = await this.repository.save({
...data,
+1 -1
View File
@@ -32,7 +32,7 @@ type SubscriberEvent<T extends ObjectLiteral> =
@EventSubscriber()
export abstract class BaseSubscriber<T extends ObjectLiteral>
implements EntitySubscriberInterface<T>
implements EntitySubscriberInterface<T>
{
protected abstract entity: ObjectType<T>;