Skip to content

Commit

Permalink
Merge pull request #149 from Media-XI/ART-168-be-매거진-콘텐츠에-미디어-url-첨부
Browse files Browse the repository at this point in the history
매거진 콘텐츠에 미디어 URL 첨부 프로시저 작성
  • Loading branch information
Hoon9901 authored Mar 18, 2024
2 parents 3b7a882 + 9cfe294 commit ad1995d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: chmod +x ./gradlew

- name: Test with Gradle
run: ./gradlew --info test -DJASYPT_ENCRYPTOR_PASSWORD=${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}
run: ./gradlew test -DJASYPT_ENCRYPTOR_PASSWORD=${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Component
public class AopForTransaction {

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Transactional(propagation = Propagation.REQUIRED)
public Object proceed(final ProceedingJoinPoint joinPoint) throws Throwable {
return joinPoint.proceed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public class LikePostDuplicatedRequestException extends RuntimeException {

public LikePostDuplicatedRequestException() {
super();
super("좋아요 요청을 자주 보내셨습니다. 잠시 후 다시 시도해주세요.");
}
}
37 changes: 37 additions & 0 deletions src/main/resources/db/migration/V202403051151__application.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# 매거진 콘텐츠 맨 앞에 마크다운 형식의 미디어 URL 을 첨부합니다.
# 작성자 : Hoon9901 (shonn.dev@gmail.com)
# 작성 날짜 : 2024-03-18
# 현재 버전 : V202403051151 (이전 버전 : V202403051150__create_curation_table.sql)

DELIMITER $$
CREATE PROCEDURE add_first_media_to_content()
BEGIN
DECLARE done BOOLEAN DEFAULT FALSE;
DECLARE p_magazine_id INT;
DECLARE cur CURSOR FOR
SELECT m.magazine_id
FROM magazine m
INNER JOIN magazine_media mm ON (m.magazine_id = mm.magazine_id);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; # NOT FOUND -> done true
START TRANSACTION;
OPEN cur;
l:LOOP
FETCH cur INTO p_magazine_id;
IF done THEN
LEAVE l;
END IF;
UPDATE magazine m
SET content = CONCAT((SELECT CONCAT('![](https://cdn.artscope.kr/', mm.url, ')')
FROM magazine_media mm
WHERE mm.magazine_id = p_magazine_id
LIMIT 1), ' ', content)
WHERE m.magazine_id = p_magazine_id;
END LOOP;
CLOSE cur;
COMMIT;
END$$
DELIMITER ;

CALL add_first_media_to_content();
DROP PROCEDURE add_first_media_to_content;
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ private byte[] createMockImageFile() throws IOException {
.andDo(print())
.andExpect(status().isOk());

Thread.sleep(3000);

mockMvc.perform(
post("/api/posts/" + post.getId() + "/like")
)
Expand Down

0 comments on commit ad1995d

Please sign in to comment.