package recommend

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	v1 "server/api/recommend/v1"
)

func (c *ControllerV1) Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error) {
	out, err := service.BookRecommendations().Update(ctx, &model.BookRecommendationsUpdateIn{
		Id:        req.Id,
		BookId:    req.BookId,
		Type:      req.Type,
		CoverUrl:  req.CoverUrl,
		SortOrder: req.SortOrder,
		Status:    req.Status,
	})
	if err != nil {
		return nil, err
	}
	return &v1.EditRes{Success: out.Success}, nil
}
