Skip to content

Commit

Permalink
fix: jpa, schema 정합성 (#367)
Browse files Browse the repository at this point in the history
* refactor: activity id Integer로 변경

* refactor: timestamp 명시

* refactor: LocalDateTimeAttributeConverter 개선

* refactor: id bigint로 변경

* Revert "refactor: activity id Integer로 변경"

This reverts commit bea44bb.

* refactor: LocalDateTime 컬럼에 대해 columnDefinition 추가

* refactor: id 수정 flyway 제거

* refactor: Activity id Long -> Integer 수정

* refactor: Article id Long -> Integer 수정

* refactor: User id Long -> Integer 수정

* refactor: Article content, hit 수정

* refactor: Board id Long -> Integer 수정

* refactor: Board articleCount Long -> Integer 수정

* refactor: Board parentId, seq Long -> Integer 수정

* refactor: Comment id, content 수정

* refactor: Dining id, date 수정

* refactor: Dining soldOut, isChanged 수정

* refactor: EventArticle id, content 수정

* refactor: Shop, Menu Entity validate 맞게 수정

* refactor: Land validate 맞게 수정

* refactor: Lecture id Long -> Integer 수정

* refactor: Member, Track, Board Notification validate 조건에 맞게 수정

* refactor: Notification 수정

* refactor: OwnerAttachment 수정

* refactor: Owner boolean 처리

* refactor: Semester id Long -> Integer 수정

* refactor: ShopCategory id Long -> Integer 수정

* refactor: ShopCategoryMap id Long -> Integer 수정

* refactor: ShopImage id Long -> Integer 수정

* refactor: MenuOption id Long -> Integer 수정

* refactor: MenuImage, ShopOpen id Long -> Integer 수정

* refactor: Boolean 값 primitive로 수정

* refactor: Shop 필드값 수정

* refactor: Student identity 수정

* refactor: TechStack imageUrl 수정

* refactor: User 정보 수정

* refactor: Repository 정보 수정

* test: 테스트 수정
  • Loading branch information
Choi-JJunho committed May 9, 2024
1 parent e0d4903 commit 19a6d73
Show file tree
Hide file tree
Showing 144 changed files with 1,035 additions and 1,017 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ public record ActivityResponse(
List<String> imageUrls,

@Schema(description = "고유 식별자", example = "1")
Long id,
Integer id,

@Schema(description = "제목", example = "코인 시간표 기능 추가")
String title
) {

public static ActivityResponse of(Activity activity, List<String> imageUrls) {
return new ActivityResponse(
activity.getDate(),
activity.getIsDeleted(),
activity.isDeleted(),
activity.getUpdatedAt(),
activity.getCreatedAt(),
activity.getDescription(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
package in.koreatech.koin.domain.activity.model;

import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

import java.time.LocalDate;

import in.koreatech.koin.global.domain.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "activities")
@NoArgsConstructor(access = PROTECTED)
public class Activity extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id")
private Long id;
private Integer id;

@Column(name = "title", nullable = false)
private String title;
Expand All @@ -37,10 +39,11 @@ public class Activity extends BaseEntity {
private LocalDate date;

@Column(name = "is_deleted")
private Boolean isDeleted;
private boolean isDeleted = false;

@Builder
private Activity(Long id, String title, String description, String imageUrls, LocalDate date, Boolean isDeleted) {
private Activity(Integer id, String title, String description, String imageUrls, LocalDate date,
boolean isDeleted) {
this.id = id;
this.title = title;
this.description = description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import in.koreatech.koin.domain.activity.model.Activity;

public interface ActivityRepository extends Repository<Activity, Long> {
public interface ActivityRepository extends Repository<Activity, Integer> {

@Query(value = "SELECT * FROM activities WHERE is_deleted = 0 AND YEAR(date) = :year", nativeQuery = true)
List<Activity> getActivitiesByYear(@Param("year") String year);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public interface CommunityApi {
@Operation(summary = "게시글 단건 조회")
@GetMapping("/articles/{id}")
ResponseEntity<ArticleResponse> getArticle(
@UserId Long userId,
@Parameter(in = PATH) @PathVariable("id") Long articleId,
@UserId Integer userId,
@Parameter(in = PATH) @PathVariable("id") Integer articleId,
@IpAddress String ipAddress
);

Expand All @@ -48,7 +48,7 @@ ResponseEntity<ArticleResponse> getArticle(
@Operation(summary = "게시글 목록 조회")
@GetMapping("/articles")
ResponseEntity<ArticlesResponse> getArticles(
@RequestParam Long boardId,
@RequestParam Integer boardId,
@RequestParam(required = false) Long page,
@RequestParam(required = false) Long limit
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class CommunityController implements CommunityApi {

@GetMapping("/articles/{id}")
public ResponseEntity<ArticleResponse> getArticle(
@UserId Long userId,
@PathVariable("id") Long articleId,
@UserId Integer userId,
@PathVariable("id") Integer articleId,
@IpAddress String ipAddress
) {
ArticleResponse foundArticle = communityService.getArticle(userId, articleId, ipAddress);
Expand All @@ -34,7 +34,7 @@ public ResponseEntity<ArticleResponse> getArticle(

@GetMapping("/articles")
public ResponseEntity<ArticlesResponse> getArticles(
@RequestParam Long boardId,
@RequestParam Integer boardId,
@RequestParam(required = false) Long page,
@RequestParam(required = false) Long limit
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
@JsonNaming(SnakeCaseStrategy.class)
public record ArticleResponse(
@Schema(description = "게시글 고유 ID", example = "1")
Long id,
Integer id,

@Schema(description = "게시판 고유 ID", example = "1")
Long boardId,
Integer boardId,

@Schema(description = "제목", example = "제목")
String title,
Expand All @@ -40,7 +40,7 @@ public record ArticleResponse(
@JsonProperty("contentSummary") String contentSummary,

@Schema(description = "조회수", example = "1")
Long hit,
Integer hit,

@Schema(description = "댓글 수", example = "1")
Byte commentCount,
Expand All @@ -65,8 +65,8 @@ public static ArticleResponse of(Article article) {
article.getTitle(),
article.getContent(),
article.getNickname(),
article.getIsSolved(),
article.getIsNotice(),
article.isSolved(),
article.isNotice(),
article.getContentSummary(),
article.getHit(),
article.getCommentCount(),
Expand All @@ -80,7 +80,7 @@ public static ArticleResponse of(Article article) {
@JsonNaming(value = SnakeCaseStrategy.class)
private record InnerBoardResponse(
@Schema(description = "게시판 고유 ID", example = "1")
Long id,
Integer id,

@Schema(description = "게시판 태그", example = "tag")
String tag,
Expand All @@ -89,22 +89,22 @@ private record InnerBoardResponse(
String name,

@Schema(description = "익명 여부", example = "false")
Boolean isAnonymous,
boolean isAnonymous,

@Schema(description = "게시글 수", example = "1")
Long articleCount,
Integer articleCount,

@Schema(description = "삭제 여부", example = "false")
Boolean isDeleted,
boolean isDeleted,

@Schema(description = "공지 여부", example = "false")
Boolean isNotice,
boolean isNotice,

@Schema(description = "부모 게시판 고유 ID", example = "1")
Long parentId,
Integer parentId,

@Schema(description = "순서", example = "1")
Long seq,
Integer seq,

@Schema(description = "하위 게시판 목록")
List<InnerBoardResponse> children,
Expand All @@ -123,8 +123,8 @@ public static InnerBoardResponse from(Board board) {
board.getName(),
board.getIsAnonymous(),
board.getArticleCount(),
board.getIsDeleted(),
board.getIsNotice(),
board.isDeleted(),
board.isNotice(),
board.getParentId(),
board.getSeq(),
board.getChildren().isEmpty()
Expand All @@ -138,16 +138,16 @@ public static InnerBoardResponse from(Board board) {
@JsonNaming(value = SnakeCaseStrategy.class)
private record InnerCommentResponse(
@Schema(description = "댓글 고유 ID", example = "1")
Long id,
Integer id,

@Schema(description = "게시글 고유 ID", example = "1")
Long articleId,
Integer articleId,

@Schema(description = "내용", example = "내용")
String content,

@Schema(description = "작성자 고유 ID", example = "1")
Long userId,
Integer userId,

@Schema(description = "작성자 닉네임", example = "닉네임")
String nickname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public static ArticlesResponse of(List<Article> articles, Board board, Long tota
private record InnerArticleResponse(

@Schema(description = "게시글 고유 ID", example = "1")
Long id,
Integer id,

@Schema(description = "게시판 고유 ID", example = "1")
Long boardId,
Integer boardId,

@Schema(description = "제목", example = "제목")
String title,
Expand All @@ -49,13 +49,16 @@ private record InnerArticleResponse(
String content,

@Schema(description = "작성자 고유 ID", example = "1")
Long userId,
Integer userId,

@Schema(description = "작성자 닉네임", example = "닉네임")
String nickname,

@Schema(description = "조회수", example = "1")
Long hit, String ip,
Integer hit,

@Schema(description = "IP 주소", example = "123.12.1.3")
String ip,

@Schema(description = "해결 여부", example = "false")
Boolean isSolved,
Expand All @@ -73,7 +76,7 @@ private record InnerArticleResponse(
Boolean isNotice,

@Schema(description = "공지 게시글 고유 ID", example = "1")
Long noticeArticleId,
Integer noticeArticleId,

@Schema(description = "요약", example = "요약")
String summary,
Expand All @@ -98,11 +101,11 @@ public static InnerArticleResponse from(Article article) {
article.getNickname(),
article.getHit(),
article.getIp(),
article.getIsSolved(),
article.getIsDeleted(),
article.isSolved(),
article.isDeleted(),
article.getCommentCount(),
article.getMeta(),
article.getIsNotice(),
article.isNotice(),
article.getNoticeArticleId(),
article.getSummary(),
article.getCreatedAt(),
Expand All @@ -115,7 +118,7 @@ public static InnerArticleResponse from(Article article) {
@JsonNaming(value = SnakeCaseStrategy.class)
public record InnerBoardResponse(
@Schema(description = "게시판 고유 ID", example = "1")
Long id,
Integer id,

@Schema(description = "게시판 태그", example = "notice")
String tag,
Expand All @@ -124,22 +127,22 @@ public record InnerBoardResponse(
String name,

@Schema(description = "익명 여부", example = "false")
Boolean isAnonymous,
boolean isAnonymous,

@Schema(description = "게시글 수", example = "1")
Long articleCount,
Integer articleCount,

@Schema(description = "삭제 여부", example = "false")
Boolean isDeleted,
boolean isDeleted,

@Schema(description = "공지 여부", example = "false")
Boolean isNotice,
boolean isNotice,

@Schema(description = "부모 게시판 고유 ID", example = "1")
Long parentId,
Integer parentId,

@Schema(description = "순서", example = "1")
Long seq,
Integer seq,

@Schema(description = "하위 게시판 목록")
List<InnerBoardResponse> children,
Expand All @@ -158,8 +161,8 @@ public static InnerBoardResponse from(Board board) {
board.getName(),
board.getIsAnonymous(),
board.getArticleCount(),
board.getIsDeleted(),
board.getIsNotice(),
board.isDeleted(),
board.isNotice(),
board.getParentId(),
board.getSeq(),
board.getChildren().isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@
@JsonNaming(SnakeCaseStrategy.class)
public record HotArticleItemResponse(
@Schema(description = "게시글 고유 ID", example = "1")
Long id,
Integer id,

@Schema(description = "게시판 고유 ID", example = "1")
Long boardId,
Integer boardId,

@Schema(description = "제목", example = "제목")
String title,

@Schema(description = "내용 요약", example = "내용 요약")
@JsonProperty("contentSummary") String contentSummary,
@JsonProperty("contentSummary")
String contentSummary,

@Schema(description = "댓글 수", example = "1")
Byte commentCount,

@Schema(description = "조회수", example = "1")
Long hit,
Integer hit,

@Schema(description = "생성 일자", example = "2023-01-04 12:00:01")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
LocalDateTime createdAt
) {

public static HotArticleItemResponse from(Article article) {
Expand Down
Loading

0 comments on commit 19a6d73

Please sign in to comment.