-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIX] 누락된 푸시알림 구현 추가
- Loading branch information
Showing
15 changed files
with
308 additions
and
48 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
48 changes: 48 additions & 0 deletions
48
src/main/java/org/websoso/WSSServer/domain/UserDevice.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,48 @@ | ||
package org.websoso.WSSServer.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class UserDevice { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(nullable = false) | ||
private Long userDeviceId; | ||
|
||
@Column | ||
private String fcmToken; | ||
|
||
@Column(nullable = false) | ||
private String deviceIdentifier; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
private UserDevice(String fcmToken, String deviceIdentifier, User user) { | ||
this.fcmToken = fcmToken; | ||
this.deviceIdentifier = deviceIdentifier; | ||
this.user = user; | ||
} | ||
|
||
public static UserDevice create(String fcmToken, String deviceIdentifier, User user) { | ||
return new UserDevice(fcmToken, deviceIdentifier, user); | ||
} | ||
|
||
public void updateFcmToken(String fcmToken) { | ||
this.fcmToken = fcmToken; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/websoso/WSSServer/dto/notification/PushSettingGetResponse.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,10 @@ | ||
package org.websoso.WSSServer.dto.notification; | ||
|
||
public record PushSettingGetResponse( | ||
Boolean isPushEnabled | ||
) { | ||
|
||
public static PushSettingGetResponse of(Boolean isPushEnabled) { | ||
return new PushSettingGetResponse(isPushEnabled); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/websoso/WSSServer/dto/notification/PushSettingRequest.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,9 @@ | ||
package org.websoso.WSSServer.dto.notification; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record PushSettingRequest( | ||
@NotNull(message = "푸시 알림 설정 값은 null일 수 없습니다.") | ||
Boolean isPushEnabled | ||
) { | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/org/websoso/WSSServer/repository/NotificationTypeRepository.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 org.websoso.WSSServer.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import org.websoso.WSSServer.domain.NotificationType; | ||
|
||
@Repository | ||
public interface NotificationTypeRepository extends JpaRepository<NotificationType, Long> { | ||
|
||
NotificationType findByNotificationTypeName(String notificationTypeName); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/org/websoso/WSSServer/repository/UserDeviceRepository.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,12 @@ | ||
package org.websoso.WSSServer.repository; | ||
|
||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import org.websoso.WSSServer.domain.UserDevice; | ||
|
||
@Repository | ||
public interface UserDeviceRepository extends JpaRepository<UserDevice, Long> { | ||
|
||
Optional<UserDevice> findByDeviceIdentifier(String deviceIdentifier); | ||
} |
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
Oops, something went wrong.