From 6458be386bb0914ec8b63e436bcdf1470ebcbbe5 Mon Sep 17 00:00:00 2001 From: skytin1004 Date: Sun, 5 Nov 2023 13:26:01 +0900 Subject: [PATCH] =?UTF-8?q?[refactor/#172]=20BaseEntity=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/inhabas/api/domain/BaseEntity.java | 4 ++-- .../board/repository/NormalBoardRepositoryImpl.java | 10 +++++----- .../repository/BudgetApplicationRepositoryImpl.java | 4 ++-- .../budget/repository/BudgetHistoryRepositoryImpl.java | 4 ++-- .../api/domain/comment/dto/CommentDetailDto.java | 2 +- .../comment/repository/CommentRepositoryImpl.java | 2 +- .../contest/repository/ContestBoardRepositoryImpl.java | 4 ++-- .../lecture/repository/LectureRepositoryImpl.java | 6 +++--- .../java/com/inhabas/api/domain/BaseEntityTest.java | 8 ++++---- .../board/repository/NormalBoardRepositoryTest.java | 2 +- .../api/domain/menu/repository/MenuRepositoryTest.java | 6 +++--- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java b/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java index 1facd5c7..53a8f8c9 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/BaseEntity.java @@ -19,9 +19,9 @@ public abstract class BaseEntity { @CreatedDate @Column(nullable = false, updatable = false, insertable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") - private LocalDateTime created; + private LocalDateTime dateCreated; @LastModifiedDate @Column - private LocalDateTime updated; + private LocalDateTime dateUpdated; } diff --git a/resource-server/src/main/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryImpl.java index 1788736b..d02e95c7 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryImpl.java @@ -29,14 +29,14 @@ public Page findAllByMenuId(MenuId menuId, Pageable pageable) { Expressions.asString("").as("contents"), member.name.value, normalBoard.menuId, - normalBoard.created, - normalBoard.updated)) + normalBoard.dateCreated, + normalBoard.dateUpdated)) .from(normalBoard) .innerJoin(member).on(eqMemberId()) .where(eqMenuId(menuId)) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) - .orderBy(normalBoard.created.desc()) + .orderBy(normalBoard.dateCreated.desc()) .fetch(); return new PageImpl<>(results, pageable, this.getCount(menuId)); @@ -63,8 +63,8 @@ public Optional findDtoById(Integer id) { normalBoard.contents.value, member.name.value, normalBoard.menuId, - normalBoard.created, - normalBoard.updated)) + normalBoard.dateCreated, + normalBoard.dateUpdated)) .from(normalBoard) .innerJoin(member).on(eqMemberId()) .where(normalBoard.id.eq(id)) diff --git a/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetApplicationRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetApplicationRepositoryImpl.java index 9aeeefd8..896c6b4e 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetApplicationRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetApplicationRepositoryImpl.java @@ -46,7 +46,7 @@ public Page search(ApplicationStatus status, Pageable budgetSupportApplication.title.value, budgetSupportApplication.applicationWriter.id, applicant.name.value, - budgetSupportApplication.created, + budgetSupportApplication.dateCreated, budgetSupportApplication.status )) .from(budgetSupportApplication) @@ -80,7 +80,7 @@ private JPAQuery getDtoJPAQuery() { budgetSupportApplication.id, budgetSupportApplication.title.value, budgetSupportApplication.dateUsed, - budgetSupportApplication.created, + budgetSupportApplication.dateCreated, budgetSupportApplication.details.value, budgetSupportApplication.outcome.value, budgetSupportApplication.applicantAccount.value, diff --git a/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetHistoryRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetHistoryRepositoryImpl.java index 6e835cde..80b0353d 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetHistoryRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/budget/repository/BudgetHistoryRepositoryImpl.java @@ -85,8 +85,8 @@ private JPAQuery getDtoJPAQuery() { Projections.constructor(BudgetHistoryDetailDto.class, budgetHistory.id, budgetHistory.dateUsed, - budgetHistory.created, - budgetHistory.updated, + budgetHistory.dateCreated, + budgetHistory.dateUpdated, budgetHistory.title.value, budgetHistory.income.value, budgetHistory.outcome.value, diff --git a/resource-server/src/main/java/com/inhabas/api/domain/comment/dto/CommentDetailDto.java b/resource-server/src/main/java/com/inhabas/api/domain/comment/dto/CommentDetailDto.java index 9c4008f8..c93fc35b 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/comment/dto/CommentDetailDto.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/comment/dto/CommentDetailDto.java @@ -30,7 +30,7 @@ public static CommentDetailDto fromEntity(Comment comment) { comment.getWriter().getId(), comment.getWriter().getName(), comment.getWriter().getSchoolInformation().getMajor(), - comment.getCreated() + comment.getDateCreated() ); } diff --git a/resource-server/src/main/java/com/inhabas/api/domain/comment/repository/CommentRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/comment/repository/CommentRepositoryImpl.java index 5dbd2906..539e5374 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/comment/repository/CommentRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/comment/repository/CommentRepositoryImpl.java @@ -23,7 +23,7 @@ public List findAllByParentBoardIdOrderByCreated(Integer board .innerJoin(comment.writer).fetchJoin() .leftJoin(comment.parentComment).fetchJoin() .where(comment.parentBoard.id.eq(boardId)) - .orderBy(comment.created.asc(), comment.parentComment.id.asc().nullsFirst(), comment.id.asc()) + .orderBy(comment.dateCreated.asc(), comment.parentComment.id.asc().nullsFirst(), comment.id.asc()) .fetch(); return convertToNestedStructure(comments); diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java index 76efb47f..0088925d 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java @@ -40,8 +40,8 @@ public Optional findDtoById(Integer id) { contestBoard.topic.value, contestBoard.start, contestBoard.deadline, - contestBoard.created, - contestBoard.updated + contestBoard.dateCreated, + contestBoard.dateUpdated )) .from(contestBoard) .innerJoin(member).on(contestBoard.writerId.eq(member.id)) diff --git a/resource-server/src/main/java/com/inhabas/api/domain/lecture/repository/LectureRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/lecture/repository/LectureRepositoryImpl.java index 2bc3c4c7..57b92bd5 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/lecture/repository/LectureRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/lecture/repository/LectureRepositoryImpl.java @@ -45,8 +45,8 @@ public Optional getDetails(Integer id) { lecture.status, lecture.rejectReason, lecture.paid, - lecture.created, - lecture.updated + lecture.dateCreated, + lecture.dateUpdated )) .from(lecture) .innerJoin(member).on(member.id.eq(lecture.chief)) @@ -71,7 +71,7 @@ public Page getList(Pageable pageable) { .where(lecture.status.in(LectureStatus.PROGRESSING, LectureStatus.TERMINATED)) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) - .orderBy(lecture.created.desc()) + .orderBy(lecture.dateCreated.desc()) .orderBy(lecture.status.asc()) .fetch(); diff --git a/resource-server/src/test/java/com/inhabas/api/domain/BaseEntityTest.java b/resource-server/src/test/java/com/inhabas/api/domain/BaseEntityTest.java index 0d293338..64b1c4d0 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/BaseEntityTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/BaseEntityTest.java @@ -52,8 +52,8 @@ public void createdTimeTest() { em.persist(board); //then - assertThat(board.getCreated()).isNotNull(); - assertThat(board.getCreated()).isInstanceOf(LocalDateTime.class); + assertThat(board.getDateCreated()).isNotNull(); + assertThat(board.getDateCreated()).isInstanceOf(LocalDateTime.class); } @Test @@ -72,8 +72,8 @@ public void updatedTimeTest() { //then NormalBoard find = em.find(NormalBoard.class, board.getId()); - assertThat(find.getUpdated()).isNotNull(); - assertThat(find.getUpdated()).isInstanceOf(LocalDateTime.class); + assertThat(find.getDateUpdated()).isNotNull(); + assertThat(find.getDateUpdated()).isInstanceOf(LocalDateTime.class); } } diff --git a/resource-server/src/test/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryTest.java b/resource-server/src/test/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryTest.java index 0785a68a..117aa133 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/board/repository/NormalBoardRepositoryTest.java @@ -82,7 +82,7 @@ public void save() { //then assertAll( () -> assertThat(saveBoard.getId()).isNotNull(), - () -> assertThat(saveBoard.getCreated()).isNotNull(), + () -> assertThat(saveBoard.getDateCreated()).isNotNull(), () -> assertThat(saveBoard.getTitle()).isEqualTo(FREE_BOARD.getTitle()), () -> assertThat(saveBoard.getContents()).isEqualTo(FREE_BOARD.getContents()), () -> assertThat(saveBoard.getWriterId()).isEqualTo(saveMember.getId()) diff --git a/resource-server/src/test/java/com/inhabas/api/domain/menu/repository/MenuRepositoryTest.java b/resource-server/src/test/java/com/inhabas/api/domain/menu/repository/MenuRepositoryTest.java index 09767bf3..6a819050 100644 --- a/resource-server/src/test/java/com/inhabas/api/domain/menu/repository/MenuRepositoryTest.java +++ b/resource-server/src/test/java/com/inhabas/api/domain/menu/repository/MenuRepositoryTest.java @@ -47,11 +47,11 @@ public void CreateNewMenu() { //then assertThat(saveActivityMenu.getId()).isNotNull(); - assertThat(saveActivityMenu.getCreated()).isNotNull(); - assertThat(saveActivityMenu.getUpdated()).isNotNull(); + assertThat(saveActivityMenu.getDateCreated()).isNotNull(); + assertThat(saveActivityMenu.getDateUpdated()).isNotNull(); assertThat(saveActivityMenu) .usingRecursiveComparison() - .ignoringFields("id", "created", "updated") + .ignoringFields("id", "dateCreated", "dateUpdated") .isEqualTo(activityBoardMenu); }