-
Notifications
You must be signed in to change notification settings - Fork 2
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 #34 from Modagbul/feat/fire
feat : 불던지기 관련 API
- Loading branch information
Showing
58 changed files
with
1,146 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
[[Fire-API]] | ||
= Fire API | ||
|
||
[[Fire-불던지기]] | ||
=== 불 던지기 | ||
operation::fire-controller-test/불_던지기[snippets='http-request,path-parameters,request-fields,http-response,response-fields'] | ||
|
||
--- | ||
[[Fire-불던질사람조회]] | ||
=== 불 던질 사람 조회 | ||
operation::fire-controller-test/불_던질_사람_조회[snippets='http-request,path-parameters,request-fields,http-response,response-fields'] | ||
|
||
--- | ||
|
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
42 changes: 42 additions & 0 deletions
42
src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUserCase.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,42 @@ | ||
package com.moing.backend.domain.board.application.service; | ||
|
||
import com.moing.backend.domain.board.domain.entity.Board; | ||
import com.moing.backend.domain.member.domain.entity.Member; | ||
import com.moing.backend.domain.team.domain.entity.Team; | ||
import com.moing.backend.domain.teamMember.domain.service.TeamMemberGetService; | ||
import com.moing.backend.global.config.fcm.dto.request.MultiRequest; | ||
import com.moing.backend.global.config.fcm.service.FcmService; | ||
import com.moing.backend.global.response.BaseServiceResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import javax.transaction.Transactional; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static com.moing.backend.global.config.fcm.constant.NewUploadTitle.UPLOAD_NOTICE_NEW_TITLE; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class SendBoardAlarmUserCase { | ||
|
||
private final TeamMemberGetService teamMemberGetService; | ||
private final FcmService fcmService; | ||
|
||
public void sendNewUploadAlarm(BaseServiceResponse baseServiceResponse, Board board) { | ||
Member member = baseServiceResponse.getMember(); | ||
Team team = baseServiceResponse.getTeam(); | ||
|
||
if (board.isNotice() && member.isNewUploadPush()) { | ||
String title = team.getName() + " " + UPLOAD_NOTICE_NEW_TITLE.getTitle(); | ||
String message = board.getTitle(); | ||
Optional<List<String>> fcmTokens = teamMemberGetService.getFcmTokensExceptMe(team.getTeamId(), member.getMemberId()); | ||
if (fcmTokens.isPresent() && !fcmTokens.get().isEmpty()) { | ||
MultiRequest toMultiRequest = new MultiRequest(fcmTokens.get(), title, message); | ||
fcmService.sendMultipleDevices(toMultiRequest); | ||
} | ||
} | ||
} | ||
} | ||
|
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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/moing/backend/domain/fire/application/dto/res/FireReceiveRes.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,19 @@ | ||
package com.moing.backend.domain.fire.application.dto.res; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
public class FireReceiveRes { | ||
|
||
private Long receiveMemberId; | ||
private String nickname; | ||
private String fireStatus; | ||
|
||
public void updateFireStatus(boolean status) { | ||
if (status) | ||
this.fireStatus = "True"; | ||
else this.fireStatus = "False"; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/moing/backend/domain/fire/application/dto/res/FireThrowRes.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,11 @@ | ||
package com.moing.backend.domain.fire.application.dto.res; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class FireThrowRes { | ||
|
||
private Long receiveMemberId; | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/moing/backend/domain/fire/application/mapper/FireMapper.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,34 @@ | ||
package com.moing.backend.domain.fire.application.mapper; | ||
|
||
import com.moing.backend.domain.fire.application.dto.res.FireReceiveRes; | ||
import com.moing.backend.domain.fire.application.dto.res.FireThrowRes; | ||
import com.moing.backend.domain.fire.domain.entity.Fire; | ||
import com.moing.backend.domain.member.domain.entity.Member; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class FireMapper { | ||
|
||
public static FireThrowRes mapToFireThrowRes(Fire fire) { | ||
return FireThrowRes.builder() | ||
.receiveMemberId(fire.getReceiveMemberId()) | ||
.build(); | ||
} | ||
|
||
public static List<FireReceiveRes> mapToFireReceiversList(List<Member> members) { | ||
List<FireReceiveRes> fireReceiveResList = new ArrayList<>(); | ||
members.forEach( | ||
member -> fireReceiveResList.add(FireMapper.mapToFireReceiveRes(member)) | ||
); | ||
return fireReceiveResList; | ||
} | ||
|
||
public static FireReceiveRes mapToFireReceiveRes(Member member) { | ||
return FireReceiveRes.builder() | ||
.receiveMemberId(member.getMemberId()) | ||
.nickname(member.getNickName()) | ||
.fireStatus("TRUE") | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.