Skip to content

Commit

Permalink
feat(notification): add PushToken entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaerim1001 committed Nov 8, 2023
1 parent 4c59677 commit f90baae
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/main/java/com/e2i/wemeet/domain/notification/PushToken.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.e2i.wemeet.domain.notification;

import com.e2i.wemeet.domain.base.BaseTimeEntity;
import com.e2i.wemeet.domain.member.Member;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "PUSH_TOKEN")
@Entity
public class PushToken extends BaseTimeEntity {

@Id
private String token;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id")
private Member member;

@Builder
public PushToken(String token, Member member) {
this.token = token;
this.member = member;
}

private void setMember(final Member member) {
this.member = member;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.e2i.wemeet.domain.notification;

import org.springframework.data.jpa.repository.JpaRepository;

public interface PushTokenRepository extends JpaRepository<PushToken, String> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS `push_token`
(
`token` varchar(100) NOT NULL,
`member_id` bigint,
PRIMARY KEY (`token`),
FOREIGN KEY (`member_id`) REFERENCES member (`member_id`) ON DELETE CASCADE
)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4;

0 comments on commit f90baae

Please sign in to comment.