ソースを参照

✨ feat(crud): 创建具体CRUD服务类

- 实现ConcreteCrudService继承自GenericCrudService
- 构造函数接收实体类型和可选配置参数
- 自动注入AppDataSource数据源实例
- 支持用户跟踪和关联字段配置选项
yourname 2 ヶ月 前
コミット
698dbb1e47
1 ファイル変更10 行追加0 行削除
  1. 10 0
      src/server/utils/concrete-crud.service.ts

+ 10 - 0
src/server/utils/concrete-crud.service.ts

@@ -0,0 +1,10 @@
+import { AppDataSource } from '../data-source';
+import { GenericCrudService, UserTrackingOptions, RelationFieldOptions } from './generic-crud.service';
+import { ObjectLiteral } from 'typeorm';
+
+// 创建具体CRUD服务类
+export class ConcreteCrudService<T extends ObjectLiteral> extends GenericCrudService<T> {
+  constructor(entity: new () => T, options?: { userTracking?: UserTrackingOptions; relationFields?: RelationFieldOptions }) {
+    super(AppDataSource, entity, options);
+  }
+}