package category

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

	v1 "server/api/category/v1"
)

func (c *ControllerV1) Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error) {
	out, err := service.Category().Create(ctx, &model.CategoryAddIn{
		Name:    req.Name,
		Channel: req.Channel,
	})
	if err != nil {
		return nil, err
	}
	return &v1.AddRes{
		Success: out.Success,
	}, nil
}
