feat: init customer authentication #2

Merged
TakahashiNguyen merged 66 commits from dev-order-service into main 2026-03-23 13:21:01 +00:00
2 changed files with 20 additions and 0 deletions
Showing only changes of commit cca440f827 - Show all commits
@@ -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;
}