package author

import (
	"context"
	v1 "server/api/author/v1"
	"server/internal/model"
	"server/internal/service"
)

func (c *ControllerV1) Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error) {
	out, err := service.Author().Create(ctx, &model.AuthorAddIn{
		UserId:  req.UserId,
		PenName: req.PenName,
		Bio:     req.Bio,
		Status:  req.Status,
	})
	if err != nil {
		return nil, err
	}

	return &v1.AddRes{
		Success: out.Success,
	}, nil
}
