任务2.4
This commit is contained in:
		@@ -65,32 +65,32 @@
 | 
			
		||||
 | 
			
		||||
### 2.4 `plan` 模块
 | 
			
		||||
 | 
			
		||||
- [ ] 2.4.1 **创建并修改 `internal/app/service/plan_service.go`:**
 | 
			
		||||
    - [ ] 定义 `PlanService` 接口,包含 `CreatePlan`, `GetPlanByID`, `ListPlans`, `UpdatePlan`, `DeletePlan`,
 | 
			
		||||
- [x] 2.4.1 **创建并修改 `internal/app/service/plan_service.go`:**
 | 
			
		||||
    - [x] 定义 `PlanService` 接口,包含 `CreatePlan`, `GetPlanByID`, `ListPlans`, `UpdatePlan`, `DeletePlan`,
 | 
			
		||||
      `StartPlan`, `StopPlan` 等方法。
 | 
			
		||||
    - [ ] 为 `CreatePlan`, `UpdatePlan` 方法定义并接收 DTO 作为输入。
 | 
			
		||||
    - [ ] 将 `GetPlanByID`, `ListPlans` 方法的返回值 `models.Plan` 或 `[]models.Plan` 替换为 `dto.PlanResponse` 或
 | 
			
		||||
    - [x] 为 `CreatePlan`, `UpdatePlan` 方法定义并接收 DTO 作为输入。
 | 
			
		||||
    - [x] 将 `GetPlanByID`, `ListPlans` 方法的返回值 `models.Plan` 或 `[]models.Plan` 替换为 `dto.PlanResponse` 或
 | 
			
		||||
      `[]dto.PlanResponse`。
 | 
			
		||||
    - [ ] 调整 `ListPlans` 方法的 `opts repository.ListPlansOptions` 参数替换为服务层自定义的查询 DTO 或一系列基本参数。
 | 
			
		||||
    - [ ] 调整 `DeletePlan`, `StartPlan`, `StopPlan` 方法,使其接收 DTO 或基本参数,并封装所有业务逻辑。
 | 
			
		||||
    - [ ] 实现 `PlanService` 接口。
 | 
			
		||||
    - [ ] 在服务层内部将输入 DTO 转换为 `models` 对象。
 | 
			
		||||
    - [ ] 在服务层内部将 `repository` 返回的 `models` 对象转换为 `dto.XxxResponse`。
 | 
			
		||||
    - [ ] 将 `internal/app/controller/plan/plan_controller.go` 中所有的业务规则判断(计划类型检查、状态检查、执行计数器重置、ContentType
 | 
			
		||||
    - [x] 调整 `ListPlans` 方法的 `opts repository.ListPlansOptions` 参数替换为服务层自定义的查询 DTO 或一系列基本参数。
 | 
			
		||||
    - [x] 调整 `DeletePlan`, `StartPlan`, `StopPlan` 方法,使其接收 DTO 或基本参数,并封装所有业务逻辑。
 | 
			
		||||
    - [x] 实现 `PlanService` 接口。
 | 
			
		||||
    - [x] 在服务层内部将输入 DTO 转换为 `models` 对象。
 | 
			
		||||
    - [x] 在服务层内部将 `repository` 返回的 `models` 对象转换为 `dto.XxxResponse`。
 | 
			
		||||
    - [x] 将 `internal/app/controller/plan/plan_controller.go` 中所有的业务规则判断(计划类型检查、状态检查、执行计数器重置、ContentType
 | 
			
		||||
      自动判断)移入服务层。
 | 
			
		||||
    - [ ] 将 `internal/app/controller/plan/plan_controller.go` 中对 `repository` 方法的直接调用移入服务层。
 | 
			
		||||
    - [ ] 将 `internal/app/controller/plan/plan_controller.go` 中对 `analysisPlanTaskManager` 的协调移入服务层。
 | 
			
		||||
    - [ ] 将 `internal/app/controller/plan/plan_controller.go` 中处理仓库层特有错误(`gorm.ErrRecordNotFound`)的逻辑移入服务层。
 | 
			
		||||
- [ ] 2.4.2 **修改 `internal/app/controller/plan/plan_controller.go`:**
 | 
			
		||||
    - [ ] 引入并使用新创建的 `plan_service`。
 | 
			
		||||
    - [ ] 移除控制器中直接创建 `models.Plan` 对象和 `repository.ListPlansOptions` 的逻辑。
 | 
			
		||||
    - [ ] 移除控制器中所有的业务规则判断。
 | 
			
		||||
    - [ ] 移除控制器中直接调用 `repository` 方法的逻辑。
 | 
			
		||||
    - [ ] 移除控制器中直接协调 `analysisPlanTaskManager` 的逻辑。
 | 
			
		||||
    - [ ] 移除控制器中直接处理仓库层特有错误的逻辑。
 | 
			
		||||
    - [ ] 调整服务层方法的调用,使其接收新的服务层输入 DTO 或基本参数,并直接处理服务层返回的 `dto.XxxResponse`。
 | 
			
		||||
- [ ] 2.4.3 **修改 `internal/core/component_initializers.go`**:创建并提供新的 `PlanService`。
 | 
			
		||||
- [ ] 2.4.4 **修改 `internal/app/api/api.go`**:更新 `PlanController` 的依赖注入。
 | 
			
		||||
    - [x] 将 `internal/app/controller/plan/plan_controller.go` 中对 `repository` 方法的直接调用移入服务层。
 | 
			
		||||
    - [x] 将 `internal/app/controller/plan/plan_controller.go` 中对 `analysisPlanTaskManager` 的协调移入服务层。
 | 
			
		||||
    - [x] 将 `internal/app/controller/plan/plan_controller.go` 中处理仓库层特有错误(`gorm.ErrRecordNotFound`)的逻辑移入服务层。
 | 
			
		||||
- [x] 2.4.2 **修改 `internal/app/controller/plan/plan_controller.go`:**
 | 
			
		||||
    - [x] 引入并使用新创建的 `plan_service`。
 | 
			
		||||
    - [x] 移除控制器中直接创建 `models.Plan` 对象和 `repository.ListPlansOptions` 的逻辑。
 | 
			
		||||
    - [x] 移除控制器中所有的业务规则判断。
 | 
			
		||||
    - [x] 移除控制器中直接调用 `repository` 方法的逻辑。
 | 
			
		||||
    - [x] 移除控制器中直接协调 `analysisPlanTaskManager` 的逻辑。
 | 
			
		||||
    - [x] 移除控制器中直接处理仓库层特有错误的逻辑。
 | 
			
		||||
    - [x] 调整服务层方法的调用,使其接收新的服务层输入 DTO 或基本参数,并直接处理服务层返回的 `dto.XxxResponse`。
 | 
			
		||||
- [x] 2.4.3 **修改 `internal/core/component_initializers.go`**:创建并提供新的 `PlanService`。
 | 
			
		||||
- [x] 2.4.4 **修改 `internal/app/api/api.go`**:更新 `PlanController` 的依赖注入。
 | 
			
		||||
 | 
			
		||||
### 2.5 `user` 模块
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user