-
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 #386 from tukcomCD2024/develop_back_notification
feat : develop_back_notification -> develop_back
- Loading branch information
Showing
25 changed files
with
763 additions
and
102 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 |
---|---|---|
|
@@ -117,14 +117,14 @@ jobs: | |
|
||
- name: Add Github Actions IP to Security group | ||
run: | | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_EC2_NOTIFICATION_SG_ID }} --group-name ${{secrets.AWS_EC2_NOTIFICATION_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_EC2_CORE_SG_ID }} --group-name ${{secrets.AWS_EC2_CORE_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- name: Connect ec2 and Run Docker Container | ||
uses: appleboy/[email protected] | ||
env: | ||
AWS_ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
with: | ||
host: ${{ secrets.SSH_NOTIFICATION_HOST }} | ||
host: ${{ secrets.SSH_CORE_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_CORE_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
|
@@ -134,12 +134,12 @@ jobs: | |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_DOCKER_USER }} --password-stdin ${{ secrets.AWS_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | ||
docker image prune -f | ||
docker pull ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8080:8080 --name notification --network test_backend ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8081:8081 -e ENVIRONMENT=dev --name notification --network test_backend ${{ steps.meta.outputs.tags }} | ||
- name: Remove Github Actions IP from security group | ||
if: always() | ||
run: | | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_EC2_NOTIFICATION_SG_ID }} --group-name ${{secrets.AWS_EC2_NOTIFICATION_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_EC2_CORE_SG_ID }} --group-name ${{secrets.AWS_EC2_CORE_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- uses: sarisia/actions-status-discord@v1 | ||
if: success() | ||
|
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
31 changes: 0 additions & 31 deletions
31
...cation/src/main/java/site/timecapsulearchive/notification/api/NotificationController.java
This file was deleted.
Oops, something went wrong.
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
33 changes: 33 additions & 0 deletions
33
...on/src/main/java/site/timecapsulearchive/notification/data/dto/FriendNotificationDto.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,33 @@ | ||
package site.timecapsulearchive.notification.data.dto; | ||
|
||
import java.util.Objects; | ||
import lombok.Builder; | ||
import site.timecapsulearchive.notification.entity.Notification; | ||
import site.timecapsulearchive.notification.entity.NotificationCategory; | ||
import site.timecapsulearchive.notification.entity.NotificationStatus; | ||
|
||
@Builder | ||
public record FriendNotificationDto( | ||
Long targetId, | ||
NotificationStatus notificationStatus, | ||
String text, | ||
String title | ||
) { | ||
|
||
public FriendNotificationDto { | ||
Objects.requireNonNull(targetId); | ||
Objects.requireNonNull(notificationStatus); | ||
Objects.requireNonNull(text); | ||
Objects.requireNonNull(title); | ||
} | ||
|
||
public Notification toNotification(final NotificationCategory notificationCategory) { | ||
return Notification.builder() | ||
.memberId(targetId) | ||
.title(title) | ||
.text(text) | ||
.status(notificationStatus) | ||
.notificationCategory(notificationCategory) | ||
.build(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...n/src/main/java/site/timecapsulearchive/notification/data/dto/FriendNotificationsDto.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,29 @@ | ||
package site.timecapsulearchive.notification.data.dto; | ||
|
||
import java.util.List; | ||
import site.timecapsulearchive.notification.entity.Notification; | ||
import site.timecapsulearchive.notification.entity.NotificationCategory; | ||
import site.timecapsulearchive.notification.entity.NotificationStatus; | ||
|
||
public record FriendNotificationsDto( | ||
String profileUrl, | ||
NotificationStatus notificationStatus, | ||
String title, | ||
String text, | ||
List<Long> targetIds | ||
) { | ||
|
||
public List<Notification> toNotification(NotificationCategory notificationCategory) { | ||
return targetIds.stream() | ||
.map(id -> Notification.builder() | ||
.memberId(id) | ||
.notificationCategory(notificationCategory) | ||
.status(notificationStatus) | ||
.imageUrl(profileUrl) | ||
.title(title) | ||
.text(text) | ||
.build() | ||
) | ||
.toList(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...c/main/java/site/timecapsulearchive/notification/data/dto/GroupInviteNotificationDto.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,28 @@ | ||
package site.timecapsulearchive.notification.data.dto; | ||
|
||
import java.util.List; | ||
import site.timecapsulearchive.notification.entity.Notification; | ||
import site.timecapsulearchive.notification.entity.NotificationCategory; | ||
import site.timecapsulearchive.notification.entity.NotificationStatus; | ||
|
||
public record GroupInviteNotificationDto ( | ||
NotificationStatus notificationStatus, | ||
String groupProfileUrl, | ||
String title, | ||
String text, | ||
List<Long> targetIds | ||
){ | ||
public List<Notification> toNotification(NotificationCategory notificationCategory) { | ||
return targetIds.stream() | ||
.map(id -> Notification.builder() | ||
.notificationCategory(notificationCategory) | ||
.memberId(id) | ||
.status(notificationStatus) | ||
.imageUrl(groupProfileUrl) | ||
.title(title) | ||
.text(text) | ||
.build() | ||
) | ||
.toList(); | ||
} | ||
} |
35 changes: 0 additions & 35 deletions
35
...on/src/main/java/site/timecapsulearchive/notification/data/mapper/NotificationMapper.java
This file was deleted.
Oops, something went wrong.
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
22 changes: 22 additions & 0 deletions
22
...ain/java/site/timecapsulearchive/notification/data/request/FriendNotificationRequest.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,22 @@ | ||
package site.timecapsulearchive.notification.data.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import site.timecapsulearchive.notification.entity.NotificationStatus; | ||
|
||
public record FriendNotificationRequest( | ||
|
||
@NotNull(message = "멤버 아이디는 필수 입니다.") | ||
Long targetId, | ||
|
||
@NotNull(message = "알림 상태는 필수 입니다.") | ||
NotificationStatus status, | ||
|
||
@NotBlank(message = "알림 제목은 필수 입니다.") | ||
String text, | ||
|
||
@NotBlank(message = "알림 내용은 필수 입니다.") | ||
String title | ||
) { | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
.../notification/src/main/java/site/timecapsulearchive/notification/entity/CategoryName.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,5 +1,5 @@ | ||
package site.timecapsulearchive.notification.entity; | ||
|
||
public enum CategoryName { | ||
CAPSULE_SKIN | ||
CAPSULE_SKIN, FRIEND_REQUEST, FRIEND_ACCEPT, GROUP_INVITE | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...n/java/site/timecapsulearchive/notification/global/config/RabbitmqComponentConstants.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,35 @@ | ||
package site.timecapsulearchive.notification.global.config; | ||
|
||
import java.util.Arrays; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum RabbitmqComponentConstants { | ||
|
||
CAPSULE_SKIN_QUEUE("notification.createCapsuleSkin.queue", "fail.notification.createCapsuleSkin.queue"), | ||
CAPSULE_SKIN_EXCHANGE("notification.createCapsuleSkin.exchange", "fail.notification.createCapsuleSkin.exchange"), | ||
FRIEND_REQUEST_NOTIFICATION_QUEUE("notification.friendRequest.queue", "fail.notification.friendRequest.queue"), | ||
FRIEND_REQUEST_NOTIFICATION_EXCHANGE("notification.friendRequest.exchange", "fail.notification.friendRequest.exchange"), | ||
FRIEND_REQUESTS_NOTIFICATION_QUEUE("notification.friendRequests.queue", "fail.notification.friendRequests.queue"), | ||
FRIEND_REQUESTS_NOTIFICATION_EXCHANGE("notification.friendRequests.exchange", "fail.notification.friendRequests.exchange"), | ||
FRIEND_ACCEPT_NOTIFICATION_QUEUE("notification.friendAccept.queue", "fail.notification.friendAccept.queue"), | ||
FRIEND_ACCEPT_NOTIFICATION_EXCHANGE("notification.friendAccept.exchange", "fail.notification.friendAccept.exchange"), | ||
GROUP_INVITE_QUEUE("notification.groupInvite.queue", "fail.notification.groupInvite.queue"), | ||
GROUP_INVITE_EXCHANGE("notification.groupInvite.exchange", "fail.notification.groupInvite.exchange"); | ||
|
||
private final String successComponent; | ||
private final String failComponent; | ||
|
||
RabbitmqComponentConstants(String successComponent, String failComponent) { | ||
this.successComponent = successComponent; | ||
this.failComponent = failComponent; | ||
} | ||
|
||
public static String getFailComponent(String successComponent) { | ||
return Arrays.stream(RabbitmqComponentConstants.values()) | ||
.filter(constants -> constants.getSuccessComponent().equals(successComponent)) | ||
.map(RabbitmqComponentConstants::getFailComponent) | ||
.toList() | ||
.get(0); | ||
} | ||
} |
Oops, something went wrong.