Skip to content

Commit

Permalink
✨ feat: create notification domain (#173)
Browse files Browse the repository at this point in the history
* ✨ feat: create notification domain

* ♻️ chore: delete BaseTimeEntity

* ♻️ chore: refactor Notification entity

* ♻️ chore: refactor Target entity

* ♻️ chore: refactor User entity

* ♻️ chore: refactor UserDevice entity

* ✨ feat: create NotificationRepository
  • Loading branch information
siyeonSon authored Jul 10, 2023
1 parent abe9f34 commit e509673
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/streetdrop-notification/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repositories {

dependencies {
implementation 'com.google.firebase:firebase-admin:9.1.0'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
}

test {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.depromeet.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.EnableMongoAuditing;

@Configuration
@EnableMongoAuditing
public class MongoAuditingConfig {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.depromeet.domain;

import lombok.Builder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;
import java.util.Date;

@Builder
@Document("notification")
public class Notification {

@Id
private String id;
private String title;
private String content;
private String type;
private User user;
private Target target;
private LocalDateTime viewedTime;
private boolean isDeleted;
@CreatedDate
private Date createdAt;
@LastModifiedDate
private Date modifiedAt;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.depromeet.domain;

import com.depromeet.domain.vo.Channel;
import lombok.Builder;

@Builder
public class Target {

private Channel channel;
private int level;
private String page;
private long pageId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.depromeet.domain;

import lombok.Builder;

@Builder
public class User {

private Long userId;
private String deviceToken;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.depromeet.domain;

import com.depromeet.domain.vo.OsType;
import lombok.Builder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Builder
@Document(collection = "user_device")
public class UserDevice {

@Id
private String id;
private Long userId;
private String deviceToken;
private OsType osType;
private String osVersion;
private boolean isDeleted;
@CreatedDate
private Date createdAt;
@LastModifiedDate
private Date modifiedAt;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.depromeet.domain.vo;

public enum Channel {
GENERAL
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.depromeet.domain.vo;


public enum OsType {
IOS, ANDROID
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.depromeet.repository;

import com.depromeet.domain.Notification;
import org.springframework.data.mongodb.repository.MongoRepository;

public interface NotificationRepository extends MongoRepository<Notification, String> {
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
spring:
data:
mongodb:
uri: ${MONGO_DB_URL}
fcm:
value: streetdrop-notification-fcm.json

0 comments on commit e509673

Please sign in to comment.