diff --git a/.gradle/7.2/executionHistory/executionHistory.bin b/.gradle/7.2/executionHistory/executionHistory.bin index 96bebf32..a72fe964 100644 Binary files a/.gradle/7.2/executionHistory/executionHistory.bin and b/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.2/executionHistory/executionHistory.lock b/.gradle/7.2/executionHistory/executionHistory.lock index 906452fd..d46ca8a0 100644 Binary files a/.gradle/7.2/executionHistory/executionHistory.lock and b/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.2/fileHashes/fileHashes.bin b/.gradle/7.2/fileHashes/fileHashes.bin index 73fdb11b..fb94a9bf 100644 Binary files a/.gradle/7.2/fileHashes/fileHashes.bin and b/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.2/fileHashes/fileHashes.lock b/.gradle/7.2/fileHashes/fileHashes.lock index 7bb43f89..d7121703 100644 Binary files a/.gradle/7.2/fileHashes/fileHashes.lock and b/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.2/fileHashes/resourceHashesCache.bin b/.gradle/7.2/fileHashes/resourceHashesCache.bin index 33f85e38..f4f7eb5b 100644 Binary files a/.gradle/7.2/fileHashes/resourceHashesCache.bin and b/.gradle/7.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index b795c71b..52c4e179 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 79d95dba..ce60207c 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/application.yml b/application.yml new file mode 100644 index 00000000..e9bb7b3b --- /dev/null +++ b/application.yml @@ -0,0 +1,78 @@ +gpt : + model: gpt-3.5-turbo + api: + key: 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 + url: https://api.openai.com/v1/chat/completions +baseUrl : https://just-s3.s3.ap-northeast-2.amazonaws.com/ +server: + port: 9000 +cloud: + aws: + credentials: + accessKey: AKIA2PIR5NDYRVE3NDUN + secretKey: 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 + region: ap-northeast-2 + bucketName: just-s3 + stack: + auto: false +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher #Swagger 문제로 추가함 ㅇㅇ + jackson: + default-property-inclusion: non-null + ## # -> #까지 뭔지 알아오기 (해석하고 발표하시길) + datasource: ## 뭔지 알아오기 + hikari: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://13.209.213.191:3306/just?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&characterEncoding=UTF-8 + username: admin + password: 334334334! + connection-timeout: 15000 #30초 설정 + maximum-pool-size: 150 #150개 설정 + + security: + oauth2: + client: + registration: + kakao: + client-id: 55ec14b78e17e978a4a3b64971060784 + redirect-uri: http://13.209.213.191:9000/api/kakao/access_token + client-authentication-method: POST + client-secret: QREhvyjJygyPKlqkJtSFc91GUlvBqA5K + authorization-grant-type: authorization_code + scope: + - account_email + - profile_nickname + client_name: Kakao + provider: + kakao: + authorization-uri: https://kauth.kakao.com/oauth/authorize + token-uri: https://kauth.kakao.com/oauth/token + user-info-uri: https://kapi.kakao.com/v2/user/me + user-name-attribute: id + ## #->해석해오기 + jpa: + database: mysql + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + generate-ddl: true + open-in-view: false + hibernate: + ddl-auto: validate + ## - >필수로 마스터 해오기 + naming: + physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + use-new-id-generator-mappings: true + properties: + hibernate: + show_sql: false + format_sql: true + enable_lazy_load_no_trans: true + +server-add: 13.209.213.191 +api-url: https://kauth.kakao.com/oauth/authorize?client_id=55ec14b78e17e978a4a3b64971060784&redirect_uri=http://13.209.213.191:9000/api/kakao/access_token&response_type=code + +jwt: + header: Authorization + secret: QREhvyjJygyPKlqkJtSFc91GUlvBqA5KaijdfijAIfj41jkjiUIJHI3ji123AasdhfuAUSLNJUIGh098587KJMGKN134JBN8 + token-validity-in-seconds: 86400 \ No newline at end of file diff --git a/src/main/generated/com/example/just/Mapper/MemberMapperImpl.java b/src/main/generated/com/example/just/Mapper/MemberMapperImpl.java index 144a6bdc..aa782b43 100644 --- a/src/main/generated/com/example/just/Mapper/MemberMapperImpl.java +++ b/src/main/generated/com/example/just/Mapper/MemberMapperImpl.java @@ -10,8 +10,13 @@ @Generated( value = "org.mapstruct.ap.MappingProcessor", +<<<<<<< HEAD + date = "2024-03-17T14:02:16+0900", + comments = "version: 1.5.3.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.2.jar, environment: Java 11.0.21 (Oracle Corporation)" +======= date = "2024-03-14T18:31:05+0900", comments = "version: 1.5.3.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.2.jar, environment: Java 11.0.11 (AdoptOpenJDK)" +>>>>>>> 1873eda5ea1d8642f1745319bf607ddf3962b063 ) @Component public class MemberMapperImpl implements MemberMapper { diff --git a/src/main/generated/com/example/just/Mapper/PostMapperImpl.java b/src/main/generated/com/example/just/Mapper/PostMapperImpl.java index 9c66101f..1f3cb8c5 100644 --- a/src/main/generated/com/example/just/Mapper/PostMapperImpl.java +++ b/src/main/generated/com/example/just/Mapper/PostMapperImpl.java @@ -10,8 +10,13 @@ @Generated( value = "org.mapstruct.ap.MappingProcessor", +<<<<<<< HEAD + date = "2024-03-17T14:02:15+0900", + comments = "version: 1.5.3.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.2.jar, environment: Java 11.0.21 (Oracle Corporation)" +======= date = "2024-03-14T18:31:05+0900", comments = "version: 1.5.3.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.2.jar, environment: Java 11.0.11 (AdoptOpenJDK)" +>>>>>>> 1873eda5ea1d8642f1745319bf607ddf3962b063 ) @Component public class PostMapperImpl implements PostMapper { diff --git a/src/main/java/com/example/just/Admin/AdminController.java b/src/main/java/com/example/just/Admin/AdminController.java index bd12c495..95b24172 100644 --- a/src/main/java/com/example/just/Admin/AdminController.java +++ b/src/main/java/com/example/just/Admin/AdminController.java @@ -4,13 +4,9 @@ import com.example.just.Dao.HashTag; import com.example.just.Dao.Member; import com.example.just.Dao.Post; -import com.example.just.Repository.HashTagMapRepository; +import com.example.just.Repository.*; import com.example.just.Response.ResponseUpdateHashtagsDto; -import com.example.just.Repository.CommentRepository; -import com.example.just.Repository.HashTagRepository; -import com.example.just.Repository.MemberRepository; -import com.example.just.Repository.PostRepository; -import com.example.just.Service.ResponsePost; +import com.example.just.Service.*; import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.Operation; import org.springframework.beans.factory.annotation.Autowired; @@ -20,9 +16,8 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import com.example.just.Service.MemberService; -import com.example.just.Service.CommentService; -import com.example.just.Service.PostService; + +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -43,17 +38,17 @@ public class AdminController { private CommentRepository commentRepository; @Autowired private MemberRepository memberRepository; - - - @Autowired - private PostRepository postRepository; @Autowired private HashTagRepository hashTagRepository; @Autowired private HashTagMapRepository hashTagMapRepository; + @Autowired + private HashTagESRepository hashTagESRepository; + @Autowired + private BlameService blameService; - @ApiOperation(value = "멤버 리스트 불러옴 admin페이지에서 members 페이지로 이동할때") - @Operation(summary = "members리스트 뽑는다", description = "\n admin페이지->members페이지-> 리스트 리턴") + @ApiOperation(value = "멤버 리스트 불러옴 admin 페이지에서 members 페이지로 이동할때") + @Operation(summary = "members 리스트 뽑는다", description = "\n admin 페이지->members 페이지-> 리스트 리턴") @GetMapping("/members") public ResponseEntity> memberList() { List members = memberService.findMembers(); @@ -61,6 +56,17 @@ public ResponseEntity> memberList() { } + @ApiOperation(value = "신고받은 멤버 조회") + @Operation(summary = "신고받은 멤버 조회", description = "\n 신고받은 횟수가 0보다 큰 멤버 조회") + @GetMapping("/reported-members") + public ResponseEntity> getReportedMembers() { + // 1 이상의 신고를 받은 멤버만 조회 + ResponseEntity> reportedMembersResponse = blameService.getBlamedList("member"); + List reportedMembers = reportedMembersResponse.getBody(); + return new ResponseEntity<>(reportedMembers, HttpStatus.OK); + } + + @ApiOperation(value = "멤버페이지에서 회원 삭제 기능 ") @Operation(summary = "회원 삭제", description = "\n member_id 헤더로 받고 데이터베이스 비교 후 회원 삭제") @DeleteMapping("/members/{member_id}") @@ -72,8 +78,8 @@ public ResponseEntity drop(@PathVariable Long member_id) { return new ResponseEntity<>("해당 회원이 존재하지 않습니다.", HttpStatus.BAD_REQUEST); } - @ApiOperation(value = "comments페이지에서 comment 리스트 불러옴") - @Operation(summary = "comments리스트", description = "\n admin페이지 -> comments->페이지로 return하여 리스트 뽑") + @ApiOperation(value = "comments 페이지에서 comment 리스트 불러옴") + @Operation(summary = "comments 리스트", description = "\n admin 페이지 -> comments->페이지로 return 하여 리스트 뽑") @GetMapping("/comments") public ResponseEntity> commentList() { List comments = commentService.getAllComments(); @@ -82,26 +88,24 @@ public ResponseEntity> commentList() { //댓글 삭제 @ApiOperation(value = "댓글 아이디와 멤버 아이디 비교 후 삭제 ") - @Operation(summary = "댓글 삭제", description = "\n comment_id, member_id 헤더로 받고 데이터베이스 비교 후 회원 삭제") - @DeleteMapping("/comments/{comment_id}/{member_id}") + @Operation(summary = "댓글 삭제", description = "\n comment_id, 헤더로 받고 데이터베이스 비교 후 회원 삭제") + @DeleteMapping("/comments/{comment_id}/") public ResponseEntity deleteComment(@PathVariable Long comment_id) { Comment comment = commentRepository.findById(comment_id) .orElseThrow(() -> new RuntimeException("부모 댓글이 존재하지 않습니다.")); List children = comment.getChildren(); if (children != null) { - for (Comment child : children) { - commentRepository.delete(child); - } + commentRepository.deleteAll(children); } commentRepository.deleteById(comment_id); return ResponseEntity.ok("ok"); } - @ApiOperation(value = "게시물 리스트 불러옴 posts페이지에서") - @Operation(summary = "게시글 리스트", description = "\n admin 페이지-> posts페이지-> return하여 post list 출력") + @ApiOperation(value = "게시물 리스트 불러옴 posts 페이지에서") + @Operation(summary = "게시글 리스트", description = "\n admin 페이지-> posts 페이지-> return 하여 post list 출력") @GetMapping("/posts") - public ResponseEntity> postList() { + public ResponseEntity> PostList() { List posts = postService.getAllPostList(); return new ResponseEntity<>(posts, HttpStatus.OK); } @@ -116,45 +120,26 @@ public ResponsePost deletePost(@PathVariable Long post_id) throws NotFoundExcept ResponsePost responsePost = new ResponsePost(post_id, "삭제 완료"); return responsePost; } -/* + @ApiOperation(value = "포스트페이지 해시태그 수정 ") @Operation(summary = "해시태그 수정", description = "\n hashtag_id 헤더로 받고 내용을 수정하면 새로운 해시태그를 생성하여 저장 ex) id_101 -> id_104로") - @PutMapping("/posts/{hashtag_id}") - public ResponseEntity updateHashtags(@PathVariable Long hashtag_id, @RequestBody List newHashtags) - throws NotFoundException { - Optional optionalHashtag = hashTagRepository.findById(hashtag_id); + @PutMapping("/hashtags/{hashtag_id}") + public ResponseEntity updateHashTag(@PathVariable Long hashtag_id, @RequestBody String newName) { + Optional optionalHashTag = hashTagRepository.findById(hashtag_id); - if (!optionalHashtag.isPresent()) { - throw new NotFoundException(); + if (!optionalHashTag.isPresent()) { + return ResponseEntity.notFound().build(); } - HashTag existingHashtag = optionalHashtag.get(); - Post post = existingHashtag.getPost(); - - // 기존 게시물의 해시태그 제거 - List existingHashtags = hashTagRepository.findByPost(post); - for (HashTag hashtag : existingHashtags) { - hashTagRepository.deleteById(hashtag.getId()); - } + HashTag hashTag = optionalHashTag.get(); + hashTag.setName(newName); + hashTagRepository.save(hashTag); - // 새로운 해시태그를 생성 저장 - List updatedHashtags = newHashtags.stream() - .map(name -> { - HashTag hashtag = new HashTag(); - hashtag.setName(name); - hashtag.setPost(post); - return hashtag; - }) - .collect(Collectors.toList()); - - hashTagRepository.saveAll(updatedHashtags); - - // 업데이트된 정보 DTO 반환 - ResponseUpdateHashtagsDto response = new ResponseUpdateHashtagsDto(hashtag_id, newHashtags); - return ResponseEntity.ok(response); + return ResponseEntity.ok("해시태그 내용이 성공적으로 수정되었습니다."); } - -*/ } + + + diff --git a/src/main/java/com/example/just/JustApplication.java b/src/main/java/com/example/just/JustApplication.java index 4fb3f640..ecced387 100644 --- a/src/main/java/com/example/just/JustApplication.java +++ b/src/main/java/com/example/just/JustApplication.java @@ -35,4 +35,4 @@ public static void main(String[] args) { SpringApplication.run(JustApplication.class, args); } -} +} \ No newline at end of file diff --git a/src/main/java/com/example/just/Repository/HashTagESRepository.java b/src/main/java/com/example/just/Repository/HashTagESRepository.java index 40c762b2..bbc6a07f 100644 --- a/src/main/java/com/example/just/Repository/HashTagESRepository.java +++ b/src/main/java/com/example/just/Repository/HashTagESRepository.java @@ -2,6 +2,9 @@ import com.example.just.Document.HashTagDocument; import java.util.List; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.Sort; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import org.springframework.data.repository.CrudRepository; diff --git a/src/main/java/com/example/just/Service/PostService.java b/src/main/java/com/example/just/Service/PostService.java index 7c33ca21..4d0aec7e 100644 --- a/src/main/java/com/example/just/Service/PostService.java +++ b/src/main/java/com/example/just/Service/PostService.java @@ -81,7 +81,7 @@ public class PostService { private GptService gptService; @Autowired - PostContentESRespository postContentESRespository; + private PostContentESRespository postContentESRespository; @Autowired private HashTagMapRepository hashTagMapRepository; diff --git a/src/test/java/com/example/just/CommentTest.java b/src/test/java/com/example/just/CommentTest.java index 00c11147..dac9af31 100644 --- a/src/test/java/com/example/just/CommentTest.java +++ b/src/test/java/com/example/just/CommentTest.java @@ -9,8 +9,8 @@ import com.example.just.Dao.Role; import com.example.just.Dto.CommentDto; import com.example.just.Dto.PutCommentDto; -import com.example.just.Dto.ResponseMyCommentDto; -import com.example.just.Dto.ResponsePostCommentDto; +import com.example.just.Response.ResponseMyCommentDto; +import com.example.just.Response.ResponsePostCommentDto; import com.example.just.Repository.CommentRepository; import com.example.just.Repository.MemberRepository; import com.example.just.Repository.PostRepository; diff --git a/src/test/java/com/example/just/KakaoTest.java b/src/test/java/com/example/just/KakaoTest.java index e7c28cbe..a0b25058 100644 --- a/src/test/java/com/example/just/KakaoTest.java +++ b/src/test/java/com/example/just/KakaoTest.java @@ -4,7 +4,7 @@ import com.example.just.Dao.Member; import com.example.just.Dao.Role; -import com.example.just.Dto.ResponseMemberDto; +import com.example.just.Response.ResponseMemberDto; import com.example.just.Repository.MemberRepository; import com.example.just.Service.KakaoService; import com.example.just.jwt.JwtFilter;