package author

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

func (c *ControllerV1) Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error) {
	out, err := service.Author().Update(ctx, &model.AuthorEditIn{
		Id:      req.Id,
		PenName: req.PenName,
		Bio:     req.Bio,
		Status:  req.Status,
	})
	if err != nil {
		return nil, err
	}

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