-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from TaskFlow-CLAP/CLAP-453
CLAP-453 댓글 작성 및 task history 조회 쿼리 수정
- Loading branch information
Showing
17 changed files
with
86 additions
and
56 deletions.
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
28 changes: 19 additions & 9 deletions
28
src/main/java/clap/server/adapter/outbound/persistense/mapper/CommentPersistenceMapper.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 |
---|---|---|
@@ -1,24 +1,34 @@ | ||
package clap.server.adapter.outbound.persistense.mapper; | ||
|
||
import clap.server.adapter.outbound.persistense.entity.task.CommentEntity; | ||
|
||
import clap.server.adapter.outbound.persistense.mapper.common.PersistenceMapper; | ||
|
||
import clap.server.domain.model.member.Member; | ||
import clap.server.domain.model.task.Comment; | ||
|
||
import org.hibernate.Hibernate; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
@Mapper(componentModel = "spring", uses = {MemberPersistenceMapper.class, TaskPersistenceMapper.class}) | ||
public interface CommentPersistenceMapper extends PersistenceMapper<CommentEntity, Comment> { | ||
public abstract class CommentPersistenceMapper { | ||
|
||
@Autowired | ||
MemberPersistenceMapper memberPersistenceMapper; | ||
|
||
@Override | ||
@Mapping(source = "modified", target = "isModified") | ||
@Mapping(source = "deleted", target = "isDeleted") | ||
Comment toDomain(final CommentEntity entity); | ||
@Mapping(target = "member", expression = "java(mapMember(entity))") | ||
@Mapping(target = "task", ignore = true) | ||
public abstract Comment toDomain(final CommentEntity entity); | ||
|
||
@Override | ||
@Mapping(source = "modified", target = "isModified") | ||
@Mapping(source = "deleted", target = "isDeleted") | ||
CommentEntity toEntity(final Comment domain); | ||
public abstract CommentEntity toEntity(final Comment domain); | ||
|
||
protected Member mapMember(CommentEntity entity) { | ||
if (entity == null || entity.getMember() == null || !Hibernate.isInitialized(entity.getMember())) { | ||
return null; | ||
} | ||
return memberPersistenceMapper.toDomain(entity.getMember()); | ||
} | ||
|
||
} |
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
3 changes: 1 addition & 2 deletions
3
...n/java/clap/server/adapter/outbound/persistense/repository/task/TaskCustomRepository.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
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
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
9 changes: 9 additions & 0 deletions
9
...ain/resources/db/migration/dev/V20250219453__Update_Modified_Member_From_Task_History.sql
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,9 @@ | ||
START TRANSACTION; | ||
|
||
UPDATE task_history th | ||
SET modified_member_id = ( | ||
SELECT member_id FROM comment c WHERE c.comment_id = th.comment_id | ||
) | ||
WHERE th.comment_id IS NOT NULL AND th.type='COMMENT_FILE'; | ||
|
||
COMMIT; |
9 changes: 9 additions & 0 deletions
9
...in/resources/db/migration/prod/V20250219453__Update_Modified_Member_From_Task_History.sql
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,9 @@ | ||
START TRANSACTION; | ||
|
||
UPDATE task_history th | ||
SET modified_member_id = ( | ||
SELECT member_id FROM comment c WHERE c.comment_id = th.comment_id | ||
) | ||
WHERE th.comment_id IS NOT NULL AND th.type='COMMENT_FILE'; | ||
|
||
COMMIT; |