package cast

import (
	"context"
	"fmt"
	"fonchain-fiee/api/cast"
	"fonchain-fiee/pkg/model/login"
	"fonchain-fiee/pkg/service"

	"github.com/gin-gonic/gin"
)

func TaskList(ctx *gin.Context) {
	var req *cast.ListTaskListReq
	var err error
	if err = ctx.ShouldBind(&req); err != nil {
		service.Error(ctx, err)
		return
	}
	loginInfo := login.GetUserInfoFromC(ctx)
	req.OperatorID = fmt.Sprint(loginInfo.ID)
	resp, err := service.CastProvider.ListTaskList(context.Background(), req)
	if err != nil {
		service.Error(ctx, err)
		return
	}
	service.Success(ctx, resp)
}
