package category

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

	v1 "server/api/category/v1"
)

func (c *ControllerV1) Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error) {
	out, err := service.Category().Update(ctx, &model.CategoryEditIn{
		Id:      req.Id,
		Name:    req.Name,
		Channel: req.Channel,
	})
	if err != nil {
		return nil, err
	}
	return &v1.EditRes{
		Success: out.Success,
	}, nil
}
