package task

import (
	"context"

	v1 "server/api/task/v1"
	"server/internal/model"
	"server/internal/service"
)

func (c *ControllerV1) Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error) {
	out, err := service.Task().Edit(ctx, &model.TaskEditIn{
		Id:           req.Id,
		TaskType:     req.TaskType,
		Title:        req.Title,
		Description:  req.Description,
		RewardPoints: req.RewardPoints,
		Status:       req.Status,
	})
	if err != nil {
		return nil, err
	}
	return &v1.EditRes{Success: out.Success}, nil
}
