fix: better manager response #39

Merged
TakahashiNguyen merged 2 commits from fix-response-me into main 2026-04-28 07:23:31 +00:00
2 changed files with 8 additions and 2 deletions
@@ -1,7 +1,9 @@
package com.drinkool.services;
import com.drinkool.Role;
import com.drinkool.Url;
import com.drinkool.dtos.SmsOtp;
import com.drinkool.entities.ManagerEntity;
import com.drinkool.models.UserModel;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
@@ -22,11 +24,14 @@ public class AccountService {
.entity("InvalidPhoneNumber")
.build();
if (
ManagerEntity.find("phone", input.phone).firstResult() != null
) return Response.accepted().entity(Role.Manager).build();
String otp = otpService.generateAndSaveOtp(input.phone);
// Ở đây bạn sẽ gọi Kafka để gửi SMS thực tế
System.out.println("OTP cho " + input.phone + " là: " + otp);
return Response.accepted().build();
return Response.accepted().entity(Role.Customer).build();
}
}
@@ -62,6 +62,7 @@ public class ManagerService extends BaseService<ManagerEntity> {
return Response.accepted()
.header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Manager)
.entity(customer)
.build();
}
}