feat(login): init
This commit is contained in:
@@ -30,4 +30,18 @@ public class RestAPI {
|
|||||||
|
|
||||||
return Response.status(Response.Status.CREATED).build();
|
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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user