Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop to main #221

Merged
merged 57 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
fb8fbd1
Update prod.workflow.yml
kjeongh May 17, 2023
e9c099c
Merge pull request #199 from tukcom2023CD/FE/feat/#139
suhyeon0921 May 21, 2023
f201543
hotfix: λ©˜ν‹° μ˜ˆμ™Έμ²˜λ¦¬ μˆ˜μ •
suhyeon0921 May 25, 2023
f5e8693
chore: 컴파일러 κ²°κ³Ό 보여쀄 μ»΄ν¬λ„ŒνŠΈ κ΅¬ν˜„
suhyeon0921 May 30, 2023
95a4786
feat: 컴파일러 API κΈ°λŠ₯
kimhalin Jun 1, 2023
eddb95e
Merge pull request #202 from tukcom2023CD/BE/feat/#201
kimhalin Jun 2, 2023
f4138f4
feat: λ‚΄κ°€ μž‘μ„±ν•œ κΈ€ 쑰회 κΈ°λŠ₯
suhyeon0921 Jun 3, 2023
fd5a778
feat: λ§ˆμ΄νŽ˜μ΄μ§€ 상단바에 μΆ”κ°€
suhyeon0921 Jun 3, 2023
2997808
chore: 둜그인, νšŒμ›κ°€μž…νŽ˜μ΄μ§€μ˜ 상단바 둜고 λΌμš°νŒ… μˆ˜μ •
suhyeon0921 Jun 5, 2023
7f5a1f6
Merge pull request #204 from tukcom2023CD/FE/feat/#203
suhyeon0921 Jun 7, 2023
860e681
fix: λΉ„λ°€λ²ˆν˜Έ μœ νš¨μ„± 검사 μœ„μΉ˜ λ³€κ²½
KoneJ Jun 7, 2023
63a87bc
feat: 필터링 κΈ°λŠ₯ κ΅¬ν˜„ 1μ°¨ μ™„λ£Œ
KoneJ Jun 7, 2023
b5c3bda
feat: 질문 리슀트 νŽ˜μ΄μ§€ 필터링 κΈ°λŠ₯ κ΅¬ν˜„ μ™„λ£Œ
KoneJ Jun 7, 2023
67672af
fix: ν‚€μ›Œλ“œ 필터링 κΈ°λŠ₯ μ‚­μ œ
KoneJ Jun 7, 2023
5da7ec7
feat: κ²Œμ‹œκΈ€ μˆ˜μ •
kjeongh Jun 8, 2023
8621ad9
feat: λ©˜ν† λ§ μ™„λ£Œ 및 μ½”λ“œ μ €μž₯
kjeongh Jun 8, 2023
f5b3dce
refactor: κ²Œμ‹œκΈ€ μ‘°νšŒμ‹œ λ©˜ν† λ§ μ™„λ£Œμ—¬λΆ€ 및 μ½”λ“œκΉŒμ§€ 쑰회
kjeongh Jun 8, 2023
520fae5
feat: κ²Œμ‹œλ¬Ό 필터링 쑰회
kimhalin Jun 8, 2023
4f450b1
fix: post columnλͺ… λ³€κ²½
kimhalin Jun 8, 2023
8e1b867
feat: κ²Œμ‹œκΈ€ νƒ€μž… 필터링 둜직
kimhalin Jun 8, 2023
bcdc782
Merge remote-tracking branch 'origin/develop' into BE/feat/#205
kimhalin Jun 8, 2023
29532e6
fix: μ•ˆ μ“°λŠ” 파일 μ‚­μ œ
kimhalin Jun 8, 2023
c26273a
Merge pull request #209 from tukcom2023CD/BE/feat/#205
kimhalin Jun 8, 2023
420a40d
hotfix: Parameter required 속성 μˆ˜μ •
kimhalin Jun 9, 2023
3b4ae6a
hotfix: λŒ“κΈ€ 둜직 μˆ˜μ •
kimhalin Jun 9, 2023
98d6c32
Merge branch 'develop' into feat/#207
kjeongh Jun 10, 2023
80af651
Merge pull request #208 from tukcom2023CD/feat/#207
kjeongh Jun 10, 2023
ac25cfb
hotfix: solved
kjeongh Jun 10, 2023
2994bef
hotfix: κ²Œμ‹œκΈ€λ¦¬μŠ€νŠΈ 및 λ§ˆμ΄νŽ˜μ΄μ§€ μ‘°νšŒμ‹œ issolved포함
kjeongh Jun 11, 2023
15ea410
feat: λ©˜ν† λ§ μ™„λ£Œλœ μ½”λ“œλ₯Ό μ „μ†‘ν•˜κ³  μ½”λ“œλ₯Ό λ³΄μ—¬μ£ΌλŠ” κΈ°λŠ₯ κ΅¬ν˜„
suhyeon0921 Jun 10, 2023
c7a0052
feat: λ©˜ν† λ§ μ™„λ£Œ μ—¬λΆ€(λ°±x)
suhyeon0921 Jun 11, 2023
968c7cf
chore: λ©˜ν† λ§ μ™„λ£Œ 여뢀에 따라 λ‹€λ₯΄κ²Œ 보여주기
suhyeon0921 Jun 11, 2023
ac217d4
hotfix: μ—­μˆœμ •λ ¬ λ§ˆμ΄νŽ˜μ΄μ§€
kjeongh Jun 11, 2023
01585b7
fix: νŽ˜μ΄μ§€λ„€μ΄μ…˜ api 연동 μˆ˜μ •
KoneJ Jun 11, 2023
f4a8df2
fix: νŽ˜μ΄μ§€λ„€μ΄μ…˜ api 연동 μ™„λ£Œ
KoneJ Jun 11, 2023
b1c19f0
chore: 상단바 λ³€κ²½
suhyeon0921 Jun 11, 2023
85d178b
fix: 필터링 μ˜΅μ…˜ 단일 μ„ νƒμœΌλ‘œ λ³€κ²½
KoneJ Jun 11, 2023
fa03a63
hotfix: κ³΅μœ μ½”λ“œ κ΄€λ ¨ 컨트둀러 μŠ€μ›¨κ±° μΆ”κ°€
kjeongh Jun 11, 2023
6a48154
Merge pull request #213 from tukcom2023CD/hotfix
kimhalin Jun 12, 2023
ccbb531
hotfix: post μ‘°νšŒμ‹œ 총 개수 μΆ”κ°€
kimhalin Jun 12, 2023
0edfb73
Merge remote-tracking branch 'origin/develop' into develop
kimhalin Jun 12, 2023
0687d1b
필터링 κΈ°λŠ₯ λ‘€λ°±
KoneJ Jun 14, 2023
7001d64
Merge pull request #212 from tukcom2023CD/FE/feat/#211
suhyeon0921 Jun 14, 2023
2ddfe28
hotfix: λ§ˆμ΄νŽ˜μ΄μ§€ post μ—­μˆœμ •λ ¬
suhyeon0921 Jun 15, 2023
f29d99d
feat: 컴파일러 api 연동 1μ°¨ κ΅¬ν˜„ - μ–Έμ–΄ κ³ μ •κ°’
KoneJ Jun 15, 2023
ef1b1b8
feat : μ–Έμ–΄ μΆ”κ°€ 및 μ–Έμ–΄ νƒœκ·Έ 선택 ν›„ 컴파일 연동 κΈ°λŠ₯ μ΅œμ’… κ΅¬ν˜„
KoneJ Jun 15, 2023
ea0d536
feat: 컴파일러 κ²°κ³Όμ°½ μŠ€νƒ€μΌλ§ μ™„λ£Œ
KoneJ Jun 15, 2023
bd07439
fix: python μ„ νƒμ‹œ C둜 λ„˜μ–΄κ°€λŠ” 였λ₯˜ μˆ˜μ •, μžλ°”μŠ€ν¬λ¦½νŠΈ 선택 κΈˆμ§€ μΆ”κ°€
KoneJ Jun 15, 2023
2d9c9d4
chore: rebase둜 μΈν•œ μ—λŸ¬ ν•΄κ²°
suhyeon0921 Jun 16, 2023
bd6a7f2
Merge pull request #214 from tukcom2023CD/FE/feat/#206
KoneJ Jun 16, 2023
1e3a81f
Merge pull request #215 from tukcom2023CD/FE/feat/#200
KoneJ Jun 16, 2023
e5534f8
hotfix: κ²Œμ‹œκΈ€ μˆ˜μ • 및 질문 μ™„λ£Œ
kjeongh Jun 16, 2023
d0c893c
feat: λ‘œκ·ΈμΈμ‹œ user idκΉŒμ§€ λ°˜ν™˜
kjeongh Jun 16, 2023
8c29373
Merge pull request #217 from tukcom2023CD/BE/hotfix/#216
kjeongh Jun 16, 2023
8b95979
#216: solvedcodeλ‚΄μš© μΆ”κ°€
kjeongh Jun 17, 2023
3ac5753
Merge pull request #219 from tukcom2023CD/BE/hotfix/#216
kjeongh Jun 17, 2023
a0f235b
Merge branch 'main' into develop
kjeongh Jun 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-ui:1.6.14'
implementation 'org.springframework.boot:spring-boot-starter-amqp'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.boot:spring-boot-starter-webflux' //webClient
implementation 'org.springframework.boot:spring-boot-starter-reactor-netty'
implementation 'org.springframework.session:spring-session-jdbc'
compileOnly 'org.projectlombok:lombok'
Expand Down
2 changes: 0 additions & 2 deletions backend/gradle/properties.java

This file was deleted.

Binary file removed backend/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions backend/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class CommentService {
private final CommentMapper commentMapper;

public Comment createComment(CommentDto.CommentCreateRequest dto, Long userId) {
findByCommentId(dto.getParentId());
Comment entity = commentMapper.toCommentEntity(dto, userId);
return commentRepository.save(entity);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.rising.backend.domain.post.controller;

import com.rising.backend.domain.post.domain.PostType;
import com.rising.backend.domain.post.dto.PostDto;
import com.rising.backend.domain.post.service.PostService;
import com.rising.backend.domain.user.domain.User;
Expand All @@ -17,6 +18,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


import java.util.List;

import static com.rising.backend.domain.post.dto.PostDto.PostCreateRequest;
Expand All @@ -42,13 +44,15 @@ public ResponseEntity<ResultResponse> create(
}

@GetMapping
public ResponseEntity<ResultResponse> getList(@PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) final Pageable pageable) {
List<PostDto.PostGetListResponse> list = postService.pageList(pageable);
return ResponseEntity.ok(ResultResponse.of(ResultCode.POST_PAGINATION_SUCCESS, list));
public ResponseEntity<ResultResponse> getList(@RequestParam(value = "type", required = false) PostType postType, @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) final Pageable pageable) {
List<PostDto.PostGetListResponse> result = null;
if (postType == null)
result = postService.pageList(pageable);
else
result = postService.getPostsByType(postType, pageable);
return ResponseEntity.ok(ResultResponse.of(ResultCode.POST_PAGINATION_SUCCESS, result));
}



@LoginRequired
@GetMapping("/{postId}/session")
public ResponseEntity<ResultResponse> getSession(
Expand Down Expand Up @@ -81,5 +85,23 @@ public ResponseEntity<ResultResponse> getPostListByUserId(@PathVariable Long use
return ResponseEntity.ok(ResultResponse.of(ResultCode.POSTLIST_FIND_BY_USERID_SUCCESS, postList));
}

@PutMapping("/{postId}")
public ResponseEntity<ResultResponse> update(
@PathVariable Long postId,
@RequestBody PostDto.PostUpdateRequest updateRequest) {
postService.updatePost(postId, updateRequest);
return ResponseEntity.ok(ResultResponse.of(ResultCode.POST_UPDATE_SUCCESS));

}

//λ©˜ν† λ§ μ’…λ£Œ
@PutMapping("/{postId}/solve")
public ResponseEntity<ResultResponse> solve(
@PathVariable Long postId,
@RequestBody PostDto.SolvedCodeRequest solvedCode) {
postService.solve(postId, solvedCode.getSolvedCode());
return ResponseEntity.ok(ResultResponse.of(ResultCode.POST_SOLVED));

}

}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.rising.backend.domain.post.domain;

import com.rising.backend.domain.post.dto.PostDto.PostUpdateRequest;
import com.rising.backend.domain.user.domain.User;
import com.rising.backend.global.domain.BaseEntity;
import lombok.*;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

Expand Down Expand Up @@ -31,31 +33,48 @@ public class Post extends BaseEntity {

@NotBlank
@Column(length = 100)
@Setter
private String title;

@NotBlank
@Column(columnDefinition = "TEXT")
@Setter
private String content;


@Column(length = 255)
private String videoUrl;

@Column(length = 255)
private String sessionUrl;

@ColumnDefault("false")
private boolean isSolved;

@Column(length = 1000)
@Setter
private String solvedCode;

@NotNull
@Enumerated(EnumType.STRING)
private PostType type;
private PostType postType;

@ManyToMany
@JoinTable(name = "POST_TAG",
joinColumns = @JoinColumn(name = "POST_ID"),
inverseJoinColumns = @JoinColumn(name = "TAG_ID")
)

@Setter
private List<Tag> tag = new ArrayList<>();


public void setTags(List<Tag> tags) {
this.tag = tags;
}

public void setSolved() {
this.isSolved = true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ public static class PostCreateRequest {
private List<String> tags = new ArrayList<>();
}

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public static class PostUpdateRequest {
private String title;
private String content;
private List<String> tags = new ArrayList<>();
}

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public static class SolvedCodeRequest {
private String solvedCode;
}

@Builder
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
Expand All @@ -52,6 +68,8 @@ public static class PostGetListResponse {
@NotEmpty
private Long commentCount;

private boolean isSolved;

private List<String> tags;
}

Expand All @@ -76,6 +94,10 @@ public static class PostDetailResponse {

private LocalDate created_at;

private boolean isSolved;

private String solvedCode;

private List<String> tags;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Post toPostEntity(PostCreateRequest postCreate, User loginUser) {
.title(postCreate.getTitle())
.videoUrl(null)
.sessionUrl(uuidConverter.toBase64(UUID.randomUUID()))
.type(postCreate.getType()).build();
.postType(postCreate.getType()).build();
}

public PostDto.PostDetailResponse toPostDto(Post post, List<String> tags) {
Expand All @@ -39,7 +39,9 @@ public PostDto.PostDetailResponse toPostDto(Post post, List<String> tags) {
.title(post.getTitle())
.content(post.getContent())
.videoUrl(post.getVideoUrl())
.type(post.getType())
.type(post.getPostType())
.isSolved(post.isSolved())
.solvedCode(post.getSolvedCode())
.tags(tags)
.created_at(post.getCreatedAt().toLocalDate())
.build();
Expand Down Expand Up @@ -68,8 +70,9 @@ public PostGetListResponse toPostListResponse(Post post) {
.content(post.getContent())
.created_at(post.getCreatedAt().toLocalDate())
.title(post.getTitle())
.type(post.getType())
.type(post.getPostType())
.tags(TagtoString(post.getTag()))
.isSolved(post.isSolved())
.commentCount(commentRepository.countByPost_Id(post.getId()))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.rising.backend.domain.post.repository;

import com.rising.backend.domain.post.domain.Post;
import com.rising.backend.domain.post.domain.PostType;
import com.rising.backend.domain.post.domain.Tag;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
Expand All @@ -11,4 +14,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
List<Post> findByUserId(Long userId);

List<Tag> findTagById(Long id);

Page<Post> findByPostType(PostType postType, Pageable pageable);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.rising.backend.domain.post.service;

import com.rising.backend.domain.post.domain.Post;
import com.rising.backend.domain.post.domain.PostType;
import com.rising.backend.domain.post.domain.Tag;
import com.rising.backend.domain.post.dto.PostDto;
import com.rising.backend.domain.post.mapper.PostMapper;
Expand All @@ -15,6 +16,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.Comparator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -57,6 +59,11 @@ public List<PostGetListResponse> pageList(Pageable pageable) {
return postMapper.toDtoPageList(postList).getContent();
}

public List<PostGetListResponse> getPostsByType(PostType postType, Pageable pageable) {
Page<Post> posts = postRepository.findByPostType(postType, pageable);
return postMapper.toDtoPageList(posts).getContent();
}

public String getSessionUrl(Long postId, User user) {
Post post = findPostById(postId);
if (!checkIsAuthor(post, user)) {
Expand All @@ -75,7 +82,10 @@ public PostDto.PostDetailResponse getPostDtoById(Long postId) {

public List<PostDto.PostGetListResponse> getPostListByUserId(Long userId) {
List<Post> postList = postRepository.findByUserId(userId);
return postMapper.toDtoList(postList);
List<Post> sortedList = postList.stream()
.sorted(Comparator.comparing(Post::getCreatedAt).reversed())
.collect(Collectors.toList());
return postMapper.toDtoList(sortedList);
}

public Tag getTagByContent(String content) {
Expand All @@ -85,4 +95,21 @@ public Tag getTagByContent(String content) {
public void deletePostById(Long postId) {
postRepository.deleteById(postId);
}

public void updatePost(Long postId, PostDto.PostUpdateRequest updateRequest) {
Post post = findPostById(postId);

List<Tag> tags = updateRequest.getTags().stream().map(t -> getTagByContent(t))
.collect(Collectors.toList());

post.setTitle(updateRequest.getTitle());
post.setContent(updateRequest.getContent());
post.setTags(tags);
}

public void solve(Long postId, String solvedCode) {
Post post = findPostById(postId);
post.setSolved(); //λ©˜ν† λ§ μ™„λ£Œ
post.setSolvedCode(solvedCode);
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
package com.rising.backend.domain.sharecoding.controller;

import com.rising.backend.domain.sharecoding.domain.Operation;
import com.rising.backend.domain.sharecoding.dto.CodingDto;
import com.rising.backend.domain.sharecoding.service.CodeService;
import com.rising.backend.global.result.ResultCode;
import com.rising.backend.global.result.ResultResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import static com.rising.backend.global.constant.RabbitMQ.*;
import static com.rising.backend.global.constant.RabbitMQ.CODE_QUEUE_NAME;
import static com.rising.backend.global.constant.RabbitMQ.EXCHANGE_NAME;

@Controller
@RestController
@RequiredArgsConstructor
@Slf4j
@Tag(name = "SHARE CODE API")
public class CodeController {

private final RabbitTemplate rabbitTemplate;
private final CodeService codeService;

@MessageMapping("code.message.{postId}")
public void send(@RequestBody Operation operation, @DestinationVariable Long postId) {
Expand All @@ -30,4 +41,13 @@ public void send(@RequestBody Operation operation, @DestinationVariable Long pos
public void receive(Operation operation) {
log.info("code send success");
}

@PostMapping("api/v1/codes")
public ResponseEntity<ResultResponse> compile(
@RequestBody CodingDto.CompilerReqeust request) {

CodingDto.CompilerResponse response = codeService.getCompileResponse(request);
return ResponseEntity.ok(ResultResponse.of(ResultCode.GET_COMPILE_RESULT, response));
}

}
Loading