Skip to content

Commit

Permalink
Merge pull request #286 from Modagbul/main
Browse files Browse the repository at this point in the history
[release] v1.0.6 (2)
  • Loading branch information
minsu20 authored May 16, 2024
2 parents 5f2eb44 + f0c411c commit 4b8eeb1
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.moing.backend.domain.member.dto.response;

import com.moing.backend.domain.member.domain.constant.Gender;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class UserProperty {
private Gender gender;
private LocalDate birthDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.moing.backend.domain.missionArchive.domain.service.MissionArchiveQueryService;
import com.moing.backend.domain.missionArchive.domain.service.MissionArchiveSaveService;
import com.moing.backend.domain.missionArchive.exception.NoAccessMissionArchiveException;
import com.moing.backend.domain.missionComment.domain.service.MissionCommentDeleteService;
import com.moing.backend.domain.missionHeart.domain.service.MissionHeartQueryService;
import com.moing.backend.domain.team.domain.entity.Team;
import com.moing.backend.domain.teamScore.application.service.TeamScoreUpdateUseCase;
Expand All @@ -31,6 +32,7 @@ public class MissionArchiveDeleteUseCase {
private final MissionArchiveQueryService missionArchiveQueryService;
private final MissionArchiveDeleteService missionArchiveDeleteService;
private final MissionQueryService missionQueryService;
private final MissionCommentDeleteService missionCommentDeleteService;

private final MemberGetService memberGetService;
private final TeamScoreUpdateUseCase teamScoreUpdateUseCase;
Expand Down Expand Up @@ -61,6 +63,7 @@ public Long deleteArchive(String userSocialId, Long missionId,Long count) {
updateUtils.deleteImgUrl(archive);
}

missionCommentDeleteService.deleteAllCommentByMissionArchive(deleteArchive.getId());
missionArchiveDeleteService.deleteMissionArchive(deleteArchive);
teamScoreUpdateUseCase.gainScoreOfArchive(mission, ScoreStatus.MINUS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.moing.backend.domain.missionArchive.domain.entity.MissionArchive;
import com.moing.backend.domain.missionArchive.domain.repository.MissionArchiveRepository;
import com.moing.backend.domain.missionComment.domain.service.MissionCommentDeleteService;
import com.moing.backend.global.annotation.DomainService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import com.moing.backend.domain.missionComment.domain.entity.MissionComment;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface MissionCommentRepository extends JpaRepository<MissionComment, Long>, MissionCommentCustomRepository {

Optional<MissionComment> findMissionCommentByMissionCommentId(Long missionCommentId);

void deleteAllMissionCommentsByMissionArchiveId(Long missionArchiveId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ public class MissionCommentDeleteService implements CommentDeleteService<Mission
public void deleteComment(MissionComment comment) {
missionCommentRepository.delete(comment);
}

public void deleteAllCommentByMissionArchive(Long missionArchiveId) {
missionCommentRepository.deleteAllMissionCommentsByMissionArchiveId(missionArchiveId);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.moing.backend.domain.team.application.dto.response;

import com.moing.backend.domain.member.domain.entity.Member;
import com.moing.backend.domain.member.dto.response.UserProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -16,13 +18,16 @@ public class GetTeamResponse {
private String memberNickName;
private Integer numOfTeam;
private List<TeamBlock> teamBlocks = new ArrayList<>();
private UserProperty userProperty;

public GetTeamResponse(Integer numOfTeam, List<TeamBlock> teamBlocks) {
this.numOfTeam=numOfTeam;
this.teamBlocks = teamBlocks;
}
public void updateMemberNickName(String memberNickName) {
this.memberNickName=memberNickName;
public void updateMemberInfo(Member member) {
this.memberNickName=member.getNickName();
this.userProperty=new UserProperty(member.getGender(), member.getBirthDate());

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TeamGetService {

public GetTeamResponse getTeamByMember(Member member) {
GetTeamResponse getTeamResponse = teamRepository.findTeamByMemberId(member.getMemberId());
getTeamResponse.updateMemberNickName(member.getNickName());
getTeamResponse.updateMemberInfo(member);
return getTeamResponse;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.moing.backend.domain.team.presentation;

import com.moing.backend.config.CommonControllerTest;
import com.moing.backend.domain.member.domain.constant.Gender;
import com.moing.backend.domain.member.dto.response.UserProperty;
import com.moing.backend.domain.team.application.dto.request.CreateTeamRequest;
import com.moing.backend.domain.team.application.dto.request.UpdateTeamRequest;
import com.moing.backend.domain.team.application.dto.response.*;
Expand All @@ -12,6 +14,7 @@
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.test.web.servlet.ResultActions;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -129,10 +132,12 @@ public void get_team() throws Exception {
teamBlocks.add(teamBlock1);
teamBlocks.add(teamBlock2);

UserProperty userProperty=new UserProperty(Gender.WOMAN, LocalDate.of(2000, 3, 28));
GetTeamResponse output = GetTeamResponse.builder()
.numOfTeam(1)
.memberNickName("유저 닉네임")
.teamBlocks(teamBlocks)
.userProperty(userProperty)
.build();

given(getTeamUseCase.getTeam(any())).willReturn(output);
Expand Down Expand Up @@ -167,7 +172,9 @@ public void get_team() throws Exception {
fieldWithPath("data.teamBlocks[].category").description("소모임 카테고리"),
fieldWithPath("data.teamBlocks[].startDate").description("소모임 시작일"),
fieldWithPath("data.teamBlocks[].deletionTime").description("소모임 삭제 시간 (삭제 안했으면 null)"),
fieldWithPath("data.teamBlocks[].profileImgUrl").description("프로필 사진 url")
fieldWithPath("data.teamBlocks[].profileImgUrl").description("프로필 사진 url"),
fieldWithPath("data.userProperty.gender").description("유저 성별"),
fieldWithPath("data.userProperty.birthDate").description("유저 태어난 날")
)

)
Expand Down

0 comments on commit 4b8eeb1

Please sign in to comment.