package admin import ( "context" adminv1 "service.xpcool.com/api/admin/v1" "service.xpcool.com/internal/model/dto" "service.xpcool.com/internal/service" ) // AuthController exposes only the public login endpoint. type AuthController struct{} // NewAuth creates the public admin auth controller (login only). func NewAuth() *AuthController { return &AuthController{} } // Login authenticates an administrator and issues a token pair. func (c *AuthController) Login(ctx context.Context, req *adminv1.LoginReq) (res *adminv1.LoginRes, err error) { p, id, err := service.AdminAuth().Login(ctx, dto.AdminLoginInput{Username: req.Username, Password: req.Password}) if err != nil { return nil, err } return &adminv1.LoginRes{AccessToken: p.AccessToken, RefreshToken: p.RefreshToken, ExpiresIn: p.ExpiresIn, AdminID: id}, nil }