-
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 remote-tracking branch 'origin/dev' into eumdeploy
- Loading branch information
Showing
17 changed files
with
279 additions
and
18 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
src/main/java/com/eum/auth/config/RedisRepositoryConfig.java merge=servers | ||
src/main/java/com/eum/auth/client/HaetsalClient.java merge=servers |
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
src/main/java/com/eum/auth/controller/DTO/request/FcmTokenRequest.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 com.eum.auth.controller.DTO.request; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
@Getter | ||
@Setter | ||
public class FcmTokenRequest { | ||
private String fcmToken; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.eum.auth.domain.fcmtoken; | ||
|
||
|
||
import com.eum.auth.common.BaseTimeEntity; | ||
import com.eum.auth.domain.user.User; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Entity | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
public class FcmToken extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long fcmTokenId; | ||
|
||
@Column | ||
private String token; | ||
|
||
@OneToOne | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/eum/auth/domain/fcmtoken/FcmTokenRepository.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 com.eum.auth.domain.fcmtoken; | ||
|
||
import com.eum.auth.domain.user.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface FcmTokenRepository extends JpaRepository<FcmToken,Long> { | ||
Optional<FcmToken> findByUser(User user); | ||
} |
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
src/main/java/com/eum/auth/messageq/FcmDeletedProducer.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 com.eum.auth.messageq; | ||
|
||
import com.eum.auth.service.DTO.FcmTokenDTO; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.stereotype.Service; | ||
|
||
|
||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class FcmDeletedProducer { | ||
|
||
private final KafkaTemplate<String, String> kafkaTemplate; | ||
public static String TOPIC = "eum-fcm-delete"; | ||
|
||
public FcmTokenDTO.deletedToken send( FcmTokenDTO.deletedToken user) { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
String jsonInString = ""; | ||
// 주문 정보 Json 포맷 | ||
try { | ||
jsonInString = mapper.writeValueAsString(user); | ||
} catch(JsonProcessingException ex) { | ||
ex.printStackTrace(); | ||
} | ||
|
||
kafkaTemplate.send(TOPIC, jsonInString); | ||
log.info("producer >> : " + user); | ||
|
||
return user; | ||
} | ||
} |
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 com.eum.auth.messageq; | ||
|
||
import com.eum.auth.service.DTO.FcmTokenDTO; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.stereotype.Service; | ||
|
||
|
||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class FcmProducer { | ||
|
||
private final KafkaTemplate<String, String> kafkaTemplate; | ||
public static String TOPIC = "eum-fcm-create"; | ||
|
||
public FcmTokenDTO.FCMDTO send( FcmTokenDTO.FCMDTO fcmdto) { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
String jsonInString = ""; | ||
// 주문 정보 Json 포맷 | ||
try { | ||
jsonInString = mapper.writeValueAsString(fcmdto); | ||
} catch(JsonProcessingException ex) { | ||
ex.printStackTrace(); | ||
} | ||
|
||
kafkaTemplate.send(TOPIC, jsonInString); | ||
log.info("create producer >> : " + fcmdto); | ||
|
||
return fcmdto; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/eum/auth/messageq/KafkaProducerConfig.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,36 @@ | ||
package com.eum.auth.messageq; | ||
|
||
import org.apache.kafka.clients.producer.ProducerConfig; | ||
import org.apache.kafka.common.serialization.StringSerializer; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.kafka.annotation.EnableKafka; | ||
import org.springframework.kafka.core.DefaultKafkaProducerFactory; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.kafka.core.ProducerFactory; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
@EnableKafka | ||
@Configuration | ||
public class KafkaProducerConfig { | ||
|
||
|
||
@Bean | ||
public ProducerFactory<String, String> producerFactory() { | ||
Map<String, Object> properties = new HashMap<>(); | ||
properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092"); | ||
properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); | ||
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); | ||
|
||
return new DefaultKafkaProducerFactory<>(properties); | ||
} | ||
@Bean | ||
public KafkaTemplate<String, String> kafkaTemplate() { | ||
return new KafkaTemplate<>(producerFactory()); | ||
} | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.eum.auth.service.DTO; | ||
|
||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
public class FcmTokenDTO { | ||
@Getter | ||
@Setter | ||
public static class FCMDTO{ | ||
private Long userId; | ||
private String token; | ||
|
||
public FCMDTO(Long userId, String token) { | ||
this.userId = userId; | ||
this.token = token; | ||
} | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static class deletedToken{ | ||
private Long userId; | ||
|
||
public deletedToken(Long userId) { | ||
this.userId = userId; | ||
} | ||
} | ||
} |
Oops, something went wrong.