package book

import (
	"context"

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

func (c *ControllerV1) BookSetFeatured(ctx context.Context, req *v1.BookSetFeaturedReq) (res *v1.BookSetFeaturedRes, err error) {
	out, err := service.Book().SetFeatured(ctx, &model.BookSetFeaturedIn{Id: req.Id, IsFeatured: req.IsFeatured})
	if err != nil {
		return nil, err
	}
	return &v1.BookSetFeaturedRes{Success: out.Success}, nil
}
