feat(login): init

This commit is contained in:
TakahashiNg
2026-03-22 09:11:12 +00:00
parent dfa07ca02c
commit cca440f827
2 changed files with 20 additions and 0 deletions
@@ -30,4 +30,18 @@ public class RestAPI {
return Response.status(Response.Status.CREATED).build();
}
@POST
@Path("/login")
public Response login(Login input) {
Customer customer = Customer.find("phone", input.phone).firstResult();
if (customer == null)
throw new BadRequestException("InvalidPhoneNumber");
if (!customer.login(input.password))
throw new BadRequestException("InvalidPassword");
return Response.accepted().build();
}
}
@@ -0,0 +1,6 @@
package com.drinkool.dtos;
public class Login {
public String phone;
public String password;
}