-
Notifications
You must be signed in to change notification settings - Fork 13
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
[feature/#204] [동아리 소개] API 구현 #206
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cdae7c4
[feature/#204] contents -> content 이름 수정, exception.class 위치 변경
whitem4rk e39b4d6
[feature/#204] ClubHistory entity 관련 구현
whitem4rk 0ee8625
[feature/#204] ClubHistory controller 구현
whitem4rk 3713b93
[feature/#204] ClubHistory service 구현
whitem4rk 9645fe2
[feature/#204] ClubHistory entity, dto test code 구현
whitem4rk 9cfc981
[feature/#204] ClubHistory service test code 구현
whitem4rk e428b63
[feature/#204] ClubHistory 전체적인 에러 수정
whitem4rk bbad31f
[feature/#204] github actions 수정
whitem4rk b0584c7
[feature/#204] review 반영 코드 수정
whitem4rk 6a07898
[feature/#204] github actions 수정
whitem4rk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
12 changes: 7 additions & 5 deletions
12
...in/board/domain/valueObject/Contents.java → ...ain/board/domain/valueObject/Content.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
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
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
60 changes: 60 additions & 0 deletions
60
resource-server/src/main/java/com/inhabas/api/domain/club/domain/entity/ClubHistory.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,60 @@ | ||
package com.inhabas.api.domain.club.domain.entity; | ||
|
||
import com.inhabas.api.auth.domain.oauth2.member.domain.entity.Member; | ||
import com.inhabas.api.domain.board.domain.valueObject.Content; | ||
import com.inhabas.api.domain.board.domain.valueObject.Title; | ||
import com.inhabas.api.domain.club.dto.SaveClubHistoryDto; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Table(name = "CLUB_HISTORY") | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class ClubHistory { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
@JoinColumn(name = "USER_ID", foreignKey = @ForeignKey(name = "FK_MEMBER_OF_CLUB_HISTORY")) | ||
private Member member; | ||
|
||
@Embedded | ||
private Title title; | ||
|
||
@Embedded | ||
private Content content; | ||
|
||
@Column(name = "DATE_HISTORY", nullable = false, columnDefinition = "DATETIME(0)") | ||
private LocalDateTime dateHistory; | ||
|
||
@CreatedDate | ||
@Column(name = "DATE_CREATED", nullable = false, updatable = false, insertable = false, columnDefinition = "DATETIME(0) DEFAULT CURRENT_TIMESTAMP") | ||
private LocalDateTime dateCreated; | ||
|
||
@Builder | ||
public ClubHistory(Member member, Title title, Content content, LocalDateTime dateHistory) { | ||
this.member = member; | ||
this.title = title; | ||
this.content = content; | ||
this.dateHistory = dateHistory; | ||
} | ||
|
||
public void updateClubHistory(Member member, SaveClubHistoryDto saveClubHistoryDto) { | ||
this.member = member; | ||
this.title = new Title(saveClubHistoryDto.getTitle()); | ||
this.content = new Content(saveClubHistoryDto.getContent()); | ||
this.dateHistory = saveClubHistoryDto.getDateHistory(); | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
resource-server/src/main/java/com/inhabas/api/domain/club/dto/ClubHistoryDto.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,53 @@ | ||
package com.inhabas.api.domain.club.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.inhabas.api.domain.club.domain.entity.ClubHistory; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Positive; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class ClubHistoryDto { | ||
|
||
@NotNull | ||
@Positive | ||
private Long id; | ||
|
||
@NotNull | ||
private String title; | ||
|
||
@NotNull | ||
private String content; | ||
|
||
@NotNull | ||
@Positive | ||
private Long writerId; | ||
|
||
@NotNull | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
@Schema(type = "string", example = "2023-11-01T00:00:00") | ||
private LocalDateTime dateHistory; | ||
|
||
@Builder | ||
public ClubHistoryDto(Long id, String title, String content, Long writerId, LocalDateTime dateHistory) { | ||
this.id = id; | ||
this.title = title; | ||
this.content = content; | ||
this.writerId = writerId; | ||
this.dateHistory = dateHistory; | ||
} | ||
|
||
public ClubHistoryDto(ClubHistory clubHistory) { | ||
this.id = clubHistory.getId(); | ||
this.title = clubHistory.getTitle().getValue(); | ||
this.content = clubHistory.getContent().getValue(); | ||
this.writerId = clubHistory.getMember().getId(); | ||
this.dateHistory = clubHistory.getDateHistory(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
resource-server/src/main/java/com/inhabas/api/domain/club/dto/SaveClubHistoryDto.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,32 @@ | ||
package com.inhabas.api.domain.club.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class SaveClubHistoryDto { | ||
|
||
private String title; | ||
|
||
private String content; | ||
|
||
@NotNull | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
@Schema(type = "string", example = "2023-11-01T00:00:00") | ||
private LocalDateTime dateHistory; | ||
|
||
@Builder | ||
public SaveClubHistoryDto(String title, String content, LocalDateTime dateHistory) { | ||
this.title = title; | ||
this.content = content; | ||
this.dateHistory = dateHistory; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...ce-server/src/main/java/com/inhabas/api/domain/club/repository/ClubHistoryRepository.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,7 @@ | ||
package com.inhabas.api.domain.club.repository; | ||
|
||
import com.inhabas.api.domain.club.domain.entity.ClubHistory; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ClubHistoryRepository extends JpaRepository<ClubHistory, Long> { | ||
} |
21 changes: 21 additions & 0 deletions
21
resource-server/src/main/java/com/inhabas/api/domain/club/usecase/ClubHistoryService.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,21 @@ | ||
package com.inhabas.api.domain.club.usecase; | ||
|
||
import com.inhabas.api.domain.club.dto.ClubHistoryDto; | ||
import com.inhabas.api.domain.club.dto.SaveClubHistoryDto; | ||
|
||
import java.util.List; | ||
|
||
public interface ClubHistoryService { | ||
|
||
Long writeClubHistory(Long memberId, SaveClubHistoryDto saveClubHistoryDto); | ||
|
||
ClubHistoryDto findClubHistory(Long clubHistoryId); | ||
|
||
List<ClubHistoryDto> getClubHistories(); | ||
|
||
void updateClubHistory(Long memberId, Long clubHistoryId, SaveClubHistoryDto saveClubHistoryDto); | ||
|
||
void deleteClubHistory(Long clubHistoryId); | ||
|
||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses: gradle/gradle-build-action@
대신에
run: ./gradlew clean build
를 사용한 이유를 알고 싶습니다.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
환경 변수 때문인가요? 특정 버전의 gradle을 사용하기 위해서 이렇게 코드를 수정한 것인지 궁금합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
application.yml에 변수 env를 넘겨줘야하는데
gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
쓰는 방식은 변수를 넘겨주는건 enterprise 버전에서만 적용된다고 그래서 저렇게 수정했어.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확실히 전자의 방식이 성능면에선 우수하네