Skip to content

Commit

Permalink
Merge pull request #98 from CSID-DGU/back
Browse files Browse the repository at this point in the history
Feat: join
  • Loading branch information
proysm authored Dec 18, 2023
2 parents 4b46960 + ccdc40b commit 2b92aac
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ public SingleResponse<User> insert(@RequestBody JoinDTO joinDTO){
public AdminResponse login(HttpServletRequest request, @RequestBody Map<String, String> loginData){
String email = loginData.get("email");
String password = loginData.get("password");
Long login_result = userService.login(email, password);
Long id = userService.login(email, password);

CommonResponse commonResponse = new CommonResponse();
HttpSession session = request.getSession(); // Session이 있으면 가져오고 없으면 Session을 생성
int isAdmin = -1;
if (login_result > 0) {
if (id > 0) {
commonResponse.setStatus("SUCCESS");
commonResponse.setMessage(null);
session.setAttribute("id", login_result); // key:id, value:id
session.setAttribute("id", id); // key:id, value:id
System.out.println(session.getAttribute("id"));
} else {
commonResponse.setStatus("FAILED");
commonResponse.setMessage("로그인 실패");
}
return responseService.getAdminResponse(commonResponse, isAdmin);
return responseService.getAdminResponse(commonResponse, id);
}

// 로그아웃
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
public interface ResponseRepository {
public<T> SingleResponse<T> getSingleResponse(CommonResponse result, T data);
public<T> ListResponse<T> getListResponse(CommonResponse result, List<T> list_data);
public AdminResponse getAdminResponse(CommonResponse result, int isAdmin);
public AdminResponse getAdminResponse(CommonResponse result, Long isAdmin);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public<T> ListResponse<T> getListResponse(CommonResponse result, List<T> list_da
listResponse.setList_data(list_data);
return listResponse;
}
public AdminResponse getAdminResponse(CommonResponse result, int isAdmin){
public AdminResponse getAdminResponse(CommonResponse result, Long isAdmin){
AdminResponse adminResponse = new AdminResponse();
adminResponse.setStatus(result.getStatus());
adminResponse.setMessage(result.getMessage());
adminResponse.setIsAdmin(isAdmin);
adminResponse.setId(isAdmin);
return adminResponse;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
@Getter
@Setter
public class AdminResponse extends CommonResponse{
private int isAdmin;
private Long id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public<T> ListResponse<T> getListResponse(CommonResponse result, List<T> list_da
return response_rp.getListResponse(result, list_data);
}

public AdminResponse getAdminResponse(CommonResponse result, int isAdmin){
public AdminResponse getAdminResponse(CommonResponse result, Long isAdmin){
return response_rp.getAdminResponse(result, isAdmin);
}

Expand Down

0 comments on commit 2b92aac

Please sign in to comment.