Skip to content

Commit

Permalink
Merge pull request #106 from Youngseo-Jeon0313/fix/#105/JPA
Browse files Browse the repository at this point in the history
Fix/#105/jpa
  • Loading branch information
Youngseo-Jeon0313 authored Mar 30, 2023
2 parents 18b15c1 + d9c3550 commit d9fd696
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.example.umc3_teamproject.controller;

import com.example.umc3_teamproject.config.resTemplate.ResponseException;
import com.example.umc3_teamproject.domain.dto.request.InterviewRequestDto;
import com.example.umc3_teamproject.domain.dto.response.InterviewResponseDto;
import com.example.umc3_teamproject.domain.item.Interview;
import com.example.umc3_teamproject.domain.item.Script;
import com.example.umc3_teamproject.repository.InterviewRepository;
import com.example.umc3_teamproject.service.InterviewService;
import com.example.umc3_teamproject.service.JwtService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -14,6 +16,7 @@
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -29,6 +32,7 @@ public class InterviewController {
private final InterviewService interviewService;
private final InterviewRepository interviewRepository;
private final InterviewResponseDto interviewResponseDto;
private final JwtService jwtService;

@PostMapping("/new")
public ResponseEntity<?> writeInterview(@Validated InterviewRequestDto.Register write){
Expand All @@ -50,8 +54,9 @@ public ResponseEntity<?> readScriptById(@PathVariable("id") Long id) {
return null;
}

@GetMapping("/user/{userId}")
public ResponseEntity<?> readScriptByUser(@PathVariable("userId") Long userId) {
@GetMapping("/user/me")
public ResponseEntity<?> readScriptByUser() throws IOException, ResponseException {
Long userId = jwtService.getmemberId();

List<Interview> interviewList=null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.example.umc3_teamproject.controller;

import com.example.umc3_teamproject.config.resTemplate.ResponseException;
import com.example.umc3_teamproject.domain.dto.request.ScriptRequestDto;
import com.example.umc3_teamproject.domain.dto.response.ScriptResponseDto;
import com.example.umc3_teamproject.domain.item.Script;
import com.example.umc3_teamproject.repository.ScriptRepository;
import com.example.umc3_teamproject.service.JwtService;
import com.example.umc3_teamproject.service.ScriptService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -35,7 +37,7 @@ public class ScriptController {
private final ScriptService scriptService;
private final ScriptRepository scriptRepository;
private final ScriptResponseDto scriptResponseDto;

private final JwtService jwtService;
@PostMapping("/new")
public ResponseEntity<?> writeScript(@RequestBody ScriptRequestDto.Register script ){

Expand All @@ -54,10 +56,11 @@ public ResponseEntity<?> readScriptById(@PathVariable("id") Long id) {
return null;
}

@GetMapping("/member/{memberId}")
public ResponseEntity<?> findScriptByUser(@PathVariable("memberId") Long memberId) {
@GetMapping("/member/me")
public ResponseEntity<?> findScriptByUser() throws ResponseException {
// @PageableDefault(page=0, size=10, sort="id", direction = Sort.Direction.DESC) Pageable pageable) {

Long memberId = jwtService.getmemberId();
List<Script> scriptList=scriptService.findByMemberId(memberId);
//model.addAttribute("scriptList", scriptList);

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/example/umc3_teamproject/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public class Member extends BaseTimeEntity {
private String nickName;
@Column(nullable = true)
private String imageUrl;
@Column
@Enumerated(EnumType.STRING)
private Tier tier ;

@Column
@Enumerated(EnumType.STRING)
private LoginType loginType; //일반 로그인 또는 소셜로그인

@Column(nullable = true)
Expand All @@ -50,7 +50,7 @@ public class Member extends BaseTimeEntity {
private int memberStatus;

@Column
private int blockStatus;
private boolean blockStatus;


@OneToMany(mappedBy = "memberId", cascade = CascadeType.ALL)
Expand Down Expand Up @@ -90,7 +90,7 @@ public Member(String socialId) {


@Builder
public Member(Long id,String email, String socialId,String introduction,String pw, String nickName, String imageUrl, Tier tier, LoginType loginType, int memberStatus, int blockStatus){
public Member(Long id,String email, String socialId,String introduction,String pw, String nickName, String imageUrl, Tier tier, LoginType loginType, int memberStatus, boolean blockStatus){
this.id = id;
this.email = email;
this.socialId = socialId;
Expand All @@ -114,6 +114,6 @@ public void createMember(String email,String pw, String nickName, String imageUr
this.memberStatus=1;
this.tier= BRONZE;
this.loginType = LoginType.DEFAULT;
this.blockStatus=0;
this.blockStatus=false;
}
}

0 comments on commit d9fd696

Please sign in to comment.