diff --git a/src/main/java/com/loafle/overflow/email/dao/EmailAuthDAO.java b/src/main/java/com/loafle/overflow/email/dao/EmailAuthDAO.java new file mode 100644 index 0000000..5d333ef --- /dev/null +++ b/src/main/java/com/loafle/overflow/email/dao/EmailAuthDAO.java @@ -0,0 +1,10 @@ +package com.loafle.overflow.email.dao; + +import com.loafle.overflow.commons.dao.BaseDAO; +import com.loafle.overflow.email.model.EmailAuth; + +/** + * Created by geek@loafle.com on 17. 6. 6. + */ +public interface EmailAuthDAO extends BaseDAO { +} diff --git a/src/main/java/com/loafle/overflow/email/dao/JPAEmailAuthDAO.java b/src/main/java/com/loafle/overflow/email/dao/JPAEmailAuthDAO.java new file mode 100644 index 0000000..b643643 --- /dev/null +++ b/src/main/java/com/loafle/overflow/email/dao/JPAEmailAuthDAO.java @@ -0,0 +1,10 @@ +package com.loafle.overflow.email.dao; + +import com.loafle.overflow.commons.dao.JPABaseDAO; +import com.loafle.overflow.email.model.EmailAuth; + +/** + * Created by geek@loafle.com on 17. 6. 6. + */ +public class JPAEmailAuthDAO extends JPABaseDAO implements EmailAuthDAO { +} diff --git a/src/main/java/com/loafle/overflow/email/model/EmailAuth.java b/src/main/java/com/loafle/overflow/email/model/EmailAuth.java new file mode 100644 index 0000000..8edba70 --- /dev/null +++ b/src/main/java/com/loafle/overflow/email/model/EmailAuth.java @@ -0,0 +1,103 @@ +package com.loafle.overflow.email.model; + +import com.loafle.overflow.member.model.Member; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by geek@loafle.com on 17. 6. 6. + */ +@SuppressWarnings("serial") +@Entity(name="EMAIL_AUTH") +public class EmailAuth implements Serializable { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + private Long id; + + @ManyToOne + @JoinColumn(name = "MEMBER_ID", nullable=false) + private Member member; + + @Column(name="AUTH_TOKEN", unique=true, nullable=false) + private String authToken; + + @Column(name = "IS_INVALID") + private Boolean isInvalid; + + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + private Date createDate; + + @Column(name = "UPDATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = true, updatable = true) + private Date updateDate; + + @Column(name = "CONFIRM_DATE") + private Date confirmDate; + + public EmailAuth() { + + } + + public EmailAuth(Long id) { + this.id = id; + } + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } + + public String getAuthToken() { + return authToken; + } + + public void setAuthToken(String authToken) { + this.authToken = authToken; + } + + public Boolean getInvalid() { + return isInvalid; + } + + public void setInvalid(Boolean invalid) { + isInvalid = invalid; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + public Date getConfirmDate() { + return confirmDate; + } + + public void setConfirmDate(Date confirmDate) { + this.confirmDate = confirmDate; + } +} diff --git a/src/main/java/com/loafle/overflow/member/model/Member.java b/src/main/java/com/loafle/overflow/member/model/Member.java index f19a7bb..03f2a08 100644 --- a/src/main/java/com/loafle/overflow/member/model/Member.java +++ b/src/main/java/com/loafle/overflow/member/model/Member.java @@ -38,6 +38,13 @@ public class Member implements Serializable { private Long authorizedDate; + public Member() { + + } + + public Member(Long id) { + this.id = id; + } public Long getId() { return id; } diff --git a/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java b/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java new file mode 100644 index 0000000..e655771 --- /dev/null +++ b/src/test/java/com/loafle/overflow/email/dao/JPAEmailAuthDAOTest.java @@ -0,0 +1,33 @@ +package com.loafle.overflow.email.dao; + +import com.loafle.overflow.email.model.EmailAuth; +import com.loafle.overflow.member.model.Member; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Created by root on 17. 6. 6. + */ +public class JPAEmailAuthDAOTest { + + private JPAEmailAuthDAO emailAuthDAO = null; + + @Before + public void before() { + + this.emailAuthDAO = new JPAEmailAuthDAO(); + } + + @Test + public void createEmailAuth() { + EmailAuth auth = new EmailAuth(); + + auth.setAuthToken("loafle.com/Auth"); + auth.setMember(new Member((long)1)); + auth.setInvalid(false); + + this.emailAuthDAO.create(auth); + } +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/member/dao/JPAMemberDAOTest.java b/src/test/java/com/loafle/overflow/member/dao/JPAMemberDAOTest.java index 99c61e5..039332f 100644 --- a/src/test/java/com/loafle/overflow/member/dao/JPAMemberDAOTest.java +++ b/src/test/java/com/loafle/overflow/member/dao/JPAMemberDAOTest.java @@ -10,6 +10,7 @@ import static org.junit.Assert.*; /** * Created by root on 17. 6. 4. */ +@Ignore public class JPAMemberDAOTest { private JPAMemberDAO jpaMemberDAO = null; @@ -24,17 +25,17 @@ public class JPAMemberDAOTest { public void findByEmail() throws Exception { } - @Ignore +// @Ignore @Test public void createMember() { Member m = new Member(); - m.setName("insanity3"); + m.setName("snnnnn"); m.setCompany("loafle"); m.setDigest("bbbbbbbbb"); m.setPwSalt("salktttt"); m.setPhone("000-000-0000"); - m.setEmail("insanity33@loafle.com"); + m.setEmail("ddddd@loafle.com"); this.jpaMemberDAO.create(m); } diff --git a/src/test/java/com/loafle/overflow/target/dao/JPATargetDaoTest.java b/src/test/java/com/loafle/overflow/target/dao/JPATargetDaoTest.java index 8be62a7..fcc29c2 100644 --- a/src/test/java/com/loafle/overflow/target/dao/JPATargetDaoTest.java +++ b/src/test/java/com/loafle/overflow/target/dao/JPATargetDaoTest.java @@ -4,6 +4,7 @@ import com.loafle.overflow.member.model.Member; import com.loafle.overflow.target.model.Target; import com.loafle.overflow.target.type.TargetType; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.util.List; @@ -13,6 +14,7 @@ import static org.junit.Assert.*; /** * Created by root on 17. 6. 5. */ +@Ignore public class JPATargetDaoTest { private JPATargetDao jpaTargetDao = null;