package recommend

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

	v1 "server/api/recommend/v1"
)

func (c *ControllerV1) Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error) {
	out, err := service.BookRecommendations().Create(ctx, &model.BookRecommendationsCreateIn{
		BookId:    req.BookId,
		Type:      req.Type,
		CoverUrl:  req.CoverUrl,
		SortOrder: req.SortOrder,
		Status:    req.Status,
	})
	if err != nil {
		return nil, err
	}
	return &v1.AddRes{Success: out.Success}, nil
}
