package auth

import (
	"context"

	v1 "server/api/auth/v1"
	"server/internal/model"
	"server/internal/service"
)

func (c *ControllerV1) AuthorLogin(ctx context.Context, req *v1.AuthorLoginReq) (res *v1.AuthorLoginRes, err error) {
	out, err := service.User().AuthorLogin(ctx, &model.UserLoginIn{Email: req.Email, Password: req.Password})
	if err != nil {
		return nil, err
	}
	return &v1.AuthorLoginRes{Token: out.Token}, nil
}
