package recommend

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

	v1 "server/api/recommend/v1"
)

func (c *ControllerV1) SortOrder(ctx context.Context, req *v1.SortOrderReq) (res *v1.SortOrderRes, err error) {
	out, err := service.BookRecommendations().SortOrder(ctx, &model.BookRecommendationsSortOrderIn{
		Id:        req.Id,
		SortOrder: req.SortOrder,
	})
	if err != nil {
		return nil, err
	}
	return &v1.SortOrderRes{Success: out.Success}, nil
}
