ai_scheduler/internal/services/task.go

36 lines
613 B
Go

package services
import (
"ai_scheduler/internal/biz"
"ai_scheduler/internal/entitys"
"github.com/gofiber/fiber/v2"
)
type TaskService struct {
taskBiz *biz.TaskBiz
chatBiz *biz.ChatHistoryBiz
}
func NewTaskService(sessionBiz *biz.SessionBiz, taskBiz *biz.TaskBiz) *TaskService {
return &TaskService{
taskBiz: taskBiz,
}
}
// Tasks 任务列表
func (s *TaskService) Tasks(c *fiber.Ctx) error {
req := &entitys.TaskRequest{}
if err := c.BodyParser(req); err != nil {
return err
}
result, err := s.taskBiz.TaskList(c.Context(), req)
if err != nil {
return err
}
return c.JSON(result)
}