-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
519 additions
and
113 deletions.
There are no files selected for viewing
68 changes: 66 additions & 2 deletions
68
Api/src/main/java/picasso/server/api/member/controller/AuthController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,66 @@ | ||
package picasso.server.api.member.controller;public class AuthController { | ||
} | ||
//package picasso.server.api.member.controller; | ||
// | ||
//import picasso.server.api.member.service.MemberService; | ||
//import picasso.server.domain.domains.member.entity.Member; | ||
//import org.springframework.beans.factory.annotation.Autowired; | ||
//import org.springframework.stereotype.Controller; | ||
//import org.springframework.ui.Model; | ||
//import org.springframework.web.bind.annotation.CookieValue; | ||
//import org.springframework.web.bind.annotation.GetMapping; | ||
//import org.springframework.web.bind.annotation.PostMapping; | ||
//import org.springframework.web.bind.annotation.RequestMapping; | ||
// | ||
//import javax.servlet.http.Cookie; | ||
//import javax.servlet.http.HttpServletResponse; | ||
//import javax.servlet.http.HttpSession; | ||
// | ||
//@Controller | ||
//@RequestMapping("/auth") | ||
//public class AuthController { | ||
// | ||
// { | ||
// System.out.println("AuthController 생성됨!"); | ||
// } | ||
// | ||
// @Autowired | ||
// MemberService memberService; | ||
// | ||
// @GetMapping("form") | ||
// public void form(@CookieValue(required = false) String email, Model model) { | ||
// model.addAttribute("email", email); | ||
// } | ||
// | ||
// @PostMapping("login") | ||
// public String login( | ||
// String email, | ||
// String password, | ||
// String saveEmail, | ||
// HttpSession session, | ||
// Model model, | ||
// HttpServletResponse response) throws Exception { | ||
// | ||
// if (saveEmail != null) { | ||
// Cookie cookie = new Cookie("email", email); | ||
// response.addCookie(cookie); | ||
// } else { | ||
// Cookie cookie = new Cookie("email", "no"); | ||
// cookie.setMaxAge(0); | ||
// response.addCookie(cookie); | ||
// } | ||
// | ||
// Member loginUser = memberService.get(email, password); | ||
// if (loginUser == null) { | ||
// model.addAttribute("refresh", "2;url=form"); | ||
// throw new Exception("회원 정보가 일치하지 않습니다."); | ||
// } | ||
// | ||
// session.setAttribute("loginUser", loginUser); | ||
// return "redirect:/"; | ||
// } | ||
// | ||
// @GetMapping("logout") | ||
// public String logout(HttpSession session) throws Exception { | ||
// session.invalidate(); | ||
// return "redirect:/"; | ||
// } | ||
//} |
102 changes: 102 additions & 0 deletions
102
Api/src/main/java/picasso/server/api/member/controller/MemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
//package picasso.server.api.member.controller; | ||
// | ||
//import org.springframework.beans.factory.annotation.Autowired; | ||
//import org.springframework.stereotype.Controller; | ||
//import org.springframework.ui.Model; | ||
//import org.springframework.web.bind.annotation.*; | ||
//import org.springframework.web.multipart.MultipartFile; | ||
//import picasso.server.api.member.service.MemberService; | ||
//import picasso.server.domain.domains.member.entity.Member; | ||
// | ||
//@Controller | ||
//@RequestMapping("/member") | ||
//public class MemberController { | ||
// | ||
// @Autowired | ||
// MemberService memberService; | ||
// | ||
// @GetMapping("form") | ||
// public void form() { | ||
// } | ||
// | ||
// @PostMapping("add") | ||
// public String add(Member member, MultipartFile photofile) throws Exception { | ||
// System.out.println(member); | ||
// if (photofile.getSize() > 0) { | ||
// String uploadFileUrl = ncpObjectStorageService.uploadFile( | ||
// "bitcamp-nc7-bucket-20", "member/", photofile); | ||
// member.setPhoto(uploadFileUrl); | ||
// } | ||
// memberService.add(member); | ||
// return "redirect:list"; | ||
// } | ||
// | ||
// | ||
// | ||
// | ||
// @GetMapping("/login") | ||
// public String loginPage(Model model) { | ||
// // 로그인 페이지로 이동하는 컨트롤러 메서드 | ||
// // Model 객체를 사용하여 필요한 데이터를 뷰로 전달할 수 있습니다. | ||
// return "login"; // 로그인 페이지의 뷰 이름 | ||
// } | ||
// | ||
// // 회원 등록 페이지로 이동하는 컨트롤러 메서드 | ||
// @GetMapping("/register") | ||
// public String registerPage(Model model) { | ||
// // 회원 등록 페이지로 이동 | ||
// return "register"; // 회원 등록 페이지의 뷰 이름 | ||
// } | ||
// | ||
// // 회원 등록 처리를 위한 컨트롤러 메서드 | ||
// @PostMapping("/register") | ||
// public String registerMember(@ModelAttribute Member member, Model model) { | ||
// try { | ||
// // 회원 등록 서비스 호출 | ||
// memberService.register(member); | ||
// // 등록 성공 시 홈 페이지로 이동 | ||
// return "redirect:/home"; | ||
// } catch (IllegalArgumentException e) { | ||
// // 등록 실패 시 에러 메시지를 모델에 추가하여 다시 회원 등록 페이지로 이동 | ||
// model.addAttribute("error", e.getMessage()); | ||
// return "register"; // 회원 등록 페이지의 뷰 이름 | ||
// } | ||
// } | ||
// | ||
// // 회원 정보 수정 페이지로 이동하는 컨트롤러 메서드 | ||
// @GetMapping("/edit/{id}") | ||
// public String editMemberPage(@PathVariable Long id, Model model) { | ||
// // 회원 정보 수정 페이지로 이동 | ||
// Member member = memberService.findById(id); | ||
// model.addAttribute("member", member); | ||
// return "edit"; // 회원 정보 수정 페이지의 뷰 이름 | ||
// } | ||
// | ||
// // 회원 정보 수정 처리를 위한 컨트롤러 메서드 | ||
// @PostMapping("/edit/{id}") | ||
// public String editMember(@PathVariable Long id, @ModelAttribute Member memberDetails, Model model) { | ||
// try { | ||
// // 회원 정보 수정 서비스 호출 | ||
// memberService.updateMember(id, memberDetails); | ||
// // 수정 성공 시 홈 페이지로 이동 | ||
// return "redirect:/home"; | ||
// } catch (IllegalArgumentException e) { | ||
// // 수정 실패 시 에러 메시지를 모델에 추가하여 다시 회원 정보 수정 페이지로 이동 | ||
// model.addAttribute("error", e.getMessage()); | ||
// return "edit"; // 회원 정보 수정 페이지의 뷰 이름 | ||
// } | ||
// } | ||
// | ||
// // 회원 삭제 처리를 위한 컨트롤러 메서드 | ||
// @GetMapping("delete") | ||
// public String delete(int no) throws Exception { | ||
// if (memberService.delete(no) == 0) { | ||
// throw new Exception("해당 번호의 회원이 없습니다."); | ||
// } else { | ||
// return "redirect:list"; | ||
// } | ||
// } | ||
// | ||
// // 여기에 다른 컨트롤러 메서드를 추가할 수 있습니다. | ||
//} | ||
// |
28 changes: 27 additions & 1 deletion
28
Api/src/main/java/picasso/server/api/member/dto/MemberDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,28 @@ | ||
package picasso.server.api.member.dto;public class MemberDTO { | ||
package picasso.server.api.member.dto; | ||
|
||
import java.sql.Date; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class MemberDTO { | ||
|
||
private Long id; | ||
private Long userId; | ||
private String email; | ||
private String password; | ||
private String nickname; | ||
private String profile; | ||
private Long point; | ||
private String loginType; | ||
private String status; | ||
private String role; | ||
private Date createdAt; | ||
private Date updatedAt; | ||
private Date loginAt; | ||
private String accessToken; | ||
private String refreshToken; | ||
|
||
// 필요한 경우 생성자, 변환 메서드 등을 여기에 추가할 수 있습니다. | ||
} |
13 changes: 11 additions & 2 deletions
13
Api/src/main/java/picasso/server/api/member/service/AuthService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
package picasso.server.api.member.service;public interface AuthService { | ||
} | ||
//package picasso.server.api.member.service; | ||
// | ||
// | ||
//import picasso.server.domain.domains.member.entity.Member; | ||
// | ||
//public interface AuthService { | ||
// void register(Member member); | ||
// String login(String email, String password); | ||
// String refreshToken(String refreshToken); | ||
// // 필요한 다른 메서드들도 여기에 추가할 수 있습니다. | ||
//} |
51 changes: 49 additions & 2 deletions
51
Api/src/main/java/picasso/server/api/member/service/AuthServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
package picasso.server.api.member.service;public class AuthServiceImpl { | ||
} | ||
//package picasso.server.api.member.service; | ||
// | ||
//import org.springframework.beans.factory.annotation.Autowired; | ||
////import org.springframework.security.crypto.password.PasswordEncoder; | ||
//import org.springframework.stereotype.Service; | ||
//import picasso.server.domain.domains.member.repository.MemberRepository; | ||
////import picasso.server.api.member.service.TokenService; | ||
// | ||
//@Service | ||
//public class AuthServiceImpl { | ||
// | ||
// private final MemberRepository memberRepository; | ||
//// private final PasswordEncoder passwordEncoder; | ||
//// private final TokenService tokenService; | ||
// | ||
// @Autowired | ||
// public AuthServiceImpl(MemberRepository memberRepository) { | ||
// this.memberRepository = memberRepository; | ||
//// this.passwordEncoder = passwordEncoder; | ||
//// this.tokenService = tokenService; | ||
// } | ||
// | ||
//// @Override | ||
//// public void register(Member member) { | ||
//// if (memberRepository.existsByEmail(member.getEmail())) { | ||
//// throw new IllegalArgumentException("Email already in use."); | ||
//// } | ||
//// member.setPassword(passwordEncoder.encode(member.getPassword())); // 비밀번호 암호화 | ||
//// memberRepository.save(member); | ||
//// } | ||
//// | ||
//// @Override | ||
//// public String login(String email, String password) { | ||
//// Member member = memberRepository.findByEmail(email) | ||
//// .orElseThrow(() -> new IllegalArgume | ||
//// ntException("Invalid email or password.")); | ||
//// | ||
//// if (!passwordEncoder.matches(password, member.getPassword())) { | ||
//// throw new IllegalArgumentException("Invalid email or password."); | ||
//// } | ||
//// | ||
//// return tokenService.generateAccessToken(member); // 토큰 생성 로직 | ||
//// } | ||
//// | ||
//// @Override | ||
//// public String refreshToken(String refreshToken) { | ||
//// return tokenService.refreshAccessToken(refreshToken); // 토큰 새로고침 로직 | ||
//// } | ||
//} |
54 changes: 54 additions & 0 deletions
54
Api/src/main/java/picasso/server/api/member/service/DefaultMemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//package picasso.server.api.member.service; | ||
// | ||
//import org.springframework.stereotype.Service; | ||
//import org.springframework.transaction.annotation.Transactional; | ||
//import picasso.server.domain.domains.member.entity.Member; | ||
//import picasso.server.domain.domains.member.repository.MemberRepository; | ||
// | ||
//import java.util.List; | ||
// | ||
//@Service | ||
//public class DefaultMemberService implements MemberService { | ||
// { | ||
// System.out.println("DefaultMemberService 생성됨!"); | ||
// } | ||
// | ||
// MemberRepository memberRepository; | ||
// | ||
// public DefaultMemberService(MemberRepository memberRepository) { | ||
// | ||
// } | ||
// | ||
// @Transactional | ||
// @Override | ||
// public int add(Member member) throws Exception { | ||
// return memberDao.insert(member); | ||
// } | ||
// | ||
// @Override | ||
// public List<Member> list() throws Exception { | ||
// return memberDao.findAll(); | ||
// } | ||
// | ||
// @Override | ||
// public Member get(int memberNo) throws Exception { | ||
// return memberDao.findBy(memberNo); | ||
// } | ||
// | ||
// @Override | ||
// public Member get(String email, String password) throws Exception { | ||
// return memberDao.findByEmailAndPassword(email, password); | ||
// } | ||
// | ||
// @Transactional | ||
// @Override | ||
// public int update(Member member) throws Exception { | ||
// return memberDao.update(member); | ||
// } | ||
// | ||
// @Transactional | ||
// @Override | ||
// public int delete(int memberNo) throws Exception { | ||
// return memberDao.delete(memberNo); | ||
// } | ||
//} |
38 changes: 36 additions & 2 deletions
38
Api/src/main/java/picasso/server/api/member/service/MemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
package picasso.server.api.member.service;public interface MemberService { | ||
} | ||
//package picasso.server.api.member.service; | ||
// | ||
//import picasso.server.domain.domains.member.entity.Member; | ||
// | ||
//import java.util.List; | ||
//import java.util.Optional; | ||
// | ||
//public interface MemberService { | ||
// | ||
// // 회원 생성 | ||
// Member save(Member member); | ||
// | ||
// // 회원 조회 (ID 기반) | ||
// Optional<Member> findById(Long id); | ||
// | ||
// // 모든 회원 조회 | ||
// List<Member> findAll(); | ||
// | ||
// // 회원 수정 | ||
// Member update(Member member); | ||
// | ||
// // 회원 삭제 (ID 기반) | ||
// void deleteById(Long id); | ||
// | ||
// // 회원 이메일로 조회 | ||
// Optional<Member> findByEmail(String email); | ||
// | ||
// // 회원 닉네임으로 조회 | ||
// Optional<Member> findByNickname(String nickname); | ||
// | ||
// // 회원 상태 변경 | ||
// void updateStatus(Long id, String status); | ||
// | ||
// // 회원 포인트 추가 | ||
// void addPoints(Long id, Long points); | ||
//} |
2 changes: 0 additions & 2 deletions
2
Api/src/main/java/picasso/server/api/member/service/MemberServiceImpl.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.